Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1 Le 26/11/2020, à 23:08

yanlatouch

Démarrage très lent d'Ubuntu 8-9 minutes

Bonjour,
après avoir exploré le forum, j'ai lu des problèmes similaires mais pas exactement identiques, je crée donc une nouvelle discussion.
Mon PC de bureau tourne avec Linux depuis plusieurs années, je change de distibutions régulièrement. Sans problème.
Dernièrement, mon PC met un temps très long pour démarrer : 5 minutes d'affichage du logo ASUS avec les options d'accès au Bios, puis 4 minutes de démarrage d'Ubuntu.
Si je choisis d'accéder au bios, le temps est encore plus long.
Mais une fois le PC démarré, tout fonctionne rapidement, sans problème, sauf l'application Disk de Gnome qui plante et ne démarre pas, ou bien démarre mais plante ensuite.

J'ai exploré les otions du bios, réinstallé différentes distributions, l'installation durant plusieurs heures... J'ai débranché tous mes périphériques (DD de donnée, lecteur cd) il ne reste que mon disque dur SSD NVME samsung 970 EVO.

J'ai fait un Boot-Info :
https://paste.ubuntu.com/p/cGfjCTdN8g/

Je ne comprend pas bien les propositions de réparation proposées, ni comment le faire :
Suggested repair: ______________________________________________________________

The default repair of the Boot-Repair utility would reinstall the grub-efi-amd64-signed of
nvme0n1p2,
using the following options:        nvme0n1p1/boot/efi,
Additional repair would be performed: unhide-bootmenu-10s  use-standard-efi-file   
Quelqu'un pourrait-il m'aider en m'indiquant une marche à suivre ou un lien vers un tuto ?

Merci beaucoup
Yann

Hors ligne

#2 Le 27/11/2020, à 10:10

malbo

Re : Démarrage très lent d'Ubuntu 8-9 minutes

Bonjour,
Je colle ci-dessous le contenu du Boot-info dont tu as donné le lien ( https://paste.ubuntu.com/p/cGfjCTdN8g/ ) dans ton post #1 :

boot-info-4ppa125                                              [20201124_0011]

============================== Boot Info Summary ===============================

 => No boot loader is installed in the MBR of /dev/nvme0n1.

nvme0n1p1: _____________________________________________________________________

    File system:       vfat
    Boot sector type:  FAT32
    Boot sector info:  No errors found in the Boot Parameter Block.
    Operating System:  
    Boot files:        /efi/BOOT/fbx64.efi /efi/BOOT/mmx64.efi 
                       /efi/ubuntu/grubx64.efi /efi/ubuntu/mmx64.efi 
                       /efi/ubuntu/shimx64.efi /efi/ubuntu/grub.cfg

nvme0n1p2: _____________________________________________________________________

    File system:       ext4
    Boot sector type:  -
    Boot sector info: 
    Operating System:  Ubuntu 20.10
    Boot files:        /boot/grub/grub.cfg /etc/fstab /etc/default/grub


================================ 1 OS detected =================================

OS#1:   L'OS actuellement utilisé - Ubuntu 20.10 CurrentSession on nvme0n1p2

============================ Architecture/Host Info ============================

CPU architecture: 64-bit
BOOT_IMAGE of the installed session in use:
/boot/vmlinuz-5.8.0-29-generic root=UUID=df375e12-c1df-4cb1-8d7a-0f5a3401f87a ro quiet splash vt.handoff=7


===================================== UEFI =====================================

BIOS is EFI-compatible, and is setup in EFI-mode for this installed-session.
SecureBoot disabled.

efibootmgr -v
BootCurrent: 0000
Timeout: 1 seconds
BootOrder: 0000,0009,0008
Boot0000* ubuntu	HD(1,GPT,9b16b8bf-6112-4085-a142-6ada78f9d645,0x800,0x100000)/File(\EFI\UBUNTU\SHIMX64.EFI)
Boot0008* Hard Drive	BBS(HD,,0x0)..GO..NO..........S.a.m.s.u.n.g. .S.S.D. .9.7.0. .E.V.O. .5.0.0.G.B....................A...........................%8U.........H..Gd-.;.A..MQ..L.S.a.m.s.u.n.g. .S.S.D. .9.7.0. .E.V.O. .5.0.0.G.B........BO
Boot0009* USB	BBS(HD,,0x0)..GO..NO........[.G.e.n.e.r.i.c. .S.T.O.R.A.G.E. .D.E.V.I.C.E. .0.9.0.3....................A..........................Gd-.;.A..MQ..L.0.0.0.0.0.0.0.0.0.9.0.3........BO

2895d47544fd587b26c7e29be1295c27   nvme0n1p1/BOOT/fbx64.efi
dc3c47be2f78a78e5e57d097ae6c5c84   nvme0n1p1/BOOT/mmx64.efi
951288adcc81d2d86508f3f18d9753e0   nvme0n1p1/ubuntu/grubx64.efi
dc3c47be2f78a78e5e57d097ae6c5c84   nvme0n1p1/ubuntu/mmx64.efi
78415fb8fb9b909f8029858113f1335f   nvme0n1p1/ubuntu/shimx64.efi
78415fb8fb9b909f8029858113f1335f   nvme0n1p1/BOOT/BOOTX64.efi


============================= Drive/Partition Info =============================

Disks info: ____________________________________________________________________

nvme0n1	: is-GPT,	no-BIOSboot,	has---ESP, 	not-usb,	not-mmc, has-os,	2048 sectors * 512 bytes

Partitions info (1/3): _________________________________________________________

nvme0n1p2	: is-os,	64, apt-get,	signed grub-pc grub-efi ,	grub2,	grub-install,	grubenv-ok,	update-grub,	farbios
nvme0n1p1	: no-os,	32, nopakmgr,	no-docgrub,	nogrub,	nogrubinstall,	no-grubenv,	noupdategrub,	not-far

Partitions info (2/3): _________________________________________________________

nvme0n1p2	: isnotESP,	fstab-has-goodEFI,	no-nt,	no-winload,	no-recov-nor-hid,	no-bmgr,	notwinboot
nvme0n1p1	: is---ESP,	part-has-no-fstab,	no-nt,	no-winload,	no-recov-nor-hid,	no-bmgr,	notwinboot

Partitions info (3/3): _________________________________________________________

nvme0n1p2	: not-sepboot,	with-boot,	fstab-without-boot,	not-sep-usr,	with--usr,	fstab-without-usr,	std-grub.d,	nvme0n1
nvme0n1p1	: not-sepboot,	no-boot,	part-has-no-fstab,	not-sep-usr,	no---usr,	part-has-no-fstab,	std-grub.d,	nvme0n1

fdisk -l (filtered): ___________________________________________________________

Disk nvme0n1: 465.76 GiB, 500107862016 bytes, 976773168 sectors
Disk identifier: 2DB8C3C6-36F3-4285-AC1A-16323E5379C5
            Start       End   Sectors   Size Type
nvme0n1p1    2048   1050623   1048576   512M EFI System
nvme0n1p2 1050624 976771071 975720448 465.3G Linux filesystem

parted -lm (filtered): _________________________________________________________

nvme0n1:500GB:nvme:512:512:gpt:Samsung SSD 970 EVO 500GB:;
1:1049kB:538MB:537MB:fat32:EFI System Partition:boot, esp;
2:538MB:500GB:500GB:ext4::;

blkid (filtered): ______________________________________________________________

NAME        FSTYPE   UUID                                 PARTUUID                             LABEL PARTLABEL
nvme0n1                                                                                              
├─nvme0n1p1 vfat     DD6A-32F9                            9b16b8bf-6112-4085-a142-6ada78f9d645       EFI System Partition
└─nvme0n1p2 ext4     df375e12-c1df-4cb1-8d7a-0f5a3401f87a a75e4c84-4e26-48ae-92b3-4dfdec5c1dab       

df (filtered): _________________________________________________________________

                   Avail Use% Mounted on
nvme0n1p2         424.7G   2% /

Mount options: __________________________________________________________________

nvme0n1p2         rw,relatime,errors=remount-ro

=================== nvme0n1p1/efi/ubuntu/grub.cfg (filtered) ===================

search.fs_uuid df375e12-c1df-4cb1-8d7a-0f5a3401f87a root 
set prefix=($root)'/boot/grub'
configfile $prefix/grub.cfg

=================== nvme0n1p2/boot/grub/grub.cfg (filtered) ====================

Ubuntu   df375e12-c1df-4cb1-8d7a-0f5a3401f87a
Ubuntu, avec Linux 5.8.0-29-generic   df375e12-c1df-4cb1-8d7a-0f5a3401f87a
Ubuntu, avec Linux 5.8.0-25-generic   df375e12-c1df-4cb1-8d7a-0f5a3401f87a
### END /etc/grub.d/30_os-prober ###
UEFI Firmware Settings   uefi-firmware
### END /etc/grub.d/30_uefi-firmware ###

======================== nvme0n1p2/etc/fstab (filtered) ========================

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/nvme0n1p2 during installation
UUID=df375e12-c1df-4cb1-8d7a-0f5a3401f87a /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/nvme0n1p1 during installation
UUID=DD6A-32F9  /boot/efi       vfat    umask=0077      0       1
/swapfile                                 none            swap    sw              0       0

==================== nvme0n1p2/etc/default/grub (filtered) =====================

GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

================= nvme0n1p2: Location of files loaded by Grub ==================

           GiB - GB             File                                 Fragment(s)
 414,860820770 = 445,453414400  boot/grub/grub.cfg                             3
 415,857494354 = 446,523584512  boot/vmlinuz                                   1
   4,829097748 = 5,185204224    boot/vmlinuz-5.8.0-25-generic                  2
 415,857494354 = 446,523584512  boot/vmlinuz-5.8.0-29-generic                  1
   4,829097748 = 5,185204224    boot/vmlinuz.old                               2
   6,672847748 = 7,164915712    boot/initrd.img                                4
   6,463863373 = 6,940520448    boot/initrd.img-5.8.0-25-generic               2
   6,672847748 = 7,164915712    boot/initrd.img-5.8.0-29-generic               4
   6,463863373 = 6,940520448    boot/initrd.img.old                            2

=================== nvme0n1p2: ls -l /etc/grub.d/ (filtered) ===================

-rwxr-xr-x 1 root root 17622 oct.   1 16:59 10_linux
-rwxr-xr-x 1 root root 42359 oct.   1 16:59 10_linux_zfs
-rwxr-xr-x 1 root root 12894 oct.   1 16:59 20_linux_xen
-rwxr-xr-x 1 root root 12059 oct.   1 16:59 30_os-prober
-rwxr-xr-x 1 root root  1424 oct.   1 16:59 30_uefi-firmware
-rwxr-xr-x 1 root root   214 oct.   1 16:59 40_custom
-rwxr-xr-x 1 root root   216 oct.   1 16:59 41_custom


========= Devices which don't seem to have a corresponding hard drive ==========

sda 

Suggested repair: ______________________________________________________________

The default repair of the Boot-Repair utility would reinstall the grub-efi-amd64-signed of
nvme0n1p2,
using the following options:        nvme0n1p1/boot/efi,
Additional repair would be performed: unhide-bootmenu-10s  use-standard-efi-file    

Final advice in case of suggested repair: ______________________________________


Please do not forget to make your UEFI firmware boot on the L'OS actuellement utilisé - Ubuntu 20.10 CurrentSession entry (nvme0n1p1/efi/****/shim****.efi (**** will be updated in the final message) file) !

Tout me parait normal dans ce Boot-info.
Ce qui retient mon attention dans ton post # 1 :

yanlatouch a écrit :

Si je choisis d'accéder au bios, le temps est encore plus long.

yanlatouch a écrit :

l'application Disk de Gnome qui plante et ne démarre pas

Cela me laisse à penser que c'est ton SSD qui est la cause de tout ça. Je te suggère de créer une LiveUSB de Ubuntu, de vérifier que tu parviens à démarrer une session live dessus (même si c'est long) et ensuite de déconnecter physiquement le SSD afin de vérifier si le démarrage de l'ordi sur la LiveUSB de Ubuntu est rapide ou non et si l'accès au Bios est toujours long. S'il s'avère que tout baigne quand le SSD est déconnecté, c'est qu'il est défectueux et doit être remplacé.

EDIT : au sujet des propositions de réparation proposées dans le Boot-info, il faut savoir que même si tout baigne, on voit toujours une proposition recommandée de réparation dans le Boot-info. Donc tu peux l'ignorer.

Dernière modification par malbo (Le 27/11/2020, à 10:17)

Hors ligne

#3 Le 27/11/2020, à 15:39

yanlatouch

Re : Démarrage très lent d'Ubuntu 8-9 minutes

Merci pour ton aide et ta réponse. J'essaie donc de booter en live CD pour vérifier l'intégrité de mon SSD.
Je reviens vers vous dès que j'ai fait ça.
Bonne journée
Yann

Hors ligne

#4 Le 28/11/2020, à 13:05

yanlatouch

Re : Démarrage très lent d'Ubuntu 8-9 minutes

Bonjour,
Sur tes conseils, j'ai booté sur un live CD en ayant débranché mon SSD : même problème, 7 minutes d'affichage de l'a page d'option BIOS, 3 minutes de démarrage d'Ubuntu.

J'ai rebranché le SSD et booté sur une clé Boot-Repair pour réaliser les réparations recommandées.
Rien ne s'améliore.
Autres précisions : extinction du PC très longue, attente de qqch ?
Au démarrage de Gparted la première étape "searching SDA partition" très longue aussi. Logique je n'ai pas de partition SDA puisque mon disque est un SSD NVME...

Je réinstalle Ubuntu sur un autre SSD KINGSTON 300 V (pas NVME).
J'ai peur que le problème se situe sur la config du BIOS ou PB matériel de la carte mère.
Ma config :
CM ASUS Z170M PLUS BIOS ver 3805
Proc : INTEL CORE I7 6700K
Mém : Gskil RIPJAWS 4 DDR4 2x8 G 2400
DD SSD M2 SAMSUNG 970 EVO 500G
Ou SSD KINGSTON SSDNOW 300V 240Gb
Y aurait-il une option dans le BIOS pour empêcher la recherche de partition SDx et tout de suite indiquer le NVMEx ? Ou c'est le GRUB qui fait ça ?

Merci pour vos avis éclairés...
Bon week-end
Yann

Hors ligne

#5 Le 28/11/2020, à 13:45

malbo

Re : Démarrage très lent d'Ubuntu 8-9 minutes

yanlatouch a écrit :

Sur tes conseils, j'ai booté sur un live CD en ayant débranché mon SSD : même problème, 7 minutes d'affichage de l'a page d'option BIOS, 3 minutes de démarrage d'Ubuntu.

Pourrais-tu prendre une photo de l'affichage de la page d'option BIOS dont il s'agite parce que je ne sais pas trop ce que tu entends par là ? Pour joindre une photo dans un post, tu trouveras des instructions dans le paragraphe 4.4 Insérer une image de la page "Aide à l'utilisation du forum Ubuntu‑FR"

Hors ligne

#6 Le 28/11/2020, à 16:12

yanlatouch

Re : Démarrage très lent d'Ubuntu 8-9 minutes

Bonjour,
Je parlais de cet écran :
http://82.232.24.28:56784/share/cp-JCGS … 150639.jpg

Dernière modification par yanlatouch (Le 28/11/2020, à 16:15)

Hors ligne

#7 Le 28/11/2020, à 18:52

malbo

Re : Démarrage très lent d'Ubuntu 8-9 minutes

OK c'est le logo Asus qui s'affiche au démarrage avec en bas de l'écran : "Please press DEL or F2 to enter UEFI BIOS setting".
Dès que tu as ça à l'écran au démarrage, si tu presses la touche "Suppr", tu vas bien dans le Bios ou pas ?

Hors ligne

#8 Le 28/11/2020, à 22:40

yanlatouch

Re : Démarrage très lent d'Ubuntu 8-9 minutes

Oui quand j'appuie sur F2 j'accède au BIOS, mais c'est pas instantané, il faut 6-7 minutes...
J'ai donc réinstallé ubuntu sur un autre SSD (pas NVME mais en SATA), l'installation a duré 4h !
Avec les règlage par défaut du BIOS, je suis bien en UEFI...
Je ne sais plus quoi faire.
Des idées ?
Commander une carte mère à Noël ?
Yann

Dernière modification par yanlatouch (Le 28/11/2020, à 22:41)

Hors ligne

#9 Le 29/11/2020, à 09:55

malbo

Re : Démarrage très lent d'Ubuntu 8-9 minutes

Bonjour,
Le manuel de ta carte-mère est téléchargeable ici : https://dlcdnets.asus.com/pub/ASUS/mb/L … UM_WEB.pdf
Dans le paragraphe "1.6  Cavaliers" de ce manuel, il y a les explications pour faire un Clear CMOS. Il faudra que tu fasses toute la procédure "Pour effacer la mémoire RTC" : cette opération permet de réinitialiser les paramètres du logiciel de la carte-mère. Après cela, il est très possible que le démarrage sur ton Ubuntu installé ne fonctionne plus (on verra plus tard comment le retrouver). Par contre, tu pourras démarrer sur ton Live CD en session live. Fais-le et raconte si ça résout le problème.

EDIT : si tu es équipé d'un multimètre, ce serait utile de mesurer la tension de la pile de ta carte-mère avant de l'enlever de la carte-mère (*) : c'est une pile 3 volts. Si tu mesures moins de 2,5 volts, la pile est à remplacer : sa référence est CR2032

(*) c'est donc à faire avant d'attaquer la procédure "Pour effacer la mémoire RTC"

Dernière modification par malbo (Le 29/11/2020, à 10:08)

Hors ligne

#10 Le 29/11/2020, à 10:06

FrancisFDZ

Re : Démarrage très lent d'Ubuntu 8-9 minutes

Bonjour,
Utilises-tu une partition swap et si oui, est-elle correctement définie dans /etc/fstab ?


-- On peut avoir des raisons de se plaindre et n'avoir pas raison de se plaindre --
[Victor Hugo]

Hors ligne

#11 Le 29/11/2020, à 10:13

malbo

Re : Démarrage très lent d'Ubuntu 8-9 minutes

@FrancisFDZ : voici le fstab extrait du post #2 :

======================== nvme0n1p2/etc/fstab (filtered) ========================

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/nvme0n1p2 during installation
UUID=df375e12-c1df-4cb1-8d7a-0f5a3401f87a /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/nvme0n1p1 during installation
UUID=DD6A-32F9  /boot/efi       vfat    umask=0077      0       1
/swapfile                                 none            swap    sw              0       0

C'est un fichier swapfile qui est utilisé : il n'y a pas de partition swap comme tu peux le constater dans cet autre extrait du post #2 :

parted -lm (filtered): _________________________________________________________

nvme0n1:500GB:nvme:512:512:gpt:Samsung SSD 970 EVO 500GB:;
1:1049kB:538MB:537MB:fat32:EFI System Partition:boot, esp;
2:538MB:500GB:500GB:ext4::;

Dernière modification par malbo (Le 29/11/2020, à 10:14)

Hors ligne

#12 Le 29/11/2020, à 13:33

yanlatouch

Re : Démarrage très lent d'Ubuntu 8-9 minutes

Bonjour,
J'avais déjà changé la pile et fait un clear CMOS avant de faire tout mes tests et réinstallation.
Je ne l'ai pas refait depuis le changement de SSD, je peux réessayer une autre fois...
Merci pour votre aide
Yann

Hors ligne

#13 Le 29/11/2020, à 13:47

malbo

Re : Démarrage très lent d'Ubuntu 8-9 minutes

Non, pas la peine de refaire un clear CMOS.
J'aimerais une précision par rapport à ce que tu as écrit dans le post #1 : "Dernièrement, mon PC met un temps très long pour démarrer". C'est le "Dernièrement" qui m’intéresse : ça a commencé à se produire, il y a quelques jours, quelques semaines, quelques mois ? Et est-ce que ça a commencé doucement à se dégrader ou bien c'est apparu franchement ?

Hors ligne

#14 Le 29/11/2020, à 16:28

yanlatouch

Re : Démarrage très lent d'Ubuntu 8-9 minutes

C'est venu d'un coup, et je ne vois pas à quel événement ça peut être lié. Pas de changement particulier.
Je soupçonnais mon alim, je viens de la remplacer par une neuve  car la précédente montrait des signes de faiblesse et faisait un bruit d'enfer...
Pas d'amélioration avec la nouvelle pour mon problème de lenteur mais au moins plus de bruit d'alim.
J'ai dépoussiéré le PC, tout débranché rebranché...

À la fin de l'installation d'Ubuntu, j'ai eu 3 messages d'erreur au redémarrage :
X86/CPU : VMX (outsider txt) disable by BIOS
et
Failed to start ZSYS daemon services
Et
Failed to start cleanup old snapshots to free space

Avec mon ubuntu tout neuf, j'ai des messages d'erreur à l'extinction du PC :
Systemd-shutdown :waiting for processus système.udev

Je ne sais pas si c'est lié au problème de lenteur...
A+
Yann

Hors ligne

#15 Le 29/11/2020, à 17:42

moko138

Re : Démarrage très lent d'Ubuntu 8-9 minutes

Failed to start cleanup old snapshots to free space
Failed to start ZSYS daemon services

???

Et d'où sort-elle

======= nvme0n1p2: ls -l /etc/grub.d/ (filtered) ====
(...)
-rwxr-xr-x 1 root root 42359 oct.   1 16:59 10_linux_zfs

la ligne en "zfs" ???

Montre

cat /etc/grub.d/10_linux_zfs

ainsi que

dpkg -l | grep -Ei "btrfs|zfs"

Merci !


%NOINDEX%
Un utilitaire précieux : ncdu
Photo, mini-tutoriel :  À la découverte de dcraw

Hors ligne

#16 Le 29/11/2020, à 21:44

yanlatouch

Re : Démarrage très lent d'Ubuntu 8-9 minutes

Bonsoir,
Tout d'abord ma partition n'est plus nvme0n1p2 car j'ai fait une clean install d'ubuntu sur un autre SSD pas nvme (en SATA). Il faudrait que je vous redonne un nouveau boot-info.
Après l'installation, dans le BIOS je suis passé de l'option "Normal" à "ASUS Optimized" je pense que ça a peut-être un lien ?

Voici les résultats des commandes demandées (désolé pour la présentation) :

yann@yann-pc:~$ cat /etc/grub.d/10_linux_zfs
#! /bin/sh
set -e

# grub-mkconfig helper script.
# Copyright (C) 2019 Canonical Ltd.
#
# GRUB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GRUB is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GRUB.  If not, see <[url]http://www.gnu.org/licenses/[/url]>.

prefix="/usr"
datarootdir="/usr/share"
ubuntu_recovery="1"
quiet_boot="1"
quick_boot="1"
gfxpayload_dynamic="1"
vt_handoff="1"

. "${pkgdatadir}/grub-mkconfig_lib"

export TEXTDOMAIN=grub
export TEXTDOMAINDIR="${datarootdir}/locale"

set -u

## Skip early if zfs utils isn't installed (instead of failing on first zpool list)
if ! `which zfs >/dev/null 2>&1`; then
    exit 0
fi

imported_pools=""
MNTDIR="$(mktemp -d ${TMPDIR:-/tmp}/zfsmnt.XXXXXX)"
ZFSTMP="$(mktemp -d ${TMPDIR:-/tmp}/zfstmp.XXXXXX)"


machine="$(uname -m)"
case "${machine}" in
    i?86) GENKERNEL_ARCH="x86" ;;
    mips|mips64) GENKERNEL_ARCH="mips" ;;
    mipsel|mips64el) GENKERNEL_ARCH="mipsel" ;;
    arm*) GENKERNEL_ARCH="arm" ;;
    *) GENKERNEL_ARCH="${machine}" ;;
esac

RC=0
on_exit() {
    # Restore initial zpool import state
    for pool in ${imported_pools}; do
        zpool export "${pool}"
    done

    mountpoint -q "${MNTDIR}"  && umount "${MNTDIR}" || true
    rmdir "${MNTDIR}"
    rm -rf "${ZFSTMP}"
    exit "${RC}"
}
trap on_exit EXIT INT QUIT ABRT PIPE TERM

# List ONLINE and DEGRADED pools
import_pools() {
    # We have to ignore zpool import output, as potentially multiple / will be available,
    # and we need to autodetect all zpools this way with their real mountpoints.
    local initial_pools="$(zpool list | awk '{if (NR>1) print $1}')"
    local all_pools=""
    local imported_pools=""
    local err=""

    set +e
    err="$(zpool import -f -a -o cachefile=none -o readonly=on -N 2>&1)"
    # Only print stderr if the command returned an error
    # (it can echo "No zpool to import" with success, which we don't want)
    if [ $? -ne 0 ]; then
        echo "Some pools couldn't be imported and will be ignored:\n${err}" >&2
    fi
    set -e

    all_pools="$(zpool list | awk '{if (NR>1) print $1}')"
    for pool in ${all_pools}; do
        if echo "${initial_pools}" | grep -wq "${pool}"; then
            continue
        fi
        imported_pools="${imported_pools} ${pool}"
    done

    echo "${imported_pools}"
}

# List all the dataset with a root mountpoint
get_root_datasets() {
    local pools="$(zpool list | awk '{if (NR>1) print $1}')"

    for p in ${pools}; do
        local rel_pool_root=$(zpool get -H altroot ${p} | awk '{print $3}')
        if [ "${rel_pool_root}" = "-" ]; then
            rel_pool_root="/"
        fi

        zfs list -H -o name,canmount,mountpoint -t filesystem | grep -E '^'"${p}"'(\s|/[[:print:]]*\s)(on|noauto)\s'"${rel_pool_root}"'$' | awk '{print $1}'
    done
}

# find if given datasets can be mounted for directory and return its path (snapshot or real path)
# $1 is our current dataset name
# $2 directory path we look for (cannot contains /)
# $3 is the temporary mount directory to use
# $4 is the optional snapshot name
# return path for directory (which can be a mountpoint)
validate_system_dataset() {
    local dataset="$1"
    local directory="$2"
    local mntdir="$3"
    local snapshot_name="$4"

    local mount_path="${mntdir}/${directory}"

    if ! zfs list "${dataset}" >/dev/null 2>&1; then
        return
    fi

    if ! mount -o noatime,zfsutil -t zfs "${dataset}" "${mount_path}"; then
        grub_warn "Failed to find a valid directory '${directory}' for dataset '${dataset}@${snapshot_name}'. Ignoring"
        return
    fi

    local candidate_path="${mount_path}"
    if [ -n "${snapshot_name}" ]; then
        # WORKAROUND a bug [url]https://github.com/zfsonlinux/zfs/issues/9958[/url]
        # Reading the content of a snapshot fails if it is not the first mount
        # for a given dataset
        first_mntdir=$(awk '{if ($1 == "'${dataset}'") {print $2; exit;}}' /proc/mounts)
        if [ "${first_mntdir}" = "/" ]; then
            # prevents // on candidate_path
            first_mntdir=""
        fi
        candidate_path="${first_mntdir}/.zfs/snapshot/${snapshot_name}"
    fi

    if [ -n "$(ls ${candidate_path} 2>/dev/null)" ]; then
        echo "${candidate_path}"
        return
    else
        mountpoint -q "${mount_path}" && umount "${mount_path}" || true
    fi
}

# Detect system directory relevant to the other, trying to find the ones associated on the current dataset or snapshot/
# System directory should be at most a direct child dataset of main datasets (no recursivity)
# We can fallback trying other zfs pools if no match has been found.
# $1 is our current dataset name (which can have @snapshot name)
# $2 directory path we look for (cannot contains /)
# $3 restrict_to_same_pool (true|false) force looking for dataset with the same basename in the current dataset pool only
# $4 is the temporary mount directory to use
# $5 is the optional etc directory (if not $2 is not etc itself)
# return path for directory (which can be a mountpoint)
get_system_directory() {
    local dataset_path="$1"
    local directory="$2"
    local restrict_to_same_pool="$3"
    local mntdir="$4"
    local etc_dir="$5"

    if [ -z "${etc_dir}" ]; then
        etc_dir="${mntdir}/etc"
    fi

    local candidate_path="${mntdir}/${directory}"

    # 1. Look for /etc/fstab first (which will mount even on top of non empty $directory)
    local mounted_fstab_entry="false"
    if [ -f "${etc_dir}/fstab" ]; then
        mount_args=$(awk '/^[^#].*[ \t]\/'"${directory}"'[ \t]/ {print "-t", $3, $1}' "${etc_dir}/fstab")
        if [ -n "${mount_args}" ]; then
            mounted_fstab_entry="true"
            mount -o noatime ${mount_args} "${candidate_path}" || mounted_fstab_entry="false"
        fi
    fi

    # If directory isn't empty. Only count if coming from /etc/fstab. Will be
    # handled below otherwise as we are interested in potential snapshots.
    if [ "${mounted_fstab_entry}" = "true" -a -n "$(ls ${candidate_path} 2>/dev/null)" ]; then
        echo "${candidate_path}"
        return
    fi

    # 2. Handle zfs case, which can be a snapshots.

    local base_dataset_path="${dataset_path}"
    local snapshot_name=""
    # For snapshots we extract the parent dataset
    if echo "${dataset_path}" | grep -q '@'; then
        base_dataset_path=$(echo "${dataset_path}" | cut -d '@' -f1)
        snapshot_name=$(echo "${dataset_path}" | cut -d '@' -f2)
    fi
    base_dataset_name="${base_dataset_path##*/}"
    base_pool="$(echo "${base_dataset_path}" | cut -d'/' -f1)"

    # 2.a) Look for child dataset included in base dataset, which needs to hold same snapshot if any
    candidate_path=$(validate_system_dataset "${base_dataset_path}/${directory}" "${directory}" "${mntdir}" "${snapshot_name}")
    if [ -n "${candidate_path}" ]; then
        echo "${candidate_path}"
        return
    fi

    # 2.b) Look for current dataset (which is already mounted as /)
    candidate_path="${mntdir}/${directory}"
    if [ -n "${snapshot_name}" ]; then
        # WORKAROUND a bug [url]https://github.com/zfsonlinux/zfs/issues/9958[/url]
        # Reading the content of a snapshot fails if it is not the first mount
        # for a given dataset
        first_mntdir=$(awk '{if ($1 == "'${base_dataset_path}'") {print $2; exit;}}' /proc/mounts)
        if [ "${first_mntdir}" = "/" ]; then
            # prevents // on candidate_path
            first_mntdir=""
        fi
        candidate_path="${first_mntdir}/.zfs/snapshot/${snapshot_name}/${directory}"
    fi
    if [ -n "$(ls ${candidate_path} 2>/dev/null)" ]; then
        echo "${candidate_path}"
        return
    fi

    # 2.c) Look for every datasets in every pool which isn't the current dataset which holds:
    # - the same dataset name (last section) than our base_dataset_name
    # - mountpoint=directory
    # - canmount!=off
    all_same_base_dataset_name="$(zfs list -H -t filesystem -o name,canmount | awk '/^[^ ]+\/'"${base_dataset_name}"'[ \t](on|noauto)/ {print $1}') "

    # order by local pool datasets first
    current_pool_same_base_datasets=""
    other_pools_same_base_datasets=""
    root_pool=$(echo "${dataset_path%%/*}")
    for d in ${all_same_base_dataset_name}; do
        cur_dataset_pool=$(echo "${d%%/*}")
        if echo "${cur_dataset_pool}" | grep -wq "${root_pool}" 2>/dev/null ; then
            current_pool_same_base_datasets="${current_pool_same_base_datasets} ${d}"
        else
            other_pools_same_base_datasets="${other_pools_same_base_datasets} ${d}"
        fi
    done
    ordered_same_base_datasets="${current_pool_same_base_datasets} ${other_pools_same_base_datasets}"
    if [ "${restrict_to_same_pool}" = "true" ]; then
        ordered_same_base_datasets="${current_pool_same_base_datasets}"
    fi

    # now, loop over them
    for d in ${ordered_same_base_datasets}; do
        cur_dataset_pool=$(echo "${d%%/*}")

        rel_pool_root=$(zpool get -H altroot ${cur_dataset_pool} | awk '{print $3}')
        if [ "${rel_pool_root}" = "-" ]; then
            rel_pool_root=""
        fi

        # check mountpoint match
        candidate_dataset=$(zfs get -H mountpoint ${d} | grep -E "mountpoint\s${rel_pool_root}/${directory}\s" | awk '{print $1}')
        if [ -z "${candidate_dataset}" ]; then
            continue
        fi

        candidate_path=$(validate_system_dataset "${candidate_dataset}" "${directory}" "${mntdir}" "${snapshot_name}")
        if [ -n "${candidate_path}" ]; then
            echo "${candidate_path}"
            return
        fi
    done

    # 2.d) If we didn't find anything yet: check for persistent datasets corresponding to our mountpoint, with canmount=on without any snapshot associated:
    # Note: we go over previous datasets as well, but this is ok, as we didn't include them before.
    all_mountable_datasets="$(zfs list -t filesystem -o name,canmount | awk  '/^[^ ]+[ \t]+on/ {print $1}')"

    # order by local pool datasets first
    current_pool_datasets=""
    other_pools_datasets=""
    root_pool=$(echo "${dataset_path%%/*}")
    for d in ${all_mountable_datasets}; do
        cur_dataset_pool=$(echo "${d%%/*}")
        if echo "${cur_dataset_pool}" | grep -wq "${root_pool}" 2>/dev/null ; then
            current_pool_datasets="${current_pool_datasets} ${d}"
        else
            other_pools_datasets="${other_pools_datasets} ${d}"
        fi
    done
    ordered_datasets="${current_pool_datasets} ${other_pools_datasets}"
    if [ "${restrict_to_same_pool}" = "true" ]; then
        ordered_datasets="${current_pool_datasets}"
    fi

    for d in ${ordered_datasets}; do
        cur_dataset_pool=$(echo "${d%%/*}")

        rel_pool_root=$(zpool get -H altroot ${cur_dataset_pool} | awk '{print $3}')
        if [ "${rel_pool_root}" = "-" ]; then
            rel_pool_root=""
        fi

        # check mountpoint match
        candidate_dataset=$(zfs get -H mountpoint ${d} | grep -E "mountpoint\s${rel_pool_root}/${directory}\s" | awk '{print $1}')
        if [ -z "${candidate_dataset}" ]; then
            continue
        fi

        candidate_path=$(validate_system_dataset "${d}" "${directory}" "${mntdir}" "")
        if [ -n "${candidate_path}" ]; then
            echo "${candidate_path}"
            return
        fi
    done

    grub_warn "Failed to find a valid directory '${directory}' for dataset '${dataset_path}'. Ignoring"
    return
}

# Try our default layout bpool as a prefered layout (fast path)
# This is get_system_directory for boot optimized for our default installation layout
# $1 is our current dataset name (which can have @snapshot name)
# $2 is the temporary mount directory to use
# return path for directory (which can be a mountpoint) if found
try_default_layout_bpool() {
    local root_dataset_path="$1"
    local mntdir="$2"

    dataset_basename="${root_dataset_path##*/}"
    candidate_dataset="bpool/BOOT/${dataset_basename}"
    dataset_properties="$(zfs get -H mountpoint,canmount ${candidate_dataset} | cut -f3 | paste -sd ' ')"
    if [ -z "${dataset_properties}" ]; then
        return
    fi

    rel_pool_root=$(zpool get -H altroot bpool | awk '{print $3}')
    if [ "${rel_pool_root}" = "-" ]; then
        rel_pool_root=""
    fi

    snapshot_name="${dataset_basename##*@}"
    [ "${snapshot_name}" = "${dataset_basename}" ] && snapshot_name=""
    if [ -z "${snapshot_name}" ]; then
        if ! echo "${dataset_properties}" | grep -Eq "${rel_pool_root}/boot (on|noauto)"; then
            return
        fi
    else
        candidate_dataset=$(echo "${candidate_dataset}" | cut -d '@' -f1)
    fi

    validate_system_dataset "${candidate_dataset}" "boot" "${mntdir}" "${snapshot_name}"
}

# Return if secure boot is enabled on that system
is_secure_boot_enabled() {
    if LANG=C mokutil --sb-state 2>/dev/null | grep -qi enabled; then
        echo "true"
        return
    fi
    echo "false"
    return
}

# Given a filesystem or snapshot dataset, returns dataset|machine id|pretty name|last used
# $1 is dataset we want information from
# $2 is the temporary mount directory to use
get_dataset_info() {
    local dataset="$1"
    local mntdir="$2"

    local base_dataset="${dataset}"
    local etc_dir="${mntdir}/etc"
    local is_snapshot="false"
    # For snapshot we extract the parent dataset
    if echo "${dataset}" | grep -q '@'; then
        base_dataset=$(echo "${dataset}" | cut -d '@' -f1)
        is_snapshot="true"
    fi

    mount -o noatime,zfsutil -t zfs "${base_dataset}" "${mntdir}"

    # read machine-id/os-release from /etc
    etc_dir=$(get_system_directory "${dataset}" "etc" "true" "${mntdir}" "")
    if [ -z  "${etc_dir}" ]; then
        grub_warn "Ignoring ${dataset}"
        mountpoint -q "${mntdir}/etc" && umount "${mntdir}/etc" || true
        umount "${mntdir}"
        return
    fi

    machine_id=""
    if [ -f "${etc_dir}/machine-id" ]; then
        machine_id=$(cat "${etc_dir}/machine-id")
    fi
    # We have to use a random temporary id if we don't have any machine-id file or if this one is empty
    # (mostly the case of new installations before first boot).
    # Let's use the dataset name directly for this.
    # Consequence is that all datasets are then separated.
    if [ -z "${machine_id}" ]; then
        machine_id="${dataset}"
    fi
    pretty_name=$(. "${etc_dir}/os-release" && echo "${PRETTY_NAME}")
    mountpoint -q "${mntdir}/etc" && umount "${mntdir}/etc" || true

    # read available kernels from /boot
    boot_dir="$(try_default_layout_bpool "${dataset}" "${mntdir}")"
    if [ -z "${boot_dir}" ]; then
        boot_dir=$(get_system_directory "${dataset}" "boot" "false" "${mntdir}" "${etc_dir}")
    fi

    if [ -z  "${boot_dir}" ]; then
        grub_warn "Ignoring ${dataset}"
        mountpoint -q "${mntdir}/boot" && umount "${mntdir}/boot" || true
        umount "${mntdir}"
        return
    fi

    initrd_list=""
    kernel_list=""
    list=$(find "${boot_dir}" -maxdepth 1 -type f -regex '.*/\(vmlinuz\|vmlinux\|kernel\)-.*')
    while [ "x$list" != "x" ] ; do
        linux=`version_find_latest $list`
        list=`echo $list | tr ' ' '\n' | fgrep -vx "$linux" | tr '\n' ' '`
        if ! grub_file_is_not_garbage "${linux}" ; then
            continue
        fi

        # Filters entry if efi/non efi.
        # Note that for now we allow kernel without .efi.signed as those are signed kernel
        # on ubuntu, loaded by the shim.
        case "${linux}" in
            *.efi.signed)
                if [ "$(is_secure_boot_enabled)" = "false" ]; then
                    continue
                fi
            ;;
        esac

        linux_basename=$(basename "${linux}")
        linux_dirname=$(dirname "${linux}")
        version=$(echo "${linux_basename}" | sed -e "s,^[^0-9]*-,,g")
        alt_version=$(echo "${version}" | sed -e "s,\.old$,,g")

        gettext_printf "Found linux image: %s in %s\n" "${linux_basename}" "${dataset}" >&2

        initrd=""
        for i in "initrd.img-${version}" "initrd-${version}.img" "initrd-${version}.gz" \
            "initrd-${version}" "initramfs-${version}.img" \
            "initrd.img-${alt_version}" "initrd-${alt_version}.img" \
            "initrd-${alt_version}" "initramfs-${alt_version}.img" \
            "initramfs-genkernel-${version}" \
            "initramfs-genkernel-${alt_version}" \
            "initramfs-genkernel-${GENKERNEL_ARCH}-${version}" \
            "initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}"; do
            if test -e "${linux_dirname}/${i}" ; then
                initrd="$i"
                break
            fi
        done

        if test -z "${initrd}" ; then
            grub_warn "Couldn't find any valid initrd for dataset ${dataset}."
            continue
        fi

        gettext_printf "Found initrd image: %s in %s\n" "${initrd}" "${dataset}" >&2

        rel_linux_dirname=$(make_system_path_relative_to_its_root "${linux_dirname}")

        initrd_list="${initrd_list}|${rel_linux_dirname}/${initrd}"
        kernel_list="${kernel_list}|${rel_linux_dirname}/${linux_basename}"
    done

    initrd_list="${initrd_list#|}"
    kernel_list="${kernel_list#|}"

    initrd_device=$(${grub_probe} --target=device "${boot_dir}" | head -1)

    mountpoint -q "${mntdir}/boot" && umount "${mntdir}/boot" || true
    # We needed to look in / for snapshots on root dataset, umount there before zfs lazily unmount it
    case "${boot_dir}" in /boot/.zfs/snapshot/*)
        umount "${boot_dir}" || true
        ;;
    esac

    # for zsys snapshots: we want to know which kernel we successful last booted with
    last_booted_kernel=$(zfs get -H com.ubuntu.zsys:last-booted-kernel "${dataset}" | awk '{print $3}')

    # snapshot: last_used is dataset creation time
    if [ "${is_snapshot}" = "true" ]; then
        last_used="$(zfs get -pH creation "${dataset}" | awk -F '\t' '{print $3}')"
    # otherwise, last_used is manually marked at boot/shutdown on a root dataset for zsys
    else
        # if current system, take current time
        if zfs mount | awk '/[ \t]+\/$/ {print $1}' | grep -q ${dataset}; then
            last_used=$(date +%s)
        else
            last_used=$(zfs get -H com.ubuntu.zsys:last-used "${dataset}" | awk '{print $3}')
            # case of non zsys, or zsys without annotation, take /etc/machine-id stat (as we mounted with noatime).
            # However, as systems can be relatime, if system is current mounted one, set current time (case of clone + reboot
            # within the same d).
            if [ "${last_used}" = "-" ]; then
                last_used=$(stat --printf="%X" "${mntdir}/etc/os-release")
                if [ -f "${mntdir}/etc/machine-id" ]; then
                    last_used=$(stat --printf="%X" "${mntdir}/etc/machine-id")
                fi
            fi
        fi
    fi

    is_zsys=$(zfs get -H com.ubuntu.zsys:bootfs "${base_dataset}" | awk '{print $3}')

    if [ -n "${initrd_list}" -a -n "${kernel_list}" ]; then
        echo "${dataset}\t${is_zsys}\t${machine_id}\t${pretty_name}\t${last_used}\t${initrd_device}\t${initrd_list}\t${kernel_list}\t${last_booted_kernel}"
    else
        grub_warn "didn't find any valid initrd or kernel."
    fi

    umount "${mntdir}" || true
    # We needed to look in / for snapshots on root dataset, umount the snapshot for etc before zfs lazily unmount it
    case "${etc_dir}" in /.zfs/snapshot/*/etc)
        snapshot_path="$(findmnt -n -o TARGET -T ${etc_dir})"
        umount "${snapshot_path}" || true
        ;;
    esac
}

# Scan available boot options and returns in a formatted list
# $1 is the temporary mount directory to use
bootlist() {
    local mntdir="$1"
    local boot_list=""

    for dataset in $(get_root_datasets); do
        # get information from current root dataset
        boot_list="${boot_list}$(get_dataset_info ${dataset} ${mntdir})\n"

        # get information from snapshots of this root dataset
        for snapshot_dataset in $(zfs list -H -o name -t snapshot "${dataset}"); do
            boot_list="${boot_list}$(get_dataset_info ${snapshot_dataset} ${mntdir})\n"
        done
    done
    echo "${boot_list}"
}


# Order machine ids by last_used from their main entry
get_machines_sorted() {
    local bootlist="$1"

    local machineids="$(echo "${bootlist}" | awk '{print $3}' | sort -u)"
    for machineid in ${machineids}; do
        echo "${bootlist}" | awk 'BEGIN{FS="\t"} $1 !~ /.*@.*/  {print $5, $3}' | sort -nr | grep -E "[^^]\b${machineid}\b" | head -1
    done | sort -nr | awk '{print $2}'
}

# Sort entries by last_used for a given machineid
sort_entries_for_machineid() {
    local bootlist="$1"
    local machineid="$2"

    tab="$(printf '\t')"
    echo "${bootlist}" | grep -E "[^^]\b${machineid}\b" | sort -k5,5r -k1,1 -t "${tab}"
}

# Return main entry index
get_main_entry() {
    local entries="$1"

    echo "${entries}" | awk 'BEGIN{FS="\t"} $1 !~ /.*@.*/  {print}' | head -1
}

# Return specific field at index from entry
get_field_from_entry() {
    local entry="$1"
    local index="$2"

    echo "${entry}" | awk "BEGIN{FS=\"\t\"} {print \$$index}"
}

# Get the main entry metadata
main_entry_meta() {
    local main_entry="$1"

    initrd=$(get_field_from_entry "${main_entry}" 7 | cut -d'|' -f1)
    kernel=$(get_field_from_entry "${main_entry}" 8 | cut -d'|' -f1)

    # Take first element (most recent entry) which is not a snapshot
    echo "${main_entry}" | awk "BEGIN{ FS=\"\t\"; OFS=\"\t\"} {print \$3, \$2, \"main\", \$4, \$1, \$6, \"$initrd\", \"$kernel\"}"
}

# Get advanced entries metadata
advanced_entries_meta() {
    local main_entry="$1"

    last_used_kernel="$(get_field_from_entry "${main_entry}" 9 )"

    # We must align initrds with kernels.
    # Adds initrds to the stack then pop them 1 by 1 as we process the kernels
    set -- $(get_field_from_entry "${main_entry}" 7 | tr "|" " ")
    for kernel in $(get_field_from_entry "${main_entry}" 8 | tr "|" " "); do
        # get initrd and pop to the next one
        initrd="$1"; shift

        was_last_used_kernel="false"
        kernel_basename=$(basename "${kernel}")
        if [ "${kernel_basename}" = "${last_used_kernel}" ]; then
            was_last_used_kernel="true"
        fi

        echo "${main_entry}" | awk "BEGIN{ FS=\"\t\"; OFS=\"\t\"}    {print \$3, \$2, \"advanced\", \$4, \$1, \$6, \"$initrd\", \"$kernel\", \"$was_last_used_kernel\"}"
    done
}

# Get history metadata
history_entries_meta() {
    local entries="$1"
    local main_dataset_name="$2"
    local main_dataset_releasename="$3"

    if [ -z "${entries}" ]; then
        return
    fi

    # Traverse snapshots and clones
    echo "${entries}" | while read entry; do
        name=""
        # Compute snapshot/filesystem dataset name
        snap_dataset_name="$(get_field_from_entry "${entry}" 1)"

        snapname="${snap_dataset_name##*@}"
        # If, this is a clone, take what is after main_dataset_name
        if [ "${snapname}" = "${snap_dataset_name}" ]; then
            snapname="${snap_dataset_name##${main_dataset_name}_}"

            # Handle manual user clone (not prefixed by "main_dataset_name")
            snapname="${snapname##*/}"
        fi

        # We keep the snapname only if it is not only a zsys auto snapshot
        if echo "${snapname}" | grep -q "^autozsys_"; then
            snapname=""
        fi

        # We store the release only if it different from main dataset release (snapshot before a release upgrade)
        releasename=$(get_field_from_entry "${entry}" 4)
        if [ "${releasename}" = "${main_dataset_releasename}" ]; then
            releasename=""
        fi

        # Snapshot date
        foo="$(get_field_from_entry "${entry}" 5)"
        snapdate="$(date -d @$(get_field_from_entry "${entry}" 5) "+%x @ %H:%M")"

        # For snapshots/clones the name can have the following formats:
        #     <DATE>: autozsys, same release
        #   <OLD_RELEASE> on <DATE>: autozsys, different release
        #   <SNAPNAME> on <DATE>: Manual snapshot, same release
        #   <SNAPNAME>, <OLD_RELEASE> on <DATE>: Manual snapshot, different release
        if [ "${snapname}" = "" -a "${releasename}" = "" ]; then
            name="${snapdate}"
        elif [ "${snapname}" = "" -a "${releasename}" != "" ]; then
            name=$(gettext_printf "%s on %s" "${releasename}" "${snapdate}")
        elif [ "${snapname}" != "" -a "${releasename}" = "" ]; then
            name=$(gettext_printf "%s on %s" "${snapname}" "${snapdate}")
        else # snapname != "" && releasename != ""
            name=$(gettext_printf "%s, %s on %s" "${snapname}" "${releasename}" "${snapdate}")
        fi

        # Choose kernel and initrd if the snapshot was booted successfully on a specific kernel before
        # Take latest by default if no match
        initrd=$(get_field_from_entry "${entry}" 7 | cut -d'|' -f1)
        kernel=$(get_field_from_entry "${entry}" 8 | cut -d'|' -f1)
        last_used_kernel="$(get_field_from_entry "${entry}" 9)"

        # We must align initrds with kernels.
        # Adds initrds to the stack then pop them 1 by 1 as we process the kernels
        set -- $(get_field_from_entry "${entry}" 7 | tr "|" " ")
        for k in $(get_field_from_entry "${entry}" 8|tr "|" " "); do
            # get initrd and pop to the next one
            candidate_initrd="$1"; shift

            kernel_basename=$(basename "${k}")
            if [ "${kernel_basename}" = "${last_used_kernel}" ]; then
                kernel="${k}"
                initrd="${candidate_initrd}"
                break
            fi
        done

        echo "${entry}" | awk "BEGIN{ FS=\"\t\"; OFS=\"\t\"}    {print \$3, \$2, \"history\", \"$name\", \$1, \$6, \"$initrd\", \"$kernel\"}"
    done
}

# Generate metadata from a BOOTLIST that will subsequently used to generate
# the final grub menu entries
generate_grub_menu_metadata() {
    local bootlist="$1"

    # Sort machineids by last_used from their main entry
    for machineid in $(get_machines_sorted "${bootlist}"); do
        entries="$(sort_entries_for_machineid "${bootlist}" ${machineid})"
        main_entry="$(get_main_entry "${entries}")"

        if [ -z "$main_entry" ]; then
            continue
        fi

        main_entry_meta "${main_entry}"
        advanced_entries_meta "${main_entry}"

        main_dataset_name="$(get_field_from_entry "${main_entry}" 1)"
        main_dataset_releasename="$(get_field_from_entry "${main_entry}" 4)"
        # grep -v errcode != 0 if there is no match. || true to not fail with -e
        other_entries="$(echo "${entries}" | grep -v "${main_entry}" || true)"
        history_entries_meta "${other_entries}" "${main_dataset_name}" "${main_dataset_releasename}"
    done
}

# Print the configuration part common to all sections
# Note:
#   If 10_linux runs these part will be defined twice in grub configuration
print_menu_prologue() {
    cat << 'EOF'
function gfxmode {
    set gfxpayload="${1}"
EOF
    if [ "${vt_handoff}" = 1 ]; then
        cat << 'EOF'
    if [ "${1}" = "keep" ]; then
        set vt_handoff=vt.handoff=1
    else
        set vt_handoff=
    fi
EOF
    fi
    cat << EOF
}
EOF

    # Use ELILO's generic "efifb" when it's known to be available.
    # FIXME: We need an interface to select vesafb in case efifb can't be used.
    GRUB_GFXPAYLOAD_LINUX="${GRUB_GFXPAYLOAD_LINUX:-}"
    if [ "${GRUB_GFXPAYLOAD_LINUX}" != "" ] || [ "${gfxpayload_dynamic}" = 0 ]; then
        echo "set linux_gfx_mode=${GRUB_GFXPAYLOAD_LINUX}"
    else
        cat << EOF
if [ "\${recordfail}" != 1 ]; then
  if [ -e \${prefix}/gfxblacklist.txt ]; then
    if hwmatch \${prefix}/gfxblacklist.txt 3; then
      if [ \${match} = 0 ]; then
        set linux_gfx_mode=keep
      else
        set linux_gfx_mode=text
      fi
    else
      set linux_gfx_mode=text
    fi
  else
    set linux_gfx_mode=keep
  fi
else
  set linux_gfx_mode=text
fi
EOF
    fi
    cat << EOF
export linux_gfx_mode
EOF
}

# Cache for prepare_grub_to_access_device call
# $1: boot_device
# $2: submenu_level
prepare_grub_to_access_device_cached() {
    local boot_device="$1"
    local submenu_level="$2"

    local boot_device_idx="$(echo ${boot_device} | tr '/' '_')"

    cache_file="${ZFSTMP}/$(echo boot_device${boot_device_idx})"
    if [ ! -f "${cache_file}" ]; then
        set +u
        echo "$(prepare_grub_to_access_device "${boot_device}")" > "${cache_file}"
        set -u
        for i in 0 1 2; do
            submenu_indentation="$(printf %${i}s | tr " " "${grub_tab}")"
            sed "s/^/${submenu_indentation}    /" "${cache_file}" > "${cache_file}--${i}"
        done
    fi

    cat "${cache_file}--${submenu_level}"
}


# Print a grub menu entry
zfs_linux_entry () {
    submenu_level="$1"
    title="$2"
    type="$3"
    dataset="$4"
    boot_device="$5"
    initrd="$6"
    kernel="$7"
    kernel_version="$8"
    kernel_additional_args="${9:-}"
    boot_devices="${10:-}"

    submenu_indentation="$(printf %${submenu_level}s | tr " " "${grub_tab}")"

    echo "${submenu_indentation}menuentry '$(echo "${title}" | grub_quote)' ${CLASS} \${menuentry_id_option} 'gnulinux-${dataset}-${kernel_version}' {"

    if [ "${quick_boot}" = 1 ]; then
        echo "${submenu_indentation}    recordfail"
    fi

    if [ "${type}" != "recovery" ] ; then
        GRUB_SAVEDEFAULT=${GRUB_SAVEDEFAULT:-}
        default_entry="$(save_default_entry)"
        if [ -n "${default_entry}" ]; then
            echo "${submenu_indentation}    ${default_entry}"
        fi
    fi

    # Use ELILO's generic "efifb" when it's known to be available.
    # FIXME: We need an interface to select vesafb in case efifb can't be used.
    if [ "${GRUB_GFXPAYLOAD_LINUX}" = "" ]; then
        echo "${submenu_indentation}    load_video"
    else
        if [ "${GRUB_GFXPAYLOAD_LINUX}" != "text" ]; then
            echo "${submenu_indentation}    load_video"
        fi
    fi

    if ([ "${ubuntu_recovery}" = 0 ] || [ "${type}" != "recovery" ]) && \
        ([ "${GRUB_GFXPAYLOAD_LINUX}" != "" ] || [ "${gfxpayload_dynamic}" = 1 ]); then
        echo "${submenu_indentation}    gfxmode \${linux_gfx_mode}"
    fi

    echo "${submenu_indentation}    insmod gzio"
    echo "${submenu_indentation}    if [ \"\${grub_platform}\" = xen ]; then insmod xzio; insmod lzopio; fi"

    if [ -n "$boot_devices" ]; then
        for device in ${boot_devices}; do
            echo "${submenu_indentation}    if [ "${boot_device}" = "${device}" ]; then"
            echo "$(prepare_grub_to_access_device_cached "${device}" $(( submenu_level +1 )) )"
            echo "${submenu_indentation}    fi"
        done
    else
        echo "$(prepare_grub_to_access_device_cached "${boot_device}" "${submenu_level}")"
    fi

    if [ "${quiet_boot}" = 0 ] || [ "${type}" != simple ]; then
        echo "${submenu_indentation}    echo $(gettext_printf "Loading Linux %s ..." ${kernel_version} | grub_quote)"
    fi

    linux_default_args="${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
    if [ ${type} = "recovery" ]; then
        linux_default_args="${GRUB_CMDLINE_LINUX_RECOVERY} ${GRUB_CMDLINE_LINUX}"
    fi

    echo "${submenu_indentation}    linux    ${kernel} root=ZFS=${dataset} ro ${linux_default_args} ${kernel_additional_args}"

    if [ "${quiet_boot}" = 0 ] || [ "${type}" != simple ]; then
        echo "${submenu_indentation}    echo '$(gettext_printf "Loading initial ramdisk ..." | grub_quote)'"
    fi
    echo "${submenu_indentation}    initrd    ${initrd}"
    echo "${submenu_indentation}}"
}

# Generate a GRUB Menu from menu meta data
# $1 menu metadata
generate_grub_menu() {
    local menu_metadata="$1"
    local last_section=""
    local main_dataset_name=""
    local main_dataset=""
    local have_zsys=""

    if [ -z "${menu_metadata}" ]; then
        return
    fi

    CLASS="--class gnu-linux --class gnu --class os"

    if [ "${GRUB_DISTRIBUTOR}" = "" ] ; then
        OS=GNU/Linux
    else
        case ${GRUB_DISTRIBUTOR} in
            Ubuntu|Kubuntu)
            OS="${GRUB_DISTRIBUTOR}"
            ;;
            *)
            OS="${GRUB_DISTRIBUTOR} GNU/Linux"
            ;;
        esac
        CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1 | LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}"
    fi

    if [ -x /lib/recovery-mode/recovery-menu ]; then
        GRUB_CMDLINE_LINUX_RECOVERY=recovery
    else
        GRUB_CMDLINE_LINUX_RECOVERY=single
    fi
    if [ "${ubuntu_recovery}" = 1 ]; then
        GRUB_CMDLINE_LINUX_RECOVERY="${GRUB_CMDLINE_LINUX_RECOVERY} nomodeset"
    fi

    case "$GENKERNEL_ARCH" in
        x86*) GRUB_CMDLINE_LINUX_RECOVERY="$GRUB_CMDLINE_LINUX_RECOVERY dis_ucode_ldr";;
    esac


    if [ "${vt_handoff}" = 1 ]; then
        for word in ${GRUB_CMDLINE_LINUX_DEFAULT}; do
            if [ "${word}" = splash ]; then
                GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_DEFAULT} \${vt_handoff}"
            fi
        done
    fi

    print_menu_prologue

    cat<<'EOF'
function zsyshistorymenu {
    # $1: root dataset (eg rpool/ROOT/ubuntu_2zhm07@autozsys_k56fr6)
    # $2: boot device id (eg 411f29ce1557bfed)
    # $3: initrd (eg /BOOT/ubuntu_2zhm07@autozsys_k56fr6/initrd.img-5.4.0-21-generic)
    # $4: kernel (eg /BOOT/ubuntu_2zhm07@autozsys_k56fr6/vmlinuz-5.4.0-21-generic)
    # $5: kernel_version (eg 5.4.0-21-generic)

    set root_dataset="${1}"
    set boot_device="${2}"
    set initrd="${3}"
    set kernel="${4}"
    set kversion="${5}"

EOF
    boot_devices=$(echo "${menu_metadata}" | cut -d"$(printf '\t')" -f6 | sort -u)

    title=$(gettext_printf "Revert system only")
    zfs_linux_entry 1 "${title}" "simple" '${root_dataset}' '${boot_device}' '${initrd}' '${kernel}' '${kversion}' '' "${boot_devices}"

    title="$(gettext_printf "Revert system and user data")"
    zfs_linux_entry 1 "${title}" "simple" '${root_dataset}' '${boot_device}' '${initrd}' '${kernel}' '${kversion}' 'zsys-revert=userdata' "${boot_devices}"

    GRUB_DISABLE_RECOVERY="${GRUB_DISABLE_RECOVERY:-}"
    if [ "${GRUB_DISABLE_RECOVERY}" != "true" ]; then
        title="$(gettext_printf "Revert system only (%s)" "$(gettext "${GRUB_RECOVERY_TITLE}")")"
        zfs_linux_entry 1 "${title}" "recovery" '${root_dataset}' '${boot_device}' '${initrd}' '${kernel}' '${kversion}' '' "${boot_devices}"

        title="$(gettext_printf "Revert system and user data (%s)" "$(gettext "${GRUB_RECOVERY_TITLE}")")"
        zfs_linux_entry 1 "${title}" "recovery" '${root_dataset}' '${boot_device}' '${initrd}' '${kernel}' '${kversion}' 'zsys-revert=userdata' "${boot_devices}"
    fi
echo "}"
echo

    # IFS is set to TAB (ASCII 0x09)
    echo "${menu_metadata}" |
    {
        at_least_one_entry=0
        have_zsys="$(which zsysd || true)"
        while IFS="$(printf '\t')" read -r machineid iszsys section name dataset device initrd kernel opt; do

            # Disable history for non zsys system or if systems is a zsys one and zsys isn't installed.
            # In pure zfs systems, we identified multiple issues due to the mount generator
            # in upstream zfs which makes it incompatible. Don't show history for now.
            if [ "${section}" = "history" ]; then
                if [ "${iszsys}" != "yes" ] || [ "${iszsys}" = "yes" -a -z "${have_zsys}" ]; then
                    continue
                fi
            fi

            if [ "${last_section}" != "${section}" -a -n "${last_section}" ]; then
                # Close previous section wrapper
                if [ "${last_section}" != "main" ]; then
                    echo "}"    # Add grub_tabs
                    at_least_one_entry=0
                fi
            fi

            case "${section}" in
                main)
                    title="${name}"
                    main_dataset_name="${name}"
                    main_dataset="${dataset}"

                    kernel_version=$(basename "${kernel}" | sed -e "s,^[^0-9]*-,,g")
                    zfs_linux_entry 0 "${title}" "simple" "${dataset}" "${device}" "${initrd}" "${kernel}" "${kernel_version}"
                    at_least_one_entry=1
                ;;
                advanced)
                    # normal and recovery entries for a given kernel
                    if [ "${last_section}" != "${section}" ]; then
                        echo "submenu '$(gettext_printf "Advanced options for %s" "${main_dataset_name}" | grub_quote)' \${menuentry_id_option} 'gnulinux-advanced-${main_dataset}' {"
                    fi

                    last_booted_kernel_marker=""
                    if [ "${opt}" = "true" ]; then
                        last_booted_kernel_marker="* "
                    fi

                    kernel_version=$(basename "${kernel}" | sed -e "s,^[^0-9]*-,,g")
                    title="$(gettext_printf "%s%s, with Linux %s" "${last_booted_kernel_marker}" "${name}" "${kernel_version}")"
                    zfs_linux_entry 1 "${title}" "advanced" "${dataset}" "${device}" "${initrd}" "${kernel}" "${kernel_version}"

                    GRUB_DISABLE_RECOVERY=${GRUB_DISABLE_RECOVERY:-}
                    if [ "${GRUB_DISABLE_RECOVERY}" != "true" ]; then
                        title="$(gettext_printf "%s%s, with Linux %s (%s)" "${last_booted_kernel_marker}" "${name}" "${kernel_version}" "$(gettext "${GRUB_RECOVERY_TITLE}")")"
                        zfs_linux_entry 1 "${title}" "recovery" "${dataset}" "${device}" "${initrd}" "${kernel}" "${kernel_version}"
                    fi
                    at_least_one_entry=1
                ;;
                history)
                    # Revert to a snapshot
                    # revert system, revert system and user data and associated recovery entries
                    if [ "${last_section}" != "${section}" ]; then
                        echo "submenu '$(gettext_printf "History for %s" "${main_dataset_name}" | grub_quote)' \${menuentry_id_option} 'gnulinux-history-${main_dataset}' {"
                    fi

                    if [ "${iszsys}" = "yes" ]; then
                        title="$(gettext_printf "Revert to %s" "${name}" | grub_quote)"
                    else
                        title="$(gettext_printf "Boot on %s" "${name}" | grub_quote)"
                    fi
                    echo "    submenu '${title}' \${menuentry_id_option} 'gnulinux-history-${dataset}' {"

                    kernel_version=$(basename "${kernel}" | sed -e "s,^[^0-9]*-,,g")

                    # Zsys only: let revert system without destroying snapshots
                    if [ "${iszsys}" = "yes" ]; then
                        echo "${grub_tab}${grub_tab}zsyshistorymenu" \"${dataset}\" \"${device}\" \"${initrd}\" \"${kernel}\" \"${kernel_version}\"
                    # Non-zsys: boot temporarly on snapshots or rollback (destroying intermediate snapshots)
                    else
                        title="$(gettext_printf "One time boot")"
                        zfs_linux_entry 2 "${title}" "simple" "${dataset}" "${device}" "${initrd}" "${kernel}" "${kernel_version}"

                        GRUB_DISABLE_RECOVERY="${GRUB_DISABLE_RECOVERY:-}"
                        if [ "${GRUB_DISABLE_RECOVERY}" != "true" ]; then
                            title="$(gettext_printf "One time boot (%s)" "$(gettext "${GRUB_RECOVERY_TITLE}")")"
                            zfs_linux_entry 2 "${title}" "recovery" "${dataset}" "${device}" "${initrd}" "${kernel}" "${kernel_version}"
                        fi

                        title="$(gettext_printf "Revert system (all intermediate snapshots will be destroyed)")"
                        zfs_linux_entry 2 "${title}" "simple" "${dataset}" "${device}" "${initrd}" "${kernel}" "${kernel_version}" "rollback=yes"
                    fi

                    echo "    }"
                    at_least_one_entry=1
                ;;
                *)
                    grub_warn "unknown section: ${section}. Ignoring entry ${name} for ${dataset}"
                ;;
            esac
            last_section="${section}"
        done

        if [ "${at_least_one_entry}" -eq 1 ]; then
            echo "}"
        fi
    }
}

# don't add trailing newline of variable is empty
# $1: content to write
# $2: destination file
trailing_newline_if_not_empty() {
    content="$1"
    dest="$2"

    if [ -z "${content}" ]; then
        rm -f "${dest}"
        touch "${dest}"
        return
    fi
    echo "${content}" > "${dest}"
}


GRUB_LINUX_ZFS_TEST="${GRUB_LINUX_ZFS_TEST:-}"
case "${GRUB_LINUX_ZFS_TEST}" in
    bootlist)
        # Import all available pools on the system and return imported list
        imported_pools=$(import_pools)
        boot_list="$(bootlist ${MNTDIR})"
        trailing_newline_if_not_empty "${boot_list}" "${GRUB_LINUX_ZFS_TEST_OUTPUT}"
        break
    ;;
    metamenu)
        boot_list="$(cat ${GRUB_LINUX_ZFS_TEST_INPUT})"
        menu_metadata="$(generate_grub_menu_metadata "${boot_list}")"
        trailing_newline_if_not_empty "${menu_metadata}" "${GRUB_LINUX_ZFS_TEST_OUTPUT}"
        break
    ;;
    grubmenu)
        menu_metadata="$(cat ${GRUB_LINUX_ZFS_TEST_INPUT})"
        grub_menu=$(generate_grub_menu "${menu_metadata}")
        trailing_newline_if_not_empty "${grub_menu}" "${GRUB_LINUX_ZFS_TEST_OUTPUT}"
        break
    ;;
    *)
        # Import all available pools on the system and return imported list
        imported_pools=$(import_pools)
        # Generate the complete list of boot entries
        boot_list="$(bootlist ${MNTDIR})"
        # Create boot menu meta data from the list of boot entries
        menu_metadata="$(generate_grub_menu_metadata "${boot_list}")"
        # Create boot menu meta data from the list of boot entries
        grub_menu="$(generate_grub_menu "${menu_metadata}")"
        if [ -n "${grub_menu}" ]; then
            # We want the trailing newline as a marker will be added
            echo "${grub_menu}"
        fi
    ;;
esac
yann@yann-pc:~$ 

et

yann@yann-pc:~$ dpkg -l | grep -Ei "btrfs|zfs"
ii  libzfs2linux                               0.8.4-1ubuntu11                     amd64        OpenZFS filesystem library for Linux
ii  libzpool2linux                             0.8.4-1ubuntu11                     amd64        OpenZFS pool library for Linux
ii  zfs-zed                                    0.8.4-1ubuntu11                     amd64        OpenZFS Event Daemon
ii  zfsutils-linux                             0.8.4-1ubuntu11                     amd64        command-line tools to manage OpenZFS filesystems
ii  zsys                                       0.5.2                               amd64        ZFS SYStem integration
yann@yann-pc:~$

Merci
Yann

Dernière modification par yanlatouch (Le 29/11/2020, à 21:56)

Hors ligne

#17 Le 29/11/2020, à 21:50

xubu1957

Re : Démarrage très lent d'Ubuntu 8-9 minutes

Bonjour,

Comme demandé dans le premier message du tutoriel Retour utilisable de commande

Pour ajouter toi-même les balises code à ton précédent message #16 :            Merci              wink

  • Cliquer sur  le lien « Modifier » en bas à droite du message

  • Sélectionner le texte

  • Cliquer sur le <> de l'éditeur de message

moko138 a écrit :

1) Les balises-code sont les < > (crochets bleus) de la barre de mise en forme.

1578811399.jpg

En séparant bien les retours :

comme
cela.

Dernière modification par xubu1957 (Le 29/11/2020, à 21:59)


Conseils pour les nouveaux demandeurs et pas qu'eux
Important : Pensez à passer vos sujets en [Résolu] lorsque ceux-ci le sont, au début du titre en cliquant sur Modifier sous le premier message, et un bref récapitulatif de la solution à la fin de celui-ci. Merci.                   Membre de Linux-Azur

Hors ligne

#18 Le 29/11/2020, à 21:57

yanlatouch

Re : Démarrage très lent d'Ubuntu 8-9 minutes

Ah j'ai enfin réussi à utiliser les balises code, merci pour les tutos.
Yann

Hors ligne

#19 Le 29/11/2020, à 22:51

moko138

Re : Démarrage très lent d'Ubuntu 8-9 minutes

Merci !  smile

Pas de paquet btrfs-tools (qui m'avait occasionné une lenteur analogue, il y a quelques années).

Je me rappelle vaguement avoir lu quelquechose sur l'introduction de zfs, il y a déjà quelques mois. Mais où ce FS à (dé)compression intervenait-il ?
Probablement pour initramfs.

     yanlatouch,
Exécute

sudo update-initramfs -u -k all ; sudo update-grub

puis chronomètre le démarrage suivant et dis-nous le résultat.


Pour le reste, je ne peux pas comparer avec ma vieille distribution.
Et ici, c'est une Ubuntu 20.10...

     malbo,
Aurais-tu une 20.10 sous la main pour comparer avec les retours de yanlatouch ?
Merci !


%NOINDEX%
Un utilitaire précieux : ncdu
Photo, mini-tutoriel :  À la découverte de dcraw

Hors ligne

#20 Le 29/11/2020, à 23:00

xubu1957

Re : Démarrage très lent d'Ubuntu 8-9 minutes

moko138 a écrit :

Je me rappelle vaguement avoir lu quelque chose sur l'introduction de zfs, il y a déjà quelques mois.

> /viewtopic.php?pid=22153476#p22153476 ?


Conseils pour les nouveaux demandeurs et pas qu'eux
Important : Pensez à passer vos sujets en [Résolu] lorsque ceux-ci le sont, au début du titre en cliquant sur Modifier sous le premier message, et un bref récapitulatif de la solution à la fin de celui-ci. Merci.                   Membre de Linux-Azur

Hors ligne

#21 Le 29/11/2020, à 23:36

yanlatouch

Re : Démarrage très lent d'Ubuntu 8-9 minutes

J'ai refait un boot-info depuis ma dernière installation :

boot-info-4ppa125                                              [20201129_2114]

============================== Boot Info Summary ===============================

 => No boot loader is installed in the MBR of /dev/sda.

sda1: __________________________________________________________________________

    File system:       vfat
    Boot sector type:  FAT32
    Boot sector info:  No errors found in the Boot Parameter Block.
    Operating System:  
    Boot files:        /efi/BOOT/fbx64.efi /efi/BOOT/mmx64.efi 
                       /efi/ubuntu/grubx64.efi /efi/ubuntu/mmx64.efi 
                       /efi/ubuntu/shimx64.efi /efi/ubuntu/grub.cfg

sda2: __________________________________________________________________________

    File system:       ext4
    Boot sector type:  -
    Boot sector info: 
    Operating System:  Ubuntu 20.10
    Boot files:        /boot/grub/grub.cfg /etc/fstab /etc/default/grub


================================ 1 OS detected =================================

OS#1:   L'OS actuellement utilisé - Ubuntu 20.10 CurrentSession on sda2

============================ Architecture/Host Info ============================

CPU architecture: 64-bit
BOOT_IMAGE of the installed session in use:
/boot/vmlinuz-5.8.0-29-generic root=UUID=f0205d01-584b-4344-87dd-55d24c082826 ro quiet splash vt.handoff=7


===================================== UEFI =====================================

BIOS is EFI-compatible, and is setup in EFI-mode for this installed-session.
SecureBoot disabled.

efibootmgr -v
BootCurrent: 0000
Timeout: 1 seconds
BootOrder: 0000,0001,0002,0003
Boot0000* ubuntu	HD(1,GPT,9c19e83a-db78-4175-8b88-fc639c731804,0x800,0x100000)/File(\EFI\UBUNTU\SHIMX64.EFI)
Boot0001* UEFI:CD/DVD Drive	BBS(129,,0x0)
Boot0002* UEFI:Removable Device	BBS(130,,0x0)
Boot0003* UEFI:Network Device	BBS(131,,0x0)

2895d47544fd587b26c7e29be1295c27   sda1/BOOT/fbx64.efi
dc3c47be2f78a78e5e57d097ae6c5c84   sda1/BOOT/mmx64.efi
951288adcc81d2d86508f3f18d9753e0   sda1/ubuntu/grubx64.efi
dc3c47be2f78a78e5e57d097ae6c5c84   sda1/ubuntu/mmx64.efi
78415fb8fb9b909f8029858113f1335f   sda1/ubuntu/shimx64.efi
78415fb8fb9b909f8029858113f1335f   sda1/BOOT/BOOTX64.efi


============================= Drive/Partition Info =============================

Disks info: ____________________________________________________________________

sda	: is-GPT,	no-BIOSboot,	has---ESP, 	not-usb,	not-mmc, has-os,	2048 sectors * 512 bytes

Partitions info (1/3): _________________________________________________________

sda2	: is-os,	64, apt-get,	signed grub-pc grub-efi ,	grub2,	grub-install,	grubenv-ok,	update-grub,	farbios
sda1	: no-os,	32, nopakmgr,	no-docgrub,	nogrub,	nogrubinstall,	no-grubenv,	noupdategrub,	not-far

Partitions info (2/3): _________________________________________________________

sda2	: isnotESP,	fstab-has-goodEFI,	no-nt,	no-winload,	no-recov-nor-hid,	no-bmgr,	notwinboot
sda1	: is---ESP,	part-has-no-fstab,	no-nt,	no-winload,	no-recov-nor-hid,	no-bmgr,	notwinboot

Partitions info (3/3): _________________________________________________________

sda2	: not-sepboot,	with-boot,	fstab-without-boot,	not-sep-usr,	with--usr,	fstab-without-usr,	std-grub.d,	sda
sda1	: not-sepboot,	no-boot,	part-has-no-fstab,	not-sep-usr,	no---usr,	part-has-no-fstab,	std-grub.d,	sda

fdisk -l (filtered): ___________________________________________________________

Disk sda: 223.57 GiB, 240057409536 bytes, 468862128 sectors
Disk identifier: 37C289A3-7D76-4ED8-9D27-70126632784B
        Start       End   Sectors   Size Type
sda1     2048   1050623   1048576   512M EFI System
sda2  1050624 468860927 467810304 223.1G Linux filesystem

parted -lm (filtered): _________________________________________________________

sda:240GB:scsi:512:512:gpt:ATA KINGSTON SV300S3:;
1:1049kB:538MB:537MB:fat32:EFI System Partition:boot, esp;
2:538MB:240GB:240GB:ext4::;

blkid (filtered): ______________________________________________________________

NAME   FSTYPE   UUID                                 PARTUUID                             LABEL PARTLABEL
sda                                                                                             
├─sda1 vfat     9DB9-3721                            9c19e83a-db78-4175-8b88-fc639c731804       EFI System Partition
└─sda2 ext4     f0205d01-584b-4344-87dd-55d24c082826 cd9b7ff0-0626-4214-b054-8eec6946bf50       

df (filtered): _________________________________________________________________

                   Avail Use% Mounted on
sda2              197.8G   4% /

Mount options: __________________________________________________________________

sda2              rw,relatime,errors=remount-ro

===================== sda1/efi/ubuntu/grub.cfg (filtered) ======================

search.fs_uuid f0205d01-584b-4344-87dd-55d24c082826 root hd0,gpt2 
set prefix=($root)'/boot/grub'
configfile $prefix/grub.cfg

====================== sda2/boot/grub/grub.cfg (filtered) ======================

Ubuntu   f0205d01-584b-4344-87dd-55d24c082826
Ubuntu, avec Linux 5.8.0-29-generic   f0205d01-584b-4344-87dd-55d24c082826
Ubuntu, avec Linux 5.8.0-25-generic   f0205d01-584b-4344-87dd-55d24c082826
### END /etc/grub.d/30_os-prober ###
UEFI Firmware Settings   uefi-firmware
### END /etc/grub.d/30_uefi-firmware ###

========================== sda2/etc/fstab (filtered) ===========================

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda2 during installation
UUID=f0205d01-584b-4344-87dd-55d24c082826 /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/sda1 during installation
UUID=9DB9-3721  /boot/efi       vfat    umask=0077      0       1
/swapfile                                 none            swap    sw              0       0

======================= sda2/etc/default/grub (filtered) =======================

GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

==================== sda2: Location of files loaded by Grub ====================

           GiB - GB             File                                 Fragment(s)
 177,128395081 = 190,190166016  boot/grub/grub.cfg                             2
   6,263744354 = 6,725644288    boot/vmlinuz                                   1
   4,904369354 = 5,266026496    boot/vmlinuz-5.8.0-25-generic                  1
   6,263744354 = 6,725644288    boot/vmlinuz-5.8.0-29-generic                  1
   4,904369354 = 5,266026496    boot/vmlinuz.old                               1
  10,127597809 = 10,874425344   boot/initrd.img                                1
  10,193031311 = 10,944684032   boot/initrd.img-5.8.0-25-generic               3
  10,127597809 = 10,874425344   boot/initrd.img-5.8.0-29-generic               1
  10,193031311 = 10,944684032   boot/initrd.img.old                            3

===================== sda2: ls -l /etc/grub.d/ (filtered) ======================

-rwxr-xr-x 1 root root 17622 oct.   1 16:59 10_linux
-rwxr-xr-x 1 root root 42359 oct.   1 16:59 10_linux_zfs
-rwxr-xr-x 1 root root 12894 oct.   1 16:59 20_linux_xen
-rwxr-xr-x 1 root root 12059 oct.   1 16:59 30_os-prober
-rwxr-xr-x 1 root root  1424 oct.   1 16:59 30_uefi-firmware
-rwxr-xr-x 1 root root   214 oct.   1 16:59 40_custom
-rwxr-xr-x 1 root root   216 oct.   1 16:59 41_custom


========= Devices which don't seem to have a corresponding hard drive ==========

sdb 

Suggested repair: ______________________________________________________________

The default repair of the Boot-Repair utility would reinstall the grub-efi-amd64-signed of
sda2,
using the following options:        sda1/boot/efi,
Additional repair would be performed: unhide-bootmenu-10s  use-standard-efi-file    

Final advice in case of suggested repair: ______________________________________


Please do not forget to make your UEFI firmware boot on the L'OS actuellement utilisé - Ubuntu 20.10 CurrentSession entry (sda1/efi/****/shim****.efi (**** will be updated in the final message) file) !

Dernière modification par yanlatouch (Le 29/11/2020, à 23:39)

Hors ligne

#22 Le 30/11/2020, à 00:55

moko138

Re : Démarrage très lent d'Ubuntu 8-9 minutes

yanlatouch, ce n'est pas ce que je t'ai demandé...


%NOINDEX%
Un utilitaire précieux : ncdu
Photo, mini-tutoriel :  À la découverte de dcraw

Hors ligne

#23 Le 30/11/2020, à 01:06

moko138

Re : Démarrage très lent d'Ubuntu 8-9 minutes

Merci beaucoup, xubu1957 !


%NOINDEX%
Un utilitaire précieux : ncdu
Photo, mini-tutoriel :  À la découverte de dcraw

Hors ligne

#24 Le 30/11/2020, à 01:17

yanlatouch

Re : Démarrage très lent d'Ubuntu 8-9 minutes

moko138 a écrit :

yanlatouch, ce n'est pas ce que je t'ai demandé...

J'ai executé la commande : sudo update-initramfs -u -k all ; sudo update-grub
Grosse amélioration : démarrage en 3 minutes 40, la page logo d'ASUS ne s'affiche plus que 20 secondes au lieu de plus de 6 minutes ; le démarrage d'ubuntu 20.10 met 3 minutes 20.

A l'extinction du PC, j'ai toujours des messages d'erreur :
Systemd-shutdown Waiting for process systemd-udevd
SDB : Worker 44438 processing SEQNUM:5260 is taking a long time.

Merci beaucoup, on a déjà réduit le temps de démarrage de plus de la moitié !

Yann

Hors ligne

#25 Le 30/11/2020, à 07:01

xubu1957

Re : Démarrage très lent d'Ubuntu 8-9 minutes

Bonjour,

@moko138

Je trouve aussi dans la Doc systemes_de_fichiers_zfs et wikipedia.org/wiki/ZFS


Conseils pour les nouveaux demandeurs et pas qu'eux
Important : Pensez à passer vos sujets en [Résolu] lorsque ceux-ci le sont, au début du titre en cliquant sur Modifier sous le premier message, et un bref récapitulatif de la solution à la fin de celui-ci. Merci.                   Membre de Linux-Azur

Hors ligne