Contenu | Rechercher | Menus

Annonce

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

À propos de l'équipe du forum.

#101 Le 19/10/2023, à 11:00

Compte supprimé

Re : Défilement de lignes après lancement du grub [RESOLU]

vous avez tous vu que mettre l'option splash est stupide.

C'est bien possible, mais à quoi le voit-on ?
Cela fonctionne très bien sur mon Ubuntu.

Quand à la purge, comme vu plus haut, autant aller au bout de la démarche et supprimer Grub et tous les répertoires dans EFI sauf microsoft et refind.
Et pour finir, purger la NVRAM des entrées obsolètes.
Qu'en pense geole ?

Dernière modification par Compte supprimé (Le 19/10/2023, à 11:08)

#102 Le 19/10/2023, à 13:26

Didiéridou

Re : Défilement de lignes après lancement du grub [RESOLU]

geole a écrit :
Didiéridou a écrit :

...et pour épurer le Refind des propositions superflues ou qui ne mènent à rien ?

Je pense que tu évoques les icônes qui ne servent à rien
C'est du parametrage dans le fichier /boot/efi/EFI/refind/refind.conf

Dans ce fichier voici ce que j'ai:

menuentry Linux {
    icon EFI/refind/icons/os_linux.png
    volume 904404F8-B481-440C-A1E3-11A5A954E601
    loader bzImage-3.3.0-rc7
    initrd initrd-3.3.0.img
    options "ro root=UUID=5f96cafa-e0a7-4057-b18f-fa709db5b837"
    disabled
}

...

menuentry "Arch Linux" {
    icon     /EFI/refind/icons/os_arch.png
    volume   "Arch Linux"
    loader   /boot/vmlinuz-linux
    initrd   /boot/initramfs-linux.img
    options  "root=PARTUUID=5028fa50-0079-4c40-b240-abfaf28693ea rw add_efi_memmap"
    submenuentry "Boot using fallback initramfs" {
        initrd /boot/initramfs-linux-fallback.img
    }
    submenuentry "Boot to terminal" {
        add_options "systemd.unit=multi-user.target"
    }
    disabled
}

...

menuentry Ubuntu {
    loader /EFI/ubuntu/grubx64.efi
    icon /EFI/refind/icons/os_linux.png
    disabled
}

...

menuentry "ELILO" {
    loader \EFI\elilo\elilo.efi
    disabled
}

...

menuentry "Windows 7" {
    loader \EFI\Microsoft\Boot\bootmgfw.efi
    disabled
}

...

menuentry "Windows via shell script" {
    icon \EFI\refind\icons\os_win.png
    loader \EFI\tools\shell.efi
    options "fs0:\EFI\tools\launch_windows.nsh"
    disabled
}

...

menuentry "My macOS" {
    icon \EFI\refind\icons\os_mac.png
    volume "macOS boot"
    loader \System\Library\CoreServices\boot.efi
    disabled
}

...

menuentry "macOS via BootNext" {
    icon /EFI/refind/icons/os_mac.png
    firmware_bootnum 80
    disabled
}

Sous Linux (Ubuntu et maintenant EOS) depuis au moins 2006 et d'autant plus ravi d'y être quand je reboot par nécessité sur Win... et que je vois la disponibilité et la réactivité compétente des membres des forums !

Hors ligne

#103 Le 19/10/2023, à 13:34

Didiéridou

Re : Défilement de lignes après lancement du grub [RESOLU]

IMG-20231019-132923.jpg IMG-20231019-132932.jpg
Voici les 6 icônes que j'ai.


Sous Linux (Ubuntu et maintenant EOS) depuis au moins 2006 et d'autant plus ravi d'y être quand je reboot par nécessité sur Win... et que je vois la disponibilité et la réactivité compétente des membres des forums !

Hors ligne

#104 Le 19/10/2023, à 13:50

Compte supprimé

Re : Défilement de lignes après lancement du grub [RESOLU]

Lesquelles de ces six icônes sont inutiles ?

#105 Le 19/10/2023, à 15:09

Didiéridou

Re : Défilement de lignes après lancement du grub [RESOLU]

La 2 EFI\UBUNTU\grubx64.efi => lance grub épuré
La 3 (Fallback boot loader from no name) => lance grub épuré
La 5 vmLinuz from EOS7 => bug !
Donc je pense ôter la 3 et la 5.

Je pensais supprimer au moins ce qui concerne Mac ("My macOS" et "macOS via BootNext")
"ELILO" ???


Sous Linux (Ubuntu et maintenant EOS) depuis au moins 2006 et d'autant plus ravi d'y être quand je reboot par nécessité sur Win... et que je vois la disponibilité et la réactivité compétente des membres des forums !

Hors ligne

#106 Le 19/10/2023, à 16:09

Compte supprimé

Re : Défilement de lignes après lancement du grub [RESOLU]

Il n'y a aucun lien de cause à effet entre les lignes de refind.conf que tu cites plus haut et l'affichage des icônes de choix.
Ce sont des modèles en cas de configuration manuelle complémentaire. Tu as de quoi lire smile

Quand aux icônes en trop, c'est juste le résultat du contenu du répertoire EFI et de ton appréciation des choses.
Que veux-tu dire par "Grub épuré" ?

Je ne sais plus combien tu as de disques et d'esp, ni ce que contient l'esp du disque dont tu parles.

Dernière modification par Compte supprimé (Le 19/10/2023, à 16:11)

#107 Le 19/10/2023, à 16:35

geole

Re : Défilement de lignes après lancement du grub [RESOLU]

Didiéridou a écrit :

didier@didier-Ubuntu:~$ journalctl --no-pager -b -g splash
oct. 19 10:08:00 didier-Ubuntu kernel: Command line: ro root=UUID=a847127f-af2f-495d-9114-a0f708e54732 quiet splash  initrd=boot\initrd.img-5.15.0-86-generic
oct. 19 10:08:00 didier-Ubuntu kernel: Kernel command line: ro root=UUID=a847127f-af2f-495d-9114-a0f708e54732 quiet splash  initrd=boot\initrd.img-5.15.0-86-generic
oct. 19 10:08:00 didier-Ubuntu kernel: Unknown kernel command line parameters "splash", will be passed to user space.
oct. 19 10:08:00 didier-Ubuntu kernel:     splash
oct. 19 10:08:03 didier-Ubuntu /usr/libexec/gdm-x-session[1594]: Kernel command line: ro root=UUID=a847127f-af2f-495d-9114-a0f708e54732 quiet splash  initrd=boot\initrd.img-5.15.0-86-generic

traduction automatique a écrit :

I : Les paramètres de ligne de commande inconnus du noyau "splash", seront transmis à l'espace utilisateur.

J'en déduis que ce n'est pas traité. Donc  c'est inutile de se fatiguer à écrire le mot.    Je pense qu'il n'y a pas de faute d'orthographe. Cette option est désuète.

Dernière modification par geole (Le 19/10/2023, à 19:33)


Les grilles de l'installateur https://doc.ubuntu-fr.org/tutoriel/inst … _subiquity

Les partitions EXT4 des disques externes => https://forum.ubuntu-fr.org/viewtopic.p … #p22697248

En ligne

#108 Le 19/10/2023, à 16:50

geole

Re : Défilement de lignes après lancement du grub [RESOLU]

menuentry "macOS via BootNext" {
    icon /EFI/refind/icons/os_mac.png
    firmware_bootnum 80
    disabled
}

Tant que tu as ce mot disable, le menu n'est pas affiché. Ce sont  des exemples pour  le traitement des cas que refind  n'a pas prévu.   Un cas d'utilisation est lorsqu'on doit se servir   du fichier de boot de windows pour lancer  les ubuntu, on se sert d'une de ces commandes pour lancer alors windows.

Ton cas est simple. Cela se traite avec décommentant des lignes en amont.
Voici un exemple qui élimine des lignes.
dont_scan_files shim.efi,MokManager.efi,bootx64.efi
éventuellement
dont_scan_files shim.efi,MokManager.efi,bootx64.efi,grubx64.efi
ainsi que
dont_scan_volumes "Recovery HD"    ou tu remplacerais  "Recovery HD" par l'étiquette qui est allouée à la partition EOS7.
Je voudrais d'ailleurs comprendre pourquoi cela ne fonctionne pas.
Tu as encore cette possibilité des répertoires. L'exemple commenté est
#dont_scan_dirs ESP:/EFI/boot,EFI/Dell,EFI/memtest86
mais je ne sais plus comment on mets plusieurs répertoires de plusieurs partitions

Dernière modification par geole (Le 19/10/2023, à 16:58)


Les grilles de l'installateur https://doc.ubuntu-fr.org/tutoriel/inst … _subiquity

Les partitions EXT4 des disques externes => https://forum.ubuntu-fr.org/viewtopic.p … #p22697248

En ligne

#109 Le 19/10/2023, à 17:12

Didiéridou

Re : Défilement de lignes après lancement du grub [RESOLU]

Tamarou a écrit :

Il n'y a aucun lien de cause à effet entre les lignes de refind.conf que tu cites plus haut et l'affichage des icônes de choix.
Ce sont des modèles en cas de configuration manuelle complémentaire. Tu as de quoi lire smile

Quand aux icônes en trop, c'est juste le résultat du contenu du répertoire EFI et de ton appréciation des choses.

J'aimerai bien n'en avoir que trois ou quatre comme avec le grub épuré.

Que veux-tu dire par "Grub épuré" ?...

Windows + Ubuntu + EOS7

...Je ne sais plus combien tu as de disques et d'esp, ni ce que contient l'esp du disque dont tu parles.

Capture-d-cran-du-2023-10-19-17-09-07.png Capture-d-cran-du-2023-10-19-17-09-30.png


Sous Linux (Ubuntu et maintenant EOS) depuis au moins 2006 et d'autant plus ravi d'y être quand je reboot par nécessité sur Win... et que je vois la disponibilité et la réactivité compétente des membres des forums !

Hors ligne

#110 Le 19/10/2023, à 17:31

Didiéridou

Re : Défilement de lignes après lancement du grub [RESOLU]

geole a écrit :

... Ce sont  des exemples pour  le traitement des cas que refind  n'a pas prévu.   Un cas d'utilisation est lorsqu'on doit se servir   du fichier de boot de windows pour lancer  les ubuntu, on se sert d'une de ces commandes pour lancer alors windows.

Ton cas est simple. Cela se traite avec décommentant des lignes en amont.
Voici un exemple qui élimine des lignes.
dont_scan_files shim.efi,MokManager.efi,bootx64.efi
éventuellement
dont_scan_files shim.efi,MokManager.efi,bootx64.efi,grubx64.efi
ainsi que
dont_scan_volumes "Recovery HD"    ou tu remplacerais  "Recovery HD" par l'étiquette qui est allouée à la partition EOS7.

EOS7 donc ?

Je voudrais d'ailleurs comprendre pourquoi cela ne fonctionne pas.

C'est pas moi qui te dira ...

Tu as encore cette possibilité des répertoires. L'exemple commenté est
#dont_scan_dirs ESP:/EFI/boot,EFI/Dell,EFI/memtest86
mais je ne sais plus comment on mets plusieurs répertoires de plusieurs partitions

???

J'avais cru comprendre que c'était dans ce fichier (refind.conf) qu'on pouvait  choisir quoi afficher ???
Dans ce fichier j'ai remarqué cette ligne qui est décommentée:
use_nvram false

Dernière modification par Didiéridou (Le 19/10/2023, à 17:41)


Sous Linux (Ubuntu et maintenant EOS) depuis au moins 2006 et d'autant plus ravi d'y être quand je reboot par nécessité sur Win... et que je vois la disponibilité et la réactivité compétente des membres des forums !

Hors ligne

#111 Le 19/10/2023, à 17:47

Compte supprimé

Re : Défilement de lignes après lancement du grub [RESOLU]

https://unix.stackexchange.com/question … -but-works

@Didiéridou
A ce stade, le mieux serait que tu regardes la documentation disponible si tu veux affiner le fonctionnement de tes outils.
Bien entendu, si après étude de la documentation disponible, il reste des points à éclairer, on essayera de répondre à tes questions.

Et, pour mon instruction, quel est l'intérêt d'avoir EOS ? J'imagine qu'il fait des choses utiles qu'Ubuntu ne sait pas faire.

Dernière modification par Compte supprimé (Le 19/10/2023, à 17:57)

#112 Le 19/10/2023, à 17:51

Didiéridou

Re : Défilement de lignes après lancement du grub [RESOLU]

https://a.fsdn.com/con/app/proj/refind/ … /max/max/1

Je n'avais pas remarqué qu'on pouvait éditer à partir de cet écran !
Vous me le conseillez ?


Sous Linux (Ubuntu et maintenant EOS) depuis au moins 2006 et d'autant plus ravi d'y être quand je reboot par nécessité sur Win... et que je vois la disponibilité et la réactivité compétente des membres des forums !

Hors ligne

#113 Le 19/10/2023, à 18:05

Didiéridou

Re : Défilement de lignes après lancement du grub [RESOLU]

Didiéridou a écrit :

https://a.fsdn.com/con/app/proj/refind/ … /max/max/1

Je n'avais pas remarqué qu'on pouvait éditer à partir de cet écran !
Vous me le conseillez ?

Bin non j'ai pas la main...


Sous Linux (Ubuntu et maintenant EOS) depuis au moins 2006 et d'autant plus ravi d'y être quand je reboot par nécessité sur Win... et que je vois la disponibilité et la réactivité compétente des membres des forums !

Hors ligne

#114 Le 19/10/2023, à 18:12

Didiéridou

Re : Défilement de lignes après lancement du grub [RESOLU]

Tamarou a écrit :

https://unix.stackexchange.com/question … -but-works

@Didiéridou
A ce stade, le mieux serait que tu regardes la documentation disponible si tu veux affiner le fonctionnement de tes outils.
Bien entendu, si après étude de la documentation disponible, il reste des points à éclairer, on essayera de répondre à tes questions...

La doc en anglais ... j'ai beaucoup de soucis pour bien comprendre tout ce qui y est mentionné hmm

...Et, pour mon instruction, quel est l'intérêt d'avoir EOS ? J'imagine qu'il fait des choses utiles qu'Ubuntu ne sait pas faire.

Il est plus "léger" et, hormis les forums qui ne sont pas tout à fait à la hauteur de tous ceux de Ubuntu wink, ça tourne plutôt pas mal. et basé sur Ubuntu
tout de même.


Sous Linux (Ubuntu et maintenant EOS) depuis au moins 2006 et d'autant plus ravi d'y être quand je reboot par nécessité sur Win... et que je vois la disponibilité et la réactivité compétente des membres des forums !

Hors ligne

#115 Le 19/10/2023, à 19:30

Compte supprimé

Re : Défilement de lignes après lancement du grub [RESOLU]

geole a écrit :

Cela me rassure que quiet splash ne soit pas mis en automatique, je commençais à avoir un doute pour ma vieille version.

Alors tu peux t'inquiéter car j'avais testé sur une Ubuntu 23.10 et je viens de refaire pour être certain.
J'ai désinstallé rEFInd et supprimé le répertoire /boot/efi/EFI/refind ainsi que le fichier /boot/refind_linux.conf.

A la suite de quoi, j'ai installé refind et voilà :

toto@toto-VirtualBox:~$ sudo cat /boot/refind_linux.conf
"Boot with standard options"  "ro root=UUID=da0f834c-30cc-484c-b805-a3cf81b0ec53 quiet splash"
"Boot to single-user mode"    "ro root=UUID=da0f834c-30cc-484c-b805-a3cf81b0ec53 quiet splash single"
"Boot with minimal options"   "ro root=UUID=da0f834c-30cc-484c-b805-a3cf81b0ec53"
toto@toto-VirtualBox:~$ 

Dernière modification par Compte supprimé (Le 19/10/2023, à 19:33)

#116 Le 19/10/2023, à 19:51

geole

Re : Défilement de lignes après lancement du grub [RESOLU]

Je suis  en plein test 22.10 d'installation sur  un disque USB, J'ai booté avec et y ai installé refind
Effectivement   le contenu est le suivant

cat /mnt/boot/refind*
"Boot with standard options"  "root=UUID=de697384-0095-4e7a-8efe-b9a12999a833 ro quiet splash vt.handoff=7"
"Boot to single-user mode"    "root=UUID=de697384-0095-4e7a-8efe-b9a12999a833 ro quiet splash vt.handoff=7 single"
"Boot with minimal options"   "ro root=UUID=de697384-0095-4e7a-8efe-b9a12999a833"

Sans l'avoir regardé, j'ai viré le refind que j'avais, cela a pris un peu temps, car il était à plein d'endroits, Je l'ai réinstallé  dans mon  le ubuntu 22.04,
Mais j'avais oublié de  supprimer la configuration. Elle est donc restée ce que j'avais.  Attention les yeux.

"Boot with standard options"  "root=UUID=79cea674-14f7-4780-b5a3-898dd31ec6b2  ro loglevel=3"
"Boot to single-user mode"    "root=UUID=79cea674-14f7-4780-b5a3-898dd31ec6b2  ro single debug ignore_loglevel "
"Boot with minimal options"   "ro root=UUID=79cea674-14f7-4780-b5a3-898dd31ec6b2 nomodeset debug ignore_loglevel"
"Boot with standard options"  "root=UUID=79cea674-14f7-4780-b5a3-898dd31ec6b2 nomodeset ro loglevel=3"
"Boot to single-user mode"    "root=UUID=79cea674-14f7-4780-b5a3-898dd31ec6b2 nomodeset ro single debug ignore_loglevel "
"Boot with minimal options"   "ro root=UUID=79cea674-14f7-4780-b5a3-898dd31ec6b2 nomodeset debug ignore_loglevel

manifestement, j'ai oublié le mot recovery.


Les grilles de l'installateur https://doc.ubuntu-fr.org/tutoriel/inst … _subiquity

Les partitions EXT4 des disques externes => https://forum.ubuntu-fr.org/viewtopic.p … #p22697248

En ligne

#117 Le 20/10/2023, à 01:27

geole

Re : Défilement de lignes après lancement du grub [RESOLU]

Pour Didiéridou
Pour modifier le fichier

gedit admin:///boot/efi/EFI/refind/refind.conf

Puis tu ajoutes cette première ligne     en mettant  les noms des labels des partitions que tu ne  veux pas faire examiner à la place de mes deux noms
dont_scan_volumes "SAVECOMMUN","Data"
Tu peux les obtenir avec cette commande sudo blkid
et cette ligne
dont_scan_dirs /EFI/boot,EFI/ubuntu,EFI/memtest86
Du coup, tous ces répertoires ne seront pas examinés. Au besoin, tu peux en ajouter. Mais il faudrait savoir lesquels.
N'oublie pas de sauver avant de quitter.

Dernière modification par geole (Le 20/10/2023, à 01:29)


Les grilles de l'installateur https://doc.ubuntu-fr.org/tutoriel/inst … _subiquity

Les partitions EXT4 des disques externes => https://forum.ubuntu-fr.org/viewtopic.p … #p22697248

En ligne

#118 Le 20/10/2023, à 09:38

Didiéridou

Re : Défilement de lignes après lancement du grub [RESOLU]

geole a écrit :

Pour Didiéridou
Pour modifier le fichier

gedit admin:///boot/efi/EFI/refind/refind.conf

Puis tu ajoutes cette première ligne     en mettant  les noms des labels des partitions que tu ne  veux pas faire examiner à la place de mes deux noms
dont_scan_volumes "SAVECOMMUN","Data"
Tu peux les obtenir avec cette commande sudo blkid
et cette ligne
dont_scan_dirs /EFI/boot,EFI/ubuntu,EFI/memtest86
Du coup, tous ces répertoires ne seront pas examinés. Au besoin, tu peux en ajouter. Mais il faudrait savoir lesquels.
N'oublie pas de sauver avant de quitter.

Bon ce n'est pas que je ne veux pas les examiner mais seulement je ne veux pas voir les lignes défiler ...


Sous Linux (Ubuntu et maintenant EOS) depuis au moins 2006 et d'autant plus ravi d'y être quand je reboot par nécessité sur Win... et que je vois la disponibilité et la réactivité compétente des membres des forums !

Hors ligne

#119 Le 20/10/2023, à 09:45

Compte supprimé

Re : Défilement de lignes après lancement du grub [RESOLU]

je ne veux pas voir les lignes défiler ...

De quelles lignes est-il question ?
Les informations que te donne geole sont relatives à la suppression des icônes que tu ne veux pas afficher sur la fenêtre de choix de rEFInd, les six icônes.
Pour qu'elles disparaissent, il faut dire à rEFInd de ne pas en tenir compte, ne pas aller les lire ou lire dans les répertoires concernés.
Une autre solution plus radicale consisterait en la suppression de Grub, memtest et tout ce qui te gène. Il ne te resterait que trois icônes, une par OS.

Par contre pour le défilement des lignes au démarrage, et maintenant que l'option quiet est en place, s'il y a des erreurs au boot, tu verras quand-même  des lignes défiler tant que les erreurs ne seront pas corrigées.

D'autre part, j'ai vu plus haut que tu as une partition "home commun", c'est juste un label ou tu montes vraiment la même partition dans /home sur les deux OS ?

Dernière modification par Compte supprimé (Le 20/10/2023, à 09:53)

#120 Le 20/10/2023, à 10:28

Didiéridou

Re : Défilement de lignes après lancement du grub [RESOLU]

Capture-d-cran-du-2023-10-20-10-03-50-Sda.png

Capture-d-cran-du-2023-10-20-10-04-46-Sdb.png

Je voudrais garder un lancement possible vers Windows, Ubuntu et EOS7.
Dans l'ordre de gauche à droite j'ai:
1-Boot Microsoft EFI boot from System (Windows sans doute ??? si oui donc à garder)   "/dev/sda1: LABEL="SYSTEM" UUID="0CED-EBAB" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="SYSTEMFAT32bootESP" PARTUUID="0a97e305-2f2d-452e-8be8-acc821e1b4c9"
ou
/dev/sda3: LABEL="Systeme" BLOCK_SIZE="512" UUID="A098FA2398F9F81C" TYPE="ntfs" PARTUUID="8c325e9e-7f85-4ea6-a2ce-ad822ed18c9b"

2-BootEfi\Ubuntu\grubx64.efi from boot,esp (=> celle-là lance le grub) "/dev/sdb1: UUID="C483-DBB3" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="boot,esp" PARTUUID="5ae5d080-5a1f-4160-b102-99ea06a8e47a"

3-Boot Fallback boot loader from boot,esp (=> celle-là aussi lance le grub)??? "/dev/sdb3: UUID="a847127f-af2f-495d-9114-a0f708e54732" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="UBUNTU" PARTUUID="6100e446-6d3b-4464-bc3b-2ab18243b6fb" c'est celui-là?
4-Boot \vmLinuz-5.15.0-86-generic from Ubuntu (=> à garder) ou  celui-là ?
5-Boot vmLinuz from EOS7 (=> à supprimer) ???
6-Boot boot\vmLinuz-6.2.0.34-generic from EOS7 (à garder) "/dev/sdb5: LABEL="EOS7" UUID="e441a19f-0001-4d1e-8e73-5c401fd2f5ec" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="ELEMENTARY07" PARTUUID="bf5ae3ef-bfa1-438e-992a-1b1deb4fcbfe"


Quant au "homecommun" c'est surtout que je veux y avoir accès depuis les deux distrib LINUX mais il n'est pas reconnu directement comme 'home" dans EOS7.
Autrement dit c'est le home Ubuntu qui se nomme homecommun.


Sous Linux (Ubuntu et maintenant EOS) depuis au moins 2006 et d'autant plus ravi d'y être quand je reboot par nécessité sur Win... et que je vois la disponibilité et la réactivité compétente des membres des forums !

Hors ligne

#121 Le 20/10/2023, à 10:29

geole

Re : Défilement de lignes après lancement du grub [RESOLU]

Didiéridou a écrit :
geole a écrit :

Je voudrais d'ailleurs comprendre pourquoi cela ne fonctionne pas.

C'est pas moi qui te dira ...

D'après cette description, je ne peux comprendre les messages qui devraient expliquer le non-fonctionnement de EOS7, De plus au tout début de la discussion, tu disais qu'il fonctionnait et qu'à priorii refind le lançait....
Je te propose de faire un point global en publiant l'URL générée par  un boot-info que tu  vas faire,
On y verra les paramétrages et un peu plus. https://doc.ubuntu-fr.org/tutoriel/boot-info


Les grilles de l'installateur https://doc.ubuntu-fr.org/tutoriel/inst … _subiquity

Les partitions EXT4 des disques externes => https://forum.ubuntu-fr.org/viewtopic.p … #p22697248

En ligne

#122 Le 20/10/2023, à 10:30

Didiéridou

Re : Défilement de lignes après lancement du grub [RESOLU]

Tamarou a écrit :

je ne veux pas voir les lignes défiler ...

De quelles lignes est-il question ?

C'est bon avec le dernier rebboot celles qui me gênaient ont disparue !


Sous Linux (Ubuntu et maintenant EOS) depuis au moins 2006 et d'autant plus ravi d'y être quand je reboot par nécessité sur Win... et que je vois la disponibilité et la réactivité compétente des membres des forums !

Hors ligne

#123 Le 20/10/2023, à 11:04

Didiéridou

Re : Défilement de lignes après lancement du grub [RESOLU]

geole a écrit :
Didiéridou a écrit :
geole a écrit :

Je voudrais d'ailleurs comprendre pourquoi cela ne fonctionne pas.

C'est pas moi qui te dira ...

D'après cette description, je ne peux comprendre les messages qui devraient expliquer le non-fonctionnement de EOS7, De plus au tout début de la discussion, tu disais qu'il fonctionnait et qu'à priorii refind le lançait....
Je te propose de faire un point global en publiant l'URL générée par  un boot-info que tu  vas faire,
On y verra les paramétrages et un peu plus. https://doc.ubuntu-fr.org/tutoriel/boot-info

Ce sera sans doute plus simple ...
https://paste.ubuntu.com/p/Mcxm76z3ny/


Sous Linux (Ubuntu et maintenant EOS) depuis au moins 2006 et d'autant plus ravi d'y être quand je reboot par nécessité sur Win... et que je vois la disponibilité et la réactivité compétente des membres des forums !

Hors ligne

#124 Le 20/10/2023, à 11:13

xubu1957

Re : Défilement de lignes après lancement du grub [RESOLU]

Bonjour,

Collage du Boot-info (2676 lignes) :

boot-info-4ppa2056                                              [20231020_1102]

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

 => No boot loader is installed in the MBR of /dev/sda.
 => No boot loader is installed in the MBR of /dev/sdb.
 => Grub2 (v2.00) is installed in the MBR of /dev/sdc and looks at sector 1 of 
    the same hard drive for core.img. core.img is at this location and looks 
    for /boot/grub. It also embeds following components:
    
    modules
    ---------------------------------------------------------------------------
    fshelp ext2 part_msdos biosdisk search_fs_uuid
    ---------------------------------------------------------------------------
    
    config script
    ---------------------------------------------------------------------------
    search.fs_uuid c3a1d334-12ff-467a-a452-8b4367d603c2 root hd1,msdos1 
    set prefix=($root)'/boot/grub'
    
    ---------------------------------------------------------------------------
 => Grub2 (v1.97-1.98) is installed in the MBR of /dev/sdd and looks at sector 
    1 of the same hard drive for core.img. core.img is at this location and 
    looks for /boot/grub in partition 1.

sda1: __________________________________________________________________________

    File system:       vfat
    Boot sector type:  Windows 8/10/11/2012: FAT32
    Boot sector info:  No errors found in the Boot Parameter Block.
    Operating System:  
    Boot files:        /efi/Boot/bootx64.efi /efi/Microsoft/Boot/bootmgfw.efi 
                       /efi/Microsoft/Boot/bootmgr.efi

sda2: __________________________________________________________________________

    File system:       
    Boot sector type:  -
    Boot sector info: 

sda3: __________________________________________________________________________

    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 8 or 10
    Boot files:        /Windows/System32/winload.exe

sda4: __________________________________________________________________________

    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:        

sdb1: __________________________________________________________________________

    File system:       vfat
    Boot sector type:  FAT32
    Boot sector info:  According to the info in the boot sector, sdb1 has 
                       73728 sectors.. But according to the info from the 
                       partition table, it has 612351 sectors.
    Operating System:  
    Boot files:        /EFI/refind/refind.conf /efi/BOOT/fbx64.efi 
                       /efi/BOOT/mmx64.efi /efi/refind/refind_x64.efi 
                       /efi/ubuntu/grubx64.efi /efi/ubuntu/mmx64.efi 
                       /efi/ubuntu/shimx64.efi /efi/ubuntu/grub.cfg 
                       /efi/refind/drivers_x64/ext4_x64.efi 
                       /efi/ubuntu/grub/grub.cfg

sdb3: __________________________________________________________________________

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

sdb4: __________________________________________________________________________

    File system:       ext4
    Boot sector type:  -
    Boot sector info: 
    Operating System:  
    Boot files:        

sdb5: __________________________________________________________________________

    File system:       ext4
    Boot sector type:  -
    Boot sector info: 
    Operating System:  elementary OS 7.1 Horus
    Boot files:        /boot/grub/grub.cfg /etc/fstab /etc/default/grub 
                       /boot/refind_linux.conf

sdc1: __________________________________________________________________________

    File system:       ntfs
    Boot sector type:  Windows 7/2008: NTFS
    Boot sector info:  No errors found in the Boot Parameter Block.
    Operating System:  
    Boot files:        

sdd1: __________________________________________________________________________

    File system:       ntfs
    Boot sector type:  Windows 2000/XP: NTFS
    Boot sector info:  No errors found in the Boot Parameter Block.
    Operating System:  
    Boot files:        


================================ 3 OS detected =================================

OS#1:   elementary OS 7.1 Horus (7.1) on sdb5
OS#2:   Ubuntu 22.04.3 LTS on sdb3
OS#3:   Windows 8 or 10 on sda3

================================ Host/Hardware =================================

CPU architecture: 64-bit
Video:  from 
BOOT_IMAGE of the installed session in use:
ro root=UUID=a847127f-af2f-495d-9114-a0f708e54732 quiet splash  initrd=boot\initrd.img-6.2.0-35-generic
df -Th / : /dev/sdb3        ext4    61G     28G   30G  49% /

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

BIOS/UEFI firmware: N02 Ver. 02.14(2.14) from HP
The firmware is EFI-compatible, and is set in EFI-mode for this installed-session.
SecureBoot disabled (confirmed by mokutil).
BootCurrent: 0015
Timeout: 0 seconds
BootOrder: 0015,0016,0014,000F,0012,000D,0010,000C,0013,000E,0000,0001,0002,0003,0004,0005,0006,0007,0008,0009,0011,000B,0017,000A
Boot0000  Startup Menu	FvVol(a881d567-6cb0-4eee-8435-2e72d33e45b5)/FvFile(9d8243e8-8381-453d-aceb-c350ee7757ca)....ISPH
Boot0001  System Information	FvVol(a881d567-6cb0-4eee-8435-2e72d33e45b5)/FvFile(9d8243e8-8381-453d-aceb-c350ee7757ca)......ISPH
Boot0002  Bios Setup	FvVol(a881d567-6cb0-4eee-8435-2e72d33e45b5)/FvFile(9d8243e8-8381-453d-aceb-c350ee7757ca)......ISPH
Boot0003  3rd Party Option ROM Management	FvVol(a881d567-6cb0-4eee-8435-2e72d33e45b5)/FvFile(9d8243e8-8381-453d-aceb-c350ee7757ca)......ISPH
Boot0004  System Diagnostics	FvVol(a881d567-6cb0-4eee-8435-2e72d33e45b5)/FvFile(9d8243e8-8381-453d-aceb-c350ee7757ca)......ISPH
Boot0005  System Diagnostics	FvVol(a881d567-6cb0-4eee-8435-2e72d33e45b5)/FvFile(9d8243e8-8381-453d-aceb-c350ee7757ca)......ISPH
Boot0006  System Diagnostics	FvVol(a881d567-6cb0-4eee-8435-2e72d33e45b5)/FvFile(9d8243e8-8381-453d-aceb-c350ee7757ca)......ISPH
Boot0007  System Diagnostics	FvVol(a881d567-6cb0-4eee-8435-2e72d33e45b5)/FvFile(9d8243e8-8381-453d-aceb-c350ee7757ca)......ISPH
Boot0008  Boot Menu	FvVol(a881d567-6cb0-4eee-8435-2e72d33e45b5)/FvFile(9d8243e8-8381-453d-aceb-c350ee7757ca)......ISPH
Boot0009  HP Recovery	FvVol(a881d567-6cb0-4eee-8435-2e72d33e45b5)/FvFile(9d8243e8-8381-453d-aceb-c350ee7757ca)......ISPH
Boot000A  TOSHIBA External USB 3.0 20140510025100	PciRoot(0x0)/Pci(0x14,0x0)/USB(21,0)N.....YM....R,Y.....ISPH
Boot000B  Gestion tierce de la ROM optionnelle	FvVol(a881d567-6cb0-4eee-8435-2e72d33e45b5)/FvFile(9d8243e8-8381-453d-aceb-c350ee7757ca)......ISPH
Boot000C* ST1000DM003-1ER162 : 	BBS(HD,ST1000DM003-1ER162 : ,0x400)/PciRoot(0x0)/Pci(0x17,0x0)/Sata(0,0,0)......ISPH
Boot000D* Maxtor Corporation Maxtor 3200 2CAHZ4QF: 	BBS(HD,Maxtor Corporation Maxtor 3200 2CAHZ4QF: ,0x900)/PciRoot(0x0)/Pci(0x14,0x0)......ISPH
Boot000E* Intel Corporation: IBA CL Slot 00FE v0106	BBS(Network,Intel Corporation: IBA CL Slot 00FE v0106,0x0)/PciRoot(0x0)/Pci(0x1f,0x6)......ISPH
Boot000F* hp HLDS DVDROM DUD0N 	PciRoot(0x0)/Pci(0x17,0x0)/Sata(1,0,0)N.....YM....R,Y..0..ISPH
Boot0010* hp HLDS DVDROM DUD0N : 	BBS(CDROM,hp HLDS DVDROM DUD0N : ,0x400)/PciRoot(0x0)/Pci(0x17,0x0)/Sata(1,0,0)...0..ISPH
Boot0011  Network Boot	FvVol(a881d567-6cb0-4eee-8435-2e72d33e45b5)/FvFile(9d8243e8-8381-453d-aceb-c350ee7757ca)......ISPH
Boot0012* Windows Boot Manager	HD(1,GPT,0a97e305-2f2d-452e-8be8-acc821e1b4c9,0x22,0x81fde)/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.}...I....................ISPH
Boot0013* PNY CS900 480GB SSD : 	BBS(HD,PNY CS900 480GB SSD : ,0x400)/PciRoot(0x0)/Pci(0x17,0x0)/Sata(2,0,0)......ISPH
Boot0014* ubuntu	HD(1,GPT,5ae5d080-5a1f-4160-b102-99ea06a8e47a,0x800,0x95800)/File(\EFI\ubuntu\shimx64.efi)....ISPH
Boot0015* rEFInd Boot Manager	HD(1,GPT,5ae5d080-5a1f-4160-b102-99ea06a8e47a,0x800,0x95800)/File(\EFI\refind\refind_x64.efi)
Boot0016* EPSON EPSON Epson Stylus SX218 Series 4D464A4B3031333987	PciRoot(0x0)/Pci(0x14,0x0)/USB(4,2)N.....YM....R,Y.....ISPH
Boot0017  Maxtor Corporation Maxtor 3200 2CAHZ4QF	PciRoot(0x0)/Pci(0x14,0x0)/USB(3,0)N.....YM....R,Y.....ISPH
Boot0018* ubuntu	HD(1,GPT,5ae5d080-5a1f-4160-b102-99ea06a8e47a,0x800,0x95800)/File(\EFI\ubuntu\shimx64.efi)

b3d98a277c250e553554ddf4d7bb9ace   sda1/Boot/bootx64.efi
b3d98a277c250e553554ddf4d7bb9ace   sda1/Microsoft/Boot/bootmgfw.efi
06523c5f4c39b3789bce23ae28c7d4d0   sda1/Microsoft/Boot/bootmgr.efi

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

Disks info: ____________________________________________________________________

sdb	: is-GPT,	no-BIOSboot,	has---ESP, 	not-usb,	not-mmc, has-os,	no-wind,	2048 sectors * 512 bytes
sda	: is-GPT,	no-BIOSboot,	has---ESP, 	not-usb,	not-mmc, has-os,	has-win,	34 sectors * 512 bytes
sdc	: notGPT,	no-BIOSboot,	has-noESP, 	not-usb,	not-mmc, no-os,	no-wind,	2048 sectors * 512 bytes
sdd	: notGPT,	no-BIOSboot,	has-noESP, 	usb-disk,	not-mmc, no-os,	no-wind,	63 sectors * 512 bytes

Partitions info (1/3): _________________________________________________________

sdb3	: is-os,	64, apt-get,	signed grub-efi ,	grub2,	grub-install,	grubenv-ok,	update-grub,	farbios
sda1	: no-os,	64, nopakmgr,	no-docgrub,	nogrub,	nogrubinstall,	no-grubenv,	noupdategrub,	not-far
sda3	: is-os,	64, nopakmgr,	no-docgrub,	nogrub,	nogrubinstall,	no-grubenv,	noupdategrub,	farbios
sda4	: no-os,	64, nopakmgr,	no-docgrub,	nogrub,	nogrubinstall,	no-grubenv,	noupdategrub,	farbios
sdb1	: no-os,	64, nopakmgr,	no-docgrub,	nogrub,	nogrubinstall,	no-grubenv,	noupdategrub,	not-far
sdb4	: no-os,	64, nopakmgr,	no-docgrub,	nogrub,	nogrubinstall,	no-grubenv,	noupdategrub,	farbios
sdb5	: is-os,	64, apt-get,	signed grub-pc grub-efi ,	grub2,	grub-install,	grubenv-ng,	update-grub,	farbios
sdc1	: no-os,	64, nopakmgr,	no-docgrub,	nogrub,	nogrubinstall,	no-grubenv,	noupdategrub,	farbios
sdd1	: no-os,	64, nopakmgr,	no-docgrub,	nogrub,	nogrubinstall,	no-grubenv,	noupdategrub,	farbios

Partitions info (2/3): _________________________________________________________

sdb3	: isnotESP,	fstab-has-goodEFI,	no-nt,	no-winload,	no-recov-nor-hid,	no-bmgr,	notwinboot
sda1	: is---ESP,	part-has-no-fstab,	no-nt,	no-winload,	no-recov-nor-hid,	no-bmgr,	notwinboot
sda3	: isnotESP,	part-has-no-fstab,	no-nt,	haswinload,	no-recov-nor-hid,	no-bmgr,	notwinboot
sda4	: isnotESP,	part-has-no-fstab,	no-nt,	no-winload,	recovery-or-hidden,	no-bmgr,	notwinboot
sdb1	: is---ESP,	part-has-no-fstab,	no-nt,	no-winload,	no-recov-nor-hid,	no-bmgr,	notwinboot
sdb4	: isnotESP,	part-has-no-fstab,	no-nt,	no-winload,	no-recov-nor-hid,	no-bmgr,	notwinboot
sdb5	: isnotESP,	fstab-has-bad-efi,	no-nt,	no-winload,	no-recov-nor-hid,	no-bmgr,	notwinboot
sdc1	: isnotESP,	part-has-no-fstab,	no-nt,	no-winload,	no-recov-nor-hid,	no-bmgr,	notwinboot
sdd1	: isnotESP,	part-has-no-fstab,	no-nt,	no-winload,	no-recov-nor-hid,	no-bmgr,	notwinboot

Partitions info (3/3): _________________________________________________________

sdb3	: not--sepboot,	with-boot,	fstab-without-boot,	not-sep-usr,	with--usr,	fstab-without-usr,	customized,	sdb
sda1	: not--sepboot,	no---boot,	part-has-no-fstab,	not-sep-usr,	no---usr,	part-has-no-fstab,	no--grub.d,	sda
sda3	: not--sepboot,	no---boot,	part-has-no-fstab,	not-sep-usr,	no---usr,	part-has-no-fstab,	no--grub.d,	sda
sda4	: not--sepboot,	no---boot,	part-has-no-fstab,	not-sep-usr,	no---usr,	part-has-no-fstab,	no--grub.d,	sda
sdb1	: not--sepboot,	no---boot,	part-has-no-fstab,	not-sep-usr,	no---usr,	part-has-no-fstab,	no--grub.d,	sdb
sdb4	: maybesepboot,	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,	customized,	sdb
sdc1	: not--sepboot,	no---boot,	part-has-no-fstab,	not-sep-usr,	no---usr,	part-has-no-fstab,	no--grub.d,	sdc
sdd1	: not--sepboot,	no---boot,	part-has-no-fstab,	not-sep-usr,	no---usr,	part-has-no-fstab,	no--grub.d,	sdd

fdisk -l (filtered): ___________________________________________________________

Disk sda: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk identifier: C553FFE2-A66F-4375-B95E-B059BD29895B
           Start        End    Sectors   Size Type
sda1          34     532479     532446   260M EFI System
sda2      532480     565247      32768    16M Microsoft reserved
sda3      565248 1952448511 1951883264 930.7G Microsoft basic data
sda4  1952448512 1953523711    1075200   525M Windows recovery environment
Disk sdb: 447.13 GiB, 480103981056 bytes, 937703088 sectors
Disk identifier: A5F178A9-D1A9-45EA-A9AB-26CBC612923E
          Start       End   Sectors   Size Type
sdb1       2048    614399    612352   299M EFI System
sdb3  468889600 598282239 129392640  61.7G Linux filesystem
sdb4  598282240 937701375 339419136 161.8G Linux filesystem
sdb5     614400 468889599 468275200 223.3G Linux filesystem
Partition table entries are not in disk order.
Disk sdc: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk identifier: 0x385d5d7b
      Boot Start        End    Sectors   Size Id Type
sdc1        2048 1953523119 1953521072 931.5G  7 HPFS/NTFS/exFAT
Disk sdd: 465.76 GiB, 500107862016 bytes, 976773168 sectors
Disk identifier: 0x4cc4cde2
      Boot Start       End   Sectors   Size Id Type
sdd1  *       63 976773119 976773057 465.8G  7 HPFS/NTFS/exFAT

parted -lm (filtered): _________________________________________________________

sda:1000GB:scsi:512:4096:gpt:ATA ST1000DM003-1ER1:;
1:17.4kB:273MB:273MB:fat32:SYSTEMFAT32bootESP:boot, esp;
2:273MB:289MB:16.8MB::Microsoft reserved partition:msftres;
3:289MB:1000GB:999GB:ntfs::msftdata;
4:1000GB:1000GB:551MB:ntfs::hidden, diag;
sdb:480GB:scsi:512:512:gpt:ATA PNY CS900 480GB:;
1:1049kB:315MB:314MB:fat32:boot,esp:boot, esp;
5:315MB:240GB:240GB:ext4:ELEMENTARY07:;
3:240GB:306GB:66.2GB:ext4:UBUNTU:;
4:306GB:480GB:174GB:ext4:HomeCOMMUN:;
sdc:1000GB:scsi:512:512:msdos:TOSHIBA External USB 3.0:;
1:1049kB:1000GB:1000GB:ntfs::;
sdd:500GB:scsi:512:512:msdos:Maxtor 3200:;
1:32.3kB:500GB:500GB:ntfs::boot;

blkid (filtered): ______________________________________________________________

NAME   FSTYPE   UUID                                 PARTUUID                             LABEL            PARTLABEL
sda                                                                                                        
├─sda1 vfat     0CED-EBAB                            0a97e305-2f2d-452e-8be8-acc821e1b4c9 SYSTEM           SYSTEMFAT32bootESP
├─sda2                                               be5d8297-ce63-438c-acfb-a47544d9371b                  Microsoft reserved partition
├─sda3 ntfs     A098FA2398F9F81C                     8c325e9e-7f85-4ea6-a2ce-ad822ed18c9b Systeme          
└─sda4 ntfs     469E08019E07E86F                     d65e1c8b-c64d-4e25-b073-ac45ebe7b23a Windows RE tools 
sdb                                                                                                        
├─sdb1 vfat     C483-DBB3                            5ae5d080-5a1f-4160-b102-99ea06a8e47a                  boot,esp
├─sdb3 ext4     a847127f-af2f-495d-9114-a0f708e54732 6100e446-6d3b-4464-bc3b-2ab18243b6fb                  UBUNTU
├─sdb4 ext4     efd5a30c-70d7-4ae8-a9d1-9eb58125818f 4c48b9d6-6b51-46d0-a0da-22d3d4b39cd1 /Home            HomeCOMMUN
└─sdb5 ext4     e441a19f-0001-4d1e-8e73-5c401fd2f5ec bf5ae3ef-bfa1-438e-992a-1b1deb4fcbfe EOS7             ELEMENTARY07
sdc                                                                                                        
└─sdc1 ntfs     F086EAE086EAA676                     385d5d7b-01                          TOSHIBA EXT      
sdd                                                                                                        
└─sdd1 ntfs     55D123D9E79ABF54                     4cc4cde2-01                          DDExterne        
sde                                                                                                        

Mount points (filtered): _______________________________________________________

                                Avail Use% Mounted on
/dev/sda1                      232.5M  10% /mnt/boot-sav/sda1
/dev/sda3                      870.5G   6% /mnt/boot-sav/sda3
/dev/sda4                       89.1M  83% /mnt/boot-sav/sda4
/dev/sdb3                       29.5G  46% /
/dev/sdb4                      114.6G  23% /home
/dev/sdb5                      177.7G  14% /mnt/boot-sav/sdb5
/dev/sdc1                       54.6G  94% /media/didier/TOSHIBA EXT
/dev/sdd1                      316.2G  32% /media/didier/DDExterne

Mount options (filtered): ______________________________________________________


==================== sdb1/EFI/refind/refind.conf (filtered) ====================

timeout 10
use_nvram false
menuentry Linux {
    icon EFI/refind/icons/os_linux.png
    volume 904404F8-B481-440C-A1E3-11A5A954E601
    loader bzImage-3.3.0-rc7
    initrd initrd-3.3.0.img
    options "ro root=UUID=5f96cafa-e0a7-4057-b18f-fa709db5b837"
    disabled
}
menuentry "Arch Linux" {
    icon     /EFI/refind/icons/os_arch.png
    volume   "Arch Linux"
    loader   /boot/vmlinuz-linux
    initrd   /boot/initramfs-linux.img
    options  "root=PARTUUID=5028fa50-0079-4c40-b240-abfaf28693ea rw add_efi_memmap"
    submenuentry "Boot using fallback initramfs" {
        initrd /boot/initramfs-linux-fallback.img
    }
    submenuentry "Boot to terminal" {
        add_options "systemd.unit=multi-user.target"
    }
    disabled
}
menuentry Ubuntu {
    loader /EFI/ubuntu/grubx64.efi
    icon /EFI/refind/icons/os_linux.png
    disabled
}
menuentry "ELILO" {
    loader \EFI\elilo\elilo.efi
    disabled
}
menuentry "Windows 7" {
    loader \EFI\Microsoft\Boot\bootmgfw.efi
    disabled
}
menuentry "Windows via shell script" {
    icon \EFI\refind\icons\os_win.png
    loader \EFI\tools\shell.efi
    options "fs0:\EFI\tools\launch_windows.nsh"
    disabled
}
menuentry "My macOS" {
    icon \EFI\refind\icons\os_mac.png
    volume "macOS boot"
    loader \System\Library\CoreServices\boot.efi
    disabled
}
menuentry "macOS via BootNext" {
    icon /EFI/refind/icons/os_mac.png
    firmware_bootnum 80
    disabled
}

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

search.fs_uuid e441a19f-0001-4d1e-8e73-5c401fd2f5ec root hd1,gpt5 
set prefix=($root)'/boot/grub'
configfile $prefix/grub.cfg

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

elementary OS 7.1 Horus   e441a19f-0001-4d1e-8e73-5c401fd2f5ec
elementary OS 7.1 Horus, with Linux 6.2.0-34-generic   e441a19f-0001-4d1e-8e73-5c401fd2f5ec
elementary OS 7.1 Horus, with Linux 6.2.0-33-generic   e441a19f-0001-4d1e-8e73-5c401fd2f5ec
Windows Boot Manager (on sda1)   osprober-efi-0CED-EBAB
Ubuntu 22.04.3 LTS (22.04) (on sdb3)   a847127f-af2f-495d-9114-a0f708e54732
Ubuntu (on sdb3)   a847127f-af2f-495d-9114-a0f708e54732
Ubuntu, with Linux 6.2.0-34-generic (on sdb3)   a847127f-af2f-495d-9114-a0f708e54732
Ubuntu, with Linux 6.2.0-33-generic (on sdb3)   a847127f-af2f-495d-9114-a0f708e54732
UEFI Firmware Settings   uefi-firmware

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

Ubuntu, with Linux 6.2.0-35-generic   a847127f-af2f-495d-9114-a0f708e54732
Ubuntu, with Linux 5.15.0-87-generic   a847127f-af2f-495d-9114-a0f708e54732
elementary OS 7.1 Horus (7.1) (on sdb5)   e441a19f-0001-4d1e-8e73-5c401fd2f5ec
elementary OS 7.1 Horus (on sdb5)   e441a19f-0001-4d1e-8e73-5c401fd2f5ec
elementary OS 7.1 Horus, with Linux 6.2.0-33-generic (on sdb5)   e441a19f-0001-4d1e-8e73-5c401fd2f5ec
### END /etc/grub.d/30_os-prober_proxy ###
Ubuntu   a847127f-af2f-495d-9114-a0f708e54732
Windows Boot Manager (on sda1)   osprober-efi-0CED-EBAB
UEFI Firmware Settings   uefi-firmware
elementary OS 7.1 Horus, with Linux 6.2.0-34-generic (on sdb5)   e441a19f-0001-4d1e-8e73-5c401fd2f5ec

========================== sdb3/etc/fstab (filtered) ===========================

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sdb1 during installation
UUID=a847127f-af2f-495d-9114-a0f708e54732 /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/sdc1 during installation
# /home was on /dev/sdb3 during installation
UUID=efd5a30c-70d7-4ae8-a9d1-9eb58125818f /home           ext4    defaults        0       2
/swapfile                                 none            swap    sw              0       0
/dev/disk/by-uuid/02c77a56-fe98-4a8b-80f1-bd5a74353ca9 /mnt/02c77a56-fe98-4a8b-80f1-bd5a74353ca9 auto nosuid,nodev,nofail,x-gvfs-show,x-gvfs-name=HomeElementary,x-gvfs-icon=HomeElementary,x-gvfs-symbolic-icon=HomeElementary 0 0
UUID=C483-DBB3  /boot/efi       vfat    defaults      0       1

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

GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true
GRUB_TIMEOUT_STYLE="menu"
GRUB_TIMEOUT="10"
GRUB_DISTRIBUTOR="`lsb_release -i -s 2> /dev/null || echo Debian`"
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
GRUB_DISABLE_OS_PROBER="false"
GRUB_SAVEDEFAULT="false"

==================== sdb3/boot/refind_linux.conf (filtered) ====================

"Boot with standard options"  "ro root=UUID=a847127f-af2f-495d-9114-a0f708e54732 quiet splash "
"Boot to single-user mode"    "ro root=UUID=a847127f-af2f-495d-9114-a0f708e54732 single"
"Boot with minimal options"   "ro root=UUID=a847127f-af2f-495d-9114-a0f708e54732"

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

           GiB - GB             File                                 Fragment(s)
 236,264011383 = 253,686550528  boot/grub/grub.cfg                             1
 255,008869171 = 273,813688320  boot/vmlinuz                                   1
 255,008869171 = 273,813688320  boot/vmlinuz-5.15.0-87-generic                 1
 252,909328461 = 271,559323648  boot/vmlinuz-6.2.0-35-generic                  2
 252,909328461 = 271,559323648  boot/vmlinuz.old                               2
 233,927730560 = 251,177988096  boot/initrd.img                                2
 233,927730560 = 251,177988096  boot/initrd.img-5.15.0-87-generic              2
 234,083980560 = 251,345760256  boot/initrd.img-6.2.0-35-generic               6
 234,083980560 = 251,345760256  boot/initrd.img.old                            6

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

-rwxr-xr-x 1 root root   916 Oct  7 11:26 10_linux_proxy
-rwxr-xr-x 1 root root   865 Oct  7 11:26 11_linux_proxy
-rwxr-xr-x 1 root root  1751 Oct  7 11:26 30_os-prober_proxy
-rwxr-xr-x 1 root root   912 Oct  7 11:26 31_linux_proxy
-rwxr-xr-x 1 root root 43031 Apr 15  2022 32_linux_zfs
-rwxr-xr-x 1 root root   124 Oct  7 11:26 33_linux_xen_proxy
-rwxr-xr-x 1 root root  1668 Oct  7 11:26 34_os-prober_proxy
-rwxr-xr-x 1 root root  1372 Apr 15  2022 35_uefi-firmware
-rwxr-xr-x 1 root root   916 Oct  7 11:26 38_linux_proxy
-rwxr-xr-x 1 root root  1670 Oct  7 11:26 39_os-prober_proxy
-rwxr-xr-x 1 root root  1668 Oct  7 11:26 40_os-prober_proxy
-rwxr-xr-x 1 root root   124 Oct  7 11:26 41_linux_xen_proxy
-rwxr-xr-x 1 root root  2924 Feb  6  2022 42_memtest86+
-rwxr-xr-x 1 root root  1670 Oct  7 11:26 43_os-prober_proxy
-rwxr-xr-x 1 root root   700 Feb 21  2022 44_fwupd
-rwxr-xr-x 1 root root   214 Aug 12  2021 45_custom
-rwxr-xr-x 1 root root   215 Apr 15  2022 46_custom
drwxr-xr-x 4 root root  4096 Aug 20  2022 backup
drwxr-xr-x 2 root root  4096 Aug 20  2022 bin
drwxr-xr-x 2 root root  4096 Oct  7 11:26 proxifiedScripts

======================== sdb3/etc/grub.d/11_linux_proxy ========================

#!/bin/sh
#THIS IS A GRUB PROXY SCRIPT
'/etc/grub.d/proxifiedScripts/linux' | /etc/grub.d/bin/grubcfg_proxy "-'Ubuntu'~f741298d11ce6e4f7d01157bb98ed3c3~
-*
-#text
+'Advanced options for Ubuntu'/*
-'Advanced options for Ubuntu'/'Ubuntu, with Linux 6.2.0-34-generic'~0f4d2c57c32296f33a0eadeb8d8d0f96~
-'Advanced options for Ubuntu'/'Ubuntu, with Linux 6.2.0-34-generic (recovery mode)'~0ebdfd9951b7b87bc5ce2389c5447a65~
-'Advanced options for Ubuntu'/'Ubuntu, with Linux 5.15.0-86-generic'~17d200a6a6b49446dde0a3b49b792e19~
-'Advanced options for Ubuntu'/'Ubuntu, with Linux 5.15.0-86-generic (recovery mode)'~78cfdf67be5c70aae81abd02811765f7~
-'Advanced options for Ubuntu'/'Ubuntu, with Linux 6.2.0-33-generic'~129e8ebb66d8291964b2fed7a54b467d~
-'Advanced options for Ubuntu'/'Ubuntu, with Linux 6.2.0-33-generic (recovery mode)'~6640d88f1908c416787ff32ba7da216c~
"

======================== sdb3/etc/grub.d/31_linux_proxy ========================

#!/bin/sh
#THIS IS A GRUB PROXY SCRIPT
'/etc/grub.d/proxifiedScripts/linux' | /etc/grub.d/bin/grubcfg_proxy "+'Ubuntu'~f741298d11ce6e4f7d01157bb98ed3c3~
+'Advanced options for Ubuntu'/'Ubuntu, with Linux 6.2.0-34-generic'~0f4d2c57c32296f33a0eadeb8d8d0f96~
+'Advanced options for Ubuntu'/'Ubuntu, with Linux 6.2.0-34-generic (recovery mode)'~0ebdfd9951b7b87bc5ce2389c5447a65~
-*
-#text
-'SUBMENU' as 'Advanced options for Ubuntu'{-'Advanced options for Ubuntu'/*, -'Advanced options for Ubuntu'/'Ubuntu, with Linux 5.15.0-86-generic'~17d200a6a6b49446dde0a3b49b792e19~, -'Advanced options for Ubuntu'/'Ubuntu, with Linux 5.15.0-86-generic (recovery mode)'~78cfdf67be5c70aae81abd02811765f7~}
+'Advanced options for Ubuntu'/'Ubuntu, with Linux 6.2.0-33-generic'~129e8ebb66d8291964b2fed7a54b467d~
+'Advanced options for Ubuntu'/'Ubuntu, with Linux 6.2.0-33-generic (recovery mode)'~6640d88f1908c416787ff32ba7da216c~
"

========================= sdb3/etc/grub.d/32_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

====================== sdb3/etc/grub.d/33_linux_xen_proxy ======================

#!/bin/sh
#THIS IS A GRUB PROXY SCRIPT
'/etc/grub.d/proxifiedScripts/linux_xen' | /etc/grub.d/bin/grubcfg_proxy "-#text
+*
"

====================== sdb3/etc/grub.d/34_os-prober_proxy ======================

#!/bin/sh
#THIS IS A GRUB PROXY SCRIPT
'/etc/grub.d/proxifiedScripts/os-prober' | /etc/grub.d/bin/grubcfg_proxy "-#text
-*
-'elementary OS 7.1 Horus (7.1) (on /dev/sdb5)'~3c4a758447760a64f99aed857e741ed1~
-'SUBMENU' as 'Advanced options for elementary OS 7.1 Horus (7.1) (on /dev/sdb5)'{-'Advanced options for elementary OS 7.1 Horus (7.1) (on /dev/sdb5)'/*, -'Advanced options for elementary OS 7.1 Horus (7.1) (on /dev/sdb5)'/'elementary OS 7.1 Horus (on /dev/sdb5)'~9d76d4e04053009c429559deb71f7c90~, -'Advanced options for elementary OS 7.1 Horus (7.1) (on /dev/sdb5)'/'elementary OS 7.1 Horus, with Linux 6.2.0-33-generic (on /dev/sdb5)'~2fc813894cb72cd7c9e2376399b85c73~, -'Advanced options for elementary OS 7.1 Horus (7.1) (on /dev/sdb5)'/'elementary OS 7.1 Horus, with Linux 6.2.0-33-generic (recovery mode) (on /dev/sdb5)'~6c7c8e7af4dcdebd188afae8530832d1~, -'Advanced options for elementary OS 7.1 Horus (7.1) (on /dev/sdb5)'/'elementary OS 7.1 Horus, with Linux 6.2.0-32-generic (on /dev/sdb5)'~0a180321a57c54248480ecd03fe409cb~, -'Advanced options for elementary OS 7.1 Horus (7.1) (on /dev/sdb5)'/'elementary OS 7.1 Horus, with Linux 6.2.0-32-generic (recovery mode) (on /dev/sdb5)'~880551caf413a0f1bbbba1223242a111~}
+'Windows Boot Manager (on /dev/sda1)'~25ce2a2304c30f1f70fe647c0bbae1bf~
-'Advanced options for elementary OS 7.1 Horus (7.1) (on /dev/sdb5)'/'elementary OS 7.1 Horus, with Linux 6.2.0-34-generic (on /dev/sdb5)'~9d76d4e04053009c429559deb71f7c90~
-'Advanced options for elementary OS 7.1 Horus (7.1) (on /dev/sdb5)'/'elementary OS 7.1 Horus, with Linux 6.2.0-34-generic (recovery mode) (on /dev/sdb5)'~8a0186ad512eb6a163e7cfcf0a04ca5e~
"

======================= sdb3/etc/grub.d/35_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

======================== sdb3/etc/grub.d/38_linux_proxy ========================

#!/bin/sh
#THIS IS A GRUB PROXY SCRIPT
'/etc/grub.d/proxifiedScripts/linux' | /etc/grub.d/bin/grubcfg_proxy "-*
-#text
-'Ubuntu'~f741298d11ce6e4f7d01157bb98ed3c3~
-'SUBMENU' as 'Advanced options for Ubuntu'{-'Advanced options for Ubuntu'/*, -'Advanced options for Ubuntu'/'Ubuntu, with Linux 6.2.0-34-generic'~0f4d2c57c32296f33a0eadeb8d8d0f96~, -'Advanced options for Ubuntu'/'Ubuntu, with Linux 6.2.0-34-generic (recovery mode)'~0ebdfd9951b7b87bc5ce2389c5447a65~, -'Advanced options for Ubuntu'/'Ubuntu, with Linux 5.15.0-86-generic'~17d200a6a6b49446dde0a3b49b792e19~, -'Advanced options for Ubuntu'/'Ubuntu, with Linux 5.15.0-86-generic (recovery mode)'~78cfdf67be5c70aae81abd02811765f7~, -'Advanced options for Ubuntu'/'Ubuntu, with Linux 6.2.0-33-generic'~129e8ebb66d8291964b2fed7a54b467d~, -'Advanced options for Ubuntu'/'Ubuntu, with Linux 6.2.0-33-generic (recovery mode)'~6640d88f1908c416787ff32ba7da216c~}
"

====================== sdb3/etc/grub.d/39_os-prober_proxy ======================

#!/bin/sh
#THIS IS A GRUB PROXY SCRIPT
'/etc/grub.d/proxifiedScripts/os-prober' | /etc/grub.d/bin/grubcfg_proxy "-#text
-*
-'elementary OS 7.1 Horus (7.1) (on /dev/sdb5)'~3c4a758447760a64f99aed857e741ed1~
-'SUBMENU' as 'Advanced options for elementary OS 7.1 Horus (7.1) (on /dev/sdb5)'{-'Advanced options for elementary OS 7.1 Horus (7.1) (on /dev/sdb5)'/*, -'Advanced options for elementary OS 7.1 Horus (7.1) (on /dev/sdb5)'/'elementary OS 7.1 Horus, with Linux 6.2.0-34-generic (on /dev/sdb5)'~9d76d4e04053009c429559deb71f7c90~, -'Advanced options for elementary OS 7.1 Horus (7.1) (on /dev/sdb5)'/'elementary OS 7.1 Horus, with Linux 6.2.0-34-generic (recovery mode) (on /dev/sdb5)'~8a0186ad512eb6a163e7cfcf0a04ca5e~, -'Advanced options for elementary OS 7.1 Horus (7.1) (on /dev/sdb5)'/'elementary OS 7.1 Horus (on /dev/sdb5)'~9d76d4e04053009c429559deb71f7c90~, -'Advanced options for elementary OS 7.1 Horus (7.1) (on /dev/sdb5)'/'elementary OS 7.1 Horus, with Linux 6.2.0-33-generic (on /dev/sdb5)'~2fc813894cb72cd7c9e2376399b85c73~, -'Advanced options for elementary OS 7.1 Horus (7.1) (on /dev/sdb5)'/'elementary OS 7.1 Horus, with Linux 6.2.0-33-generic (recovery mode) (on /dev/sdb5)'~6c7c8e7af4dcdebd188afae8530832d1~, -'Advanced options for elementary OS 7.1 Horus (7.1) (on /dev/sdb5)'/'elementary OS 7.1 Horus, with Linux 6.2.0-32-generic (on /dev/sdb5)'~0a180321a57c54248480ecd03fe409cb~, -'Advanced options for elementary OS 7.1 Horus (7.1) (on /dev/sdb5)'/'elementary OS 7.1 Horus, with Linux 6.2.0-32-generic (recovery mode) (on /dev/sdb5)'~880551caf413a0f1bbbba1223242a111~}
-'Windows Boot Manager (on /dev/sda1)'~25ce2a2304c30f1f70fe647c0bbae1bf~
"

====================== sdb3/etc/grub.d/40_os-prober_proxy ======================

#!/bin/sh
#THIS IS A GRUB PROXY SCRIPT
'/etc/grub.d/proxifiedScripts/os-prober' | /etc/grub.d/bin/grubcfg_proxy "+'Advanced options for elementary OS 7.1 Horus (7.1) (on /dev/sdb5)'/'elementary OS 7.1 Horus, with Linux 6.2.0-34-generic (on /dev/sdb5)'~9d76d4e04053009c429559deb71f7c90~
+'Advanced options for elementary OS 7.1 Horus (7.1) (on /dev/sdb5)'/'elementary OS 7.1 Horus, with Linux 6.2.0-34-generic (recovery mode) (on /dev/sdb5)'~8a0186ad512eb6a163e7cfcf0a04ca5e~
-*
-#text
-'Windows Boot Manager (on /dev/sda1)'~25ce2a2304c30f1f70fe647c0bbae1bf~
-'elementary OS 7.1 Horus (7.1) (on /dev/sdb5)'~3c4a758447760a64f99aed857e741ed1~
-'SUBMENU' as 'Advanced options for elementary OS 7.1 Horus (7.1) (on /dev/sdb5)'{-'Advanced options for elementary OS 7.1 Horus (7.1) (on /dev/sdb5)'/*, -'Advanced options for elementary OS 7.1 Horus (7.1) (on /dev/sdb5)'/'elementary OS 7.1 Horus (on /dev/sdb5)'~9d76d4e04053009c429559deb71f7c90~, -'Advanced options for elementary OS 7.1 Horus (7.1) (on /dev/sdb5)'/'elementary OS 7.1 Horus, with Linux 6.2.0-33-generic (on /dev/sdb5)'~2fc813894cb72cd7c9e2376399b85c73~, -'Advanced options for elementary OS 7.1 Horus (7.1) (on /dev/sdb5)'/'elementary OS 7.1 Horus, with Linux 6.2.0-33-generic (recovery mode) (on /dev/sdb5)'~6c7c8e7af4dcdebd188afae8530832d1~, -'Advanced options for elementary OS 7.1 Horus (7.1) (on /dev/sdb5)'/'elementary OS 7.1 Horus, with Linux 6.2.0-32-generic (on /dev/sdb5)'~0a180321a57c54248480ecd03fe409cb~, -'Advanced options for elementary OS 7.1 Horus (7.1) (on /dev/sdb5)'/'elementary OS 7.1 Horus, with Linux 6.2.0-32-generic (recovery mode) (on /dev/sdb5)'~880551caf413a0f1bbbba1223242a111~}
"

====================== sdb3/etc/grub.d/41_linux_xen_proxy ======================

#!/bin/sh
#THIS IS A GRUB PROXY SCRIPT
'/etc/grub.d/proxifiedScripts/linux_xen' | /etc/grub.d/bin/grubcfg_proxy "-*
+#text
"

====================== sdb3/etc/grub.d/43_os-prober_proxy ======================

#!/bin/sh
#THIS IS A GRUB PROXY SCRIPT
'/etc/grub.d/proxifiedScripts/os-prober' | /etc/grub.d/bin/grubcfg_proxy "-*
-'elementary OS 7.1 Horus (7.1) (on /dev/sdb5)'~3c4a758447760a64f99aed857e741ed1~
-'SUBMENU' as 'Advanced options for elementary OS 7.1 Horus (7.1) (on /dev/sdb5)'{-'Advanced options for elementary OS 7.1 Horus (7.1) (on /dev/sdb5)'/*, -'Advanced options for elementary OS 7.1 Horus (7.1) (on /dev/sdb5)'/'elementary OS 7.1 Horus, with Linux 6.2.0-34-generic (on /dev/sdb5)'~9d76d4e04053009c429559deb71f7c90~, -'Advanced options for elementary OS 7.1 Horus (7.1) (on /dev/sdb5)'/'elementary OS 7.1 Horus, with Linux 6.2.0-34-generic (recovery mode) (on /dev/sdb5)'~8a0186ad512eb6a163e7cfcf0a04ca5e~, -'Advanced options for elementary OS 7.1 Horus (7.1) (on /dev/sdb5)'/'elementary OS 7.1 Horus (on /dev/sdb5)'~9d76d4e04053009c429559deb71f7c90~, -'Advanced options for elementary OS 7.1 Horus (7.1) (on /dev/sdb5)'/'elementary OS 7.1 Horus, with Linux 6.2.0-33-generic (on /dev/sdb5)'~2fc813894cb72cd7c9e2376399b85c73~, -'Advanced options for elementary OS 7.1 Horus (7.1) (on /dev/sdb5)'/'elementary OS 7.1 Horus, with Linux 6.2.0-33-generic (recovery mode) (on /dev/sdb5)'~6c7c8e7af4dcdebd188afae8530832d1~, -'Advanced options for elementary OS 7.1 Horus (7.1) (on /dev/sdb5)'/'elementary OS 7.1 Horus, with Linux 6.2.0-32-generic (on /dev/sdb5)'~0a180321a57c54248480ecd03fe409cb~, -'Advanced options for elementary OS 7.1 Horus (7.1) (on /dev/sdb5)'/'elementary OS 7.1 Horus, with Linux 6.2.0-32-generic (recovery mode) (on /dev/sdb5)'~880551caf413a0f1bbbba1223242a111~}
-'Windows Boot Manager (on /dev/sda1)'~25ce2a2304c30f1f70fe647c0bbae1bf~
+#text
"

=========================== sdb3/etc/grub.d/44_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

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

elementary OS 7.1 Horus   e441a19f-0001-4d1e-8e73-5c401fd2f5ec
elementary OS 7.1 Horus, with Linux 6.2.0-34-generic   e441a19f-0001-4d1e-8e73-5c401fd2f5ec
elementary OS 7.1 Horus, with Linux 6.2.0-33-generic   e441a19f-0001-4d1e-8e73-5c401fd2f5ec
Windows Boot Manager (on sda1)   osprober-efi-0CED-EBAB
Ubuntu 22.04.3 LTS (22.04) (on sdb3)   a847127f-af2f-495d-9114-a0f708e54732
Ubuntu (on sdb3)   a847127f-af2f-495d-9114-a0f708e54732
Ubuntu, with Linux 6.2.0-34-generic (on sdb3)   a847127f-af2f-495d-9114-a0f708e54732
Ubuntu, with Linux 6.2.0-33-generic (on sdb3)   a847127f-af2f-495d-9114-a0f708e54732
UEFI Firmware Settings   uefi-firmware

========================== sdb5/etc/fstab (filtered) ===========================

# <file system>  <mount point>  <type>  <options>  <dump>  <pass>
PARTUUID=5ae5d080-5a1f-4160-b102-99ea06a8e47a  /boot/efi  vfat  umask=0077  0  0
/dev/disk/by-id/wwn-0x5000039585e0185e-part1 /mnt/wwn-0x5000039585e0185e-part1 auto nosuid,nodev,nofail,x-gvfs-show 0 0
/dev/disk/by-label/DDExterne /mnt/DDExterne auto nosuid,nodev,nofail,x-gvfs-show,x-gvfs-name=DD%20Externe 0 0
/dev/disk/by-uuid/efd5a30c-70d7-4ae8-a9d1-9eb58125818f /mnt/efd5a30c-70d7-4ae8-a9d1-9eb58125818f auto nosuid,nodev,nofail,x-gvfs-show,x-gvfs-name=Home%20commun 0 0
/dev/disk/by-uuid/a847127f-af2f-495d-9114-a0f708e54732 /mnt/a847127f-af2f-495d-9114-a0f708e54732 auto nosuid,nodev,nofail,x-gvfs-show,x-gvfs-name=Partition%20Ubuntu 0 0
UUID=e441a19f-0001-4d1e-8e73-5c401fd2f5ec / ext4 noatime,errors=remount-ro,x-gvfs-name=Partition%20EOS 0 0

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

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

==================== sdb5/boot/refind_linux.conf (filtered) ====================

"Boot with standard options"  "root=UUID=e441a19f-0001-4d1e-8e73-5c401fd2f5ec ro quiet splash vt.handoff=7"
"Boot to single-user mode"    "root=UUID=e441a19f-0001-4d1e-8e73-5c401fd2f5ec ro quiet splash vt.handoff=7 single"
"Boot with minimal options"   "ro root=UUID=e441a19f-0001-4d1e-8e73-5c401fd2f5ec"

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

           GiB - GB             File                                 Fragment(s)
  14,715709686 = 15,800872960   boot/grub/grub.cfg                             1
  73,925777435 = 79,377199104   boot/vmlinuz                                   2
  98,714839935 = 105,994252288  boot/vmlinuz-6.2.0-33-generic                  2
  73,925777435 = 79,377199104   boot/vmlinuz-6.2.0-34-generic                  2
  98,714839935 = 105,994252288  boot/vmlinuz.old                               2
 125,066402435 = 134,289027072  vmlinuz                                        2
  16,042964935 = 17,226002432   boot/initrd.img                                8
  10,667964935 = 11,454640128   boot/initrd.img-6.2.0-33-generic               4
  16,042964935 = 17,226002432   boot/initrd.img-6.2.0-34-generic               8
  10,667964935 = 11,454640128   boot/initrd.img.old                            4

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

-rwxr-xr-x 1 root root  5826 Oct  7 09:42 10_linux_proxy
-rwxr-xr-x 1 root root 43021 Jan 12  2023 11_linux_zfs
-rwxr-xr-x 1 root root 14387 Aug  5 15:28 20_linux_xen
-rwxr-xr-x 1 root root  1523 Oct  7 09:42 31_os-prober_proxy
-rwxr-xr-x 1 root root  1372 Jan 12  2023 32_uefi-firmware
-rwxr-xr-x 1 root root   700 Sep 20  2022 35_fwupd
-rwxr-xr-x 1 root root   214 Jan 12  2023 40_custom
-rwxr-xr-x 1 root root   215 Jan 12  2023 41_custom
drwxr-xr-x 4 root root  4096 Feb 21  2023 backup
drwxr-xr-x 2 root root  4096 Feb 24  2023 bin
drwxr-xr-x 2 root root  4096 Oct  7 09:42 proxifiedScripts

========================= sdb5/etc/grub.d/11_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}"
            ;;
        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

====================== sdb5/etc/grub.d/31_os-prober_proxy ======================

#!/bin/sh
#THIS IS A GRUB PROXY SCRIPT
'/etc/grub.d/proxifiedScripts/os-prober' | /etc/grub.d/bin/grubcfg_proxy "-*
-'Ubuntu 22.04.3 LTS (22.04) (on /dev/sdb3)'~20275088b9a907e6ee4744d637a9046b~
-'SUBMENU' as 'Advanced options for Ubuntu 22.04.3 LTS (22.04) (on /dev/sdb3)'{-'Advanced options for Ubuntu 22.04.3 LTS (22.04) (on /dev/sdb3)'/*, -'Advanced options for Ubuntu 22.04.3 LTS (22.04) (on /dev/sdb3)'/'Ubuntu, with Linux 6.2.0-34-generic (on /dev/sdb3)'~3d94d178738ab56bb83a4846d8b761b8~, -'Advanced options for Ubuntu 22.04.3 LTS (22.04) (on /dev/sdb3)'/'Ubuntu, with Linux 6.2.0-34-generic (recovery mode) (on /dev/sdb3)'~67ceea50a843f7f3bb538b2cfd110008~, -'Advanced options for Ubuntu 22.04.3 LTS (22.04) (on /dev/sdb3)'/'Ubuntu, with Linux 5.15.0-86-generic (on /dev/sdb3)'~d25b9833433d736fe56adbe810fa6464~, -'Advanced options for Ubuntu 22.04.3 LTS (22.04) (on /dev/sdb3)'/'Ubuntu, with Linux 5.15.0-86-generic (recovery mode) (on /dev/sdb3)'~e2abb9534adc6d5ef2b38169d35c738e~, -'Advanced options for Ubuntu 22.04.3 LTS (22.04) (on /dev/sdb3)'/'Ubuntu, with Linux 6.2.0-33-generic (on /dev/sdb3)'~a59eaa083d005368555e1bd61e68f3b5~, -'Advanced options for Ubuntu 22.04.3 LTS (22.04) (on /dev/sdb3)'/'Ubuntu, with Linux 6.2.0-33-generic (recovery mode) (on /dev/sdb3)'~a3f9f531aad2e9c962b1923d61526abf~, -'Advanced options for Ubuntu 22.04.3 LTS (22.04) (on /dev/sdb3)'/'Ubuntu (on /dev/sdb3)'~3d94d178738ab56bb83a4846d8b761b8~}
-#text
-'Windows Boot Manager (on /dev/sda1)'~25ce2a2304c30f1f70fe647c0bbae1bf~
"

======================= sdb5/etc/grub.d/32_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



Suggested repair: ______________________________________________________________

The default repair of the Boot-Repair utility would purge (in order to unsign) and reinstall the grub-efi of
sdb3,
using the following options:  sdb1/boot/efi
Additional repair would be performed: unhide-bootmenu-10s use-standard-efi-file

Final advice in case of suggested repair: ______________________________________

Please do not forget to make your UEFI firmware boot on the Ubuntu 22.04.3 LTS 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)

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

Hors ligne

#125 Le 20/10/2023, à 11:17

Didiéridou

Re : Défilement de lignes après lancement du grub [RESOLU]

Bonjour Xubu1957
Quand j'ai vu le nombre de lignes je n'ai pas osé les copier/coller...

Dernière modification par Didiéridou (Le 20/10/2023, à 11:17)


Sous Linux (Ubuntu et maintenant EOS) depuis au moins 2006 et d'autant plus ravi d'y être quand je reboot par nécessité sur Win... et que je vois la disponibilité et la réactivité compétente des membres des forums !

Hors ligne