#1 Le 27/08/2022, à 12:53
- bricomega
swap qui ne se monte pas
bonjour
quand je demarre ubuntu ça met plus de 2 minutes avant d'arriver à la fenêtre de connection,et lorsque je regarde l'état des partitions avec gparted je constate que le swap n'est pas monté,c'est ce qui occasionne ce retard au demarrage je pense,
comment faire pour que le swap se monte au demarrage
merci de me renseigner si possible
Hors ligne
#2 Le 27/08/2022, à 13:10
- malbo
Re : swap qui ne se monte pas
Bonjour,
Je te prie de faire un Boot-info depuis une session de ton Ubuntu installé,puis de donner l'URL de ce Boot-info dans ta réponse.
Hors ligne
#3 Le 27/08/2022, à 13:24
- MicP
Re : swap qui ne se monte pas
Bonjour
… lorsque je regarde l'état des partitions avec gparted je constate que le swap n'est pas monté …
Effectivement, une partition de swap ne content pas un système de fichiers comme les autres <=> un système de fichiers de type swap ne peut pas être monté.
Par contre, un système de fichiers de type swap peut-être activé ou désactivé.
… c'est ce qui occasionne ce retard au demarrage …
Qu'est-ce qui te fait envisager cette hypothèse ?
…comment faire pour que le swap se monte au demarrage …
Comme on ne peut qu'activer ou désactiver un système de fichiers de type swap
je suppose que tu voudrais que ce système de fichiers de type swap soit activé au démarrage.
C'est en spécifiant dans le fichier /etc/fstab l'UUID de ce système de fichiers de type swap que l'on peut demander à ce qu'il soit activé au démarrage du système.
Par exemple, voilà la ligne de mon fichier /etc/fstab qui permet d'activer le système de fichiers de type swap au démarrage de mon système Linux :
michel@lubuv:~$ grep swap /etc/fstab
UUID=ea1c0504-e739-44ab-b2f0-a578917e318f swap swap defaults 0 0
michel@lubuv:~$
Et voilà comment je peux faire s'afficher l'UUID du (ou des) système de fichiers de type swap qui est accessible sur ma machine :
michel@lubuv:~$ sudo blkid | grep swap
/dev/sda1: UUID="ea1c0504-e739-44ab-b2f0-a578917e318f" TYPE="swap" PARTUUID="72f23966-01"
michel@lubuv:~$
=======
Mais il se peut que le système de fichiers swap qui est utilisé par ton système ne soit pas dans une partition
mais dans un fichier nommé swapfile qui aurait été créé à la racine du système de fichiers de ton système Ubuntu.
et dans ce cas, ce fichier serait :
michel@lubuv:~$ ls -l /swapfile
-rw------- 1 root root 536870912 août 14 23:28 /swapfile
michel@lubuv:~$
et dans ton fichier /etc/fstab, la ligne qui permettrait d'activer ce swap au démarrage de ton système Ubuntu serait :
michel@lubuv:~$ grep swapfile /etc/fstab
/swapfile swap swap defaults 0 0
michel@lubuv:~$
Dernière modification par MicP (Le 27/08/2022, à 13:36)
Hors ligne
#4 Le 27/08/2022, à 15:21
- bricomega
Re : swap qui ne se monte pas
bonjour malbo
voila le boot-info
boot-info-4ppa200 [20220827_1610]
============================== Boot Info Summary ===============================
=> No boot loader is installed in the MBR of /dev/sda.
=> Windows 7/8/10/11/2012 is installed in the MBR of /dev/sdb.
sda1: __________________________________________________________________________
File system: ntfs
Boot sector type: Windows 8/10/11/2012: NTFS
Boot sector info: No errors found in the Boot Parameter Block.
Operating System:
Boot files:
sda2: __________________________________________________________________________
File system: swap
Boot sector type: -
Boot sector info:
sda3: __________________________________________________________________________
/var/log/boot-info/20220827_161003/Boot-Info_20220827_1610.txt
je n'y comprends rien,sur mon ordi j'ai 3 distros,win10,ubuntu et debian,jusquà present j'avais 3 distros et 2 partitions libres une pour installer une autre debian et une pour son home,tout marchait bien,j'ai voulu installer une autre debian et son home sur mes 2 partitions libres et depuis tout part en vrille
Hors ligne
#5 Le 27/08/2022, à 15:23
- xubu1957
Re : swap qui ne se monte pas
Bonjour,
Bonjour,
Je te prie de faire un Boot-info depuis une session de ton Ubuntu installé,puis de donner l'URL de ce Boot-info dans ta réponse.
Conseils pour les nouveaux demandeurs et pas qu'eux
Important : Pensez à passer vos sujets en [Réso|u] 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
En ligne
#6 Le 27/08/2022, à 17:34
- bricomega
Re : swap qui ne se monte pas
bonjour
voila je pense que c'est ça
boot-info-4ppa200 [20220827_1835]
============================== Boot Info Summary ===============================
=> No boot loader is installed in the MBR of /dev/sda.
=> Windows 7/8/10/11/2012 is installed in the MBR of /dev/sdb.
sda1: __________________________________________________________________________
File system: ntfs
Boot sector type: Windows 8/10/11/2012: NTFS
Boot sector info: No errors found in the Boot Parameter Block.
Operating System:
Boot files:
sda2: __________________________________________________________________________
File system: swap
Boot sector type: -
Boot sector info:
sda3: __________________________________________________________________________
File system: ext4
Boot sector type: -
Boot sector info:
Operating System:
Boot files:
sda4: __________________________________________________________________________
File system: ext4
Boot sector type: -
Boot sector info:
Operating System:
Boot files:
sda5: __________________________________________________________________________
File system: ext4
Boot sector type: -
Boot sector info:
Operating System:
Boot files:
sdb1: __________________________________________________________________________
File system: vfat
Boot sector type: FAT32
Boot sector info: No errors found in the Boot Parameter Block.
Operating System:
Boot files: /efi/Boot/bootx64.efi /efi/Boot/fbx64.efi
/efi/Boot/mmx64.efi /efi/debian/fbx64.efi
/efi/debian/grubx64.efi /efi/debian/mmx64.efi
/efi/debian/shimx64.efi /efi/ubuntu/grubx64.efi
/efi/ubuntu/mmx64.efi /efi/ubuntu/shimx64.efi
/efi/debian/grub.cfg /efi/ubuntu/grub.cfg
/efi/Microsoft/Boot/bootmgfw.efi
/efi/Microsoft/Boot/bootmgr.efi
sdb2: __________________________________________________________________________
File system:
Boot sector type: -
Boot sector info:
sdb3: __________________________________________________________________________
File system: ntfs
Boot sector type: Windows 8/10/11/2012: NTFS
Boot sector info: No errors found in the Boot Parameter Block.
Operating System: Windows 10 or 11
Boot files: /Windows/System32/winload.exe
sdb4: __________________________________________________________________________
File system: ext4
Boot sector type: -
Boot sector info:
Operating System: Debian GNU/Linux 11 (bullseye)
Boot files: /boot/grub/grub.cfg /etc/fstab /etc/default/grub
sdb5: __________________________________________________________________________
File system: ext4
Boot sector type: -
Boot sector info:
Operating System: Debian GNU/Linux 11 (bullseye)
Boot files: /boot/grub/grub.cfg /etc/fstab /etc/default/grub
sdb6: __________________________________________________________________________
File system: ext4
Boot sector type: -
Boot sector info:
Operating System: Ubuntu 22.04.1 LTS
Boot files: /boot/grub/grub.cfg /etc/fstab /etc/default/grub
sdb7: __________________________________________________________________________
File system: ntfs
Boot sector type: Windows 8/10/11/2012: NTFS
Boot sector info: No errors found in the Boot Parameter Block.
Operating System:
Boot files:
================================ 4 OS detected =================================
OS#1: L'OS actuellement utilisé - Ubuntu 22.04.1 LTS CurrentSession on sdb6
OS#2: Debian GNU/Linux 11 (bullseye) on sdb4
OS#3: Debian GNU/Linux 11 (bullseye) on sdb5
OS#4: Windows 10 or 11 on sdb3
================================ Host/Hardware =================================
CPU architecture: 64-bit
Video: UHD Graphics 620 from Intel Corporation
BOOT_IMAGE of the installed session in use:
/boot/vmlinuz-5.15.0-46-generic root=UUID=9b243a8a-12c2-45b3-a54b-045682bd44df ro quiet splash
df -Th / : /dev/sdb6 ext4 58G 12G 43G 23% /
===================================== UEFI =====================================
BIOS/UEFI firmware: X705UAR.318(5.12) from American Megatrends Inc.
The firmware is EFI-compatible, and is set in EFI-mode for this installed-session.
SecureBoot disabled - SecureBoot disabled - Veuillez indiquer ce message à boot.repair@gmail.com.
BootCurrent: 0000
Timeout: 2 seconds
BootOrder: 0000,0001,0002,0003
Boot0000* debian HD(1,GPT,b80d135c-1870-4035-a2e2-7ad1fa763355,0x800,0x82000)/File(\EFI\DEBIAN\SHIMX64.EFI)
Boot0001* ubuntu HD(1,GPT,b80d135c-1870-4035-a2e2-7ad1fa763355,0x800,0x82000)/File(\EFI\UBUNTU\SHIMX64.EFI)
Boot0002* Windows EFI Boot Manager HD(1,GPT,b80d135c-1870-4035-a2e2-7ad1fa763355,0x800,0x82000)/File(\EFI\MICROSOFT\BOOT\BOOTMGFW.EFI)WINDOWS.........x...B.C.D.O.B.J.E.C.T.=.{.9.d.e.a.8.6.2.c.-.5.c.d.d.-.4.e.7.0.-.a.c.c.1.-.f.3.2.b.3.4.4.d.4.7.9.5.}....................
Boot0003* debian HD(1,GPT,b80d135c-1870-4035-a2e2-7ad1fa763355,0x800,0x82000)/File(\EFI\DEBIAN\GRUBX64.EFI)..BO
728124f6ec8e22fbdbe7034812c81b95 sdb1/Boot/bootx64.efi
c152ec201c37b6e97bbc2207e49d1271 sdb1/Boot/fbx64.efi
fdafb5eece6caeccb788c946a28e6872 sdb1/Boot/mmx64.efi
0d240e1ce1b2b02dec9bbb162cfb94da sdb1/debian/fbx64.efi
1b236359c52f180ce9fe705cbce94703 sdb1/debian/grubx64.efi
f617c3c1b1bdf56909dcb8e1b996749b sdb1/debian/mmx64.efi
cefed90870185ef689f004e686de8fce sdb1/debian/shimx64.efi
f62c28d9b477b6a1a7b1c991b2b6637d sdb1/ubuntu/grubx64.efi
fdafb5eece6caeccb788c946a28e6872 sdb1/ubuntu/mmx64.efi
728124f6ec8e22fbdbe7034812c81b95 sdb1/ubuntu/shimx64.efi
72293f4ecf0f5b24dce601d2c3c4b26e sdb1/Microsoft/Boot/bootmgfw.efi
75641ea3cae97c7ea935e501d6e5e227 sdb1/Microsoft/Boot/bootmgr.efi
============================= Drive/Partition Info =============================
Disks info: ____________________________________________________________________
sdb : is-GPT, no-BIOSboot, has---ESP, not-usb, not-mmc, has-os, has-win, 2048 sectors * 512 bytes
sda : is-GPT, no-BIOSboot, has-noESP, not-usb, not-mmc, no-os, no-wind, 2048 sectors * 512 bytes
Partitions info (1/3): _________________________________________________________
sdb4 : is-os, 64, apt-get, signed grub-efi , grub2, grub-install, grubenv-ok, update-grub, farbios
sdb7 : no-os, 32, nopakmgr, no-docgrub, nogrub, nogrubinstall, no-grubenv, noupdategrub, farbios
sdb5 : is-os, 64, apt-get, signed grub-efi , grub2, grub-install, grubenv-ok, update-grub, farbios
sdb3 : is-os, 32, nopakmgr, no-docgrub, nogrub, nogrubinstall, no-grubenv, noupdategrub, not-far
sdb1 : no-os, 32, nopakmgr, no-docgrub, nogrub, nogrubinstall, no-grubenv, noupdategrub, not-far
sdb6 : is-os, 64, apt-get, signed grub-pc grub-efi , grub2, grub-install, grubenv-ok, update-grub, farbios
sda4 : no-os, 32, nopakmgr, no-docgrub, nogrub, nogrubinstall, no-grubenv, noupdategrub, farbios
sda5 : no-os, 32, nopakmgr, no-docgrub, nogrub, nogrubinstall, no-grubenv, noupdategrub, farbios
sda3 : no-os, 32, nopakmgr, no-docgrub, nogrub, nogrubinstall, no-grubenv, noupdategrub, farbios
sda1 : no-os, 32, nopakmgr, no-docgrub, nogrub, nogrubinstall, no-grubenv, noupdategrub, farbios
Partitions info (2/3): _________________________________________________________
sdb4 : isnotESP, fstab-has-goodEFI, no-nt, no-winload, no-recov-nor-hid, no-bmgr, notwinboot
sdb7 : isnotESP, part-has-no-fstab, no-nt, no-winload, recovery-or-hidden, no-bmgr, notwinboot
sdb5 : isnotESP, fstab-has-goodEFI, no-nt, no-winload, no-recov-nor-hid, no-bmgr, notwinboot
sdb3 : isnotESP, part-has-no-fstab, no-nt, haswinload, no-recov-nor-hid, no-bmgr, notwinboot
sdb1 : is---ESP, part-has-no-fstab, no-nt, no-winload, no-recov-nor-hid, no-bmgr, notwinboot
sdb6 : isnotESP, fstab-has-goodEFI, no-nt, no-winload, no-recov-nor-hid, no-bmgr, notwinboot
sda4 : isnotESP, part-has-no-fstab, no-nt, no-winload, no-recov-nor-hid, no-bmgr, notwinboot
sda5 : isnotESP, part-has-no-fstab, no-nt, no-winload, no-recov-nor-hid, no-bmgr, notwinboot
sda3 : isnotESP, part-has-no-fstab, no-nt, no-winload, no-recov-nor-hid, no-bmgr, notwinboot
sda1 : isnotESP, part-has-no-fstab, no-nt, no-winload, no-recov-nor-hid, no-bmgr, notwinboot
Partitions info (3/3): _________________________________________________________
sdb4 : not--sepboot, with-boot, fstab-without-boot, not-sep-usr, with--usr, fstab-without-usr, std-grub.d, sdb
sdb7 : not--sepboot, no---boot, part-has-no-fstab, not-sep-usr, no---usr, part-has-no-fstab, no--grub.d, sdb
sdb5 : not--sepboot, with-boot, fstab-without-boot, not-sep-usr, with--usr, fstab-without-usr, std-grub.d, sdb
sdb3 : not--sepboot, no---boot, part-has-no-fstab, not-sep-usr, no---usr, part-has-no-fstab, no--grub.d, sdb
sdb1 : not--sepboot, no---boot, part-has-no-fstab, not-sep-usr, no---usr, part-has-no-fstab, no--grub.d, sdb
sdb6 : not--sepboot, with-boot, fstab-without-boot, not-sep-usr, with--usr, fstab-without-usr, customized, sdb
sda4 : maybesepboot, no---boot, part-has-no-fstab, not-sep-usr, no---usr, part-has-no-fstab, no--grub.d, sda
sda5 : maybesepboot, no---boot, part-has-no-fstab, not-sep-usr, no---usr, part-has-no-fstab, no--grub.d, sda
sda3 : maybesepboot, no---boot, part-has-no-fstab, not-sep-usr, no---usr, part-has-no-fstab, no--grub.d, sda
sda1 : not--sepboot, no---boot, part-has-no-fstab, not-sep-usr, no---usr, part-has-no-fstab, no--grub.d, sda
fdisk -l (filtered): ___________________________________________________________
Disk sda: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk identifier: 3C18BB3C-4281-48A6-9CFD-421A2D51B6BB
Start End Sectors Size Type
sda1 2048 528607231 528605184 252.1G Microsoft basic data
sda2 528607232 560064511 31457280 15G Microsoft basic data
sda3 560064512 969664511 409600000 195.3G Linux filesystem
sda4 969664512 1379264511 409600000 195.3G Linux filesystem
sda5 1379264512 1953524277 574259766 273.8G Linux filesystem
Disk sdb: 238.47 GiB, 256060514304 bytes, 500118192 sectors
Disk identifier: 1E5749F3-7926-48BA-86F1-843422A724FC
Start End Sectors Size Type
sdb1 2048 534527 532480 260M EFI System
sdb2 534528 567295 32768 16M Microsoft reserved
sdb3 567296 187488255 186920960 89.1G Microsoft basic data
sdb4 187488256 281860095 94371840 45G Microsoft basic data
sdb5 281860096 376231935 94371840 45G Microsoft basic data
sdb6 376231936 498786303 122554368 58.4G Microsoft basic data
sdb7 498786304 500117503 1331200 650M Windows recovery environment
parted -lm (filtered): _________________________________________________________
sda:1000GB:scsi:512:4096:gpt:ATA ST1000LM035-1RK1:;
1:1049kB:271GB:271GB:ntfs:windows data:msftdata;
2:271GB:287GB:16.1GB:linux-swap(v1):swap:msftdata;
3:287GB:496GB:210GB:ext4:home debian:;
4:496GB:706GB:210GB:ext4:home kde:;
5:706GB:1000GB:294GB:ext4:home ubuntu:;
sdb:256GB:scsi:512:512:gpt:ATA SanDisk SD9SN8W2:;
1:1049kB:274MB:273MB:fat32:EFI system partition:boot, esp;
2:274MB:290MB:16.8MB::Microsoft reserved partition:msftres;
3:290MB:96.0GB:95.7GB:ntfs:windows:msftdata;
4:96.0GB:144GB:48.3GB:ext4:systeme debian:msftdata;
5:144GB:193GB:48.3GB:ext4:systeme kde:msftdata;
6:193GB:255GB:62.7GB:ext4:systeme ubuntu:msftdata;
7:255GB:256GB:682MB:ntfs:win recovery:hidden, diag;
blkid (filtered): ______________________________________________________________
NAME FSTYPE UUID PARTUUID LABEL PARTLABEL
sda
├─sda1 ntfs 8270E76470E75D83 43617761-5eb4-4e3b-bb57-1d63afa02415 DATA windows data
├─sda2 swap b23f3faa-381e-42f3-bb58-af5616f11378 00168dff-9710-e79a-e4ec-d91ffe1b2d00 swap
├─sda3 ext4 3b25d7fb-8127-4a05-bfd9-df36c0670584 a6adcb5b-b4e1-4647-828c-6c2b99a3313b home debian home debian
├─sda4 ext4 44f2ad7c-cd19-455a-ad47-3fb01095ec1c 2838d686-448a-44c4-8eae-10c53a3eb4c2 home kde home kde
└─sda5 ext4 3c238729-6050-4da2-98c8-3202529d8da3 112ef786-f46e-42fd-b63b-8afe0feb33f9 home ubuntu home ubuntu
sdb
├─sdb1 vfat 0F63-B9A1 b80d135c-1870-4035-a2e2-7ad1fa763355 EFI system partition
├─sdb2 d5d317a1-e597-4961-8794-ab586e20d14f Microsoft reserved partition
├─sdb3 ntfs 01D5D1AFCF6AC2A0 1cba5c0e-d2eb-45c3-b3a6-27d43725f972 windows windows
├─sdb4 ext4 123bcb04-2606-4786-957c-2a41be0b46e4 4f2ddaa0-44e2-01d8-5081-86277122ec00 sys deb systeme debian
├─sdb5 ext4 4a7fb877-a6d9-4cc1-9e66-d966f06bfc72 57ddde80-44e2-01d8-408b-ce2b7122ec00 systeme kde systeme kde
├─sdb6 ext4 9b243a8a-12c2-45b3-a54b-045682bd44df 0005fd0d-a9f0-607c-e2dc-fc171afa0b00 systeme ubuntu systeme ubuntu
└─sdb7 ntfs F60A0E4E0A0E0BF5 db2882d1-6a32-4cfd-acd9-410402c4ed5c win recovery win recovery
Mount points (filtered): _______________________________________________________
Avail Use% Mounted on
/dev/sda1 229.8G 9% /mnt/boot-sav/sda1
/dev/sda3 181.4G 0% /mnt/boot-sav/sda3
/dev/sda4 181.4G 0% /mnt/boot-sav/sda4
/dev/sda5 254.7G 0% /home
/dev/sdb1 222.5M 13% /mnt/boot-sav/sdb1
/dev/sdb3 39.7G 55% /mnt/boot-sav/sdb3
/dev/sdb4 32.2G 22% /mnt/boot-sav/sdb4
/dev/sdb5 37.3G 10% /mnt/boot-sav/sdb5
/dev/sdb6 42.3G 21% /
/dev/sdb7 175.8M 73% /mnt/boot-sav/sdb7
Mount options (filtered): ______________________________________________________
/dev/sda1 fuseblk ro,relatime,user_id=0,group_id=0,allow_other,blksize=4096
/dev/sda3 ext4 rw,relatime
/dev/sda4 ext4 rw,relatime
/dev/sda5 ext4 rw,relatime
/dev/sdb1 vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro
/dev/sdb3 fuseblk ro,relatime,user_id=0,group_id=0,allow_other,blksize=4096
/dev/sdb4 ext4 rw,relatime
/dev/sdb5 ext4 rw,relatime
/dev/sdb6 ext4 rw,relatime,errors=remount-ro
/dev/sdb7 fuseblk ro,relatime,user_id=0,group_id=0,allow_other,blksize=4096
===================== sdb1/efi/debian/grub.cfg (filtered) ======================
search.fs_uuid 123bcb04-2606-4786-957c-2a41be0b46e4 root hd1,gpt4
set prefix=($root)'/boot/grub'
configfile $prefix/grub.cfg
===================== sdb1/efi/ubuntu/grub.cfg (filtered) ======================
search.fs_uuid 9b243a8a-12c2-45b3-a54b-045682bd44df root hd1,gpt6
set prefix=($root)'/boot/grub'
configfile $prefix/grub.cfg
====================== sdb4/boot/grub/grub.cfg (filtered) ======================
Debian GNU/Linux 123bcb04-2606-4786-957c-2a41be0b46e4
Debian GNU/Linux, with Linux 5.18.0-0.deb11.3-amd64 123bcb04-2606-4786-957c-2a41be0b46e4
Debian GNU/Linux, with Linux 5.10.0-17-amd64 123bcb04-2606-4786-957c-2a41be0b46e4
Debian GNU/Linux, with Linux 5.10.0-16-amd64 123bcb04-2606-4786-957c-2a41be0b46e4
Windows Boot Manager (on sdb1) osprober-efi-0F63-B9A1
Debian GNU/Linux 11 (bullseye) (on sdb5) 4a7fb877-a6d9-4cc1-9e66-d966f06bfc72
Debian GNU/Linux (on sdb5) 4a7fb877-a6d9-4cc1-9e66-d966f06bfc72
Debian GNU/Linux, with Linux 5.10.0-17-amd64 (on sdb5) 4a7fb877-a6d9-4cc1-9e66-d966f06bfc72
Debian GNU/Linux, with Linux 5.10.0-16-amd64 (on sdb5) 4a7fb877-a6d9-4cc1-9e66-d966f06bfc72
Ubuntu 22.04.1 LTS (22.04) (on sdb6) 9b243a8a-12c2-45b3-a54b-045682bd44df
Ubuntu (on sdb6) 9b243a8a-12c2-45b3-a54b-045682bd44df
Ubuntu, with Linux 5.15.0-46-generic (on sdb6) 9b243a8a-12c2-45b3-a54b-045682bd44df
Ubuntu, with Linux 5.15.0-43-generic (on sdb6) 9b243a8a-12c2-45b3-a54b-045682bd44df
### END /etc/grub.d/30_os-prober ###
System setup uefi-firmware
### END /etc/grub.d/30_uefi-firmware ###
========================== sdb4/etc/fstab (filtered) ===========================
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sdb4 during installation
UUID=123bcb04-2606-4786-957c-2a41be0b46e4 / ext4 errors=remount-ro 0 1
# /boot/efi was on /dev/sdb1 during installation
UUID=0F63-B9A1 /boot/efi vfat umask=0077 0 1
# /home was on /dev/sda3 during installation
UUID=3b25d7fb-8127-4a05-bfd9-df36c0670584 /home ext4 defaults 0 2
# swap was on /dev/sda2 during installation
UUID=b23f3faa-381e-42f3-bb58-af5616f11378 none swap sw 0 0
======================= sdb4/etc/default/grub (filtered) =======================
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_CMDLINE_LINUX=""
==================== sdb4: Location of files loaded by Grub ====================
GiB - GB File Fragment(s)
119,658462524 = 128,482295808 boot/grub/grub.cfg 4
93,282741547 = 100,161581056 boot/vmlinuz-5.10.0-16-amd64 1
92,860973358 = 99,708710912 boot/vmlinuz-5.10.0-17-amd64 1
94,654506683 = 101,634502656 boot/vmlinuz-5.18.0-0.deb11.3-amd64 1
94,654506683 = 101,634502656 vmlinuz 1
92,860973358 = 99,708710912 vmlinuz.old 1
94,007514954 = 100,939800576 boot/initrd.img-5.10.0-16-amd64 1
94,211681366 = 101,159022592 boot/initrd.img-5.10.0-17-amd64 1
95,666160583 = 102,720757760 boot/initrd.img-5.18.0-0.deb11.3-amd64 2
95,666160583 = 102,720757760 initrd.img 2
94,211681366 = 101,159022592 initrd.img.old 1
===================== sdb4: ls -l /etc/grub.d/ (filtered) ======================
-rwxr-xr-x 1 root root 13664 Jul 11 2021 10_linux
-rwxr-xr-x 1 root root 13726 Jul 11 2021 20_linux_xen
-rwxr-xr-x 1 root root 12059 Jul 11 2021 30_os-prober
-rwxr-xr-x 1 root root 1416 Jul 11 2021 30_uefi-firmware
-rwxr-xr-x 1 root root 214 Jul 11 2021 40_custom
-rwxr-xr-x 1 root root 216 Jul 11 2021 41_custom
====================== sdb5/boot/grub/grub.cfg (filtered) ======================
Debian GNU/Linux 4a7fb877-a6d9-4cc1-9e66-d966f06bfc72
Debian GNU/Linux, with Linux 5.10.0-17-amd64 4a7fb877-a6d9-4cc1-9e66-d966f06bfc72
Debian GNU/Linux, with Linux 5.10.0-16-amd64 4a7fb877-a6d9-4cc1-9e66-d966f06bfc72
Windows Boot Manager (on sda1) osprober-efi-0F63-B9A1
Debian GNU/Linux 11 (bullseye) (on sda4) a2cc5ba2-2d04-40ad-bcba-df4209699285
Debian GNU/Linux (on sda4) a2cc5ba2-2d04-40ad-bcba-df4209699285
Debian GNU/Linux, with Linux 5.10.0-17-amd64 (on sda4) a2cc5ba2-2d04-40ad-bcba-df4209699285
Debian GNU/Linux, with Linux 5.10.0-16-amd64 (on sda4) a2cc5ba2-2d04-40ad-bcba-df4209699285
Ubuntu 22.04.1 LTS (22.04) (on sda6) 9b243a8a-12c2-45b3-a54b-045682bd44df
Ubuntu (on sda6) 9b243a8a-12c2-45b3-a54b-045682bd44df
Ubuntu, with Linux 5.15.0-46-generic (on sda6) 9b243a8a-12c2-45b3-a54b-045682bd44df
Ubuntu, with Linux 5.15.0-43-generic (on sda6) 9b243a8a-12c2-45b3-a54b-045682bd44df
### END /etc/grub.d/30_os-prober ###
System setup uefi-firmware
### END /etc/grub.d/30_uefi-firmware ###
========================== sdb5/etc/fstab (filtered) ===========================
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda5 during installation
UUID=4a7fb877-a6d9-4cc1-9e66-d966f06bfc72 / ext4 errors=remount-ro 0 1
# /boot/efi was on /dev/sda1 during installation
UUID=0F63-B9A1 /boot/efi vfat umask=0077 0 1
# /home was on /dev/sdb4 during installation
UUID=44f2ad7c-cd19-455a-ad47-3fb01095ec1c /home ext4 defaults 0 2
# swap was on /dev/sdb2 during installation
UUID=b23f3faa-381e-42f3-bb58-af5616f11378 none swap sw 0 0
======================= sdb5/etc/default/grub (filtered) =======================
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_CMDLINE_LINUX=""
==================== sdb5: Location of files loaded by Grub ====================
GiB - GB File Fragment(s)
160,719440460 = 172,571185152 boot/grub/grub.cfg 3
135,665554047 = 145,669779456 boot/vmlinuz-5.10.0-16-amd64 1
135,388317108 = 145,372098560 boot/vmlinuz-5.10.0-17-amd64 1
135,388317108 = 145,372098560 vmlinuz 1
135,665554047 = 145,669779456 vmlinuz.old 1
136,169795990 = 146,211205120 boot/initrd.img-5.10.0-16-amd64 1
140,136650085 = 150,470582272 boot/initrd.img-5.10.0-17-amd64 1
140,136650085 = 150,470582272 initrd.img 1
136,169795990 = 146,211205120 initrd.img.old 1
===================== sdb5: ls -l /etc/grub.d/ (filtered) ======================
-rwxr-xr-x 1 root root 13664 Jul 11 2021 10_linux
-rwxr-xr-x 1 root root 13726 Jul 11 2021 20_linux_xen
-rwxr-xr-x 1 root root 12059 Jul 11 2021 30_os-prober
-rwxr-xr-x 1 root root 1416 Jul 11 2021 30_uefi-firmware
-rwxr-xr-x 1 root root 214 Jul 11 2021 40_custom
-rwxr-xr-x 1 root root 216 Jul 11 2021 41_custom
====================== sdb6/boot/grub/grub.cfg (filtered) ======================
debian e558806c-0053-4438-a518-2c4f4fa14056
Ubuntu 9b243a8a-12c2-45b3-a54b-045682bd44df
Windows osprober-efi-0F63-B9A1
Ubuntu, with Linux 5.15.0-46-generic 9b243a8a-12c2-45b3-a54b-045682bd44df
Ubuntu, with Linux 5.15.0-43-generic 9b243a8a-12c2-45b3-a54b-045682bd44df
Debian GNU/Linux 11 (bullseye) (on sdb5) 44c4af9a-63e0-4400-b570-5f76fdab3eb2
Debian GNU/Linux (on sdb5) 44c4af9a-63e0-4400-b570-5f76fdab3eb2
Debian GNU/Linux, with Linux 5.10.0-17-amd64 (on sdb5) 44c4af9a-63e0-4400-b570-5f76fdab3eb2
Debian GNU/Linux, with Linux 5.10.0-16-amd64 (on sdb5) 44c4af9a-63e0-4400-b570-5f76fdab3eb2
Debian GNU/Linux, with Linux 5.10.0-17-amd64 (on sdb4) 6bcdf620-0e26-4136-bbc6-0f465a411b6a
Debian GNU/Linux, with Linux 5.10.0-16-amd64 (on sdb4) 6bcdf620-0e26-4136-bbc6-0f465a411b6a
Debian GNU/Linux (on sdb4) 6bcdf620-0e26-4136-bbc6-0f465a411b6a
UEFI Firmware Settings uefi-firmware
========================== sdb6/etc/fstab (filtered) ===========================
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sdb6 during installation
UUID=9b243a8a-12c2-45b3-a54b-045682bd44df / ext4 errors=remount-ro 0 1
# /boot/efi was on /dev/sdb1 during installation
UUID=0F63-B9A1 /boot/efi vfat umask=0077 0 1
# /home was on /dev/sda5 during installation
UUID=3c238729-6050-4da2-98c8-3202529d8da3 /home ext4 defaults 0 2
# swap was on /dev/sda2 during installation
UUID=b23f3faa-381e-42f3-bb58-af5616f11378 none swap sw 0 0
======================= sdb6/etc/default/grub (filtered) =======================
GRUB_DEFAULT="0"
GRUB_TIMEOUT_STYLE="hidden"
GRUB_TIMEOUT="5"
GRUB_DISTRIBUTOR="`lsb_release -i -s 2> /dev/null || echo Debian`"
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
GRUB_GFXMODE="640x480"
==================== sdb6: Location of files loaded by Grub ====================
GiB - GB File Fragment(s)
195,366237640 = 209,772900352 boot/grub/grub.cfg 1
225,784175873 = 242,433912832 boot/vmlinuz-5.15.0-43-generic 2
205,748043060 = 220,920279040 boot/vmlinuz-5.15.0-46-generic 1
205,748043060 = 220,920279040 boot/vmlinuz.old 1
215,296764374 = 231,173140480 boot/initrd.img-5.15.0-43-generic 2
216,641689301 = 232,617242624 boot/initrd.img-5.15.0-46-generic 1
216,641689301 = 232,617242624 boot/initrd.img.old 1
===================== sdb6: ls -l /etc/grub.d/ (filtered) ======================
-rwxr-xr-x 1 root root 694 Aug 27 08:45 10_linux_proxy
-rwxr-xr-x 1 root root 211 Aug 27 08:45 40_custom_proxy
-rwxr-xr-x 1 root root 694 Aug 27 08:45 41_linux_proxy
-rwxr-xr-x 1 root root 224 Aug 27 08:45 42_custom_proxy
-rwxr-xr-x 1 root root 694 Aug 27 08:45 44_linux_proxy
-rwxr-xr-x 1 root root 43031 Apr 15 23:50 45_linux_zfs
-rwxr-xr-x 1 root root 14180 Apr 15 23:50 46_linux_xen
-rwxr-xr-x 1 root root 2924 Feb 6 2022 47_memtest86+
-rwxr-xr-x 1 root root 2353 Aug 27 08:45 48_os-prober_proxy
-rwxr-xr-x 1 root root 1372 Apr 15 23:50 49_uefi-firmware
-rwxr-xr-x 1 root root 700 Feb 19 2022 50_fwupd
-rwxr-xr-x 1 root root 252 Aug 27 08:45 51_custom_proxy
-rwxr-xr-x 1 root root 215 Apr 15 23:50 52_custom
drwxr-xr-x 4 root root 4096 May 10 05:02 backup
drwxr-xr-x 2 root root 4096 May 10 05:02 bin
drwxr-xr-x 2 root root 4096 Aug 27 08:45 proxifiedScripts
======================= sdb6/etc/grub.d/40_custom_proxy ========================
#!/bin/sh
#THIS IS A GRUB PROXY SCRIPT
'/etc/grub.d/proxifiedScripts/custom' | /etc/grub.d/bin/grubcfg_proxy "-*
-'Windows '~93533e8bfc309a45f7f1139f533493b5~
-#text
+'debian'~34f10f178fca299d48d3f200d4a730ee~
"
======================== sdb6/etc/grub.d/41_linux_proxy ========================
#!/bin/sh
#THIS IS A GRUB PROXY SCRIPT
'/etc/grub.d/proxifiedScripts/linux' | /etc/grub.d/bin/grubcfg_proxy "-*
-#text
-'SUBMENU' as 'Advanced options for Ubuntu'{-'Advanced options for Ubuntu'/*, -'Advanced options for Ubuntu'/'Ubuntu, with Linux 5.15.0-46-generic'~11293db4d73065cb29ee169842bdbb6b~, -'Advanced options for Ubuntu'/'Ubuntu, with Linux 5.15.0-46-generic (recovery mode)'~79d972856635b3b117301b5166a7390f~, -'Advanced options for Ubuntu'/'Ubuntu, with Linux 5.15.0-43-generic'~7887406e931d25c2bfaab4dfa17a7f5f~, -'Advanced options for Ubuntu'/'Ubuntu, with Linux 5.15.0-43-generic (recovery mode)'~1510e97d9664ae6909b34bd3341af1ba~}
+'Ubuntu'~a8f82f2cf2696c47dccdf60b1434e606~
"
======================= sdb6/etc/grub.d/42_custom_proxy ========================
#!/bin/sh
#THIS IS A GRUB PROXY SCRIPT
'/etc/grub.d/proxifiedScripts/custom' | /etc/grub.d/bin/grubcfg_proxy "-*
-#text
-'debian'~34f10f178fca299d48d3f200d4a730ee~ as 'Debian '
+'Windows '~93533e8bfc309a45f7f1139f533493b5~
"
======================== sdb6/etc/grub.d/44_linux_proxy ========================
#!/bin/sh
#THIS IS A GRUB PROXY SCRIPT
'/etc/grub.d/proxifiedScripts/linux' | /etc/grub.d/bin/grubcfg_proxy "-'Ubuntu'~a8f82f2cf2696c47dccdf60b1434e606~
-*
-#text
+'SUBMENU' as 'Advanced options for Ubuntu'{+'Advanced options for Ubuntu'/*, +'Advanced options for Ubuntu'/'Ubuntu, with Linux 5.15.0-46-generic'~11293db4d73065cb29ee169842bdbb6b~, +'Advanced options for Ubuntu'/'Ubuntu, with Linux 5.15.0-46-generic (recovery mode)'~79d972856635b3b117301b5166a7390f~, +'Advanced options for Ubuntu'/'Ubuntu, with Linux 5.15.0-43-generic'~7887406e931d25c2bfaab4dfa17a7f5f~, +'Advanced options for Ubuntu'/'Ubuntu, with Linux 5.15.0-43-generic (recovery mode)'~1510e97d9664ae6909b34bd3341af1ba~}
"
========================= sdb6/etc/grub.d/45_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 <http://www.gnu.org/licenses/>.
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 https://github.com/zfsonlinux/zfs/issues/9958
# 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 https://github.com/zfsonlinux/zfs/issues/9958
# 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}" 2>/dev/null | 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=""
candidate_kernel_list="$(find "${boot_dir}" -maxdepth 1 -type f -regex '.*/\(vmlinuz\|vmlinux\|kernel\)-.*')"
while [ -n "${candidate_kernel_list}" ] ; do
list_basename="$(echo "${candidate_kernel_list}" | sed -e 's#.*/##')"
linux=$(version_find_latest ${list_basename})
linux=$(echo "${candidate_kernel_list}" | while read k; do
if [ "$(basename "${k}")" = "${linux}" ]; then
echo -n "${k}"
break
fi
done)
# || true to not abort even if candidate_kernel_list is empty on last entry
candidate_kernel_list="$(echo "${candidate_kernel_list}" | fgrep -vx "${linux}"||true)"
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 -v FS='\t' '{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
snapshots="$(zfs list -H -o name -t snapshot "${dataset}"|while read snapshot_dataset; do
get_dataset_info "${snapshot_dataset}" ${mntdir}
done)"
[ -n "${snapshots}" ] && boot_list="${boot_list}${snapshots}\n"
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
oldIFS="$IFS"
export IFS='|'
set -- $(get_field_from_entry "${main_entry}" 7)
for kernel in $(get_field_from_entry "${main_entry}" 8); 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
IFS="$oldIFS"
}
# 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
oldIFS="$IFS"
export IFS='|'
set -- $(get_field_from_entry "${entry}" 7)
for k in $(get_field_from_entry "${entry}" 8); 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
IFS="$oldIFS"
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 in echo trims end of line spaces
echo "${submenu_indentation} linux \"${kernel}\" root=ZFS=\"${dataset}\" ro $(echo ${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
========================= sdb6/etc/grub.d/46_linux_xen =========================
#! /bin/sh
set -e
# grub-mkconfig helper script.
# Copyright (C) 2006,2007,2008,2009,2010 Free Software Foundation, Inc.
#
# 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 <http://www.gnu.org/licenses/>.
prefix="/usr"
exec_prefix="/usr"
datarootdir="/usr/share"
. "$pkgdatadir/grub-mkconfig_lib"
export TEXTDOMAIN=grub
export TEXTDOMAINDIR="${datarootdir}/locale"
CLASS="--class gnu-linux --class gnu --class os --class xen"
SUPPORTED_INITS="sysvinit:/lib/sysvinit/init systemd:/lib/systemd/systemd upstart:/sbin/upstart"
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
OS=GNU/Linux
else
OS="${GRUB_DISTRIBUTOR} GNU/Linux"
CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}"
fi
# loop-AES arranges things so that /dev/loop/X can be our root device, but
# the initrds that Linux uses don't like that.
case ${GRUB_DEVICE} in
/dev/loop/*|/dev/loop[0-9])
GRUB_DEVICE=`losetup ${GRUB_DEVICE} | sed -e "s/^[^(]*(\([^)]\+\)).*/\1/"`
# We can't cope with devices loop-mounted from files here.
case ${GRUB_DEVICE} in
/dev/*) ;;
*) exit 0 ;;
esac
;;
esac
# Default to disabling partition uuid support to maintian compatibility with
# older kernels.
GRUB_DISABLE_LINUX_PARTUUID=${GRUB_DISABLE_LINUX_PARTUUID-true}
# btrfs may reside on multiple devices. We cannot pass them as value of root= parameter
# and mounting btrfs requires user space scanning, so force UUID in this case.
if ( [ "x${GRUB_DEVICE_UUID}" = "x" ] && [ "x${GRUB_DEVICE_PARTUUID}" = "x" ] ) \
|| ( [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \
&& [ "x${GRUB_DISABLE_LINUX_PARTUUID}" = "xtrue" ] ) \
|| ( ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \
&& ! test -e "/dev/disk/by-partuuid/${GRUB_DEVICE_PARTUUID}" ) \
|| ( test -e "${GRUB_DEVICE}" && uses_abstraction "${GRUB_DEVICE}" lvm ); then
LINUX_ROOT_DEVICE=${GRUB_DEVICE}
elif [ "x${GRUB_DEVICE_UUID}" = "x" ] \
|| [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ]; then
LINUX_ROOT_DEVICE=PARTUUID=${GRUB_DEVICE_PARTUUID}
else
LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
fi
# Allow overriding GRUB_CMDLINE_LINUX and GRUB_CMDLINE_LINUX_DEFAULT.
if [ "${GRUB_CMDLINE_LINUX_XEN_REPLACE}" ]; then
GRUB_CMDLINE_LINUX="${GRUB_CMDLINE_LINUX_XEN_REPLACE}"
fi
if [ "${GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT}" ]; then
GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT}"
fi
case x"$GRUB_FS" in
xbtrfs)
rootsubvol="`make_system_path_relative_to_its_root /`"
rootsubvol="${rootsubvol#/}"
if [ "x${rootsubvol}" != x ]; then
GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"
fi;;
xzfs)
rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true`
bootfs="`make_system_path_relative_to_its_root / | sed -e "s,@$,,"`"
LINUX_ROOT_DEVICE="ZFS=${rpool}${bootfs%/}"
;;
esac
title_correction_code=
linux_entry ()
{
linux_entry_xsm "$@" false
linux_entry_xsm "$@" true
}
linux_entry_xsm ()
{
os="$1"
version="$2"
xen_version="$3"
type="$4"
args="$5"
xen_args="$6"
xsm="$7"
# If user wants to enable XSM support, make sure there's
# corresponding policy file.
if ${xsm} ; then
xenpolicy="xenpolicy-$xen_version"
if test ! -e "${xen_dirname}/${xenpolicy}" ; then
return
fi
xen_args="$xen_args flask=enforcing"
xen_version="$(gettext_printf "%s (XSM enabled)" "$xen_version")"
# xen_version is used for messages only; actual file is xen_basename
fi
if [ -z "$boot_device_id" ]; then
boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
fi
if [ x$type != xsimple ] ; then
if [ x$type = xrecovery ] ; then
title="$(gettext_printf "%s, with Xen %s and Linux %s (%s)" "${os}" "${xen_version}" "${version}" "$(gettext "${GRUB_RECOVERY_TITLE}")")"
elif [ "${type#init-}" != "$type" ] ; then
title="$(gettext_printf "%s, with Xen %s and Linux %s (%s)" "${os}" "${xen_version}" "${version}" "${type#init-}")"
else
title="$(gettext_printf "%s, with Xen %s and Linux %s" "${os}" "${xen_version}" "${version}")"
fi
replacement_title="$(echo "Advanced options for ${OS}" | sed 's,>,>>,g')>$(echo "$title" | sed 's,>,>>,g')"
if [ x"Xen ${xen_version}>$title" = x"$GRUB_ACTUAL_DEFAULT" ]; then
quoted="$(echo "$GRUB_ACTUAL_DEFAULT" | grub_quote)"
title_correction_code="${title_correction_code}if [ \"x\$default\" = '$quoted' ]; then default='$(echo "$replacement_title" | grub_quote)'; fi;"
grub_warn "$(gettext_printf "Please don't use old title \`%s' for GRUB_DEFAULT, use \`%s' (for versions before 2.00) or \`%s' (for 2.00 or later)" "$GRUB_ACTUAL_DEFAULT" "$replacement_title" "gnulinux-advanced-$boot_device_id>gnulinux-$version-$type-$boot_device_id")"
fi
echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'xen-gnulinux-$version-$type-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
else
title="$(gettext_printf "%s, with Xen hypervisor" "${os}")"
echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'xen-gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
fi
if [ x$type != xrecovery ] ; then
save_default_entry | grub_add_tab | sed "s/^/$submenu_indentation/"
fi
if [ -z "${prepare_boot_cache}" ]; then
prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | grub_add_tab)"
fi
printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
xmessage="$(gettext_printf "Loading Xen %s ..." ${xen_version})"
lmessage="$(gettext_printf "Loading Linux %s ..." ${version})"
sed "s/^/$submenu_indentation/" << EOF
echo '$(echo "$xmessage" | grub_quote)'
if [ "\$grub_platform" = "pc" -o "\$grub_platform" = "" ]; then
xen_rm_opts=
else
xen_rm_opts="no-real-mode edd=off"
fi
${xen_loader} ${rel_xen_dirname}/${xen_basename} placeholder ${xen_args} \${xen_rm_opts}
echo '$(echo "$lmessage" | grub_quote)'
${module_loader} ${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args}
EOF
if test -n "${initrd}" ; then
# TRANSLATORS: ramdisk isn't identifier. Should be translated.
message="$(gettext_printf "Loading initial ramdisk ...")"
initrd_path=
for i in ${initrd}; do
initrd_path="${initrd_path} ${rel_dirname}/${i}"
done
sed "s/^/$submenu_indentation/" << EOF
echo '$(echo "$message" | grub_quote)'
${module_loader} --nounzip $(echo $initrd_path)
EOF
fi
if ${xsm} && test -n "${xenpolicy}" ; then
message="$(gettext_printf "Loading XSM policy ...")"
sed "s/^/$submenu_indentation/" << EOF
echo '$(echo "$message" | grub_quote)'
${module_loader} ${rel_dirname}/${xenpolicy}
EOF
fi
sed "s/^/$submenu_indentation/" << EOF
}
EOF
}
linux_list=
for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* /boot/kernel-*; do
if grub_file_is_not_garbage "$i"; then
basename=$(basename $i)
version=$(echo $basename | sed -e "s,^[^0-9]*-,,g")
dirname=$(dirname $i)
config=
for j in "${dirname}/config-${version}" "${dirname}/config-${alt_version}" "/etc/kernels/kernel-config-${version}" ; do
if test -e "${j}" ; then
config="${j}"
break
fi
done
if (grep -qx "CONFIG_XEN_DOM0=y" "${config}" 2> /dev/null || grep -qx "CONFIG_XEN_PRIVILEGED_GUEST=y" "${config}" 2> /dev/null); then linux_list="$linux_list $i" ; fi
fi
done
if [ "x${linux_list}" = "x" ] ; then
exit 0
fi
file_is_not_xen_garbage () {
case "$1" in
*/xen-syms-*)
return 1;;
*/xenpolicy-*)
return 1;;
*/*.config)
return 1;;
*)
return 0;;
esac
}
xen_list=
for i in /boot/xen*; do
if grub_file_is_not_garbage "$i" && file_is_not_xen_garbage "$i" ; then xen_list="$xen_list $i" ; fi
done
prepare_boot_cache=
boot_device_id=
title_correction_code=
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
# Extra indentation to add to menu entries in a submenu. We're not in a submenu
# yet, so it's empty. In a submenu it will be equal to '\t' (one tab).
submenu_indentation=""
is_top_level=true
while [ "x${xen_list}" != "x" ] ; do
list="${linux_list}"
current_xen=`version_find_latest $xen_list`
xen_basename=`basename ${current_xen}`
xen_dirname=`dirname ${current_xen}`
rel_xen_dirname=`make_system_path_relative_to_its_root $xen_dirname`
xen_version=`echo $xen_basename | sed -e "s,.gz$,,g;s,^xen-,,g"`
if [ -z "$boot_device_id" ]; then
boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
fi
if [ "x$is_top_level" != xtrue ]; then
echo " submenu '$(gettext_printf "Xen hypervisor, version %s" "${xen_version}" | grub_quote)' \$menuentry_id_option 'xen-hypervisor-$xen_version-$boot_device_id' {"
fi
if ($grub_file --is-arm64-efi $current_xen); then
xen_loader="xen_hypervisor"
module_loader="xen_module"
else
if ($grub_file --is-x86-multiboot2 $current_xen); then
xen_loader="multiboot2"
module_loader="module2"
else
xen_loader="multiboot"
module_loader="module"
fi
fi
initrd_early=
for i in ${GRUB_EARLY_INITRD_LINUX_STOCK} \
${GRUB_EARLY_INITRD_LINUX_CUSTOM}; do
if test -e "${xen_dirname}/${i}" ; then
initrd_early="${initrd_early} ${i}"
fi
done
while [ "x$list" != "x" ] ; do
linux=`version_find_latest $list`
gettext_printf "Found linux image: %s\n" "$linux" >&2
basename=`basename $linux`
dirname=`dirname $linux`
rel_dirname=`make_system_path_relative_to_its_root $dirname`
version=`echo $basename | sed -e "s,^[^0-9]*-,,g"`
alt_version=`echo $version | sed -e "s,\.old$,,g"`
linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
initrd_real=
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 "${dirname}/${i}" ; then
initrd_real="$i"
break
fi
done
initrd=
if test -n "${initrd_early}" || test -n "${initrd_real}"; then
initrd="${initrd_early} ${initrd_real}"
initrd_display=
for i in ${initrd}; do
initrd_display="${initrd_display} ${dirname}/${i}"
done
gettext_printf "Found initrd image: %s\n" "$(echo $initrd_display)" >&2
fi
if test -z "${initrd_real}"; then
# "UUID=" magic is parsed by initrds. Since there's no initrd, it can't work here.
if [ "x${GRUB_DEVICE_PARTUUID}" = "x" ] \
|| [ "x${GRUB_DISABLE_LINUX_PARTUUID}" = "xtrue" ]; then
linux_root_device_thisversion=${GRUB_DEVICE}
else
linux_root_device_thisversion=PARTUUID=${GRUB_DEVICE_PARTUUID}
fi
fi
# The GRUB_DISABLE_SUBMENU option used to be different than others since it was
# mentioned in the documentation that has to be set to 'y' instead of 'true' to
# enable it. This caused a lot of confusion to users that set the option to 'y',
# 'yes' or 'true'. This was fixed but all of these values must be supported now.
if [ "x${GRUB_DISABLE_SUBMENU}" = xyes ] || [ "x${GRUB_DISABLE_SUBMENU}" = xy ]; then
GRUB_DISABLE_SUBMENU="true"
fi
if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xtrue ]; then
linux_entry "${OS}" "${version}" "${xen_version}" simple \
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" "${GRUB_CMDLINE_XEN} ${GRUB_CMDLINE_XEN_DEFAULT}"
submenu_indentation="$grub_tab$grub_tab"
if [ -z "$boot_device_id" ]; then
boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
fi
# TRANSLATORS: %s is replaced with an OS name
echo "submenu '$(gettext_printf "Advanced options for %s (with Xen hypervisor)" "${OS}" | grub_quote)' \$menuentry_id_option 'gnulinux-advanced-$boot_device_id' {"
echo " submenu '$(gettext_printf "Xen hypervisor, version %s" "${xen_version}" | grub_quote)' \$menuentry_id_option 'xen-hypervisor-$xen_version-$boot_device_id' {"
is_top_level=false
fi
linux_entry "${OS}" "${version}" "${xen_version}" advanced \
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" "${GRUB_CMDLINE_XEN} ${GRUB_CMDLINE_XEN_DEFAULT}"
for supported_init in ${SUPPORTED_INITS}; do
init_path="${supported_init#*:}"
if [ -x "${init_path}" ] && [ "$(readlink -f /sbin/init)" != "$(readlink -f "${init_path}")" ]; then
linux_entry "${OS}" "${version}" "${xen_version}" "init-${supported_init%%:*}" \
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT} init=${init_path}" "${GRUB_CMDLINE_XEN} ${GRUB_CMDLINE_XEN_DEFAULT}"
fi
done
if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
linux_entry "${OS}" "${version}" "${xen_version}" recovery \
"single ${GRUB_CMDLINE_LINUX}" "${GRUB_CMDLINE_XEN}"
fi
list=`echo $list | tr ' ' '\n' | fgrep -vx "$linux" | tr '\n' ' '`
done
if [ x"$is_top_level" != xtrue ]; then
echo ' }'
fi
xen_list=`echo $xen_list | tr ' ' '\n' | fgrep -vx "$current_xen" | tr '\n' ' '`
done
# If at least one kernel was found, then we need to
# add a closing '}' for the submenu command.
if [ x"$is_top_level" != xtrue ]; then
echo '}'
fi
echo "$title_correction_code"
====================== sdb6/etc/grub.d/48_os-prober_proxy ======================
#!/bin/sh
#THIS IS A GRUB PROXY SCRIPT
'/etc/grub.d/proxifiedScripts/os-prober' | /etc/grub.d/bin/grubcfg_proxy "-'Debian GNU/Linux 11 (bullseye) (on /dev/sdb4)'~c684fa3fc2027366d3d39d5cb1240adb~
-'Windows Boot Manager (on /dev/sdb1)'~93533e8bfc309a45f7f1139f533493b5~
+*
+'Debian GNU/Linux 11 (bullseye) (on /dev/sdb5)'~9295f57b7909803302b5a552672b2409~
+'SUBMENU' as 'Advanced options for Debian GNU/Linux 11 (bullseye) (on /dev/sdb5)'{+'Advanced options for Debian GNU/Linux 11 (bullseye) (on /dev/sdb5)'/*, +'Advanced options for Debian GNU/Linux 11 (bullseye) (on /dev/sdb5)'/'Debian GNU/Linux (on /dev/sdb5)'~2301f9998ff87aa9cfb5a8ee3a695614~, +'Advanced options for Debian GNU/Linux 11 (bullseye) (on /dev/sdb5)'/'Debian GNU/Linux, with Linux 5.10.0-17-amd64 (on /dev/sdb5)'~2301f9998ff87aa9cfb5a8ee3a695614~, +'Advanced options for Debian GNU/Linux 11 (bullseye) (on /dev/sdb5)'/'Debian GNU/Linux, with Linux 5.10.0-17-amd64 (recovery mode) (on /dev/sdb5)'~f5570cf92125d992ed07bf7798971550~, +'Advanced options for Debian GNU/Linux 11 (bullseye) (on /dev/sdb5)'/'Debian GNU/Linux, with Linux 5.10.0-16-amd64 (on /dev/sdb5)'~926c22c5c4f7fcd3fa5347638972d9f7~, +'Advanced options for Debian GNU/Linux 11 (bullseye) (on /dev/sdb5)'/'Debian GNU/Linux, with Linux 5.10.0-16-amd64 (recovery mode) (on /dev/sdb5)'~b2191f5110f80507fcdb0b38e1d0b8a0~}
+#text
+'SUBMENU' as 'Advanced options for Debian GNU/Linux 11 (bullseye) (on /dev/sdb4)'{+'Advanced options for Debian GNU/Linux 11 (bullseye) (on /dev/sdb4)'/*, +'Advanced options for Debian GNU/Linux 11 (bullseye) (on /dev/sdb4)'/'Debian GNU/Linux, with Linux 5.10.0-17-amd64 (on /dev/sdb4)'~6635c4564b73a0c12037825e1f1dd798~, +'Advanced options for Debian GNU/Linux 11 (bullseye) (on /dev/sdb4)'/'Debian GNU/Linux, with Linux 5.10.0-17-amd64 (recovery mode) (on /dev/sdb4)'~476a5a1dfba29f0b12b8c2cb2ca5381a~, +'Advanced options for Debian GNU/Linux 11 (bullseye) (on /dev/sdb4)'/'Debian GNU/Linux, with Linux 5.10.0-16-amd64 (on /dev/sdb4)'~27ff5e5b67e6770a40aee152d85d9ca4~, +'Advanced options for Debian GNU/Linux 11 (bullseye) (on /dev/sdb4)'/'Debian GNU/Linux, with Linux 5.10.0-16-amd64 (recovery mode) (on /dev/sdb4)'~09d3c55163e6ebd474dfd8b35a55bd68~, +'Advanced options for Debian GNU/Linux 11 (bullseye) (on /dev/sdb4)'/'Debian GNU/Linux (on /dev/sdb4)'~6635c4564b73a0c12037825e1f1dd798~}
"
======================= sdb6/etc/grub.d/49_uefi-firmware =======================
#! /bin/sh
set -e
# grub-mkconfig helper script.
# Copyright (C) 2020 Free Software Foundation, Inc.
#
# 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 <http://www.gnu.org/licenses/>.
prefix="/usr"
exec_prefix="/usr"
datarootdir="/usr/share"
export TEXTDOMAIN=grub
export TEXTDOMAINDIR="${datarootdir}/locale"
. "$pkgdatadir/grub-mkconfig_lib"
EFI_VARS_DIR=/sys/firmware/efi/efivars
EFI_GLOBAL_VARIABLE=8be4df61-93ca-11d2-aa0d-00e098032b8c
OS_INDICATIONS="$EFI_VARS_DIR/OsIndicationsSupported-$EFI_GLOBAL_VARIABLE"
if [ -e "$OS_INDICATIONS" ] && \
[ "$(( $(printf 0x%x \'"$(cat $OS_INDICATIONS | cut -b5)"\') & 1 ))" = 1 ]; then
LABEL="UEFI Firmware Settings"
gettext_printf "Adding boot menu entry for UEFI Firmware Settings ...\n" >&2
cat << EOF
menuentry '$LABEL' \$menuentry_id_option 'uefi-firmware' {
fwsetup
}
EOF
fi
=========================== sdb6/etc/grub.d/50_fwupd ===========================
#! /bin/sh
# SPDX-License-Identifier: LGPL-2.1+
set -e
[ -d ${pkgdatadir:?} ]
# shellcheck source=/dev/null
. "$pkgdatadir/grub-mkconfig_lib"
if [ -f /var/lib/fwupd/uefi_capsule.conf ] &&
ls /sys/firmware/efi/efivars/fwupd-*-0abba7dc-e516-4167-bbf5-4d9d1c739416 1>/dev/null 2>&1; then
. /var/lib/fwupd/uefi_capsule.conf
if [ "${EFI_PATH}" != "" ] && [ "${ESP}" != "" ]; then
echo "Adding Linux Firmware Updater entry" >&2
cat << EOF
menuentry 'Linux Firmware Updater' \$menuentry_id_option 'fwupd' {
EOF
${grub_probe:?}
prepare_grub_to_access_device '`${grub_probe} --target=device \${ESP}` | sed -e "s/^/\t/"'
cat << EOF
chainloader ${EFI_PATH}
}
EOF
fi
fi
======================= sdb6/etc/grub.d/51_custom_proxy ========================
#!/bin/sh
#THIS IS A GRUB PROXY SCRIPT
'/etc/grub.d/proxifiedScripts/custom' | /etc/grub.d/bin/grubcfg_proxy "+*
-'Windows '~93533e8bfc309a45f7f1139f533493b5~
+#text
-'debian'~34f10f178fca299d48d3f200d4a730ee~ as 'Windows Boot Manager (on /dev/sdb1)'
"
Suggested repair: ______________________________________________________________
The default repair of the Boot-Repair utility would reinstall the grub-efi of
sdb4,
using the following options: sdb1/boot/efi
Additional repair would be performed: unhide-bootmenu-10s use-standard-efi-file
Blockers in case of suggested repair: __________________________________________
Please use this software in a live-session (live-CD or live-USB). This will enable this feature.
Final advice in case of suggested repair: ______________________________________
Please do not forget to make your UEFI firmware boot on the Debian GNU/Linux 11 (bullseye) entry (sdb1/efi/****/grub****.efi (**** will be updated in the final message) file) !
If your computer reboots directly into Windows, try to change the boot order in your UEFI firmware.
If your UEFI firmware does not allow to change the boot order, change the default boot entry of the Windows bootloader.
For example you can boot into Windows, then type the following command in an admin command prompt:
bcdedit /set {bootmgr} path \EFI\****\grub****.efi (**** will be updated in the final message)
Dernière modification par bricomega (Le 27/08/2022, à 17:42)
Hors ligne
#7 Le 27/08/2022, à 17:42
- xubu1957
Re : swap qui ne se monte pas
Le lien /p/vX33tFkQmV/
Collage du Boot-info (1924 lignes) :
boot-info-4ppa200 [20220827_1828]
============================== Boot Info Summary ===============================
=> No boot loader is installed in the MBR of /dev/sda.
=> Windows 7/8/10/11/2012 is installed in the MBR of /dev/sdb.
sda1: __________________________________________________________________________
File system: ntfs
Boot sector type: Windows 8/10/11/2012: NTFS
Boot sector info: No errors found in the Boot Parameter Block.
Operating System:
Boot files:
sda2: __________________________________________________________________________
File system: swap
Boot sector type: -
Boot sector info:
sda3: __________________________________________________________________________
File system: ext4
Boot sector type: -
Boot sector info:
Operating System:
Boot files:
sda4: __________________________________________________________________________
File system: ext4
Boot sector type: -
Boot sector info:
Operating System:
Boot files:
sda5: __________________________________________________________________________
File system: ext4
Boot sector type: -
Boot sector info:
Operating System:
Boot files:
sdb1: __________________________________________________________________________
File system: vfat
Boot sector type: FAT32
Boot sector info: No errors found in the Boot Parameter Block.
Operating System:
Boot files: /efi/Boot/bootx64.efi /efi/Boot/fbx64.efi
/efi/Boot/mmx64.efi /efi/debian/fbx64.efi
/efi/debian/grubx64.efi /efi/debian/mmx64.efi
/efi/debian/shimx64.efi /efi/ubuntu/grubx64.efi
/efi/ubuntu/mmx64.efi /efi/ubuntu/shimx64.efi
/efi/debian/grub.cfg /efi/ubuntu/grub.cfg
/efi/Microsoft/Boot/bootmgfw.efi
/efi/Microsoft/Boot/bootmgr.efi
sdb2: __________________________________________________________________________
File system:
Boot sector type: -
Boot sector info:
sdb3: __________________________________________________________________________
File system: ntfs
Boot sector type: Windows 8/10/11/2012: NTFS
Boot sector info: No errors found in the Boot Parameter Block.
Operating System: Windows 10 or 11
Boot files: /Windows/System32/winload.exe
sdb4: __________________________________________________________________________
File system: ext4
Boot sector type: -
Boot sector info:
Operating System: Debian GNU/Linux 11 (bullseye)
Boot files: /boot/grub/grub.cfg /etc/fstab /etc/default/grub
sdb5: __________________________________________________________________________
File system: ext4
Boot sector type: -
Boot sector info:
Operating System: Debian GNU/Linux 11 (bullseye)
Boot files: /boot/grub/grub.cfg /etc/fstab /etc/default/grub
sdb6: __________________________________________________________________________
File system: ext4
Boot sector type: -
Boot sector info:
Operating System: Ubuntu 22.04.1 LTS
Boot files: /boot/grub/grub.cfg /etc/fstab /etc/default/grub
sdb7: __________________________________________________________________________
File system: ntfs
Boot sector type: Windows 8/10/11/2012: NTFS
Boot sector info: No errors found in the Boot Parameter Block.
Operating System:
Boot files:
================================ 4 OS detected =================================
OS#1: L'OS actuellement utilisé - Ubuntu 22.04.1 LTS CurrentSession on sdb6
OS#2: Debian GNU/Linux 11 (bullseye) on sdb4
OS#3: Debian GNU/Linux 11 (bullseye) on sdb5
OS#4: Windows 10 or 11 on sdb3
================================ Host/Hardware =================================
CPU architecture: 64-bit
Video: UHD Graphics 620 from Intel Corporation
BOOT_IMAGE of the installed session in use:
/boot/vmlinuz-5.15.0-46-generic root=UUID=9b243a8a-12c2-45b3-a54b-045682bd44df ro quiet splash
df -Th / : /dev/sdb6 ext4 58G 12G 43G 22% /
===================================== UEFI =====================================
BIOS/UEFI firmware: X705UAR.318(5.12) from American Megatrends Inc.
The firmware is EFI-compatible, and is set in EFI-mode for this installed-session.
SecureBoot disabled - SecureBoot disabled - Veuillez indiquer ce message à boot.repair@gmail.com.
BootCurrent: 0000
Timeout: 2 seconds
BootOrder: 0000,0001,0002,0003
Boot0000* debian HD(1,GPT,b80d135c-1870-4035-a2e2-7ad1fa763355,0x800,0x82000)/File(\EFI\DEBIAN\SHIMX64.EFI)
Boot0001* ubuntu HD(1,GPT,b80d135c-1870-4035-a2e2-7ad1fa763355,0x800,0x82000)/File(\EFI\UBUNTU\SHIMX64.EFI)
Boot0002* Windows EFI Boot Manager HD(1,GPT,b80d135c-1870-4035-a2e2-7ad1fa763355,0x800,0x82000)/File(\EFI\MICROSOFT\BOOT\BOOTMGFW.EFI)WINDOWS.........x...B.C.D.O.B.J.E.C.T.=.{.9.d.e.a.8.6.2.c.-.5.c.d.d.-.4.e.7.0.-.a.c.c.1.-.f.3.2.b.3.4.4.d.4.7.9.5.}....................
Boot0003* debian HD(1,GPT,b80d135c-1870-4035-a2e2-7ad1fa763355,0x800,0x82000)/File(\EFI\DEBIAN\GRUBX64.EFI)..BO
============================= Drive/Partition Info =============================
Disks info: ____________________________________________________________________
sdb : is-GPT, no-BIOSboot, has---ESP, not-usb, not-mmc, has-os, has-win, 2048 sectors * 512 bytes
sda : is-GPT, no-BIOSboot, has-noESP, not-usb, not-mmc, no-os, no-wind, 2048 sectors * 512 bytes
Partitions info (1/3): _________________________________________________________
sdb4 : is-os, 64, apt-get, signed grub-efi , grub2, grub-install, grubenv-ok, update-grub, farbios
sdb7 : no-os, 32, nopakmgr, no-docgrub, nogrub, nogrubinstall, no-grubenv, noupdategrub, farbios
sdb5 : is-os, 64, apt-get, signed grub-efi , grub2, grub-install, grubenv-ok, update-grub, farbios
sdb3 : is-os, 32, nopakmgr, no-docgrub, nogrub, nogrubinstall, no-grubenv, noupdategrub, not-far
sdb1 : no-os, 32, nopakmgr, no-docgrub, nogrub, nogrubinstall, no-grubenv, noupdategrub, not-far
sdb6 : is-os, 64, apt-get, signed grub-pc grub-efi , grub2, grub-install, grubenv-ok, update-grub, farbios
sda4 : no-os, 32, nopakmgr, no-docgrub, nogrub, nogrubinstall, no-grubenv, noupdategrub, farbios
sda5 : no-os, 32, nopakmgr, no-docgrub, nogrub, nogrubinstall, no-grubenv, noupdategrub, farbios
sda3 : no-os, 32, nopakmgr, no-docgrub, nogrub, nogrubinstall, no-grubenv, noupdategrub, farbios
sda1 : no-os, 32, nopakmgr, no-docgrub, nogrub, nogrubinstall, no-grubenv, noupdategrub, farbios
Partitions info (2/3): _________________________________________________________
sdb4 : isnotESP, fstab-has-goodEFI, no-nt, no-winload, no-recov-nor-hid, no-bmgr, notwinboot
sdb7 : isnotESP, part-has-no-fstab, no-nt, no-winload, recovery-or-hidden, no-bmgr, notwinboot
sdb5 : isnotESP, fstab-has-goodEFI, no-nt, no-winload, no-recov-nor-hid, no-bmgr, notwinboot
sdb3 : isnotESP, part-has-no-fstab, no-nt, haswinload, no-recov-nor-hid, no-bmgr, notwinboot
sdb1 : is---ESP, part-has-no-fstab, no-nt, no-winload, no-recov-nor-hid, no-bmgr, notwinboot
sdb6 : isnotESP, fstab-has-goodEFI, no-nt, no-winload, no-recov-nor-hid, no-bmgr, notwinboot
sda4 : isnotESP, part-has-no-fstab, no-nt, no-winload, no-recov-nor-hid, no-bmgr, notwinboot
sda5 : isnotESP, part-has-no-fstab, no-nt, no-winload, no-recov-nor-hid, no-bmgr, notwinboot
sda3 : isnotESP, part-has-no-fstab, no-nt, no-winload, no-recov-nor-hid, no-bmgr, notwinboot
sda1 : isnotESP, part-has-no-fstab, no-nt, no-winload, no-recov-nor-hid, no-bmgr, notwinboot
Partitions info (3/3): _________________________________________________________
sdb4 : not--sepboot, with-boot, fstab-without-boot, not-sep-usr, with--usr, fstab-without-usr, std-grub.d, sdb
sdb7 : not--sepboot, no---boot, part-has-no-fstab, not-sep-usr, no---usr, part-has-no-fstab, no--grub.d, sdb
sdb5 : not--sepboot, with-boot, fstab-without-boot, not-sep-usr, with--usr, fstab-without-usr, std-grub.d, sdb
sdb3 : not--sepboot, no---boot, part-has-no-fstab, not-sep-usr, no---usr, part-has-no-fstab, no--grub.d, sdb
sdb1 : not--sepboot, no---boot, part-has-no-fstab, not-sep-usr, no---usr, part-has-no-fstab, no--grub.d, sdb
sdb6 : not--sepboot, with-boot, fstab-without-boot, not-sep-usr, with--usr, fstab-without-usr, customized, sdb
sda4 : maybesepboot, no---boot, part-has-no-fstab, not-sep-usr, no---usr, part-has-no-fstab, no--grub.d, sda
sda5 : maybesepboot, no---boot, part-has-no-fstab, not-sep-usr, no---usr, part-has-no-fstab, no--grub.d, sda
sda3 : maybesepboot, no---boot, part-has-no-fstab, not-sep-usr, no---usr, part-has-no-fstab, no--grub.d, sda
sda1 : not--sepboot, no---boot, part-has-no-fstab, not-sep-usr, no---usr, part-has-no-fstab, no--grub.d, sda
fdisk -l (filtered): ___________________________________________________________
Disk sda: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk identifier: 3C18BB3C-4281-48A6-9CFD-421A2D51B6BB
Start End Sectors Size Type
sda1 2048 528607231 528605184 252.1G Microsoft basic data
sda2 528607232 560064511 31457280 15G Microsoft basic data
sda3 560064512 969664511 409600000 195.3G Linux filesystem
sda4 969664512 1379264511 409600000 195.3G Linux filesystem
sda5 1379264512 1953524277 574259766 273.8G Linux filesystem
Disk sdb: 238.47 GiB, 256060514304 bytes, 500118192 sectors
Disk identifier: 1E5749F3-7926-48BA-86F1-843422A724FC
Start End Sectors Size Type
sdb1 2048 534527 532480 260M EFI System
sdb2 534528 567295 32768 16M Microsoft reserved
sdb3 567296 187488255 186920960 89.1G Microsoft basic data
sdb4 187488256 281860095 94371840 45G Microsoft basic data
sdb5 281860096 376231935 94371840 45G Microsoft basic data
sdb6 376231936 498786303 122554368 58.4G Microsoft basic data
sdb7 498786304 500117503 1331200 650M Windows recovery environment
parted -lm (filtered): _________________________________________________________
sda:1000GB:scsi:512:4096:gpt:ATA ST1000LM035-1RK1:;
1:1049kB:271GB:271GB:ntfs:windows data:msftdata;
2:271GB:287GB:16.1GB:linux-swap(v1):swap:msftdata;
3:287GB:496GB:210GB:ext4:home debian:;
4:496GB:706GB:210GB:ext4:home kde:;
5:706GB:1000GB:294GB:ext4:home ubuntu:;
sdb:256GB:scsi:512:512:gpt:ATA SanDisk SD9SN8W2:;
1:1049kB:274MB:273MB:fat32:EFI system partition:boot, esp;
2:274MB:290MB:16.8MB::Microsoft reserved partition:msftres;
3:290MB:96.0GB:95.7GB:ntfs:windows:msftdata;
4:96.0GB:144GB:48.3GB:ext4:systeme debian:msftdata;
5:144GB:193GB:48.3GB:ext4:systeme kde:msftdata;
6:193GB:255GB:62.7GB:ext4:systeme ubuntu:msftdata;
7:255GB:256GB:682MB:ntfs:win recovery:hidden, diag;
blkid (filtered): ______________________________________________________________
NAME FSTYPE UUID PARTUUID LABEL PARTLABEL
sda
├─sda1 ntfs 8270E76470E75D83 43617761-5eb4-4e3b-bb57-1d63afa02415 DATA windows data
├─sda2 swap b23f3faa-381e-42f3-bb58-af5616f11378 00168dff-9710-e79a-e4ec-d91ffe1b2d00 swap
├─sda3 ext4 3b25d7fb-8127-4a05-bfd9-df36c0670584 a6adcb5b-b4e1-4647-828c-6c2b99a3313b home debian home debian
├─sda4 ext4 44f2ad7c-cd19-455a-ad47-3fb01095ec1c 2838d686-448a-44c4-8eae-10c53a3eb4c2 home kde home kde
└─sda5 ext4 3c238729-6050-4da2-98c8-3202529d8da3 112ef786-f46e-42fd-b63b-8afe0feb33f9 home ubuntu home ubuntu
sdb
├─sdb1 vfat 0F63-B9A1 b80d135c-1870-4035-a2e2-7ad1fa763355 EFI system partition
├─sdb2 d5d317a1-e597-4961-8794-ab586e20d14f Microsoft reserved partition
├─sdb3 ntfs 01D5D1AFCF6AC2A0 1cba5c0e-d2eb-45c3-b3a6-27d43725f972 windows windows
├─sdb4 ext4 123bcb04-2606-4786-957c-2a41be0b46e4 4f2ddaa0-44e2-01d8-5081-86277122ec00 sys deb systeme debian
├─sdb5 ext4 4a7fb877-a6d9-4cc1-9e66-d966f06bfc72 57ddde80-44e2-01d8-408b-ce2b7122ec00 systeme kde systeme kde
├─sdb6 ext4 9b243a8a-12c2-45b3-a54b-045682bd44df 0005fd0d-a9f0-607c-e2dc-fc171afa0b00 systeme ubuntu systeme ubuntu
└─sdb7 ntfs F60A0E4E0A0E0BF5 db2882d1-6a32-4cfd-acd9-410402c4ed5c win recovery win recovery
Mount points (filtered): _______________________________________________________
Avail Use% Mounted on
/dev/sda1 229.8G 9% /mnt/boot-sav/sda1
/dev/sda3 181.4G 0% /mnt/boot-sav/sda3
/dev/sda4 181.4G 0% /mnt/boot-sav/sda4
/dev/sda5 254.7G 0% /home
/dev/sdb3 39.7G 55% /mnt/boot-sav/sdb3
/dev/sdb4 32.2G 22% /mnt/boot-sav/sdb4
/dev/sdb5 37.3G 10% /mnt/boot-sav/sdb5
/dev/sdb6 42.3G 21% /
/dev/sdb7 175.8M 73% /mnt/boot-sav/sdb7
Mount options (filtered): ______________________________________________________
/dev/sda1 fuseblk ro,relatime,user_id=0,group_id=0,allow_other,blksize=4096
/dev/sda3 ext4 rw,relatime
/dev/sda4 ext4 rw,relatime
/dev/sda5 ext4 rw,relatime
/dev/sdb3 fuseblk ro,relatime,user_id=0,group_id=0,allow_other,blksize=4096
/dev/sdb4 ext4 rw,relatime
/dev/sdb5 ext4 rw,relatime
/dev/sdb6 ext4 rw,relatime,errors=remount-ro
/dev/sdb7 fuseblk ro,relatime,user_id=0,group_id=0,allow_other,blksize=4096
===================== sdb1/efi/debian/grub.cfg (filtered) ======================
search.fs_uuid 123bcb04-2606-4786-957c-2a41be0b46e4 root hd1,gpt4
set prefix=($root)'/boot/grub'
configfile $prefix/grub.cfg
===================== sdb1/efi/ubuntu/grub.cfg (filtered) ======================
search.fs_uuid 9b243a8a-12c2-45b3-a54b-045682bd44df root hd1,gpt6
set prefix=($root)'/boot/grub'
configfile $prefix/grub.cfg
====================== sdb4/boot/grub/grub.cfg (filtered) ======================
Debian GNU/Linux 123bcb04-2606-4786-957c-2a41be0b46e4
Debian GNU/Linux, with Linux 5.18.0-0.deb11.3-amd64 123bcb04-2606-4786-957c-2a41be0b46e4
Debian GNU/Linux, with Linux 5.10.0-17-amd64 123bcb04-2606-4786-957c-2a41be0b46e4
Debian GNU/Linux, with Linux 5.10.0-16-amd64 123bcb04-2606-4786-957c-2a41be0b46e4
Windows Boot Manager (on sdb1) osprober-efi-0F63-B9A1
Debian GNU/Linux 11 (bullseye) (on sdb5) 4a7fb877-a6d9-4cc1-9e66-d966f06bfc72
Debian GNU/Linux (on sdb5) 4a7fb877-a6d9-4cc1-9e66-d966f06bfc72
Debian GNU/Linux, with Linux 5.10.0-17-amd64 (on sdb5) 4a7fb877-a6d9-4cc1-9e66-d966f06bfc72
Debian GNU/Linux, with Linux 5.10.0-16-amd64 (on sdb5) 4a7fb877-a6d9-4cc1-9e66-d966f06bfc72
Ubuntu 22.04.1 LTS (22.04) (on sdb6) 9b243a8a-12c2-45b3-a54b-045682bd44df
Ubuntu (on sdb6) 9b243a8a-12c2-45b3-a54b-045682bd44df
Ubuntu, with Linux 5.15.0-46-generic (on sdb6) 9b243a8a-12c2-45b3-a54b-045682bd44df
Ubuntu, with Linux 5.15.0-43-generic (on sdb6) 9b243a8a-12c2-45b3-a54b-045682bd44df
### END /etc/grub.d/30_os-prober ###
System setup uefi-firmware
### END /etc/grub.d/30_uefi-firmware ###
========================== sdb4/etc/fstab (filtered) ===========================
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sdb4 during installation
UUID=123bcb04-2606-4786-957c-2a41be0b46e4 / ext4 errors=remount-ro 0 1
# /boot/efi was on /dev/sdb1 during installation
UUID=0F63-B9A1 /boot/efi vfat umask=0077 0 1
# /home was on /dev/sda3 during installation
UUID=3b25d7fb-8127-4a05-bfd9-df36c0670584 /home ext4 defaults 0 2
# swap was on /dev/sda2 during installation
UUID=b23f3faa-381e-42f3-bb58-af5616f11378 none swap sw 0 0
======================= sdb4/etc/default/grub (filtered) =======================
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_CMDLINE_LINUX=""
==================== sdb4: Location of files loaded by Grub ====================
GiB - GB File Fragment(s)
119,658462524 = 128,482295808 boot/grub/grub.cfg 4
93,282741547 = 100,161581056 boot/vmlinuz-5.10.0-16-amd64 1
92,860973358 = 99,708710912 boot/vmlinuz-5.10.0-17-amd64 1
94,654506683 = 101,634502656 boot/vmlinuz-5.18.0-0.deb11.3-amd64 1
94,654506683 = 101,634502656 vmlinuz 1
92,860973358 = 99,708710912 vmlinuz.old 1
94,007514954 = 100,939800576 boot/initrd.img-5.10.0-16-amd64 1
94,211681366 = 101,159022592 boot/initrd.img-5.10.0-17-amd64 1
95,666160583 = 102,720757760 boot/initrd.img-5.18.0-0.deb11.3-amd64 2
95,666160583 = 102,720757760 initrd.img 2
94,211681366 = 101,159022592 initrd.img.old 1
===================== sdb4: ls -l /etc/grub.d/ (filtered) ======================
-rwxr-xr-x 1 root root 13664 Jul 11 2021 10_linux
-rwxr-xr-x 1 root root 13726 Jul 11 2021 20_linux_xen
-rwxr-xr-x 1 root root 12059 Jul 11 2021 30_os-prober
-rwxr-xr-x 1 root root 1416 Jul 11 2021 30_uefi-firmware
-rwxr-xr-x 1 root root 214 Jul 11 2021 40_custom
-rwxr-xr-x 1 root root 216 Jul 11 2021 41_custom
====================== sdb5/boot/grub/grub.cfg (filtered) ======================
Debian GNU/Linux 4a7fb877-a6d9-4cc1-9e66-d966f06bfc72
Debian GNU/Linux, with Linux 5.10.0-17-amd64 4a7fb877-a6d9-4cc1-9e66-d966f06bfc72
Debian GNU/Linux, with Linux 5.10.0-16-amd64 4a7fb877-a6d9-4cc1-9e66-d966f06bfc72
Windows Boot Manager (on sda1) osprober-efi-0F63-B9A1
Debian GNU/Linux 11 (bullseye) (on sda4) a2cc5ba2-2d04-40ad-bcba-df4209699285
Debian GNU/Linux (on sda4) a2cc5ba2-2d04-40ad-bcba-df4209699285
Debian GNU/Linux, with Linux 5.10.0-17-amd64 (on sda4) a2cc5ba2-2d04-40ad-bcba-df4209699285
Debian GNU/Linux, with Linux 5.10.0-16-amd64 (on sda4) a2cc5ba2-2d04-40ad-bcba-df4209699285
Ubuntu 22.04.1 LTS (22.04) (on sda6) 9b243a8a-12c2-45b3-a54b-045682bd44df
Ubuntu (on sda6) 9b243a8a-12c2-45b3-a54b-045682bd44df
Ubuntu, with Linux 5.15.0-46-generic (on sda6) 9b243a8a-12c2-45b3-a54b-045682bd44df
Ubuntu, with Linux 5.15.0-43-generic (on sda6) 9b243a8a-12c2-45b3-a54b-045682bd44df
### END /etc/grub.d/30_os-prober ###
System setup uefi-firmware
### END /etc/grub.d/30_uefi-firmware ###
========================== sdb5/etc/fstab (filtered) ===========================
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda5 during installation
UUID=4a7fb877-a6d9-4cc1-9e66-d966f06bfc72 / ext4 errors=remount-ro 0 1
# /boot/efi was on /dev/sda1 during installation
UUID=0F63-B9A1 /boot/efi vfat umask=0077 0 1
# /home was on /dev/sdb4 during installation
UUID=44f2ad7c-cd19-455a-ad47-3fb01095ec1c /home ext4 defaults 0 2
# swap was on /dev/sdb2 during installation
UUID=b23f3faa-381e-42f3-bb58-af5616f11378 none swap sw 0 0
======================= sdb5/etc/default/grub (filtered) =======================
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_CMDLINE_LINUX=""
==================== sdb5: Location of files loaded by Grub ====================
GiB - GB File Fragment(s)
160,719440460 = 172,571185152 boot/grub/grub.cfg 3
135,665554047 = 145,669779456 boot/vmlinuz-5.10.0-16-amd64 1
135,388317108 = 145,372098560 boot/vmlinuz-5.10.0-17-amd64 1
135,388317108 = 145,372098560 vmlinuz 1
135,665554047 = 145,669779456 vmlinuz.old 1
136,169795990 = 146,211205120 boot/initrd.img-5.10.0-16-amd64 1
140,136650085 = 150,470582272 boot/initrd.img-5.10.0-17-amd64 1
140,136650085 = 150,470582272 initrd.img 1
136,169795990 = 146,211205120 initrd.img.old 1
===================== sdb5: ls -l /etc/grub.d/ (filtered) ======================
-rwxr-xr-x 1 root root 13664 Jul 11 2021 10_linux
-rwxr-xr-x 1 root root 13726 Jul 11 2021 20_linux_xen
-rwxr-xr-x 1 root root 12059 Jul 11 2021 30_os-prober
-rwxr-xr-x 1 root root 1416 Jul 11 2021 30_uefi-firmware
-rwxr-xr-x 1 root root 214 Jul 11 2021 40_custom
-rwxr-xr-x 1 root root 216 Jul 11 2021 41_custom
====================== sdb6/boot/grub/grub.cfg (filtered) ======================
debian e558806c-0053-4438-a518-2c4f4fa14056
Ubuntu 9b243a8a-12c2-45b3-a54b-045682bd44df
Windows osprober-efi-0F63-B9A1
Ubuntu, with Linux 5.15.0-46-generic 9b243a8a-12c2-45b3-a54b-045682bd44df
Ubuntu, with Linux 5.15.0-43-generic 9b243a8a-12c2-45b3-a54b-045682bd44df
Debian GNU/Linux 11 (bullseye) (on sdb5) 44c4af9a-63e0-4400-b570-5f76fdab3eb2
Debian GNU/Linux (on sdb5) 44c4af9a-63e0-4400-b570-5f76fdab3eb2
Debian GNU/Linux, with Linux 5.10.0-17-amd64 (on sdb5) 44c4af9a-63e0-4400-b570-5f76fdab3eb2
Debian GNU/Linux, with Linux 5.10.0-16-amd64 (on sdb5) 44c4af9a-63e0-4400-b570-5f76fdab3eb2
Debian GNU/Linux, with Linux 5.10.0-17-amd64 (on sdb4) 6bcdf620-0e26-4136-bbc6-0f465a411b6a
Debian GNU/Linux, with Linux 5.10.0-16-amd64 (on sdb4) 6bcdf620-0e26-4136-bbc6-0f465a411b6a
Debian GNU/Linux (on sdb4) 6bcdf620-0e26-4136-bbc6-0f465a411b6a
UEFI Firmware Settings uefi-firmware
========================== sdb6/etc/fstab (filtered) ===========================
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sdb6 during installation
UUID=9b243a8a-12c2-45b3-a54b-045682bd44df / ext4 errors=remount-ro 0 1
# /boot/efi was on /dev/sdb1 during installation
UUID=0F63-B9A1 /boot/efi vfat umask=0077 0 1
# /home was on /dev/sda5 during installation
UUID=3c238729-6050-4da2-98c8-3202529d8da3 /home ext4 defaults 0 2
# swap was on /dev/sda2 during installation
UUID=b23f3faa-381e-42f3-bb58-af5616f11378 none swap sw 0 0
======================= sdb6/etc/default/grub (filtered) =======================
GRUB_DEFAULT="0"
GRUB_TIMEOUT_STYLE="hidden"
GRUB_TIMEOUT="5"
GRUB_DISTRIBUTOR="`lsb_release -i -s 2> /dev/null || echo Debian`"
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
GRUB_GFXMODE="640x480"
==================== sdb6: Location of files loaded by Grub ====================
GiB - GB File Fragment(s)
195,366237640 = 209,772900352 boot/grub/grub.cfg 1
225,784175873 = 242,433912832 boot/vmlinuz-5.15.0-43-generic 2
205,748043060 = 220,920279040 boot/vmlinuz-5.15.0-46-generic 1
205,748043060 = 220,920279040 boot/vmlinuz.old 1
215,296764374 = 231,173140480 boot/initrd.img-5.15.0-43-generic 2
216,641689301 = 232,617242624 boot/initrd.img-5.15.0-46-generic 1
216,641689301 = 232,617242624 boot/initrd.img.old 1
===================== sdb6: ls -l /etc/grub.d/ (filtered) ======================
-rwxr-xr-x 1 root root 694 Aug 27 08:45 10_linux_proxy
-rwxr-xr-x 1 root root 211 Aug 27 08:45 40_custom_proxy
-rwxr-xr-x 1 root root 694 Aug 27 08:45 41_linux_proxy
-rwxr-xr-x 1 root root 224 Aug 27 08:45 42_custom_proxy
-rwxr-xr-x 1 root root 694 Aug 27 08:45 44_linux_proxy
-rwxr-xr-x 1 root root 43031 Apr 15 23:50 45_linux_zfs
-rwxr-xr-x 1 root root 14180 Apr 15 23:50 46_linux_xen
-rwxr-xr-x 1 root root 2924 Feb 6 2022 47_memtest86+
-rwxr-xr-x 1 root root 2353 Aug 27 08:45 48_os-prober_proxy
-rwxr-xr-x 1 root root 1372 Apr 15 23:50 49_uefi-firmware
-rwxr-xr-x 1 root root 700 Feb 19 2022 50_fwupd
-rwxr-xr-x 1 root root 252 Aug 27 08:45 51_custom_proxy
-rwxr-xr-x 1 root root 215 Apr 15 23:50 52_custom
drwxr-xr-x 4 root root 4096 May 10 05:02 backup
drwxr-xr-x 2 root root 4096 May 10 05:02 bin
drwxr-xr-x 2 root root 4096 Aug 27 08:45 proxifiedScripts
======================= sdb6/etc/grub.d/40_custom_proxy ========================
#!/bin/sh
#THIS IS A GRUB PROXY SCRIPT
'/etc/grub.d/proxifiedScripts/custom' | /etc/grub.d/bin/grubcfg_proxy "-*
-'Windows '~93533e8bfc309a45f7f1139f533493b5~
-#text
+'debian'~34f10f178fca299d48d3f200d4a730ee~
"
======================== sdb6/etc/grub.d/41_linux_proxy ========================
#!/bin/sh
#THIS IS A GRUB PROXY SCRIPT
'/etc/grub.d/proxifiedScripts/linux' | /etc/grub.d/bin/grubcfg_proxy "-*
-#text
-'SUBMENU' as 'Advanced options for Ubuntu'{-'Advanced options for Ubuntu'/*, -'Advanced options for Ubuntu'/'Ubuntu, with Linux 5.15.0-46-generic'~11293db4d73065cb29ee169842bdbb6b~, -'Advanced options for Ubuntu'/'Ubuntu, with Linux 5.15.0-46-generic (recovery mode)'~79d972856635b3b117301b5166a7390f~, -'Advanced options for Ubuntu'/'Ubuntu, with Linux 5.15.0-43-generic'~7887406e931d25c2bfaab4dfa17a7f5f~, -'Advanced options for Ubuntu'/'Ubuntu, with Linux 5.15.0-43-generic (recovery mode)'~1510e97d9664ae6909b34bd3341af1ba~}
+'Ubuntu'~a8f82f2cf2696c47dccdf60b1434e606~
"
======================= sdb6/etc/grub.d/42_custom_proxy ========================
#!/bin/sh
#THIS IS A GRUB PROXY SCRIPT
'/etc/grub.d/proxifiedScripts/custom' | /etc/grub.d/bin/grubcfg_proxy "-*
-#text
-'debian'~34f10f178fca299d48d3f200d4a730ee~ as 'Debian '
+'Windows '~93533e8bfc309a45f7f1139f533493b5~
"
======================== sdb6/etc/grub.d/44_linux_proxy ========================
#!/bin/sh
#THIS IS A GRUB PROXY SCRIPT
'/etc/grub.d/proxifiedScripts/linux' | /etc/grub.d/bin/grubcfg_proxy "-'Ubuntu'~a8f82f2cf2696c47dccdf60b1434e606~
-*
-#text
+'SUBMENU' as 'Advanced options for Ubuntu'{+'Advanced options for Ubuntu'/*, +'Advanced options for Ubuntu'/'Ubuntu, with Linux 5.15.0-46-generic'~11293db4d73065cb29ee169842bdbb6b~, +'Advanced options for Ubuntu'/'Ubuntu, with Linux 5.15.0-46-generic (recovery mode)'~79d972856635b3b117301b5166a7390f~, +'Advanced options for Ubuntu'/'Ubuntu, with Linux 5.15.0-43-generic'~7887406e931d25c2bfaab4dfa17a7f5f~, +'Advanced options for Ubuntu'/'Ubuntu, with Linux 5.15.0-43-generic (recovery mode)'~1510e97d9664ae6909b34bd3341af1ba~}
"
========================= sdb6/etc/grub.d/45_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 <http://www.gnu.org/licenses/>.
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 https://github.com/zfsonlinux/zfs/issues/9958
# 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 https://github.com/zfsonlinux/zfs/issues/9958
# 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}" 2>/dev/null | 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=""
candidate_kernel_list="$(find "${boot_dir}" -maxdepth 1 -type f -regex '.*/\(vmlinuz\|vmlinux\|kernel\)-.*')"
while [ -n "${candidate_kernel_list}" ] ; do
list_basename="$(echo "${candidate_kernel_list}" | sed -e 's#.*/##')"
linux=$(version_find_latest ${list_basename})
linux=$(echo "${candidate_kernel_list}" | while read k; do
if [ "$(basename "${k}")" = "${linux}" ]; then
echo -n "${k}"
break
fi
done)
# || true to not abort even if candidate_kernel_list is empty on last entry
candidate_kernel_list="$(echo "${candidate_kernel_list}" | fgrep -vx "${linux}"||true)"
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 -v FS='\t' '{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
snapshots="$(zfs list -H -o name -t snapshot "${dataset}"|while read snapshot_dataset; do
get_dataset_info "${snapshot_dataset}" ${mntdir}
done)"
[ -n "${snapshots}" ] && boot_list="${boot_list}${snapshots}\n"
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
oldIFS="$IFS"
export IFS='|'
set -- $(get_field_from_entry "${main_entry}" 7)
for kernel in $(get_field_from_entry "${main_entry}" 8); 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
IFS="$oldIFS"
}
# 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
oldIFS="$IFS"
export IFS='|'
set -- $(get_field_from_entry "${entry}" 7)
for k in $(get_field_from_entry "${entry}" 8); 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
IFS="$oldIFS"
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 in echo trims end of line spaces
echo "${submenu_indentation} linux \"${kernel}\" root=ZFS=\"${dataset}\" ro $(echo ${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
========================= sdb6/etc/grub.d/46_linux_xen =========================
#! /bin/sh
set -e
# grub-mkconfig helper script.
# Copyright (C) 2006,2007,2008,2009,2010 Free Software Foundation, Inc.
#
# 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 <http://www.gnu.org/licenses/>.
prefix="/usr"
exec_prefix="/usr"
datarootdir="/usr/share"
. "$pkgdatadir/grub-mkconfig_lib"
export TEXTDOMAIN=grub
export TEXTDOMAINDIR="${datarootdir}/locale"
CLASS="--class gnu-linux --class gnu --class os --class xen"
SUPPORTED_INITS="sysvinit:/lib/sysvinit/init systemd:/lib/systemd/systemd upstart:/sbin/upstart"
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
OS=GNU/Linux
else
OS="${GRUB_DISTRIBUTOR} GNU/Linux"
CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}"
fi
# loop-AES arranges things so that /dev/loop/X can be our root device, but
# the initrds that Linux uses don't like that.
case ${GRUB_DEVICE} in
/dev/loop/*|/dev/loop[0-9])
GRUB_DEVICE=`losetup ${GRUB_DEVICE} | sed -e "s/^[^(]*(\([^)]\+\)).*/\1/"`
# We can't cope with devices loop-mounted from files here.
case ${GRUB_DEVICE} in
/dev/*) ;;
*) exit 0 ;;
esac
;;
esac
# Default to disabling partition uuid support to maintian compatibility with
# older kernels.
GRUB_DISABLE_LINUX_PARTUUID=${GRUB_DISABLE_LINUX_PARTUUID-true}
# btrfs may reside on multiple devices. We cannot pass them as value of root= parameter
# and mounting btrfs requires user space scanning, so force UUID in this case.
if ( [ "x${GRUB_DEVICE_UUID}" = "x" ] && [ "x${GRUB_DEVICE_PARTUUID}" = "x" ] ) \
|| ( [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \
&& [ "x${GRUB_DISABLE_LINUX_PARTUUID}" = "xtrue" ] ) \
|| ( ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \
&& ! test -e "/dev/disk/by-partuuid/${GRUB_DEVICE_PARTUUID}" ) \
|| ( test -e "${GRUB_DEVICE}" && uses_abstraction "${GRUB_DEVICE}" lvm ); then
LINUX_ROOT_DEVICE=${GRUB_DEVICE}
elif [ "x${GRUB_DEVICE_UUID}" = "x" ] \
|| [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ]; then
LINUX_ROOT_DEVICE=PARTUUID=${GRUB_DEVICE_PARTUUID}
else
LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
fi
# Allow overriding GRUB_CMDLINE_LINUX and GRUB_CMDLINE_LINUX_DEFAULT.
if [ "${GRUB_CMDLINE_LINUX_XEN_REPLACE}" ]; then
GRUB_CMDLINE_LINUX="${GRUB_CMDLINE_LINUX_XEN_REPLACE}"
fi
if [ "${GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT}" ]; then
GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT}"
fi
case x"$GRUB_FS" in
xbtrfs)
rootsubvol="`make_system_path_relative_to_its_root /`"
rootsubvol="${rootsubvol#/}"
if [ "x${rootsubvol}" != x ]; then
GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"
fi;;
xzfs)
rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true`
bootfs="`make_system_path_relative_to_its_root / | sed -e "s,@$,,"`"
LINUX_ROOT_DEVICE="ZFS=${rpool}${bootfs%/}"
;;
esac
title_correction_code=
linux_entry ()
{
linux_entry_xsm "$@" false
linux_entry_xsm "$@" true
}
linux_entry_xsm ()
{
os="$1"
version="$2"
xen_version="$3"
type="$4"
args="$5"
xen_args="$6"
xsm="$7"
# If user wants to enable XSM support, make sure there's
# corresponding policy file.
if ${xsm} ; then
xenpolicy="xenpolicy-$xen_version"
if test ! -e "${xen_dirname}/${xenpolicy}" ; then
return
fi
xen_args="$xen_args flask=enforcing"
xen_version="$(gettext_printf "%s (XSM enabled)" "$xen_version")"
# xen_version is used for messages only; actual file is xen_basename
fi
if [ -z "$boot_device_id" ]; then
boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
fi
if [ x$type != xsimple ] ; then
if [ x$type = xrecovery ] ; then
title="$(gettext_printf "%s, with Xen %s and Linux %s (%s)" "${os}" "${xen_version}" "${version}" "$(gettext "${GRUB_RECOVERY_TITLE}")")"
elif [ "${type#init-}" != "$type" ] ; then
title="$(gettext_printf "%s, with Xen %s and Linux %s (%s)" "${os}" "${xen_version}" "${version}" "${type#init-}")"
else
title="$(gettext_printf "%s, with Xen %s and Linux %s" "${os}" "${xen_version}" "${version}")"
fi
replacement_title="$(echo "Advanced options for ${OS}" | sed 's,>,>>,g')>$(echo "$title" | sed 's,>,>>,g')"
if [ x"Xen ${xen_version}>$title" = x"$GRUB_ACTUAL_DEFAULT" ]; then
quoted="$(echo "$GRUB_ACTUAL_DEFAULT" | grub_quote)"
title_correction_code="${title_correction_code}if [ \"x\$default\" = '$quoted' ]; then default='$(echo "$replacement_title" | grub_quote)'; fi;"
grub_warn "$(gettext_printf "Please don't use old title \`%s' for GRUB_DEFAULT, use \`%s' (for versions before 2.00) or \`%s' (for 2.00 or later)" "$GRUB_ACTUAL_DEFAULT" "$replacement_title" "gnulinux-advanced-$boot_device_id>gnulinux-$version-$type-$boot_device_id")"
fi
echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'xen-gnulinux-$version-$type-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
else
title="$(gettext_printf "%s, with Xen hypervisor" "${os}")"
echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'xen-gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
fi
if [ x$type != xrecovery ] ; then
save_default_entry | grub_add_tab | sed "s/^/$submenu_indentation/"
fi
if [ -z "${prepare_boot_cache}" ]; then
prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | grub_add_tab)"
fi
printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
xmessage="$(gettext_printf "Loading Xen %s ..." ${xen_version})"
lmessage="$(gettext_printf "Loading Linux %s ..." ${version})"
sed "s/^/$submenu_indentation/" << EOF
echo '$(echo "$xmessage" | grub_quote)'
if [ "\$grub_platform" = "pc" -o "\$grub_platform" = "" ]; then
xen_rm_opts=
else
xen_rm_opts="no-real-mode edd=off"
fi
${xen_loader} ${rel_xen_dirname}/${xen_basename} placeholder ${xen_args} \${xen_rm_opts}
echo '$(echo "$lmessage" | grub_quote)'
${module_loader} ${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args}
EOF
if test -n "${initrd}" ; then
# TRANSLATORS: ramdisk isn't identifier. Should be translated.
message="$(gettext_printf "Loading initial ramdisk ...")"
initrd_path=
for i in ${initrd}; do
initrd_path="${initrd_path} ${rel_dirname}/${i}"
done
sed "s/^/$submenu_indentation/" << EOF
echo '$(echo "$message" | grub_quote)'
${module_loader} --nounzip $(echo $initrd_path)
EOF
fi
if ${xsm} && test -n "${xenpolicy}" ; then
message="$(gettext_printf "Loading XSM policy ...")"
sed "s/^/$submenu_indentation/" << EOF
echo '$(echo "$message" | grub_quote)'
${module_loader} ${rel_dirname}/${xenpolicy}
EOF
fi
sed "s/^/$submenu_indentation/" << EOF
}
EOF
}
linux_list=
for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* /boot/kernel-*; do
if grub_file_is_not_garbage "$i"; then
basename=$(basename $i)
version=$(echo $basename | sed -e "s,^[^0-9]*-,,g")
dirname=$(dirname $i)
config=
for j in "${dirname}/config-${version}" "${dirname}/config-${alt_version}" "/etc/kernels/kernel-config-${version}" ; do
if test -e "${j}" ; then
config="${j}"
break
fi
done
if (grep -qx "CONFIG_XEN_DOM0=y" "${config}" 2> /dev/null || grep -qx "CONFIG_XEN_PRIVILEGED_GUEST=y" "${config}" 2> /dev/null); then linux_list="$linux_list $i" ; fi
fi
done
if [ "x${linux_list}" = "x" ] ; then
exit 0
fi
file_is_not_xen_garbage () {
case "$1" in
*/xen-syms-*)
return 1;;
*/xenpolicy-*)
return 1;;
*/*.config)
return 1;;
*)
return 0;;
esac
}
xen_list=
for i in /boot/xen*; do
if grub_file_is_not_garbage "$i" && file_is_not_xen_garbage "$i" ; then xen_list="$xen_list $i" ; fi
done
prepare_boot_cache=
boot_device_id=
title_correction_code=
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
# Extra indentation to add to menu entries in a submenu. We're not in a submenu
# yet, so it's empty. In a submenu it will be equal to '\t' (one tab).
submenu_indentation=""
is_top_level=true
while [ "x${xen_list}" != "x" ] ; do
list="${linux_list}"
current_xen=`version_find_latest $xen_list`
xen_basename=`basename ${current_xen}`
xen_dirname=`dirname ${current_xen}`
rel_xen_dirname=`make_system_path_relative_to_its_root $xen_dirname`
xen_version=`echo $xen_basename | sed -e "s,.gz$,,g;s,^xen-,,g"`
if [ -z "$boot_device_id" ]; then
boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
fi
if [ "x$is_top_level" != xtrue ]; then
echo " submenu '$(gettext_printf "Xen hypervisor, version %s" "${xen_version}" | grub_quote)' \$menuentry_id_option 'xen-hypervisor-$xen_version-$boot_device_id' {"
fi
if ($grub_file --is-arm64-efi $current_xen); then
xen_loader="xen_hypervisor"
module_loader="xen_module"
else
if ($grub_file --is-x86-multiboot2 $current_xen); then
xen_loader="multiboot2"
module_loader="module2"
else
xen_loader="multiboot"
module_loader="module"
fi
fi
initrd_early=
for i in ${GRUB_EARLY_INITRD_LINUX_STOCK} \
${GRUB_EARLY_INITRD_LINUX_CUSTOM}; do
if test -e "${xen_dirname}/${i}" ; then
initrd_early="${initrd_early} ${i}"
fi
done
while [ "x$list" != "x" ] ; do
linux=`version_find_latest $list`
gettext_printf "Found linux image: %s\n" "$linux" >&2
basename=`basename $linux`
dirname=`dirname $linux`
rel_dirname=`make_system_path_relative_to_its_root $dirname`
version=`echo $basename | sed -e "s,^[^0-9]*-,,g"`
alt_version=`echo $version | sed -e "s,\.old$,,g"`
linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
initrd_real=
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 "${dirname}/${i}" ; then
initrd_real="$i"
break
fi
done
initrd=
if test -n "${initrd_early}" || test -n "${initrd_real}"; then
initrd="${initrd_early} ${initrd_real}"
initrd_display=
for i in ${initrd}; do
initrd_display="${initrd_display} ${dirname}/${i}"
done
gettext_printf "Found initrd image: %s\n" "$(echo $initrd_display)" >&2
fi
if test -z "${initrd_real}"; then
# "UUID=" magic is parsed by initrds. Since there's no initrd, it can't work here.
if [ "x${GRUB_DEVICE_PARTUUID}" = "x" ] \
|| [ "x${GRUB_DISABLE_LINUX_PARTUUID}" = "xtrue" ]; then
linux_root_device_thisversion=${GRUB_DEVICE}
else
linux_root_device_thisversion=PARTUUID=${GRUB_DEVICE_PARTUUID}
fi
fi
# The GRUB_DISABLE_SUBMENU option used to be different than others since it was
# mentioned in the documentation that has to be set to 'y' instead of 'true' to
# enable it. This caused a lot of confusion to users that set the option to 'y',
# 'yes' or 'true'. This was fixed but all of these values must be supported now.
if [ "x${GRUB_DISABLE_SUBMENU}" = xyes ] || [ "x${GRUB_DISABLE_SUBMENU}" = xy ]; then
GRUB_DISABLE_SUBMENU="true"
fi
if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xtrue ]; then
linux_entry "${OS}" "${version}" "${xen_version}" simple \
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" "${GRUB_CMDLINE_XEN} ${GRUB_CMDLINE_XEN_DEFAULT}"
submenu_indentation="$grub_tab$grub_tab"
if [ -z "$boot_device_id" ]; then
boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
fi
# TRANSLATORS: %s is replaced with an OS name
echo "submenu '$(gettext_printf "Advanced options for %s (with Xen hypervisor)" "${OS}" | grub_quote)' \$menuentry_id_option 'gnulinux-advanced-$boot_device_id' {"
echo " submenu '$(gettext_printf "Xen hypervisor, version %s" "${xen_version}" | grub_quote)' \$menuentry_id_option 'xen-hypervisor-$xen_version-$boot_device_id' {"
is_top_level=false
fi
linux_entry "${OS}" "${version}" "${xen_version}" advanced \
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" "${GRUB_CMDLINE_XEN} ${GRUB_CMDLINE_XEN_DEFAULT}"
for supported_init in ${SUPPORTED_INITS}; do
init_path="${supported_init#*:}"
if [ -x "${init_path}" ] && [ "$(readlink -f /sbin/init)" != "$(readlink -f "${init_path}")" ]; then
linux_entry "${OS}" "${version}" "${xen_version}" "init-${supported_init%%:*}" \
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT} init=${init_path}" "${GRUB_CMDLINE_XEN} ${GRUB_CMDLINE_XEN_DEFAULT}"
fi
done
if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
linux_entry "${OS}" "${version}" "${xen_version}" recovery \
"single ${GRUB_CMDLINE_LINUX}" "${GRUB_CMDLINE_XEN}"
fi
list=`echo $list | tr ' ' '\n' | fgrep -vx "$linux" | tr '\n' ' '`
done
if [ x"$is_top_level" != xtrue ]; then
echo ' }'
fi
xen_list=`echo $xen_list | tr ' ' '\n' | fgrep -vx "$current_xen" | tr '\n' ' '`
done
# If at least one kernel was found, then we need to
# add a closing '}' for the submenu command.
if [ x"$is_top_level" != xtrue ]; then
echo '}'
fi
echo "$title_correction_code"
====================== sdb6/etc/grub.d/48_os-prober_proxy ======================
#!/bin/sh
#THIS IS A GRUB PROXY SCRIPT
'/etc/grub.d/proxifiedScripts/os-prober' | /etc/grub.d/bin/grubcfg_proxy "-'Debian GNU/Linux 11 (bullseye) (on /dev/sdb4)'~c684fa3fc2027366d3d39d5cb1240adb~
-'Windows Boot Manager (on /dev/sdb1)'~93533e8bfc309a45f7f1139f533493b5~
+*
+'Debian GNU/Linux 11 (bullseye) (on /dev/sdb5)'~9295f57b7909803302b5a552672b2409~
+'SUBMENU' as 'Advanced options for Debian GNU/Linux 11 (bullseye) (on /dev/sdb5)'{+'Advanced options for Debian GNU/Linux 11 (bullseye) (on /dev/sdb5)'/*, +'Advanced options for Debian GNU/Linux 11 (bullseye) (on /dev/sdb5)'/'Debian GNU/Linux (on /dev/sdb5)'~2301f9998ff87aa9cfb5a8ee3a695614~, +'Advanced options for Debian GNU/Linux 11 (bullseye) (on /dev/sdb5)'/'Debian GNU/Linux, with Linux 5.10.0-17-amd64 (on /dev/sdb5)'~2301f9998ff87aa9cfb5a8ee3a695614~, +'Advanced options for Debian GNU/Linux 11 (bullseye) (on /dev/sdb5)'/'Debian GNU/Linux, with Linux 5.10.0-17-amd64 (recovery mode) (on /dev/sdb5)'~f5570cf92125d992ed07bf7798971550~, +'Advanced options for Debian GNU/Linux 11 (bullseye) (on /dev/sdb5)'/'Debian GNU/Linux, with Linux 5.10.0-16-amd64 (on /dev/sdb5)'~926c22c5c4f7fcd3fa5347638972d9f7~, +'Advanced options for Debian GNU/Linux 11 (bullseye) (on /dev/sdb5)'/'Debian GNU/Linux, with Linux 5.10.0-16-amd64 (recovery mode) (on /dev/sdb5)'~b2191f5110f80507fcdb0b38e1d0b8a0~}
+#text
+'SUBMENU' as 'Advanced options for Debian GNU/Linux 11 (bullseye) (on /dev/sdb4)'{+'Advanced options for Debian GNU/Linux 11 (bullseye) (on /dev/sdb4)'/*, +'Advanced options for Debian GNU/Linux 11 (bullseye) (on /dev/sdb4)'/'Debian GNU/Linux, with Linux 5.10.0-17-amd64 (on /dev/sdb4)'~6635c4564b73a0c12037825e1f1dd798~, +'Advanced options for Debian GNU/Linux 11 (bullseye) (on /dev/sdb4)'/'Debian GNU/Linux, with Linux 5.10.0-17-amd64 (recovery mode) (on /dev/sdb4)'~476a5a1dfba29f0b12b8c2cb2ca5381a~, +'Advanced options for Debian GNU/Linux 11 (bullseye) (on /dev/sdb4)'/'Debian GNU/Linux, with Linux 5.10.0-16-amd64 (on /dev/sdb4)'~27ff5e5b67e6770a40aee152d85d9ca4~, +'Advanced options for Debian GNU/Linux 11 (bullseye) (on /dev/sdb4)'/'Debian GNU/Linux, with Linux 5.10.0-16-amd64 (recovery mode) (on /dev/sdb4)'~09d3c55163e6ebd474dfd8b35a55bd68~, +'Advanced options for Debian GNU/Linux 11 (bullseye) (on /dev/sdb4)'/'Debian GNU/Linux (on /dev/sdb4)'~6635c4564b73a0c12037825e1f1dd798~}
"
======================= sdb6/etc/grub.d/49_uefi-firmware =======================
#! /bin/sh
set -e
# grub-mkconfig helper script.
# Copyright (C) 2020 Free Software Foundation, Inc.
#
# 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 <http://www.gnu.org/licenses/>.
prefix="/usr"
exec_prefix="/usr"
datarootdir="/usr/share"
export TEXTDOMAIN=grub
export TEXTDOMAINDIR="${datarootdir}/locale"
. "$pkgdatadir/grub-mkconfig_lib"
EFI_VARS_DIR=/sys/firmware/efi/efivars
EFI_GLOBAL_VARIABLE=8be4df61-93ca-11d2-aa0d-00e098032b8c
OS_INDICATIONS="$EFI_VARS_DIR/OsIndicationsSupported-$EFI_GLOBAL_VARIABLE"
if [ -e "$OS_INDICATIONS" ] && \
[ "$(( $(printf 0x%x \'"$(cat $OS_INDICATIONS | cut -b5)"\') & 1 ))" = 1 ]; then
LABEL="UEFI Firmware Settings"
gettext_printf "Adding boot menu entry for UEFI Firmware Settings ...\n" >&2
cat << EOF
menuentry '$LABEL' \$menuentry_id_option 'uefi-firmware' {
fwsetup
}
EOF
fi
=========================== sdb6/etc/grub.d/50_fwupd ===========================
#! /bin/sh
# SPDX-License-Identifier: LGPL-2.1+
set -e
[ -d ${pkgdatadir:?} ]
# shellcheck source=/dev/null
. "$pkgdatadir/grub-mkconfig_lib"
if [ -f /var/lib/fwupd/uefi_capsule.conf ] &&
ls /sys/firmware/efi/efivars/fwupd-*-0abba7dc-e516-4167-bbf5-4d9d1c739416 1>/dev/null 2>&1; then
. /var/lib/fwupd/uefi_capsule.conf
if [ "${EFI_PATH}" != "" ] && [ "${ESP}" != "" ]; then
echo "Adding Linux Firmware Updater entry" >&2
cat << EOF
menuentry 'Linux Firmware Updater' \$menuentry_id_option 'fwupd' {
EOF
${grub_probe:?}
prepare_grub_to_access_device '`${grub_probe} --target=device \${ESP}` | sed -e "s/^/\t/"'
cat << EOF
chainloader ${EFI_PATH}
}
EOF
fi
fi
======================= sdb6/etc/grub.d/51_custom_proxy ========================
#!/bin/sh
#THIS IS A GRUB PROXY SCRIPT
'/etc/grub.d/proxifiedScripts/custom' | /etc/grub.d/bin/grubcfg_proxy "+*
-'Windows '~93533e8bfc309a45f7f1139f533493b5~
+#text
-'debian'~34f10f178fca299d48d3f200d4a730ee~ as 'Windows Boot Manager (on /dev/sdb1)'
"
Suggested repair: ______________________________________________________________
The default repair of the Boot-Repair utility would reinstall the grub-efi of
sdb4,
using the following options: sdb1/boot/efi
Additional repair would be performed: unhide-bootmenu-10s use-standard-efi-file
Blockers in case of suggested repair: __________________________________________
Please use this software in a live-session (live-CD or live-USB). This will enable this feature.
Final advice in case of suggested repair: ______________________________________
Please do not forget to make your UEFI firmware boot on the Debian GNU/Linux 11 (bullseye) entry (sdb1/efi/****/grub****.efi (**** will be updated in the final message) file) !
If your computer reboots directly into Windows, try to change the boot order in your UEFI firmware.
If your UEFI firmware does not allow to change the boot order, change the default boot entry of the Windows bootloader.
For example you can boot into Windows, then type the following command in an admin command prompt:
bcdedit /set {bootmgr} path \EFI\****\grub****.efi (**** will be updated in the final message)
Dernière modification par xubu1957 (Le 27/08/2022, à 18:00)
Conseils pour les nouveaux demandeurs et pas qu'eux
Important : Pensez à passer vos sujets en [Réso|u] 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
En ligne
#8 Le 27/08/2022, à 22:39
- geole
Re : swap qui ne se monte pas
Bonsoir.
Je te prie de donner ce retour qui indiquera les erreurs réelles.
journalctl -b -p err
j'ai noté.
OS#1: L'OS actuellement utilisé - Ubuntu 22.04.1 LTS CurrentSession on sdb6
========================= sdb6/etc/fstab (filtered) ===========================
UUID=9b243a8a-12c2-45b3-a54b-045682bd44df / ext4 errors=remount-ro 0 1
UUID=0F63-B9A1 /boot/efi vfat umask=0077 0 1
UUID=3c238729-6050-4da2-98c8-3202529d8da3 /home ext4 defaults 0 2
UUID=b23f3faa-381e-42f3-bb58-af5616f11378 none swap sw 0 0
blkid (filtered): ______________________________________________________________
NAME FSTYPE UUID PARTUUID LABEL PARTLABEL
├─sda2 swap b23f3faa-381e-42f3-bb58-af5616f11378 00168dff-9710-e79a-e4ec-d91ffe1b2d00
├─sda4 ext4 44f2ad7c-cd19-455a-ad47-3fb01095ec1c 2838d686-448a-44c4-8eae-10c53a3eb4c2
└─sda5 ext4 3c238729-6050-4da2-98c8-3202529d8da3 112ef786-f46e-42fd-b63b-8afe0feb33f9
├─sdb1 vfat 0F63-B9A1 b80d135c-1870-4035-a2e2-7ad1fa763355 EFI
├─sdb6 ext4 9b243a8a-12c2-45b3-a54b-045682bd44df 0005fd0d-a9f0-607c-e2dc-fc171afa0b00è
Je suis surpris par cette information.
fdisk -l (filtered): ___________________________________________________________
Start End Sectors Size Type
sda2 528607232 560064511 31457280 15G Microsoft basic data
Dernière modification par geole (Le 27/08/2022, à 23:01)
Les grilles de l'installateur https://doc.ubuntu-fr.org/tutoriel/inst … _subiquity
"gedit admin:///etc/fstab" est proscrit, utilisez "pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY xdg-open /etc/fstab" Voir https://doc.ubuntu-fr.org/gedit
Les partitions EXT4 des disques externes => https://forum.ubuntu-fr.org/viewtopic.p … #p22697248
Hors ligne
#9 Le 27/08/2022, à 23:04
- MicP
Re : swap qui ne se monte pas
Tel qu'il est spécifié dans le fichier /etc/fstab, le système de fichiers de swap dont l'UUID est b23f3faa-381e-42f3-bb58-af5616f11378
et qui est dans la partition /dev/sda2 devrait être activé sans aucun problème.
Donc, s'il y a un problème, ça ne semble pas être un problème d'activation de swap.
Dernière modification par MicP (Le 28/08/2022, à 11:32)
Hors ligne
#10 Le 28/08/2022, à 05:06
- bricomega
Re : swap qui ne se monte pas
bonjour
voici la reponse
août 28 05:53:35 jean-asus kernel: x86/cpu: SGX disabled by BIOS.
août 28 05:53:35 jean-asus kernel: ACPI BIOS Error (bug): Could not resolve symbol [\_PR.PR00._CPC], AE_NOT_FOUND (20210730/psargs-330)
août 28 05:53:35 jean-asus kernel: ACPI Error: Aborting method \_PR.PR01._CPC due to previous error (AE_NOT_FOUND) (20210730/psparse-529)
août 28 05:53:35 jean-asus kernel: ACPI BIOS Error (bug): Could not resolve symbol [\_PR.PR00._CPC], AE_NOT_FOUND (20210730/psargs-330)
août 28 05:53:35 jean-asus kernel: ACPI Error: Aborting method \_PR.PR02._CPC due to previous error (AE_NOT_FOUND) (20210730/psparse-529)
août 28 05:53:35 jean-asus kernel: ACPI BIOS Error (bug): Could not resolve symbol [\_PR.PR00._CPC], AE_NOT_FOUND (20210730/psargs-330)
août 28 05:53:35 jean-asus kernel: ACPI Error: Aborting method \_PR.PR03._CPC due to previous error (AE_NOT_FOUND) (20210730/psparse-529)
août 28 05:53:35 jean-asus kernel: ACPI BIOS Error (bug): Could not resolve symbol [\_PR.PR00._CPC], AE_NOT_FOUND (20210730/psargs-330)
août 28 05:53:35 jean-asus kernel: ACPI Error: Aborting method \_PR.PR04._CPC due to previous error (AE_NOT_FOUND) (20210730/psparse-529)
août 28 05:53:35 jean-asus kernel: ACPI BIOS Error (bug): Could not resolve symbol [\_PR.PR00._CPC], AE_NOT_FOUND (20210730/psargs-330)
août 28 05:53:35 jean-asus kernel: ACPI Error: Aborting method \_PR.PR05._CPC due to previous error (AE_NOT_FOUND) (20210730/psparse-529)
août 28 05:53:35 jean-asus kernel: ACPI BIOS Error (bug): Could not resolve symbol [\_PR.PR00._CPC], AE_NOT_FOUND (20210730/psargs-330)
août 28 05:53:35 jean-asus kernel: ACPI Error: Aborting method \_PR.PR06._CPC due to previous error (AE_NOT_FOUND) (20210730/psparse-529)
août 28 05:53:35 jean-asus kernel: ACPI BIOS Error (bug): Could not resolve symbol [\_PR.PR00._CPC], AE_NOT_FOUND (20210730/psargs-330)
août 28 05:53:35 jean-asus kernel: ACPI Error: Aborting method \_PR.PR07._CPC due to previous error (AE_NOT_FOUND) (20210730/psparse-529)
août 28 05:53:35 jean-asus kernel: r8152 2-1:1.0 (unnamed net_device) (uninitialized): Invalid ether addr 00:00:00:00:00:00
août 28 05:53:35 jean-asus kernel: mtd device must be supplied (device name is empty)
août 28 05:53:36 jean-asus kernel: rtw_8821ce 0000:03:00.0: rfe 4 isn't supported
août 28 05:53:36 jean-asus kernel: rtw_8821ce 0000:03:00.0: failed to setup chip efuse info
août 28 05:53:36 jean-asus kernel: rtw_8821ce 0000:03:00.0: failed to setup chip information
août 28 05:53:36 jean-asus kernel: mtd device must be supplied (device name is empty)
août 28 05:53:37 jean-asus kernel: mtd device must be supplied (device name is empty)
août 28 05:55:53 jean-asus lightdm[1268]: gkr-pam: unable to locate daemon control file
~lines 1-23/23 (END)
en ce qui concerne la partie rtw 8821ce l'erreur est normale,c'est la carte wifit je n'ai pas installer les pilotes,quand au swap qui ne se montai pas j'ai modifié le fichier fstab et maintenant ça fonctionne,le problème c'est le temps de demarrage au moins 2 minutes,c'est un peu chiant même si ça n'empêche pas le fonctionnement normal
Hors ligne
#11 Le 28/08/2022, à 05:53
- xubu1957
Re : swap qui ne se monte pas
Bonjour,
Montre :
ubuntu-drivers devices
et d'éventuels paquets cassés :
dpkg -l | grep -v ^ii
Conseils pour les nouveaux demandeurs et pas qu'eux
Important : Pensez à passer vos sujets en [Réso|u] 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
En ligne
#12 Le 28/08/2022, à 06:28
- bricomega
Re : swap qui ne se monte pas
bonjour
voila
ean@jean-asus:~$ ubuntu-drivers devices
== /sys/devices/pci0000:00/0000:00:1c.5/0000:03:00.0 ==
modalias : pci:v000010ECd0000C821sv00001A3Bsd00003040bc02sc80i00
vendor : Realtek Semiconductor Co., Ltd.
model : RTL8821CE 802.11ac PCIe Wireless Network Adapter
driver : rtl8821ce-dkms - distro free
jean@jean-asus:~$
et
ean@jean-asus:~$ dpkg -l | grep -v ^ii
Souhait=inconnU/Installé/suppRimé/Purgé/H=à garder
| État=Non/Installé/fichier-Config/dépaqUeté/échec-conFig/H=semi-installé/W=attend-traitement-déclenchements
|/ Err?=(aucune)/besoin Réinstallation (État,Err: majuscule=mauvais)
||/ Nom Version Architecture Description
+++-========================================-==========================================-============-================================================================================
rc linux-image-5.15.0-25-generic 5.15.0-25.25 amd64 Signed kernel image generic
rc linux-image-5.15.0-27-generic 5.15.0-27.28 amd64 Signed kernel image generic
rc linux-image-5.15.0-30-generic 5.15.0-30.31 amd64 Signed kernel image generic
rc linux-image-5.15.0-33-generic 5.15.0-33.34 amd64 Signed kernel image generic
rc linux-image-5.15.0-37-generic 5.15.0-37.39 amd64 Signed kernel image generic
rc linux-image-5.15.0-39-generic 5.15.0-39.42 amd64 Signed kernel image generic
rc linux-image-5.15.0-40-generic 5.15.0-40.43 amd64 Signed kernel image generic
rc linux-image-5.15.0-41-generic 5.15.0-41.44 amd64 Signed kernel image generic
rc linux-modules-5.15.0-25-generic 5.15.0-25.25 amd64 Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
rc linux-modules-5.15.0-27-generic 5.15.0-27.28 amd64 Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
rc linux-modules-5.15.0-30-generic 5.15.0-30.31 amd64 Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
rc linux-modules-5.15.0-33-generic 5.15.0-33.34 amd64 Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
rc linux-modules-5.15.0-37-generic 5.15.0-37.39 amd64 Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
rc linux-modules-5.15.0-39-generic 5.15.0-39.42 amd64 Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
rc linux-modules-5.15.0-40-generic 5.15.0-40.43 amd64 Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
rc linux-modules-5.15.0-41-generic 5.15.0-41.44 amd64 Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
rc linux-modules-extra-5.15.0-25-generic 5.15.0-25.25 amd64 Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
rc linux-modules-extra-5.15.0-27-generic 5.15.0-27.28 amd64 Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
rc linux-modules-extra-5.15.0-30-generic 5.15.0-30.31 amd64 Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
rc linux-modules-extra-5.15.0-33-generic 5.15.0-33.34 amd64 Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
rc linux-modules-extra-5.15.0-37-generic 5.15.0-37.39 amd64 Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
rc linux-modules-extra-5.15.0-39-generic 5.15.0-39.42 amd64 Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
rc linux-modules-extra-5.15.0-40-generic 5.15.0-40.43 amd64 Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
rc linux-modules-extra-5.15.0-41-generic 5.15.0-41.44 amd64 Linux kernel extra modules for version 5.15.0 on 64 bit x86 SMP
rc snapd 2.56.2+22.04ubuntu1 amd64 Daemon and tooling that enable snap packages
jean@jean-asus:~$
en ce qui concerne RTL8821CE 802.11ac PCIe Wireless Network Adapter je n'ai pas installé le pilote donc si il y a une erreur à ce niveau c'est normal
Dernière modification par bricomega (Le 28/08/2022, à 06:30)
Hors ligne
#13 Le 28/08/2022, à 06:30
- xubu1957
Re : swap qui ne se monte pas
Pour purger les résidus de configuration marqués "rc" :
sudo apt purge ~c
comme expliqué à la machine à café.
Le pilote wifi RTL8821CE est disponible dans le gestionnaire_de_pilotes_proprietaires.
C'est toujours la carte graphique :
00:02.0 VGA compatible controller [0300]: Intel Corporation UHD Graphics 620 [8086:5917] (rev 07) (prog-if 00 [VGA controller])
Kernel driver in use: i915
Kernel modules: i915
vu dans problème d'affichage ?
Nous avons des anomalies remontées pour cette carte avec les noyaux 5.15 > Installation Kernel avec PPA mainline
Je vois un noyau 5.18 :
Debian GNU/Linux, with Linux 5.18.0-0.deb11.3-amd64 123bcb04-2606-4786-957c-2a41be0b46e4
Dernière modification par xubu1957 (Le 28/08/2022, à 06:31)
Conseils pour les nouveaux demandeurs et pas qu'eux
Important : Pensez à passer vos sujets en [Réso|u] 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
En ligne
#14 Le 28/08/2022, à 06:34
- bricomega
Re : swap qui ne se monte pas
bonjour
a priori je n'ai plus de problème d'affichage
Hors ligne
#15 Le 28/08/2022, à 06:37
- xubu1957
Re : swap qui ne se monte pas
Tu en avais ?
Je vois que tu avais enlevé les noyaux 5.15, et ajouté un noyau 5.18.
Conseils pour les nouveaux demandeurs et pas qu'eux
Important : Pensez à passer vos sujets en [Réso|u] 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
En ligne
#16 Le 28/08/2022, à 10:01
- bricomega
Re : swap qui ne se monte pas
bonjour
oui,avant en bas de l'écran j'avais des endroits oû quand je passais la souris dessus j'avais comme des dechirures dans l'affichage,mais maintenant ça ne le fait plus
et les noyaux ils se rajoutent quand je fais les mises à jour,moi j'y touche pas
Dernière modification par bricomega (Le 28/08/2022, à 10:03)
Hors ligne
#17 Le 28/08/2022, à 10:37
- xubu1957
Re : swap qui ne se monte pas
Fournis les noyaux présents :
echo; dpkg -l | awk '!/^rc/ && / linux-(c|g|h|i|lo|m|si|t)/{print $1,$2,$3,$4 | "sort -k3V | column -t"}' ; echo -e "\nNoyau courant : $(uname -mr)"
Il ne fait pas partie des noyaux officiels > linux-headers-generic
Tu l'as installé avec un tutoriel, le noyau 5.18 ?
Dernière modification par xubu1957 (Le 28/08/2022, à 10:40)
Conseils pour les nouveaux demandeurs et pas qu'eux
Important : Pensez à passer vos sujets en [Réso|u] 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
En ligne
#18 Le 29/08/2022, à 05:30
- bricomega
Re : swap qui ne se monte pas
bonjour
la seule explication possible c'est que j'avais installé les paquets ubuntu studio et le noyau temps reel,depuis j'ai desinstallé tout ça et aussi les paquets snap par la même occasion,,en fait ubuntu fonctionne très bien le seul truc c'est que ça mets un temps fou à demarrer
Hors ligne
#19 Le 29/08/2022, à 05:33
- xubu1957
Re : swap qui ne se monte pas
Bonjour,
Montre, en te servant du Retour utilisable de commande :
systemd-analyze time
systemd-analyze blame
systemd-analyze critical-chain
et :
ls -l /var/crash
Conseils pour les nouveaux demandeurs et pas qu'eux
Important : Pensez à passer vos sujets en [Réso|u] 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
En ligne
#20 Le 29/08/2022, à 06:54
- iznobe
Re : swap qui ne se monte pas
Bonjour , on note dans les erreurs a relever :
août 28 05:53:35 jean-asus kernel: r8152 2-1:1.0 (unnamed net_device) (uninitialized): Invalid ether addr 00:00:00:00:00:00
....
août 28 05:53:36 jean-asus kernel: rtw_8821ce 0000:03:00.0: rfe 4 isn't supported
août 28 05:53:36 jean-asus kernel: rtw_8821ce 0000:03:00.0: failed to setup chip efuse info
août 28 05:53:36 jean-asus kernel: rtw_8821ce 0000:03:00.0: failed to setup chip information
...
août 28 05:55:53 jean-asus lightdm[1268]: gkr-pam: unable to locate daemon control file
je ne saurais trop dire si ' est important a prendre en compte .
et aussi :
ean@jean-asus:~$ ubuntu-drivers devices
== /sys/devices/pci0000:00/0000:00:1c.5/0000:03:00.0 ==
modalias : pci:v000010ECd0000C821sv00001A3Bsd00003040bc02sc80i00
vendor : Realtek Semiconductor Co., Ltd.
model : RTL8821CE 802.11ac PCIe Wireless Network Adapter
driver : rtl8821ce-dkms - distro free
jean@jean-asus:~$
est ce que cela veut dire que la carte wifi serait mal détectée ? le pilote n' est peut etre pas celui approprié pour cette carte wifi ?
La carte reseau ethernet parait ne plus avoir d' adresse MAC ... peut etre qu' elle est morte ?
ce qui m ' étonne avec ce qu ' on voit là , c ' est qu ' internet fonctionne correctement sur cette machine , cela parait surprenant .
Dernière modification par iznobe (Le 29/08/2022, à 06:59)
retour COMPLET et utilisable de commande
MSI Z490A-pro , i7 10700 , 32 GB RAM .
Hors ligne
#21 Le 29/08/2022, à 07:09
- xubu1957
Re : swap qui ne se monte pas
août 28 05:53:36 jean-asus kernel: rtw_8821ce 0000:03:00.0: rfe 4 isn't supported
août 28 05:53:36 jean-asus kernel: rtw_8821ce 0000:03:00.0: failed to setup chip efuse info
août 28 05:53:36 jean-asus kernel: rtw_8821ce 0000:03:00.0: failed to setup chip information
Dans askubuntu.com/questions/1390106/how-to-activate-wifi-on-new-laptop
On voit chili555, faire des propositions d'améliorations.
Conseils pour les nouveaux demandeurs et pas qu'eux
Important : Pensez à passer vos sujets en [Réso|u] 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
En ligne
#22 Le 29/08/2022, à 08:56
- malbo
Re : swap qui ne se monte pas
Extrait du Boot-info du post #7 :
----------------------------------------------------------------------------------------
parted -lm (filtered): _________________________________________________________
sda:1000GB:scsi:512:4096:gpt:ATA ST1000LM035-1RK1:;
1:1049kB:271GB:271GB:ntfs:windows data:msftdata;
2:271GB:287GB:16.1GB:linux-swap(v1):swap:msftdata;
3:287GB:496GB:210GB:ext4:home debian:;
4:496GB:706GB:210GB:ext4:home kde:;
5:706GB:1000GB:294GB:ext4:home ubuntu:;
sdb:256GB:scsi:512:512:gpt:ATA SanDisk SD9SN8W2:;
1:1049kB:274MB:273MB:fat32:EFI system partition:boot, esp;
2:274MB:290MB:16.8MB::Microsoft reserved partition:msftres;
3:290MB:96.0GB:95.7GB:ntfs:windows:msftdata;
4:96.0GB:144GB:48.3GB:ext4:systeme debian:msftdata;
5:144GB:193GB:48.3GB:ext4:systeme kde:msftdata;
6:193GB:255GB:62.7GB:ext4:systeme ubuntu:msftdata;
7:255GB:256GB:682MB:ntfs:win recovery:hidden, diag;
-----------------------------------------------------------------------------------------------
Toutes les mentions "msftdata" que j'ai mises en gras n'ont rien à faire là puisqu'il ne s'agit pas de partitions microsoft (il s'agit d'une partition swap et de partitions ext4). Cela rejoint ce que geole a noté à la fin de son post #8 (mention "Microsoft basic data" alors qu'il s'agit d'une partition swap).
Dernière modification par malbo (Le 29/08/2022, à 08:58)
Hors ligne
#23 Le 29/08/2022, à 10:43
- bricomega
Re : swap qui ne se monte pas
bonjour
je n'ai pas installé les pilotes wifi pour la carte RTL8821CE 802.11ac PCIe Wireless Network Adapter,car c'est un pilote proprietaire ,par contre l'ethernet fonctionne parfaitement sans installation particulière.
voila les réponses aux commandes
jean@jean-asus:~$ systemd-analyze time
Startup finished in 6.450s (firmware) + 8.035s (loader) + 36.184s (kernel) + 9.245s (userspace) = 59.916s
graphical.target reached after 9.236s in userspace
jean@jean-asus:~$
et aussi
jean@jean-asus:~$ systemd-analyze blame
6.440s NetworkManager-wait-online.service
811ms user@1000.service
654ms udisks2.service
637ms blueman-mechanism.service
577ms networkd-dispatcher.service
534ms dev-sdb6.device
445ms systemd-fsck@dev-disk-by\x2duuid-3c238729\x2d6050\x2d4da2\x2d98c8\x2d320>
233ms systemd-journal-flush.service
212ms accounts-daemon.service
206ms home.mount
193ms systemd-resolved.service
173ms networking.service
136ms avahi-daemon.service
135ms systemd-modules-load.service
135ms systemd-udev-trigger.service
130ms upower.service
129ms bluetooth.service
127ms modprobe@mtdpstore.service
126ms NetworkManager.service
121ms ModemManager.service
110ms systemd-journald.service
109ms polkit.service
109ms systemd-udevd.service
106ms keyboard-setup.service
104ms modprobe@chromeos_pstore.service
103ms update-notifier-download.service
100ms apport.service
95ms gpu-manager.service
91ms secureboot-db.service
87ms apparmor.service
83ms systemd-fsck@dev-disk-by\x2duuid-0F63\x2dB9A1.service
83ms systemd-logind.service
82ms wpa_supplicant.service
81ms thermald.service
73ms alsa-restore.service
72ms grub-common.service
59ms e2scrub_reap.service
59ms rsyslog.service
57ms lightdm.service
52ms plymouth-quit-wait.service
49ms cups.service
44ms dev-hugepages.mount
43ms dev-mqueue.mount
43ms sys-kernel-debug.mount
42ms sys-kernel-tracing.mount
41ms lm-sensors.service
39ms kmod-static-nodes.service
38ms modprobe@configfs.service
38ms modprobe@drm.service
36ms modprobe@fuse.service
36ms systemd-update-utmp.service
28ms systemd-tmpfiles-setup.service
27ms boot-efi.mount
25ms systemd-remount-fs.service
25ms grub-initrd-fallback.service
24ms systemd-tmpfiles-setup-dev.service
19ms plymouth-start.service
19ms dev-disk-by\x2duuid-b23f3faa\x2d381e\x2d42f3\x2dbb58\x2daf5616f11378.swap
19ms modprobe@efi_pstore.service
15ms kerneloops.service
13ms systemd-sysusers.service
13ms openvpn.service
13ms setvtrgb.service
13ms systemd-sysctl.service
13ms user-runtime-dir@1000.service
12ms plymouth-read-write.service
12ms modprobe@pstore_blk.service
10ms rtkit-daemon.service
8ms modprobe@pstore_zone.service
8ms systemd-backlight@backlight:intel_backlight.service
7ms systemd-user-sessions.service
7ms modprobe@ramoops.service
7ms systemd-update-utmp-runlevel.service
6ms systemd-backlight@leds:asus::kbd_backlight.service
6ms systemd-random-seed.service
5ms ifupdown-pre.service
5ms console-setup.service
3ms sys-fs-fuse-connections.mount
3ms sys-kernel-config.mount
2ms ufw.service
lines 58-80/80 (END)
par contre à cette commande le terminal ne me redonne pas la main
et aussi
The time when unit became active or started is printed after the "@" character.
The time the unit took to start is printed after the "+" character.
graphical.target @9.236s
└─multi-user.target @9.235s
└─kerneloops.service @9.219s +15ms
└─network-online.target @9.210s
└─NetworkManager-wait-online.service @2.767s +6.440s
└─NetworkManager.service @2.625s +126ms
└─dbus.service @2.621s
└─basic.target @2.595s
└─sockets.target @2.593s
└─uuidd.socket @2.590s
└─sysinit.target @2.558s
└─apparmor.service @2.454s +87ms
└─local-fs.target @2.453s
└─home.mount @2.245s +206ms
└─systemd-fsck@dev-disk-by\x2duuid-3c238729\x2d6050\x2d4da2\x2d98c8\x2d3202529d8da3.service @1.797s +445ms
└─dev-disk-by\x2duuid-3c238729\x2d6050\x2d4da2\x2d98c8\x2d3202529d8da3.device @1.794s
~
~lines 1-19/19 (END)
là aussi le terminal ne me rend pas la main
Hors ligne
#24 Le 29/08/2022, à 10:52
- iznobe
Re : swap qui ne se monte pas
@malbo : ok .
comment s ' assurer de savoir si c ' est un bug de boot-info ou bien d ' ailleurs dans le systeme du coup ?
en essayant de recuperer les infos de partition manuellement peut etre ? ( sous différentes formes )
Dernière modification par iznobe (Le 29/08/2022, à 10:52)
retour COMPLET et utilisable de commande
MSI Z490A-pro , i7 10700 , 32 GB RAM .
Hors ligne
#25 Le 29/08/2022, à 11:09
- bricomega
Re : swap qui ne se monte pas
bonjour
à mon avis c'est dans l'efi qu'il y a la pagaille,mais je ne me sens pas d'y toucher,j'ai 4 distros sur mon ordi,win10,ubuntu et 2 debian,j'ai peur que si je touche à l'efi plus rien ne demarre
Hors ligne