Contenu | Rechercher | Menus

Annonce

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

À propos de l'équipe du forum.

#1 Le 19/07/2025, à 17:01

Chanchris

Ubuntu 24.04.02 LTS

Bonjour,

En lançant la mise à jour du système ce matin, il y a  eu un bug !
Apparemment un paquet n'a pas pu s'installer qui semble être celui d'un nouveau noyau 6.14 ?

Depuis un écran intitulé "Toutes les mises à jour ne peuvent être installées", il m'est proposé une mise à jour partielle qui se lance puis s'arrête (en calculant les changements)

Quelqu'un a-t-i le même souci ?

Quel est le problème ? y a-t-il une solution ?

Merci

Hors ligne

#2 Le 19/07/2025, à 17:05

geole

Re : Ubuntu 24.04.02 LTS

Bonjour
Merci publier

sudo apt upgrade

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

Hors ligne

#3 Le 19/07/2025, à 19:55

Chanchris

Re : Ubuntu 24.04.02 LTS

chanchris126@chanchris126-MS-7D48:~$ sudo apt upgrade
[sudo] Mot de passe de chanchris126 : 
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances... Fait
Lecture des informations d'état... Fait      
Calcul de la mise à jour... Fait
0 mis à jour, 0 nouvellement installés, 0 à enlever et 0 non mis à jour.
2 partiellement installés ou enlevés.
Il est nécessaire de prendre 0 o/15,1 Mo dans les archives.
Après cette opération, 0 o d'espace disque supplémentaires seront utilisés.
Souhaitez-vous continuer ? [O/n] o
Paramétrage de linux-image-6.14.0-24-generic (6.14.0-24.24~24.04.3) ...
Traitement des actions différées (« triggers ») pour linux-image-6.14.0-24-generic (6.14.0-24.24~24.04.3) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-6.14.0-24-generic
/etc/kernel/postinst.d/zz-update-grub:
Sourcing file `/etc/default/grub'
Generating grub configuration file ...
using custom appearance settings
Found background image: /root/snap/20250409_125006_042.jpg
Found linux image: /boot/vmlinuz-6.14.0-24-generic
Found initrd image: /boot/initrd.img-6.14.0-24-generic
Found linux image: /boot/vmlinuz-6.11.0-29-generic
Found initrd image: /boot/initrd.img-6.11.0-29-generic
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot 
entries.
Found Windows Boot Manager on /dev/nvme0n1p1@/EFI/Microsoft/Boot/bootmgfw.efi
Found Ubuntu 25.04 (25.04) on /dev/nvme0n1p5
Found linux image: /boot/vmlinuz-6.14.0-24-generic
Found initrd image: /boot/initrd.img-6.14.0-24-generic
Found linux image: /boot/vmlinuz-6.11.0-29-generic
Found initrd image: /boot/initrd.img-6.11.0-29-generic
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot 
entries.
Found Windows Boot Manager on /dev/nvme0n1p1@/EFI/Microsoft/Boot/bootmgfw.efi
Found Ubuntu 25.04 (25.04) on /dev/nvme0n1p5
Found linux image: /boot/vmlinuz-6.14.0-24-generic
Found initrd image: /boot/initrd.img-6.14.0-24-generic
Found linux image: /boot/vmlinuz-6.11.0-29-generic
Found initrd image: /boot/initrd.img-6.11.0-29-generic
Found memtest86+ 64bit EFI image: /boot/memtest86+x64.efi
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot 
entries.
Found Windows Boot Manager on /dev/nvme0n1p1@/EFI/Microsoft/Boot/bootmgfw.efi
Found Ubuntu 25.04 (25.04) on /dev/nvme0n1p5
Found memtest86+ 64bit EFI image: /boot/memtest86+x64.efi
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot 
entries.
Found Windows Boot Manager on /dev/nvme0n1p1@/EFI/Microsoft/Boot/bootmgfw.efi
Found Ubuntu 25.04 (25.04) on /dev/nvme0n1p5
Adding boot menu entry for UEFI Firmware Settings ...
erreur : out of memory.
erreur : syntax error.
erreur : Incorrect command.
erreur : syntax error.
Erreur de syntaxe à la ligne 449
Syntax errors are detected in generated GRUB config file.
Ensure that there are no errors in /etc/default/grub
and /etc/grub.d/* files or please file a bug report with
/boot/grub/grub.cfg.new file attached.
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 1
dpkg: erreur de traitement du paquet linux-image-6.14.0-24-generic (--configure)
 :
 le sous-processus paquet linux-image-6.14.0-24-generic script post-installation
 installé a renvoyé un état de sortie d'erreur 1
Des erreurs ont été rencontrées pendant l'exécution :
 linux-image-6.14.0-24-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
chanchris126@chanchris126-MS-7D48:~$ 

Hors ligne

#4 Le 20/07/2025, à 09:57

geole

Re : Ubuntu 24.04.02 LTS

Chanchris a écrit :
chanchris126@chanchris126-MS-7D48:~$ sudo apt upgrade
...........
Erreur de syntaxe à la ligne 449
Syntax errors are detected in generated GRUB config file.
Ensure that there are no errors in /etc/default/grub
and /etc/grub.d/* files or please file a bug report with
/boot/grub/grub.cfg.new file attached.
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 1

Bonjour.
Dans un premier temps, publie le contenu du premier fichier

cat  /etc/default/grub      

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

Hors ligne

#5 Le 20/07/2025, à 10:48

Chanchris

Re : Ubuntu 24.04.02 LTS

Voici le retour demandé :

chanchris126@chanchris126-MS-7D48:~$ cat  /etc/default/grub     
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT="0"
GRUB_TIMEOUT_STYLE="hidden"
GRUB_TIMEOUT="5"
GRUB_DISTRIBUTOR="`( . /etc/os-release; echo ${NAME:-Ubuntu} ) 2>/dev/null || echo Ubuntu`"
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

# If your computer has multiple operating systems installed, then you
# probably want to run os-prober. However, if your computer is a host
# for guest OSes installed via LVM or raw disk devices, running
# os-prober can cause damage to those guest OSes as it mounts
# filesystems to look for things.
#GRUB_DISABLE_OS_PROBER="false"

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal
#GRUB_TERMINAL="console"

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE="640x480"

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID="true"

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

export GRUB_COLOR_NORMAL="light-gray/black"
export GRUB_COLOR_HIGHLIGHT="yellow/black"
export GRUB_MENU_PICTURE="/root/snap/20250409_125006_042.jpg"chanchris126@chanchris126-MS-7D48:~$ 

Hors ligne

#6 Le 20/07/2025, à 11:03

geole

Re : Ubuntu 24.04.02 LTS

Le dernier caractère de la dernière ligne n’est pas "
Ces caractères
chanchris126@chanchris126-MS-7D48:~$
en sont la cause.

Dernière modification par geole (Le 20/07/2025, à 11:08)


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

Hors ligne

#7 Le 20/07/2025, à 11:41

Chanchris

Re : Ubuntu 24.04.02 LTS

Comment corriger ce problème ?

Hors ligne

#8 Le 20/07/2025, à 11:58

geole

Re : Ubuntu 24.04.02 LTS

Avec un éditeur de texte.
Par exemple

gted /etc/default/grub

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

Hors ligne

#9 Le 20/07/2025, à 13:50

Chanchris

Re : Ubuntu 24.04.02 LTS

Que faire exactement ?

Hors ligne

#10 Le 20/07/2025, à 13:56

xubu1957

Re : Ubuntu 24.04.02 LTS

Bonjour,

C'est à la suite de Ubuntu Mate 25.04[Resolu] ?


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

#11 Le 20/07/2025, à 15:05

geole

Re : Ubuntu 24.04.02 LTS

Il faut que cette ligne

export GRUB_MENU_PICTURE="/root/snap/20250409_125006_042.jpg"chanchris126@chanchris126-MS

devienne

export GRUB_MENU_PICTURE="/root/snap/20250409_125006_042.jpg"

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

Hors ligne

#12 Le 20/07/2025, à 15:38

Chanchris

Re : Ubuntu 24.04.02 LTS

En modifiant /etc/defaut/grub ?
Puis sudo update grub ?

Hors ligne

#13 Le 20/07/2025, à 15:45

geole

Re : Ubuntu 24.04.02 LTS

Oui et continue par

sudo apt upgrade

Dernière modification par geole (Le 20/07/2025, à 15:47)


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

Hors ligne

#14 Le 20/07/2025, à 20:26

Chanchris

Re : Ubuntu 24.04.02 LTS

voici mon fichier Grub.cfg

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT="0"
GRUB_TIMEOUT_STYLE="hidden"
GRUB_TIMEOUT="5"
GRUB_DISTRIBUTOR="`( . /etc/os-release; echo ${NAME:-Ubuntu} ) 2>/dev/null || echo Ubuntu`"
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

# If your computer has multiple operating systems installed, then you
# probably want to run os-prober. However, if your computer is a host
# for guest OSes installed via LVM or raw disk devices, running
# os-prober can cause damage to those guest OSes as it mounts
# filesystems to look for things.
#GRUB_DISABLE_OS_PROBER="false"

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal
#GRUB_TERMINAL="console"

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE="640x480"

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID="true"

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

export GRUB_COLOR_NORMAL="light-gray/black"
export GRUB_COLOR_HIGHLIGHT="yellow/black"
export GRUB_MENU_PICTURE="/root/snap/20250409_125006_042.jpg"

Il n'y a pas chanchris126@chanchris126-MS à la dernière ligne ??

Hors ligne

#15 Le 20/07/2025, à 22:23

geole

Re : Ubuntu 24.04.02 LTS

Redonne ce retour.

sudo apt upgrade

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

Hors ligne

#16 Le 23/07/2025, à 15:46

Chanchris

Re : Ubuntu 24.04.02 LTS

Voici le retour demandé :

chanchris126@chanchris126-MS-7D48:~$ sudo apt upgrade
[sudo] Mot de passe de chanchris126 : 
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances... Fait
Lecture des informations d'état... Fait      
Calcul de la mise à jour... Fait
0 mis à jour, 0 nouvellement installés, 0 à enlever et 0 non mis à jour.
2 partiellement installés ou enlevés.
Il est nécessaire de prendre 0 o/15,1 Mo dans les archives.
Après cette opération, 0 o d'espace disque supplémentaires seront utilisés.
Souhaitez-vous continuer ? [O/n] o
Paramétrage de linux-image-6.14.0-24-generic (6.14.0-24.24~24.04.3) ...
Traitement des actions différées (« triggers ») pour linux-image-6.14.0-24-generic (6.14.0-24.24~24.04.3) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-6.14.0-24-generic
/etc/kernel/postinst.d/zz-update-grub:
Sourcing file `/etc/default/grub'
Generating grub configuration file ...
using custom appearance settings
Found background image: /root/snap/20250409_125006_042.jpg
Found linux image: /boot/vmlinuz-6.14.0-24-generic
Found initrd image: /boot/initrd.img-6.14.0-24-generic
Found linux image: /boot/vmlinuz-6.11.0-29-generic
Found initrd image: /boot/initrd.img-6.11.0-29-generic
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot 
entries.
Found Windows Boot Manager on /dev/nvme0n1p1@/EFI/Microsoft/Boot/bootmgfw.efi
Found Ubuntu 25.04 (25.04) on /dev/nvme0n1p5
Found linux image: /boot/vmlinuz-6.14.0-24-generic
Found initrd image: /boot/initrd.img-6.14.0-24-generic
Found linux image: /boot/vmlinuz-6.11.0-29-generic
Found initrd image: /boot/initrd.img-6.11.0-29-generic
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot 
entries.
Found Windows Boot Manager on /dev/nvme0n1p1@/EFI/Microsoft/Boot/bootmgfw.efi
Found Ubuntu 25.04 (25.04) on /dev/nvme0n1p5
Found linux image: /boot/vmlinuz-6.14.0-24-generic
Found initrd image: /boot/initrd.img-6.14.0-24-generic
Found linux image: /boot/vmlinuz-6.11.0-29-generic
Found initrd image: /boot/initrd.img-6.11.0-29-generic
Found memtest86+ 64bit EFI image: /boot/memtest86+x64.efi
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot 
entries.
Found Windows Boot Manager on /dev/nvme0n1p1@/EFI/Microsoft/Boot/bootmgfw.efi
Found Ubuntu 25.04 (25.04) on /dev/nvme0n1p5
Found memtest86+ 64bit EFI image: /boot/memtest86+x64.efi
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot 
entries.
Found Windows Boot Manager on /dev/nvme0n1p1@/EFI/Microsoft/Boot/bootmgfw.efi
Found Ubuntu 25.04 (25.04) on /dev/nvme0n1p5
Adding boot menu entry for UEFI Firmware Settings ...
erreur : out of memory.
erreur : syntax error.
erreur : Incorrect command.
erreur : syntax error.
Erreur de syntaxe à la ligne 449
Syntax errors are detected in generated GRUB config file.
Ensure that there are no errors in /etc/default/grub
and /etc/grub.d/* files or please file a bug report with
/boot/grub/grub.cfg.new file attached.
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 1
dpkg: erreur de traitement du paquet linux-image-6.14.0-24-generic (--configure)
 :
 le sous-processus paquet linux-image-6.14.0-24-generic script post-installation
 installé a renvoyé un état de sortie d'erreur 1
Des erreurs ont été rencontrées pendant l'exécution :
 linux-image-6.14.0-24-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
chanchris126@chanchris126-MS-7D48:~$ 

Hors ligne

#17 Le 23/07/2025, à 16:46

geole

Re : Ubuntu 24.04.02 LTS

Bonjour
Redonne

cat -n -e /etc/default/grub
cat -n -e /etc/grub.d/*

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

Hors ligne

#18 Le 23/07/2025, à 20:15

Chanchris

Re : Ubuntu 24.04.02 LTS

chanchris126@chanchris126-MS-7D48:~$ cat -n -e /etc/grub.d/*
     1	#! /bin/sh$
     2	set -e$
     3	$
     4	# grub-mkconfig helper script.$
     5	# Copyright (C) 2006,2007,2008,2009,2010  Free Software Foundation, Inc.$
     6	#$
     7	# GRUB is free software: you can redistribute it and/or modify$
     8	# it under the terms of the GNU General Public License as published by$
     9	# the Free Software Foundation, either version 3 of the License, or$
    10	# (at your option) any later version.$
    11	#$
    12	# GRUB is distributed in the hope that it will be useful,$
    13	# but WITHOUT ANY WARRANTY; without even the implied warranty of$
    14	# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$
    15	# GNU General Public License for more details.$
    16	#$
    17	# You should have received a copy of the GNU General Public License$
    18	# along with GRUB.  If not, see <http://www.gnu.org/licenses/>.$
    19	$
    20	prefix="/usr"$
    21	exec_prefix="/usr"$
    22	datarootdir="/usr/share"$
    23	grub_lang=`echo $LANG | cut -d . -f 1`$
    24	grubdir="`echo "/boot/grub" | sed 's,//*,/,g'`"$
    25	quick_boot="1"$
    26	$
    27	export TEXTDOMAIN=grub$
    28	export TEXTDOMAINDIR="${datarootdir}/locale"$
    29	$
    30	. "$pkgdatadir/grub-mkconfig_lib"$
    31	$
    32	# Do this as early as possible, since other commands might depend on it.$
    33	# (e.g. the `loadfont' command might need lvm or raid modules)$
    34	for i in ${GRUB_PRELOAD_MODULES} ; do$
    35	  echo "insmod $i"$
    36	done$
    37	$
    38	if [ "x${GRUB_DEFAULT}" = "x" ] ; then GRUB_DEFAULT=0 ; fi$
    39	if [ "x${GRUB_DEFAULT}" = "xsaved" ] ; then GRUB_DEFAULT='${saved_entry}' ; fi$
    40	if [ "x${GRUB_TIMEOUT}" = "x" ] ; then GRUB_TIMEOUT=5 ; fi$
    41	if [ "x${GRUB_GFXMODE}" = "x" ] ; then GRUB_GFXMODE=auto ; fi$
    42	$
    43	if [ "x${GRUB_DEFAULT_BUTTON}" = "x" ] ; then GRUB_DEFAULT_BUTTON="$GRUB_DEFAULT" ; fi$
    44	if [ "x${GRUB_DEFAULT_BUTTON}" = "xsaved" ] ; then GRUB_DEFAULT_BUTTON='${saved_entry}' ; fi$
    45	if [ "x${GRUB_TIMEOUT_BUTTON}" = "x" ] ; then GRUB_TIMEOUT_BUTTON="$GRUB_TIMEOUT" ; fi$
    46	$
    47	cat << EOF$
    48	if [ -s \$prefix/grubenv ]; then$
    49	  set have_grubenv=true$
    50	  load_env$
    51	fi$
    52	EOF$
    53	cat <<EOF$
    54	if [ "\${initrdfail}" = 2 ]; then$
    55	   set initrdfail=$
    56	elif [ "\${initrdfail}" = 1 ]; then$
    57	   set next_entry="\${prev_entry}"$
    58	   set prev_entry=$
    59	   save_env prev_entry$
    60	   if [ "\${next_entry}" ]; then$
    61	      set initrdfail=2$
    62	   fi$
    63	fi$
    64	EOF$
    65	if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then$
    66	    cat <<EOF$
    67	if cmostest $GRUB_BUTTON_CMOS_ADDRESS ; then$
    68	   set default="${GRUB_DEFAULT_BUTTON}"$
    69	elif [ "\${next_entry}" ] ; then$
    70	   set default="\${next_entry}"$
    71	   set next_entry=$
    72	   save_env next_entry$
    73	   set boot_once=true$
    74	else$
    75	   set default="${GRUB_DEFAULT}"$
    76	fi$
    77	EOF$
    78	else$
    79	    cat <<EOF$
    80	if [ "\${next_entry}" ] ; then$
    81	   set default="\${next_entry}"$
    82	   set next_entry=$
    83	   save_env next_entry$
    84	   set boot_once=true$
    85	else$
    86	   set default="${GRUB_DEFAULT}"$
    87	fi$
    88	EOF$
    89	fi$
    90	cat <<EOF$
    91	$
    92	if [ x"\${feature_menuentry_id}" = xy ]; then$
    93	  menuentry_id_option="--id"$
    94	else$
    95	  menuentry_id_option=""$
    96	fi$
    97	$
    98	export menuentry_id_option$
    99	$
   100	if [ "\${prev_saved_entry}" ]; then$
   101	  set saved_entry="\${prev_saved_entry}"$
   102	  save_env saved_entry$
   103	  set prev_saved_entry=$
   104	  save_env prev_saved_entry$
   105	  set boot_once=true$
   106	fi$
   107	$
   108	function savedefault {$
   109	  if [ -z "\${boot_once}" ]; then$
   110	    saved_entry="\${chosen}"$
   111	    save_env saved_entry$
   112	  fi$
   113	}$
   114	EOF$
   115	$
   116	cat <<"EOF"$
   117	function initrdfail {$
   118	    if [ -n "${have_grubenv}" ]; then if [ -n "${partuuid}" ]; then$
   119	      if [ -z "${initrdfail}" ]; then$
   120	        set initrdfail=1$
   121	        if [ -n "${boot_once}" ]; then$
   122	          set prev_entry="${default}"$
   123	          save_env prev_entry$
   124	        fi$
   125	      fi$
   126	      save_env initrdfail$
   127	    fi; fi$
   128	}$
   129	EOF$
   130	$
   131	if [ "$quick_boot" = 1 ]; then$
   132	    cat <<EOF$
   133	function recordfail {$
   134	  set recordfail=1$
   135	EOF$
   136	$
   137	  check_writable () {$
   138	    abstractions="$(grub-probe --target=abstraction "${grubdir}")"$
   139	    for abstraction in $abstractions; do$
   140	      case "$abstraction" in$
   141	        diskfilter | lvm)$
   142	          cat <<EOF$
   143	  # GRUB lacks write support for $abstraction, so recordfail support is disabled.$
   144	EOF$
   145	          return 1$
   146	          ;;$
   147	      esac$
   148	    done$
   149	$
   150	    FS="$(grub-probe --target=fs "${grubdir}")"$
   151	    case "$FS" in$
   152	      btrfs | cpiofs | newc | odc | romfs | squash4 | tarfs | zfs)$
   153		cat <<EOF$
   154	  # GRUB lacks write support for $FS, so recordfail support is disabled.$
   155	EOF$
   156		return 1$
   157		;;$
   158	    esac$
   159	$
   160	    cat <<EOF$
   161	  if [ -n "\${have_grubenv}" ]; then if [ -z "\${boot_once}" ]; then save_env recordfail; fi; fi$
   162	EOF$
   163	  }$
   164	$
   165	  if ! check_writable; then$
   166	    recordfail_broken=1$
   167	  fi$
   168	$
   169	  cat <<EOF$
   170	}$
   171	EOF$
   172	fi$
   173	$
   174	cat <<EOF$
   175	function load_video {$
   176	EOF$
   177	if [ -n "${GRUB_VIDEO_BACKEND}" ]; then$
   178	    cat <<EOF$
   179	  insmod ${GRUB_VIDEO_BACKEND}$
   180	EOF$
   181	else$
   182	# If all_video.mod isn't available load all modules available$
   183	# with versions prior to introduction of all_video.mod$
   184	cat <<EOF$
   185	  if [ x\$feature_all_video_module = xy ]; then$
   186	    insmod all_video$
   187	  else$
   188	    insmod efi_gop$
   189	    insmod efi_uga$
   190	    insmod ieee1275_fb$
   191	    insmod vbe$
   192	    insmod vga$
   193	    insmod video_bochs$
   194	    insmod video_cirrus$
   195	  fi$
   196	EOF$
   197	fi$
   198	cat <<EOF$
   199	}$
   200	$
   201	EOF$
   202	$
   203	serial=0;$
   204	gfxterm=0;$
   205	for x in ${GRUB_TERMINAL_INPUT} ${GRUB_TERMINAL_OUTPUT}; do$
   206	    if [ xserial = "x$x" ]; then$
   207		serial=1;$
   208	    fi$
   209	    if [ xgfxterm = "x$x" ]; then$
   210		gfxterm=1;$
   211	    fi$
   212	done$
   213	$
   214	if [ "x$serial" = x1 ]; then$
   215	    if [ "x${GRUB_SERIAL_COMMAND}" = "x" ] ; then$
   216		grub_warn "$(gettext "Requested serial terminal but GRUB_SERIAL_COMMAND is unspecified. Default parameters will be used.")"$
   217		GRUB_SERIAL_COMMAND=serial$
   218	    fi$
   219	    echo "${GRUB_SERIAL_COMMAND}"$
   220	fi$
   221	$
   222	if [ "x$gfxterm" = x1 ]; then$
   223	    if [ -n "$GRUB_FONT" ] ; then$
   224	       # Make the font accessible$
   225	       prepare_grub_to_access_device `${grub_probe} --target=device "${GRUB_FONT}"`$
   226	    cat << EOF$
   227	if loadfont `make_system_path_relative_to_its_root "${GRUB_FONT}"` ; then$
   228	EOF$
   229	    else$
   230		for dir in "${pkgdatadir}" "`echo '/boot/grub' | sed "s,//*,/,g"`" /usr/share/grub ; do$
   231		    for basename in unicode unifont ascii; do$
   232			path="${dir}/${basename}.pf2"$
   233			if is_path_readable_by_grub "${path}" > /dev/null ; then$
   234			    font_path="${path}"$
   235			else$
   236			    continue$
   237			fi$
   238			break 2$
   239		    done$
   240		done$
   241		if [ -n "${font_path}" ] ; then$
   242	    cat << EOF$
   243	if [ x\$feature_default_font_path = xy ] ; then$
   244	   font=unicode$
   245	else$
   246	EOF$
   247	                # Make the font accessible$
   248			prepare_grub_to_access_device `${grub_probe} --target=device "${font_path}"`$
   249	    cat << EOF$
   250	    font="`make_system_path_relative_to_its_root "${font_path}"`"$
   251	fi$
   252	$
   253	if loadfont \$font ; then$
   254	EOF$
   255		    else$
   256	    cat << EOF$
   257	if loadfont unicode ; then$
   258	EOF$
   259		    fi$
   260		fi$
   261	$
   262	    cat << EOF$
   263	  set gfxmode=${GRUB_GFXMODE}$
   264	  load_video$
   265	  insmod gfxterm$
   266	EOF$
   267	$
   268	# Gettext variables and module$
   269	if [ "x${grub_lang}" != "xC" ] && [ "x${LANG}" != "xPOSIX" ] && [ "x${LANG}" != "x" ]; then$
   270	  cat << EOF$
   271	  set locale_dir=\$prefix/locale$
   272	  set lang=${grub_lang}$
   273	  insmod gettext$
   274	EOF$
   275	fi$
   276	$
   277	cat <<EOF$
   278	fi$
   279	EOF$
   280	fi$
   281	$
   282	case x${GRUB_TERMINAL_INPUT} in$
   283	  x)$
   284	    # Just use the native terminal$
   285	  ;;$
   286	  x*)$
   287	    cat << EOF$
   288	terminal_input ${GRUB_TERMINAL_INPUT}$
   289	EOF$
   290	  ;;$
   291	esac$
   292	$
   293	case x${GRUB_TERMINAL_OUTPUT} in$
   294	  x)$
   295	    # Just use the native terminal$
   296	  ;;$
   297	  x*)$
   298	    cat << EOF$
   299	terminal_output ${GRUB_TERMINAL_OUTPUT}$
   300	EOF$
   301	  ;;$
   302	esac$
   303	$
   304	if [ "x$gfxterm" = x1 ]; then$
   305	    if [ "x$GRUB_THEME" != x ] && [ -f "$GRUB_THEME" ] \$
   306		&& is_path_readable_by_grub "$GRUB_THEME"; then$
   307		gettext_printf "Found theme: %s\n" "$GRUB_THEME" >&2$
   308	$
   309		prepare_grub_to_access_device `${grub_probe} --target=device "$GRUB_THEME"`$
   310		cat << EOF$
   311	insmod gfxmenu$
   312	EOF$
   313		themedir="`dirname "$GRUB_THEME"`"$
   314		for x in "$themedir"/*.pf2 "$themedir"/f/*.pf2; do$
   315		    if [ -f "$x" ]; then$
   316			cat << EOF$
   317	loadfont (\$root)`make_system_path_relative_to_its_root $x`$
   318	EOF$
   319		    fi$
   320		done$
   321		if [ x"`echo "$themedir"/*.jpg`" != x"$themedir/*.jpg" ] || [ x"`echo "$themedir"/*.jpeg`" != x"$themedir/*.jpeg" ]; then$
   322		    cat << EOF$
   323	insmod jpeg$
   324	EOF$
   325		fi$
   326		if [ x"`echo "$themedir"/*.png`" != x"$themedir/*.png" ]; then$
   327		    cat << EOF$
   328	insmod png$
   329	EOF$
   330		fi$
   331		if [ x"`echo "$themedir"/*.tga`" != x"$themedir/*.tga" ]; then$
   332		    cat << EOF$
   333	insmod tga$
   334	EOF$
   335		fi$
   336		    $
   337		cat << EOF$
   338	set theme=(\$root)`make_system_path_relative_to_its_root $GRUB_THEME`$
   339	export theme$
   340	EOF$
   341	    elif [ "x$GRUB_BACKGROUND" != x ] && [ -f "$GRUB_BACKGROUND" ] \$
   342		    && is_path_readable_by_grub "$GRUB_BACKGROUND"; then$
   343		gettext_printf "Found background: %s\n" "$GRUB_BACKGROUND" >&2$
   344		case "$GRUB_BACKGROUND" in $
   345		    *.png)         reader=png ;;$
   346		    *.tga)         reader=tga ;;$
   347		    *.jpg|*.jpeg)  reader=jpeg ;;$
   348		    *)             gettext "Unsupported image format" >&2; echo >&2; exit 1 ;;$
   349		esac$
   350		prepare_grub_to_access_device `${grub_probe} --target=device "$GRUB_BACKGROUND"`$
   351		cat << EOF$
   352	insmod $reader$
   353	background_image -m stretch `make_system_path_relative_to_its_root "$GRUB_BACKGROUND"`$
   354	EOF$
   355	    fi$
   356	fi$
   357	$
   358	make_timeout ()$
   359	{$
   360	    cat << EOF$
   361	if [ "\${recordfail}" = 1 ] ; then$
   362	  set timeout=${GRUB_RECORDFAIL_TIMEOUT:-30}$
   363	else$
   364	EOF$
   365	    if [ "x${3}" != "x" ] ; then$
   366		timeout="${2}"$
   367		style="${3}"$
   368	    elif [ "x${1}" != "x" ] && \$
   369		 ([ "$quick_boot" = 1 ] || [ "x${1}" != "x0" ]) ; then$
   370		# Handle the deprecated GRUB_HIDDEN_TIMEOUT scheme.$
   371		timeout="${1}"$
   372		if [ "x${2}" != "x0" ] ; then$
   373		    grub_warn "$(gettext "Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.")"$
   374		fi$
   375		if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then$
   376		    style="hidden"$
   377		    verbose=$
   378		else$
   379		    style="countdown"$
   380		    verbose=" --verbose"$
   381		fi$
   382	    else$
   383		# No hidden timeout, so treat as GRUB_TIMEOUT_STYLE=menu$
   384		timeout="${2}"$
   385		style="menu"$
   386	    fi$
   387	    cat << EOF$
   388	  if [ x\$feature_timeout_style = xy ] ; then$
   389	    set timeout_style=${style}$
   390	    set timeout=${timeout}$
   391	EOF$
   392	    if [ "x${style}" = "xmenu" ] ; then$
   393		cat << EOF$
   394	  # Fallback normal timeout code in case the timeout_style feature is$
   395	  # unavailable.$
   396	  else$
   397	    set timeout=${timeout}$
   398	EOF$
   399	    else$
   400		cat << EOF$
   401	  # Fallback hidden-timeout code in case the timeout_style feature is$
   402	  # unavailable.$
   403	  elif sleep${verbose} --interruptible ${timeout} ; then$
   404	    set timeout=0$
   405	EOF$
   406	    fi$
   407	    cat << EOF$
   408	  fi$
   409	fi$
   410	EOF$
   411	if [ "$recordfail_broken" = 1 ]; then$
   412	  cat << EOF$
   413	if [ \$grub_platform = efi ]; then$
   414	  set timeout=${GRUB_RECORDFAIL_TIMEOUT:-30}$
   415	  if [ x\$feature_timeout_style = xy ] ; then$
   416	    set timeout_style=menu$
   417	  fi$
   418	fi$
   419	EOF$
   420	fi$
   421	}$
   422	$
   423	if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then$
   424	    cat <<EOF$
   425	if cmostest $GRUB_BUTTON_CMOS_ADDRESS ; then$
   426	EOF$
   427	make_timeout "${GRUB_HIDDEN_TIMEOUT_BUTTON}" "${GRUB_TIMEOUT_BUTTON}" "${GRUB_TIMEOUT_STYLE_BUTTON}"$
   428	echo else$
   429	make_timeout "${GRUB_HIDDEN_TIMEOUT}" "${GRUB_TIMEOUT}" "${GRUB_TIMEOUT_STYLE}"$
   430	echo fi$
   431	else$
   432	make_timeout "${GRUB_HIDDEN_TIMEOUT}" "${GRUB_TIMEOUT}" "${GRUB_TIMEOUT_STYLE}"$
   433	fi$
   434	$
   435	if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ] && [ "x$GRUB_BUTTON_CMOS_CLEAN" = "xyes" ]; then$
   436	    cat <<EOF$
   437	cmosclean $GRUB_BUTTON_CMOS_ADDRESS$
   438	EOF$
   439	fi$
   440	$
   441	# Play an initial tune$
   442	if [ "x${GRUB_INIT_TUNE}" != "x" ] ; then$
   443	  echo "play ${GRUB_INIT_TUNE}"$
   444	fi$
   445	$
   446	if [ "x${GRUB_BADRAM}" != "x" ] ; then$
   447	  echo "badram ${GRUB_BADRAM}"$
   448	fi$
   449	#!/bin/sh$
   450	set -e$
   451	$
   452	# grub-mkconfig helper script.$
   453	# Copyright (C) 2010  Alexander Kurtz <kurtz.alex@googlemail.com>$
   454	#$
   455	# GRUB is free software: you can redistribute it and/or modify$
   456	# it under the terms of the GNU General Public License as published by$
   457	# the Free Software Foundation, either version 3 of the License, or$
   458	# (at your option) any later version.$
   459	#$
   460	# GRUB is distributed in the hope that it will be useful,$
   461	# but WITHOUT ANY WARRANTY; without even the implied warranty of$
   462	# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$
   463	# GNU General Public License for more details.$
   464	#$
   465	# You should have received a copy of the GNU General Public License$
   466	# along with GRUB.  If not, see <http://www.gnu.org/licenses/>.$
   467	$
   468	# Include the GRUB helper library for grub-mkconfig.$
   469	. /usr/share/grub/grub-mkconfig_lib$
   470	$
   471	# We want to work in /boot/grub/ only.$
   472	test -d /boot/grub; cd /boot/grub$
   473	$
   474	# Set the location of a possibly necessary cache file for the background image.$
   475	# NOTE: This MUST BE A DOTFILE to avoid confusing it with user-defined images.$
   476	BACKGROUND_CACHE=".background_cache"$
   477	$
   478	set_default_theme(){$
   479		case $GRUB_DISTRIBUTOR in$
   480			Tanglu|Ubuntu|Kubuntu)$
   481				# Set a monochromatic theme for Tanglu/Ubuntu.$
   482				echo "${1}set menu_color_normal=white/black"$
   483				echo "${1}set menu_color_highlight=black/light-gray"$
   484	$
   485				if [ -e /usr/share/plymouth/themes/default.grub ]; then$
   486					sed "s/^/${1}/" /usr/share/plymouth/themes/default.grub$
   487				fi$
   488				# For plymouth backward compatibility. Can be removed$
   489				# after xenial.$
   490				if [ -e /lib/plymouth/themes/default.grub ]; then$
   491					sed "s/^/${1}/" /lib/plymouth/themes/default.grub$
   492				fi$
   493				;;$
   494			*)$
   495				# Set the traditional Debian blue theme.$
   496				echo "${1}set menu_color_normal=cyan/blue"$
   497				echo "${1}set menu_color_highlight=white/blue"$
   498				;;$
   499		esac$
   500	}$
   501	$
   502	module_available(){$
   503		local module$
   504		for module in "${1}.mod" */"${1}.mod"; do$
   505			if [ -f "${module}" ]; then$
   506				return 0$
   507			fi$
   508		done$
   509		return 1$
   510	}$
   511	$
   512	set_background_image(){$
   513		# Step #1: Search all available output modes ...$
   514		local output$
   515		for output in ${GRUB_TERMINAL_OUTPUT}; do$
   516			if [ "x$output" = "xgfxterm" ]; then$
   517				break$
   518			fi$
   519		done$
   520	$
   521		# ... and check if we are able to display a background image at all.$
   522		if ! [ "x${output}" = "xgfxterm" ]; then$
   523			return 1$
   524		fi$
   525	$
   526		# Step #2: Check if the specified background image exists.$
   527		if ! [ -f "${1}" ]; then$
   528			return 2$
   529		fi$
   530	$
   531		# Step #3: Search the correct GRUB module for our background image.$
   532		local reader$
   533		case "${1}" in$
   534			*.jpg|*.JPG|*.jpeg|*.JPEG) reader="jpeg";;$
   535			*.png|*.PNG) reader="png";;$
   536			*.tga|*.TGA) reader="tga";;$
   537			*) return 3;; # Unknown image type.$
   538		esac$
   539	$
   540		# Step #4: Check if the necessary GRUB module is available.$
   541		if ! module_available "${reader}"; then$
   542			return 4$
   543		fi$
   544	$
   545		# Step #5: Check if GRUB can read the background image directly.$
   546		# If so, we can remove the cache file (if any). Otherwise the background$
   547		# image needs to be cached under /boot/grub/.$
   548		if is_path_readable_by_grub "${1}"; then$
   549			rm --force "${BACKGROUND_CACHE}.jpeg" \$
   550				"${BACKGROUND_CACHE}.png" "${BACKGROUND_CACHE}.tga"$
   551		elif cp "${1}" "${BACKGROUND_CACHE}.${reader}"; then$
   552			set -- "${BACKGROUND_CACHE}.${reader}" "${2}" "${3}"$
   553		else$
   554			return 5$
   555		fi$
   556	$
   557		# Step #6: Prepare GRUB to read the background image.$
   558		if ! prepare_grub_to_access_device "`${grub_probe} --target=device "${1}"`"; then$
   559			return 6$
   560		fi$
   561	$
   562		# Step #7: Everything went fine, print out a message to stderr ...$
   563		echo "Found background image: ${1}" >&2$
   564	$
   565		# ... and write our configuration snippet to stdout. Use the colors$
   566		# desktop-base specified. If we're using a user-defined background, use$
   567		# the default colors since we've got no idea how the image looks like.$
   568		# If loading the background image fails, use the default theme.$
   569		echo "insmod ${reader}"$
   570		echo "if background_image `make_system_path_relative_to_its_root "${1}"`; then"$
   571		if [ -n "${2}" ]; then$
   572			echo "  set color_normal=${2}"$
   573		fi$
   574		if [ -n "${3}" ]; then$
   575			echo "  set color_highlight=${3}"$
   576		fi$
   577		if [ -z "${2}" ] && [ -z "${3}" ]; then$
   578			echo "  true"$
   579		fi$
   580		echo "else"$
   581		set_default_theme "  "$
   582		echo "fi"$
   583	}$
   584	$
   585	# Earlier versions of grub-pc copied the default background image to /boot/grub$
   586	# during postinst. Remove those obsolete images if they haven't been touched by$
   587	# the user. They are still available under /usr/share/images/desktop-base/ if$
   588	# desktop-base is installed.$
   589	while read checksum background; do$
   590		if [ -f "${background}" ] && [ "x`sha1sum "${background}"`" = "x${checksum}  ${background}" ]; then$
   591			echo "Removing old background image: ${background}" >&2$
   592			rm "${background}"$
   593		fi$
   594	done <<EOF$
   595	648ee65dd0c157a69b019a5372cbcfea4fc754a5  debian-blueish-wallpaper-640x480.png$
   596	0431e97a6c661084c59676c4baeeb8c2f602edb8  debian-blueish-wallpaper-640x480.png$
   597	968ecf6696c5638cfe80e8e70aba239526270864  debian-blueish-wallpaper-640x480.tga$
   598	11143e8c92a073401de0b0fd42d0c052af4ccd9b  moreblue-orbit-grub.png$
   599	d00d5e505ab63f2d53fa880bfac447e2d3bb197c  moreblue-orbit-grub.png$
   600	f5b12c1009ec0a3b029185f6b66cd0d7e5611019  moreblue-orbit-grub.png$
   601	EOF$
   602	$
   603	# Include the configuration of desktop-base if available.$
   604	if [ -f "/usr/share/desktop-base/grub_background.sh" ]; then$
   605		. "/usr/share/desktop-base/grub_background.sh"$
   606	fi$
   607	$
   608	# First check whether the user has specified a background image explicitly.$
   609	# If so, try to use it. Don't try the other possibilities in that case$
   610	# (#608263).$
   611	if [ -n "${GRUB_BACKGROUND+x}" ]; then$
   612		set_background_image "${GRUB_BACKGROUND}" || set_default_theme$
   613		exit 0$
   614	fi$
   615	$
   616	# Next search for pictures the user put into /boot/grub/ and use the first one.$
   617	for background in *.jpg *.JPG *.jpeg *.JPEG *.png *.PNG *.tga *.TGA; do$
   618		if set_background_image "${background}"; then$
   619			exit 0$
   620		fi$
   621	done$
   622	$
   623	# Next try to use the background image and colors specified by desktop-base.$
   624	if set_background_image "${WALLPAPER}" "${COLOR_NORMAL}" "${COLOR_HIGHLIGHT}"; then$
   625		exit 0$
   626	fi$
   627	$
   628	# If we haven't found a background image yet, use the default from desktop-base.$
   629	case $GRUB_DISTRIBUTOR in$
   630		Ubuntu|Kubuntu)$
   631			;;$
   632		Tanglu)$
   633			if set_background_image "/usr/share/images/grub/grub.png"; then$
   634				exit 0$
   635			fi$
   636			;;$
   637		*)$
   638			if set_background_image "/usr/share/images/desktop-base/desktop-grub.png"; then$
   639				exit 0$
   640			fi$
   641			;;$
   642	esac$
   643	$
   644	# Finally, if all of the above fails, use the default theme.$
   645	set_default_theme$
   646	#!/bin/sh$
   647	#THIS IS A GRUB PROXY SCRIPT$
   648	'/etc/grub.d/proxifiedScripts/linux' | /etc/grub.d/bin/grubcfg_proxy "-'SUBMENU' as 'Advanced options for Ubuntu'{-'Advanced options for Ubuntu'/*, -'Advanced options for Ubuntu'/'Ubuntu, with Linux 6.14.0-24-generic'~ed42cb1bc10bf62b93eeb2abaebaafaf~, -'Advanced options for Ubuntu'/'Ubuntu, with Linux 6.14.0-24-generic (recovery mode)'~b2dd84bf734123180fb731ffcbacffcc~, -'Advanced options for Ubuntu'/'Ubuntu, with Linux 6.11.0-29-generic'~9976110a8a02e4aec94bbb07bccb7277~, -'Advanced options for Ubuntu'/'Ubuntu, with Linux 6.11.0-29-generic (recovery mode)'~a63a181363bfd36a8b55191d80bed36a~}$
   649	+*$
   650	+#text$
   651	-'Ubuntu'~eb05176484bd1d5368b32f1f84f8ccd1~$
   652	"#!/bin/sh$
   653	#THIS IS A GRUB PROXY SCRIPT$
   654	'/etc/grub.d/proxifiedScripts/os-prober' | /etc/grub.d/bin/grubcfg_proxy "-*$
   655	-'Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'~134dd03574b43585791efd6c2e827b71~$
   656	-'SUBMENU' as 'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'{-'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/*, -'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Ubuntu (on /dev/nvme0n1p5)'~cc96c467383f79e632e1c88452fb38c8~, -'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Ubuntu, with Linux 6.14.0-24-generic (on /dev/nvme0n1p5)'~cc96c467383f79e632e1c88452fb38c8~, -'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Ubuntu, with Linux 6.14.0-24-generic (recovery mode) (on /dev/nvme0n1p5)'~72bfd870d8385ef96ffd975793c6ebb4~, -'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Memory test (memtest86+x64.efi)'~b29573a9321427edec4848bf641e981d~, -'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Memory test (memtest86+x64.efi, serial console)'~234e2b4d9d9d2c68b1789be49d33100e~, -'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Memory test (memtest86+ia32.efi)'~ca310618ac9120fe40de012fcd221c51~, -'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Memory test (memtest86+ia32.efi, serial console)'~fa192ec1dac1db67fd402fd7f99a6a7b~, -'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Memory test (memtest86+x64.bin)'~83bfbf79f9d2e5222d74305efb85ae52~, -'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Memory test (memtest86+x64.bin, serial console)'~6d2876c39f2b193378d0f2915a68b6aa~, -'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Memory test (memtest86+ia32.bin)'~d408d4759af95ef87faaa5f55f282c75~, -'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Memory test (memtest86+ia32.bin, serial console)'~b446cb7716f5bd64334d1ae61b99b671~}$
   657	-#text$
   658	+'Windows Boot Manager (on /dev/nvme0n1p1)'~de20f8367656d13763b692aadbca3155~$
   659	"#!/bin/sh$
   660	#THIS IS A GRUB PROXY SCRIPT$
   661	'/etc/grub.d/proxifiedScripts/linux' | /etc/grub.d/bin/grubcfg_proxy "-*$
   662	-#text$
   663	-'SUBMENU' as 'Advanced options for Ubuntu'{-'Advanced options for Ubuntu'/*, -'Advanced options for Ubuntu'/'Ubuntu, with Linux 6.14.0-24-generic'~ed42cb1bc10bf62b93eeb2abaebaafaf~, -'Advanced options for Ubuntu'/'Ubuntu, with Linux 6.14.0-24-generic (recovery mode)'~b2dd84bf734123180fb731ffcbacffcc~, -'Advanced options for Ubuntu'/'Ubuntu, with Linux 6.11.0-29-generic'~9976110a8a02e4aec94bbb07bccb7277~, -'Advanced options for Ubuntu'/'Ubuntu, with Linux 6.11.0-29-generic (recovery mode)'~a63a181363bfd36a8b55191d80bed36a~}$
   664	+'Ubuntu'~eb05176484bd1d5368b32f1f84f8ccd1~ as 'Ubuntu Desktop'$
   665	"#!/bin/sh$
   666	#THIS IS A GRUB PROXY SCRIPT$
   667	'/etc/grub.d/proxifiedScripts/os-prober' | /etc/grub.d/bin/grubcfg_proxy "-*$
   668	-'Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'~134dd03574b43585791efd6c2e827b71~$
   669	-'SUBMENU' as 'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'{-'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/*, -'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Ubuntu (on /dev/nvme0n1p5)'~cc96c467383f79e632e1c88452fb38c8~, -'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Ubuntu, with Linux 6.14.0-24-generic (on /dev/nvme0n1p5)'~cc96c467383f79e632e1c88452fb38c8~, -'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Ubuntu, with Linux 6.14.0-24-generic (recovery mode) (on /dev/nvme0n1p5)'~72bfd870d8385ef96ffd975793c6ebb4~, -'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Memory test (memtest86+x64.efi)'~b29573a9321427edec4848bf641e981d~, -'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Memory test (memtest86+x64.efi, serial console)'~234e2b4d9d9d2c68b1789be49d33100e~, -'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Memory test (memtest86+ia32.efi)'~ca310618ac9120fe40de012fcd221c51~, -'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Memory test (memtest86+ia32.efi, serial console)'~fa192ec1dac1db67fd402fd7f99a6a7b~, -'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Memory test (memtest86+x64.bin)'~83bfbf79f9d2e5222d74305efb85ae52~, -'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Memory test (memtest86+x64.bin, serial console)'~6d2876c39f2b193378d0f2915a68b6aa~, -'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Memory test (memtest86+ia32.bin)'~d408d4759af95ef87faaa5f55f282c75~, -'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Memory test (memtest86+ia32.bin, serial console)'~b446cb7716f5bd64334d1ae61b99b671~}$
   670	-#text$
   671	-'Windows Boot Manager (on /dev/nvme0n1p1)'~de20f8367656d13763b692aadbca3155~$
   672	"#!/bin/sh$
   673	#THIS IS A GRUB PROXY SCRIPT$
   674	'/etc/grub.d/proxifiedScripts/linux' | /etc/grub.d/bin/grubcfg_proxy "-'Ubuntu'~eb05176484bd1d5368b32f1f84f8ccd1~ as 'Ubuntu Desktop'$
   675	-*$
   676	-#text$
   677	+'SUBMENU' as 'Advanced options for Ubuntu'{+'Advanced options for Ubuntu'/*, +'Advanced options for Ubuntu'/'Ubuntu, with Linux 6.14.0-24-generic'~ed42cb1bc10bf62b93eeb2abaebaafaf~, +'Advanced options for Ubuntu'/'Ubuntu, with Linux 6.14.0-24-generic (recovery mode)'~b2dd84bf734123180fb731ffcbacffcc~, +'Advanced options for Ubuntu'/'Ubuntu, with Linux 6.11.0-29-generic'~9976110a8a02e4aec94bbb07bccb7277~, +'Advanced options for Ubuntu'/'Ubuntu, with Linux 6.11.0-29-generic (recovery mode)'~a63a181363bfd36a8b55191d80bed36a~}$
   678	"#! /bin/sh$
   679	set -e$
   680	$
   681	# grub-mkconfig helper script.$
   682	# Copyright (C) 2019 Canonical Ltd.$
   683	#$
   684	# GRUB is free software: you can redistribute it and/or modify$
   685	# it under the terms of the GNU General Public License as published by$
   686	# the Free Software Foundation, either version 3 of the License, or$
   687	# (at your option) any later version.$
   688	#$
   689	# GRUB is distributed in the hope that it will be useful,$
   690	# but WITHOUT ANY WARRANTY; without even the implied warranty of$
   691	# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$
   692	# GNU General Public License for more details.$
   693	#$
   694	# You should have received a copy of the GNU General Public License$
   695	# along with GRUB.  If not, see <http://www.gnu.org/licenses/>.$
   696	$
   697	prefix="/usr"$
   698	datarootdir="/usr/share"$
   699	ubuntu_recovery="1"$
   700	quiet_boot="1"$
   701	quick_boot="1"$
   702	gfxpayload_dynamic="1"$
   703	vt_handoff="1"$
   704	$
   705	. "${pkgdatadir}/grub-mkconfig_lib"$
   706	$
   707	export TEXTDOMAIN=grub$
   708	export TEXTDOMAINDIR="${datarootdir}/locale"$
   709	$
   710	## Skip early if zfs utils isn't installed (instead of failing on first zpool list)$
   711	if ! `which zfs >/dev/null 2>&1`; then$
   712	    exit 0$
   713	fi$
   714	$
   715	imported_pools=""$
   716	MNTDIR="$(mktemp -d ${TMPDIR:-/tmp}/zfsmnt.XXXXXX)"$
   717	ZFSTMP="$(mktemp -d ${TMPDIR:-/tmp}/zfstmp.XXXXXX)"$
   718	$
   719	$
   720	machine="$(uname -m)"$
   721	case "${machine}" in$
   722	    i?86) GENKERNEL_ARCH="x86" ;;$
   723	    mips|mips64) GENKERNEL_ARCH="mips" ;;$
   724	    mipsel|mips64el) GENKERNEL_ARCH="mipsel" ;;$
   725	    arm*) GENKERNEL_ARCH="arm" ;;$
   726	    *) GENKERNEL_ARCH="${machine}" ;;$
   727	esac$
   728	$
   729	RC=0$
   730	on_exit() {$
   731	    # Restore initial zpool import state$
   732	    for pool in ${imported_pools}; do$
   733	        zpool export "${pool}"$
   734	    done$
   735	$
   736	    mountpoint -q "${MNTDIR}/boot"  && umount "${MNTDIR}/boot" || true$
   737	    mountpoint -q "${MNTDIR}"  && umount "${MNTDIR}" || true$
   738	    rmdir "${MNTDIR}"$
   739	    rm -rf "${ZFSTMP}"$
   740	    exit "${RC}"$
   741	}$
   742	trap on_exit EXIT INT QUIT ABRT PIPE TERM$
   743	$
   744	# List ONLINE and DEGRADED pools$
   745	import_pools() {$
   746	    # We have to ignore zpool import output, as potentially multiple / will be available,$
   747	    # and we need to autodetect all zpools this way with their real mountpoints.$
   748	    local initial_pools="$(zpool list | awk '{if (NR>1) print $1}')"$
   749	    local all_pools=""$
   750	    local imported_pools=""$
   751	    local err=""$
   752	$
   753	    set +e$
   754	    err="$(zpool import -f -a -o cachefile=none -o readonly=on -N 2>&1)"$
   755	    # Only print stderr if the command returned an error$
   756	    # (it can echo "No zpool to import" with success, which we don't want)$
   757	    if [ $? -ne 0 ]; then$
   758	        echo "Some pools couldn't be imported and will be ignored:\n${err}" >&2$
   759	    fi$
   760	    set -e$
   761	$
   762	    all_pools="$(zpool list | awk '{if (NR>1) print $1}')"$
   763	    for pool in ${all_pools}; do$
   764	        if echo "${initial_pools}" | grep -wq "${pool}"; then$
   765	            continue$
   766	        fi$
   767	        imported_pools="${imported_pools} ${pool}"$
   768	    done$
   769	$
   770	    echo "${imported_pools}"$
   771	}$
   772	$
   773	# List all the dataset with a root mountpoint$
   774	get_root_datasets() {$
   775	    local pools="$(zpool list | awk '{if (NR>1) print $1}')"$
   776	$
   777	    for p in ${pools}; do$
   778	        local rel_pool_root=$(zpool get -H altroot ${p} | awk '{print $3}')$
   779	        if [ "${rel_pool_root}" = "-" ]; then$
   780	            rel_pool_root="/"$
   781	        fi$
   782	$
   783	        zfs list -H -o name,canmount,mountpoint -t filesystem | grep -E '^'"${p}"'(\s|/[[:print:]]*\s)(on|noauto)\s'"${rel_pool_root}"'$' | awk '{print $1}'$
   784	    done$
   785	}$
   786	$
   787	# find if given datasets can be mounted for directory and return its path (snapshot or real path)$
   788	# $1 is our current dataset name$
   789	# $2 directory path we look for (cannot contains /)$
   790	# $3 is the temporary mount directory to use$
   791	# $4 is the optional snapshot name$
   792	# return path for directory (which can be a mountpoint)$
   793	validate_system_dataset() {$
   794	    local dataset="$1"$
   795	    local directory="$2"$
   796	    local mntdir="$3"$
   797	    local snapshot_name="$4"$
   798	$
   799	    local mount_path="${mntdir}/${directory}"$
   800	$
   801	    if ! zfs list "${dataset}" >/dev/null 2>&1; then$
   802	        return$
   803	    fi$
   804	$
   805	    if ! mount -o noatime,zfsutil -t zfs "${dataset}" "${mount_path}"; then$
   806	        grub_warn "Failed to find a valid directory '${directory}' for dataset '${dataset}@${snapshot_name}'. Ignoring"$
   807	        return$
   808	    fi$
   809	$
   810	    local candidate_path="${mount_path}"$
   811	    if [ -n "${snapshot_name}" ]; then$
   812	        # WORKAROUND a bug https://github.com/zfsonlinux/zfs/issues/9958$
   813	        # Reading the content of a snapshot fails if it is not the first mount$
   814	        # for a given dataset$
   815	        first_mntdir=$(awk '{if ($1 == "'${dataset}'") {print $2; exit;}}' /proc/mounts)$
   816	        if [ "${first_mntdir}" = "/" ]; then$
   817	            # prevents // on candidate_path$
   818	            first_mntdir=""$
   819	        fi$
   820	        candidate_path="${first_mntdir}/.zfs/snapshot/${snapshot_name}"$
   821	    fi$
   822	$
   823	    if [ -n "$(ls "${candidate_path}" 2>/dev/null)" ]; then$
   824	        echo "${candidate_path}"$
   825	        return$
   826	    else$
   827	        mountpoint -q "${mount_path}" && umount "${mount_path}" || true$
   828	    fi$
   829	}$
   830	$
   831	# Detect system directory relevant to the other, trying to find the ones associated on the current dataset or snapshot/$
   832	# System directory should be at most a direct child dataset of main datasets (no recursivity)$
   833	# We can fallback trying other zfs pools if no match has been found.$
   834	# $1 is our current dataset name (which can have @snapshot name)$
   835	# $2 directory path we look for (cannot contains /)$
   836	# $3 restrict_to_same_pool (true|false) force looking for dataset with the same basename in the current dataset pool only$
   837	# $4 is the temporary mount directory to use$
   838	# $5 is the optional etc directory (if not $2 is not etc itself)$
   839	# return path for directory (which can be a mountpoint)$
   840	get_system_directory() {$
   841	    local dataset_path="$1"$
   842	    local directory="$2"$
   843	    local restrict_to_same_pool="$3"$
   844	    local mntdir="$4"$
   845	    local etc_dir="$5"$
   846	$
   847	    if [ -z "${etc_dir}" ]; then$
   848	        etc_dir="${mntdir}/etc"$
   849	    fi$
   850	$
   851	    local candidate_path="${mntdir}/${directory}"$
   852	$
   853	    # 1. Look for /etc/fstab first (which will mount even on top of non empty $directory)$
   854	    local mounted_fstab_entry="false"$
   855	    if [ -f "${etc_dir}/fstab" ]; then$
   856	        mount_args=$(awk '/^[^#].*[ \t]\/'"${directory}"'[ \t]/ {print "-t", $3, $1}' "${etc_dir}/fstab")$
   857	        if [ -n "${mount_args}" ]; then$
   858	            mounted_fstab_entry="true"$
   859	            mount -o noatime ${mount_args} "${candidate_path}" || mounted_fstab_entry="false"$
   860	        fi$
   861	    fi$
   862	$
   863	    # If directory isn't empty. Only count if coming from /etc/fstab. Will be$
   864	    # handled below otherwise as we are interested in potential snapshots.$
   865	    if [ "${mounted_fstab_entry}" = "true" -a -n "$(ls ${candidate_path} 2>/dev/null)" ]; then$
   866	        echo "${candidate_path}"$
   867	        return$
   868	    fi$
   869	$
   870	    # 2. Handle zfs case, which can be a snapshots.$
   871	$
   872	    local base_dataset_path="${dataset_path}"$
   873	    local snapshot_name=""$
   874	    # For snapshots we extract the parent dataset$
   875	    if echo "${dataset_path}" | grep -q '@'; then$
   876	        base_dataset_path=$(echo "${dataset_path}" | cut -d '@' -f1)$
   877	        snapshot_name=$(echo "${dataset_path}" | cut -d '@' -f2)$
   878	    fi$
   879	    base_dataset_name="${base_dataset_path##*/}"$
   880	    base_pool="$(echo "${base_dataset_path}" | cut -d'/' -f1)"$
   881	$
   882	    # 2.a) Look for child dataset included in base dataset, which needs to hold same snapshot if any$
   883	    candidate_path=$(validate_system_dataset "${base_dataset_path}/${directory}" "${directory}" "${mntdir}" "${snapshot_name}")$
   884	    if [ -n "${candidate_path}" ]; then$
   885	        echo "${candidate_path}"$
   886	        return$
   887	    fi$
   888	$
   889	    # 2.b) Look for current dataset (which is already mounted as /)$
   890	    candidate_path="${mntdir}/${directory}"$
   891	    if [ -n "${snapshot_name}" ]; then$
   892	        # WORKAROUND a bug https://github.com/zfsonlinux/zfs/issues/9958$
   893	        # Reading the content of a snapshot fails if it is not the first mount$
   894	        # for a given dataset$
   895	        first_mntdir=$(awk '{if ($1 == "'${base_dataset_path}'") {print $2; exit;}}' /proc/mounts)$
   896	        if [ "${first_mntdir}" = "/" ]; then$
   897	            # prevents // on candidate_path$
   898	            first_mntdir=""$
   899	        fi$
   900	        candidate_path="${first_mntdir}/.zfs/snapshot/${snapshot_name}/${directory}"$
   901	    fi$
   902	    if [ -n "$(ls "${candidate_path}" 2>/dev/null)" ]; then$
   903	        echo "${candidate_path}"$
   904	        return$
   905	    fi$
   906	$
   907	    # 2.c) Look for every datasets in every pool which isn't the current dataset which holds:$
   908	    # - the same dataset name (last section) than our base_dataset_name$
   909	    # - mountpoint=directory$
   910	    # - canmount!=off$
   911	    all_same_base_dataset_name="$(zfs list -H -t filesystem -o name,canmount | awk '/^[^ ]+\/'"${base_dataset_name}"'[ \t](on|noauto)/ {print $1}') "$
   912	$
   913	    # order by local pool datasets first$
   914	    current_pool_same_base_datasets=""$
   915	    other_pools_same_base_datasets=""$
   916	    root_pool=$(echo "${dataset_path%%/*}")$
   917	    for d in ${all_same_base_dataset_name}; do$
   918	        cur_dataset_pool=$(echo "${d%%/*}")$
   919	        if echo "${cur_dataset_pool}" | grep -wq "${root_pool}" 2>/dev/null ; then$
   920	            current_pool_same_base_datasets="${current_pool_same_base_datasets} ${d}"$
   921	        else$
   922	            other_pools_same_base_datasets="${other_pools_same_base_datasets} ${d}"$
   923	        fi$
   924	    done$
   925	    ordered_same_base_datasets="${current_pool_same_base_datasets} ${other_pools_same_base_datasets}"$
   926	    if [ "${restrict_to_same_pool}" = "true" ]; then$
   927	        ordered_same_base_datasets="${current_pool_same_base_datasets}"$
   928	    fi$
   929	$
   930	    # now, loop over them$
   931	    for d in ${ordered_same_base_datasets}; do$
   932	        cur_dataset_pool=$(echo "${d%%/*}")$
   933	$
   934	        rel_pool_root=$(zpool get -H altroot ${cur_dataset_pool} | awk '{print $3}')$
   935	        if [ "${rel_pool_root}" = "-" ]; then$
   936	            rel_pool_root=""$
   937	        fi$
   938	$
   939	        # check mountpoint match$
   940	        candidate_dataset=$(zfs get -H mountpoint ${d} | grep -E "mountpoint\s${rel_pool_root}/${directory}\s" | awk '{print $1}')$
   941	        if [ -z "${candidate_dataset}" ]; then$
   942	            continue$
   943	        fi$
   944	$
   945	        candidate_path=$(validate_system_dataset "${candidate_dataset}" "${directory}" "${mntdir}" "${snapshot_name}")$
   946	        if [ -n "${candidate_path}" ]; then$
   947	            echo "${candidate_path}"$
   948	            return$
   949	        fi$
   950	    done$
   951	$
   952	    # 2.d) If we didn't find anything yet: check for persistent datasets corresponding to our mountpoint, with canmount=on without any snapshot associated:$
   953	    # Note: we go over previous datasets as well, but this is ok, as we didn't include them before.$
   954	    all_mountable_datasets="$(zfs list -t filesystem -o name,canmount | awk  '/^[^ ]+[ \t]+on/ {print $1}')"$
   955	$
   956	    # order by local pool datasets first$
   957	    current_pool_datasets=""$
   958	    other_pools_datasets=""$
   959	    root_pool=$(echo "${dataset_path%%/*}")$
   960	    for d in ${all_mountable_datasets}; do$
   961	        cur_dataset_pool=$(echo "${d%%/*}")$
   962	        if echo "${cur_dataset_pool}" | grep -wq "${root_pool}" 2>/dev/null ; then$
   963	            current_pool_datasets="${current_pool_datasets} ${d}"$
   964	        else$
   965	            other_pools_datasets="${other_pools_datasets} ${d}"$
   966	        fi$
   967	    done$
   968	    ordered_datasets="${current_pool_datasets} ${other_pools_datasets}"$
   969	    if [ "${restrict_to_same_pool}" = "true" ]; then$
   970	        ordered_datasets="${current_pool_datasets}"$
   971	    fi$
   972	$
   973	    for d in ${ordered_datasets}; do$
   974	        cur_dataset_pool=$(echo "${d%%/*}")$
   975	$
   976	        rel_pool_root=$(zpool get -H altroot ${cur_dataset_pool} | awk '{print $3}')$
   977	        if [ "${rel_pool_root}" = "-" ]; then$
   978	            rel_pool_root=""$
   979	        fi$
   980	$
   981	        # check mountpoint match$
   982	        candidate_dataset=$(zfs get -H mountpoint ${d} | grep -E "mountpoint\s${rel_pool_root}/${directory}\s" | awk '{print $1}')$
   983	        if [ -z "${candidate_dataset}" ]; then$
   984	            continue$
   985	        fi$
   986	$
   987	        candidate_path=$(validate_system_dataset "${d}" "${directory}" "${mntdir}" "")$
   988	        if [ -n "${candidate_path}" ]; then$
   989	            echo "${candidate_path}"$
   990	            return$
   991	        fi$
   992	    done$
   993	$
   994	    grub_warn "Failed to find a valid directory '${directory}' for dataset '${dataset_path}'. Ignoring"$
   995	    return$
   996	}$
   997	$
   998	# Try our default layout bpool as a prefered layout (fast path)$
   999	# This is get_system_directory for boot optimized for our default installation layout$
  1000	# $1 is our current dataset name (which can have @snapshot name)$
  1001	# $2 is the temporary mount directory to use$
  1002	# return path for directory (which can be a mountpoint) if found$
  1003	try_default_layout_bpool() {$
  1004	    local root_dataset_path="$1"$
  1005	    local mntdir="$2"$
  1006	$
  1007	    dataset_basename="${root_dataset_path##*/}"$
  1008	    candidate_dataset="bpool/BOOT/${dataset_basename}"$
  1009	    dataset_properties="$(zfs get -H mountpoint,canmount "${candidate_dataset}" 2>/dev/null | cut -f3 | paste -sd ' ')"$
  1010	    if [ -z "${dataset_properties}" ]; then$
  1011	        return$
  1012	    fi$
  1013	$
  1014	    rel_pool_root=$(zpool get -H altroot bpool | awk '{print $3}')$
  1015	    if [ "${rel_pool_root}" = "-" ]; then$
  1016	        rel_pool_root=""$
  1017	    fi$
  1018	$
  1019	    snapshot_name="${dataset_basename##*@}"$
  1020	    [ "${snapshot_name}" = "${dataset_basename}" ] && snapshot_name=""$
  1021	    if [ -z "${snapshot_name}" ]; then$
  1022	        if ! echo "${dataset_properties}" | grep -Eq "${rel_pool_root}/boot (on|noauto)"; then$
  1023	            return$
  1024	        fi$
  1025	    else$
  1026	        candidate_dataset=$(echo "${candidate_dataset}" | cut -d '@' -f1)$
  1027	    fi$
  1028	$
  1029	    validate_system_dataset "${candidate_dataset}" "boot" "${mntdir}" "${snapshot_name}"$
  1030	}$
  1031	$
  1032	# Return if secure boot is enabled on that system$
  1033	is_secure_boot_enabled() {$
  1034	    if LANG=C mokutil --sb-state 2>/dev/null | grep -qi enabled; then$
  1035	        echo "true"$
  1036	        return$
  1037	    fi$
  1038	    echo "false"$
  1039	    return$
  1040	}$
  1041	$
  1042	# Given a filesystem or snapshot dataset, returns dataset|machine id|pretty name|last used$
  1043	# $1 is dataset we want information from$
  1044	# $2 is the temporary mount directory to use$
  1045	get_dataset_info() {$
  1046	    local dataset="$1"$
  1047	    local mntdir="$2"$
  1048	$
  1049	    local base_dataset="${dataset}"$
  1050	    local etc_dir="${mntdir}/etc"$
  1051	    local is_snapshot="false"$
  1052	    # For snapshot we extract the parent dataset$
  1053	    if echo "${dataset}" | grep -q '@'; then$
  1054	        base_dataset=$(echo "${dataset}" | cut -d '@' -f1)$
  1055	        is_snapshot="true"$
  1056	    fi$
  1057	$
  1058	    mount -o noatime,zfsutil -t zfs "${base_dataset}" "${mntdir}"$
  1059	$
  1060	    # read machine-id/os-release from /etc$
  1061	    etc_dir=$(get_system_directory "${dataset}" "etc" "true" "${mntdir}" "")$
  1062	    if [ -z  "${etc_dir}" ]; then$
  1063	        grub_warn "Ignoring ${dataset}"$
  1064	        mountpoint -q "${mntdir}/etc" && umount "${mntdir}/etc" || true$
  1065	        umount "${mntdir}"$
  1066	        return$
  1067	    fi$
  1068	$
  1069	    machine_id=""$
  1070	    if [ -f "${etc_dir}/machine-id" ]; then$
  1071	        machine_id=$(cat "${etc_dir}/machine-id")$
  1072	    fi$
  1073	    # We have to use a random temporary id if we don't have any machine-id file or if this one is empty$
  1074	    # (mostly the case of new installations before first boot).$
  1075	    # Let's use the dataset name directly for this.$
  1076	    # Consequence is that all datasets are then separated.$
  1077	    if [ -z "${machine_id}" ]; then$
  1078	        machine_id="${dataset}"$
  1079	    fi$
  1080	    pretty_name=$(. "${etc_dir}/os-release" && echo "${PRETTY_NAME}")$
  1081	    mountpoint -q "${mntdir}/etc" && umount "${mntdir}/etc" || true$
  1082	$
  1083	    # read available kernels from /boot$
  1084	    boot_dir="$(try_default_layout_bpool "${dataset}" "${mntdir}")"$
  1085	    if [ -z "${boot_dir}" ]; then$
  1086	        boot_dir=$(get_system_directory "${dataset}" "boot" "false" "${mntdir}" "${etc_dir}")$
  1087	    fi$
  1088	$
  1089	    if [ -z  "${boot_dir}" ]; then$
  1090	        grub_warn "Ignoring ${dataset}"$
  1091	        mountpoint -q "${mntdir}/boot" && umount "${mntdir}/boot" || true$
  1092	        umount "${mntdir}"$
  1093	        return$
  1094	    fi$
  1095	$
  1096	    initrd_list=""$
  1097	    kernel_list=""$
  1098	    candidate_kernel_list="$(find "${boot_dir}" -maxdepth 1 -type f -regex '.*/\(vmlinuz\|vmlinux\|kernel\)-.*')"$
  1099	$
  1100	    # Perform a reverse version sort on the entire list.$
  1101	    # Temporarily replace the '.old' suffix by ' 1' and append ' 2' for all$
  1102	    # other files to order the '.old' files after their non-old counterpart$
  1103	    # in reverse-sorted order.$
  1104	$
  1105	    reverse_sorted_list=$(echo $candidate_kernel_list | tr ' ' '\n' | sed -e 's/\.old$/ 1/; / 1$/! s/$/ 2/' | version_sort -r | sed -e 's/ 1$/.old/; s/ 2$//')$
  1106	$
  1107	    for linux in ${reverse_sorted_list}; do$
  1108	        if ! grub_file_is_not_garbage "${linux}" ; then$
  1109	            continue$
  1110	        fi$
  1111	$
  1112	        # Filters entry if efi/non efi.$
  1113	        # Note that for now we allow kernel without .efi.signed as those are signed kernel$
  1114	        # on ubuntu, loaded by the shim.$
  1115	        case "${linux}" in$
  1116	            *.efi.signed)$
  1117	                if [ "$(is_secure_boot_enabled)" = "false" ]; then$
  1118	                    continue$
  1119	                fi$
  1120	            ;;$
  1121	        esac$
  1122	$
  1123	        linux_basename=$(basename "${linux}")$
  1124	        linux_dirname=$(dirname "${linux}")$
  1125	        version=$(echo "${linux_basename}" | sed -e "s,^[^0-9]*-,,g")$
  1126	        alt_version=$(echo "${version}" | sed -e "s,\.old$,,g")$
  1127	$
  1128	        gettext_printf "Found linux image: %s in %s\n" "${linux_basename}" "${dataset}" >&2$
  1129	$
  1130	        initrd=""$
  1131	        for i in "initrd.img-${version}" "initrd-${version}.img" "initrd-${version}.gz" \$
  1132	            "initrd-${version}" "initramfs-${version}.img" \$
  1133	            "initrd.img-${alt_version}" "initrd-${alt_version}.img" \$
  1134	            "initrd-${alt_version}" "initramfs-${alt_version}.img" \$
  1135	            "initramfs-genkernel-${version}" \$
  1136	            "initramfs-genkernel-${alt_version}" \$
  1137	            "initramfs-genkernel-${GENKERNEL_ARCH}-${version}" \$
  1138	            "initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}"; do$
  1139	            if test -e "${linux_dirname}/${i}" ; then$
  1140	                initrd="$i"$
  1141	                break$
  1142	            fi$
  1143	        done$
  1144	$
  1145	        if test -z "${initrd}" ; then$
  1146	            grub_warn "Couldn't find any valid initrd for dataset ${dataset}."$
  1147	            continue$
  1148	        fi$
  1149	$
  1150	        gettext_printf "Found initrd image: %s in %s\n" "${initrd}" "${dataset}" >&2$
  1151	$
  1152	        rel_linux_dirname=$(make_system_path_relative_to_its_root "${linux_dirname}")$
  1153	$
  1154	        initrd_list="${initrd_list}|${rel_linux_dirname}/${initrd}"$
  1155	        kernel_list="${kernel_list}|${rel_linux_dirname}/${linux_basename}"$
  1156	    done$
  1157	$
  1158	    initrd_list="${initrd_list#|}"$
  1159	    kernel_list="${kernel_list#|}"$
  1160	$
  1161	    initrd_device=$(${grub_probe} --target=device "${boot_dir}" | head -1)$
  1162	$
  1163	    mountpoint -q "${mntdir}/boot" && umount "${mntdir}/boot" || true$
  1164	    # We needed to look in / for snapshots on root dataset, umount there before zfs lazily unmount it$
  1165	    case "${boot_dir}" in /boot/.zfs/snapshot/*)$
  1166	        umount "${boot_dir}" || true$
  1167	        ;;$
  1168	    esac$
  1169	$
  1170	    # for zsys snapshots: we want to know which kernel we successful last booted with$
  1171	    last_booted_kernel=$(zfs get -H com.ubuntu.zsys:last-booted-kernel "${dataset}" | awk -v FS='\t' '{print $3}')$
  1172	$
  1173	    # snapshot: last_used is dataset creation time$
  1174	    if [ "${is_snapshot}" = "true" ]; then$
  1175	        last_used="$(zfs get -pH creation "${dataset}" | awk -F '\t' '{print $3}')"$
  1176	    # otherwise, last_used is manually marked at boot/shutdown on a root dataset for zsys$
  1177	    else$
  1178	        # if current system, take current time$
  1179	        if zfs mount | awk '/[ \t]+\/$/ {print $1}' | grep -q "${dataset}"; then$
  1180	            last_used=$(date +%s)$
  1181	        else$
  1182	            last_used=$(zfs get -H com.ubuntu.zsys:last-used "${dataset}" | awk '{print $3}')$
  1183	            # case of non zsys, or zsys without annotation, take /etc/machine-id stat (as we mounted with noatime).$
  1184	            # However, as systems can be relatime, if system is current mounted one, set current time (case of clone + reboot$
  1185	            # within the same d).$
  1186	            if [ "${last_used}" = "-" ]; then$
  1187	                last_used=$(stat --printf="%X" "${mntdir}/etc/os-release")$
  1188	                if [ -f "${mntdir}/etc/machine-id" ]; then$
  1189	                    last_used=$(stat --printf="%X" "${mntdir}/etc/machine-id")$
  1190	                fi$
  1191	            fi$
  1192	        fi$
  1193	    fi$
  1194	$
  1195	    is_zsys=$(zfs get -H com.ubuntu.zsys:bootfs "${base_dataset}" | awk '{print $3}')$
  1196	$
  1197	    if [ -n "${initrd_list}" -a -n "${kernel_list}" ]; then$
  1198	        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}"$
  1199	    else$
  1200	        grub_warn "didn't find any valid initrd or kernel."$
  1201	    fi$
  1202	$
  1203	    umount "${mntdir}" || true$
  1204	    # We needed to look in / for snapshots on root dataset, umount the snapshot for etc before zfs lazily unmount it$
  1205	    # This process only needs to run if the snapshot contains an .../etc path,$
  1206	    #  otherwise the build process may silently fail and produce no kernel lines in grub.cfg$
  1207	    if [ -e "${etc_dir}" ]; then$
  1208	        case "${etc_dir}" in /.zfs/snapshot/*/etc)$
  1209	            snapshot_path="$(findmnt -n -o TARGET -T "${etc_dir}")"$
  1210	            umount "${snapshot_path}" || true$
  1211	            ;;$
  1212	        esac$
  1213	    fi$
  1214	}$
  1215	$
  1216	# Scan available boot options and returns in a formatted list$
  1217	# $1 is the temporary mount directory to use$
  1218	bootlist() {$
  1219	    local mntdir="$1"$
  1220	    local boot_list=""$
  1221	$
  1222	    for dataset in $(get_root_datasets); do$
  1223	        # get information from current root dataset$
  1224	        boot_list="${boot_list}$(get_dataset_info "${dataset}" ${mntdir})\n"$
  1225	$
  1226	        # get information from snapshots of this root dataset$
  1227	        snapshots="$(zfs list -H -o name -t snapshot "${dataset}"|while read snapshot_dataset; do$
  1228	            get_dataset_info "${snapshot_dataset}" ${mntdir}$
  1229	        done)"$
  1230	        [ -n "${snapshots}" ] && boot_list="${boot_list}${snapshots}\n"$
  1231	    done$
  1232	    echo "${boot_list}"$
  1233	}$
  1234	$
  1235	$
  1236	# Order machine ids by last_used from their main entry$
  1237	get_machines_sorted() {$
  1238	    local bootlist="$1"$
  1239	$
  1240	    local machineids="$(echo "${bootlist}" | awk '{print $3}' | sort -u)"$
  1241	    for machineid in ${machineids}; do$
  1242	        echo "${bootlist}" | awk 'BEGIN{FS="\t"} $1 !~ /.*@.*/  {print $5, $3}' | sort -nr | grep -E "[^^]\b${machineid}\b" | head -1$
  1243	    done | sort -nr | awk '{print $2}'$
  1244	}$
  1245	$
  1246	# Sort entries by last_used for a given machineid$
  1247	sort_entries_for_machineid() {$
  1248	    local bootlist="$1"$
  1249	    local machineid="$2"$
  1250	$
  1251	    tab="$(printf '\t')"$
  1252	    echo "${bootlist}" | grep -E "[^^]\b${machineid}\b" | sort -k5,5r -k1,1 -t "${tab}"$
  1253	}$
  1254	$
  1255	# Return main entry index$
  1256	get_main_entry() {$
  1257	    local entries="$1"$
  1258	$
  1259	    echo "${entries}" | awk 'BEGIN{FS="\t"} $1 !~ /.*@.*/  {print}' | head -1$
  1260	}$
  1261	$
  1262	# Return specific field at index from entry$
  1263	get_field_from_entry() {$
  1264	    local entry="$1"$
  1265	    local index="$2"$
  1266	$
  1267	    echo "${entry}" | awk "BEGIN{FS=\"\t\"} {print \$$index}"$
  1268	}$
  1269	$
  1270	# Get the main entry metadata$
  1271	main_entry_meta() {$
  1272	    local main_entry="$1"$
  1273	$
  1274	    initrd=$(get_field_from_entry "${main_entry}" 7 | cut -d'|' -f1)$
  1275	    kernel=$(get_field_from_entry "${main_entry}" 8 | cut -d'|' -f1)$
  1276	$
  1277	    # Take first element (most recent entry) which is not a snapshot$
  1278	    echo "${main_entry}" | awk "BEGIN{ FS=\"\t\"; OFS=\"\t\"} {print \$3, \$2, \"main\", \$4, \$1, \$6, \"$initrd\", \"$kernel\"}"$
  1279	}$
  1280	$
  1281	# Get advanced entries metadata$
  1282	advanced_entries_meta() {$
  1283	    local main_entry="$1"$
  1284	$
  1285	    last_used_kernel="$(get_field_from_entry "${main_entry}" 9 )"$
  1286	$
  1287	    # We must align initrds with kernels.$
  1288	    # Adds initrds to the stack then pop them 1 by 1 as we process the kernels$
  1289	    oldIFS="$IFS"$
  1290	    export IFS='|'$
  1291	    set -- $(get_field_from_entry "${main_entry}" 7)$
  1292	    for kernel in $(get_field_from_entry "${main_entry}" 8); do$
  1293	        # get initrd and pop to the next one$
  1294	        initrd="$1"; shift$
  1295	$
  1296	        was_last_used_kernel="false"$
  1297	        kernel_basename=$(basename "${kernel}")$
  1298	        if [ "${kernel_basename}" = "${last_used_kernel}" ]; then$
  1299	            was_last_used_kernel="true"$
  1300	        fi$
  1301	$
  1302	        echo "${main_entry}" | awk "BEGIN{ FS=\"\t\"; OFS=\"\t\"}    {print \$3, \$2, \"advanced\", \$4, \$1, \$6, \"$initrd\", \"$kernel\", \"$was_last_used_kernel\"}"$
  1303	    done$
  1304	    IFS="$oldIFS"$
  1305	}$
  1306	$
  1307	# Get history metadata$
  1308	history_entries_meta() {$
  1309	    local entries="$1"$
  1310	    local main_dataset_name="$2"$
  1311	    local main_dataset_releasename="$3"$
  1312	$
  1313	    if [ -z "${entries}" ]; then$
  1314	        return$
  1315	    fi$
  1316	$
  1317	    # Traverse snapshots and clones$
  1318	    echo "${entries}" | while read entry; do$
  1319	        name=""$
  1320	        # Compute snapshot/filesystem dataset name$
  1321	        snap_dataset_name="$(get_field_from_entry "${entry}" 1)"$
  1322	$
  1323	        snapname="${snap_dataset_name##*@}"$
  1324	        # If, this is a clone, take what is after main_dataset_name$
  1325	        if [ "${snapname}" = "${snap_dataset_name}" ]; then$
  1326	            snapname="${snap_dataset_name##${main_dataset_name}_}"$
  1327	$
  1328	            # Handle manual user clone (not prefixed by "main_dataset_name")$
  1329	            snapname="${snapname##*/}"$
  1330	        fi$
  1331	$
  1332	        # We keep the snapname only if it is not only a zsys auto snapshot$
  1333	        if echo "${snapname}" | grep -q "^autozsys_"; then$
  1334	            snapname=""$
  1335	        fi$
  1336	$
  1337	        # We store the release only if it different from main dataset release (snapshot before a release upgrade)$
  1338	        releasename=$(get_field_from_entry "${entry}" 4)$
  1339	        if [ "${releasename}" = "${main_dataset_releasename}" ]; then$
  1340	            releasename=""$
  1341	        fi$
  1342	$
  1343	        # Snapshot date$
  1344	        foo="$(get_field_from_entry "${entry}" 5)"$
  1345	        snapdate="$(date -d @$(get_field_from_entry "${entry}" 5) "+%x @ %H:%M")"$
  1346	$
  1347	        # For snapshots/clones the name can have the following formats:$
  1348	        # 	<DATE>: autozsys, same release$
  1349	        #   <OLD_RELEASE> on <DATE>: autozsys, different release$
  1350	        #   <SNAPNAME> on <DATE>: Manual snapshot, same release$
  1351	        #   <SNAPNAME>, <OLD_RELEASE> on <DATE>: Manual snapshot, different release$
  1352	        if [ "${snapname}" = "" -a "${releasename}" = "" ]; then$
  1353	            name="${snapdate}"$
  1354	        elif [ "${snapname}" = "" -a "${releasename}" != "" ]; then$
  1355	            name=$(gettext_printf "%s on %s" "${releasename}" "${snapdate}")$
  1356	        elif [ "${snapname}" != "" -a "${releasename}" = "" ]; then$
  1357	            name=$(gettext_printf "%s on %s" "${snapname}" "${snapdate}")$
  1358	        else # snapname != "" && releasename != ""$
  1359	            name=$(gettext_printf "%s, %s on %s" "${snapname}" "${releasename}" "${snapdate}")$
  1360	        fi$
  1361	$
  1362	        # Choose kernel and initrd if the snapshot was booted successfully on a specific kernel before$
  1363	        # Take latest by default if no match$
  1364	        initrd=$(get_field_from_entry "${entry}" 7 | cut -d'|' -f1)$
  1365	        kernel=$(get_field_from_entry "${entry}" 8 | cut -d'|' -f1)$
  1366	        last_used_kernel="$(get_field_from_entry "${entry}" 9)"$
  1367	$
  1368	        # We must align initrds with kernels.$
  1369	        # Adds initrds to the stack then pop them 1 by 1 as we process the kernels$
  1370	        oldIFS="$IFS"$
  1371	        export IFS='|'$
  1372	        set -- $(get_field_from_entry "${entry}" 7)$
  1373	        for k in $(get_field_from_entry "${entry}" 8); do$
  1374	            # get initrd and pop to the next one$
  1375	            candidate_initrd="$1"; shift$
  1376	$
  1377	            kernel_basename=$(basename -- "${k}")$
  1378	            if [ "${kernel_basename}" = "${last_used_kernel}" ]; then$
  1379	                kernel="${k}"$
  1380	                initrd="${candidate_initrd}"$
  1381	                break$
  1382	            fi$
  1383	        done$
  1384	        IFS="$oldIFS"$
  1385	$
  1386	        echo "${entry}" | awk "BEGIN{ FS=\"\t\"; OFS=\"\t\"}    {print \$3, \$2, \"history\", \"$name\", \$1, \$6, \"$initrd\", \"$kernel\"}"$
  1387	    done$
  1388	}$
  1389	$
  1390	# Generate metadata from a BOOTLIST that will subsequently used to generate$
  1391	# the final grub menu entries$
  1392	generate_grub_menu_metadata() {$
  1393	    local bootlist="$1"$
  1394	$
  1395	    # Sort machineids by last_used from their main entry$
  1396	    for machineid in $(get_machines_sorted "${bootlist}"); do$
  1397	        entries="$(sort_entries_for_machineid "${bootlist}" ${machineid})"$
  1398	        main_entry="$(get_main_entry "${entries}")"$
  1399	$
  1400	        if [ -z "$main_entry" ]; then$
  1401	            continue$
  1402	        fi$
  1403	$
  1404	        main_entry_meta "${main_entry}"$
  1405	        advanced_entries_meta "${main_entry}"$
  1406	$
  1407	        main_dataset_name="$(get_field_from_entry "${main_entry}" 1)"$
  1408	        main_dataset_releasename="$(get_field_from_entry "${main_entry}" 4)"$
  1409	        # grep -v errcode != 0 if there is no match. || true to not fail with -e$
  1410	        other_entries="$(echo "${entries}" | grep -v "${main_entry}" || true)"$
  1411	        history_entries_meta "${other_entries}" "${main_dataset_name}" "${main_dataset_releasename}"$
  1412	    done$
  1413	}$
  1414	$
  1415	# Print the configuration part common to all sections$
  1416	# Note:$
  1417	#   If 10_linux runs these part will be defined twice in grub configuration$
  1418	print_menu_prologue() {$
  1419	    cat << 'EOF'$
  1420	function gfxmode {$
  1421		set gfxpayload="${1}"$
  1422	EOF$
  1423	    if [ "${vt_handoff}" = 1 ]; then$
  1424	        cat << 'EOF'$
  1425		if [ "${1}" = "keep" ]; then$
  1426			set vt_handoff=vt.handoff=1$
  1427		else$
  1428			set vt_handoff=$
  1429		fi$
  1430	EOF$
  1431	    fi$
  1432	    cat << EOF$
  1433	}$
  1434	EOF$
  1435	$
  1436	    # Use ELILO's generic "efifb" when it's known to be available.$
  1437	    # FIXME: We need an interface to select vesafb in case efifb can't be used.$
  1438	    GRUB_GFXPAYLOAD_LINUX="${GRUB_GFXPAYLOAD_LINUX:-}"$
  1439	    if [ "${GRUB_GFXPAYLOAD_LINUX}" != "" ] || [ "${gfxpayload_dynamic}" = 0 ]; then$
  1440	        echo "set linux_gfx_mode=${GRUB_GFXPAYLOAD_LINUX}"$
  1441	    else$
  1442	        cat << EOF$
  1443	if [ "\${recordfail}" != 1 ]; then$
  1444	  if [ -e \${prefix}/gfxblacklist.txt ]; then$
  1445	    if hwmatch \${prefix}/gfxblacklist.txt 3; then$
  1446	      if [ \${match} = 0 ]; then$
  1447	        set linux_gfx_mode=keep$
  1448	      else$
  1449	        set linux_gfx_mode=text$
  1450	      fi$
  1451	    else$
  1452	      set linux_gfx_mode=text$
  1453	    fi$
  1454	  else$
  1455	    set linux_gfx_mode=keep$
  1456	  fi$
  1457	else$
  1458	  set linux_gfx_mode=text$
  1459	fi$
  1460	EOF$
  1461	    fi$
  1462	    cat << EOF$
  1463	export linux_gfx_mode$
  1464	EOF$
  1465	}$
  1466	$
  1467	# Cache for prepare_grub_to_access_device call$
  1468	# $1: boot_device$
  1469	# $2: submenu_level$
  1470	prepare_grub_to_access_device_cached() {$
  1471	    local boot_device="$1"$
  1472	    local submenu_level="$2"$
  1473	$
  1474	    local boot_device_idx="$(echo ${boot_device} | tr '/' '_')"$
  1475	$
  1476	    cache_file="${ZFSTMP}/$(echo boot_device${boot_device_idx})"$
  1477	    if [ ! -f "${cache_file}" ]; then$
  1478	        set +u$
  1479	        echo "$(prepare_grub_to_access_device "${boot_device}")" > "${cache_file}"$
  1480	        set -u$
  1481	        for i in 0 1 2; do$
  1482	            submenu_indentation="$(printf %${i}s | tr " " "${grub_tab}")"$
  1483	            sed "s/^/${submenu_indentation}	/" "${cache_file}" > "${cache_file}--${i}"$
  1484	        done$
  1485	    fi$
  1486	$
  1487	    cat "${cache_file}--${submenu_level}"$
  1488	}$
  1489	$
  1490	$
  1491	# Print a grub menu entry$
  1492	zfs_linux_entry () {$
  1493	    submenu_level="$1"$
  1494	    title="$2"$
  1495	    type="$3"$
  1496	    dataset="$4"$
  1497	    boot_device="$5"$
  1498	    initrd="$6"$
  1499	    kernel="$7"$
  1500	    kernel_version="$8"$
  1501	    kernel_additional_args="${9:-}"$
  1502	    boot_devices="${10:-}"$
  1503	$
  1504	    submenu_indentation="$(printf %${submenu_level}s | tr " " "${grub_tab}")"$
  1505	$
  1506	    echo "${submenu_indentation}menuentry '$(echo "${title}" | grub_quote)' ${CLASS} \${menuentry_id_option} 'gnulinux-${dataset}-${kernel_version}' {"$
  1507	$
  1508	    if [ "${quick_boot}" = 1 ]; then$
  1509	        echo "${submenu_indentation}	recordfail"$
  1510	    fi$
  1511	$
  1512	    if [ "${type}" != "recovery" ] ; then$
  1513	        GRUB_SAVEDEFAULT=${GRUB_SAVEDEFAULT:-}$
  1514	        default_entry="$(save_default_entry)"$
  1515	        if [ -n "${default_entry}" ]; then$
  1516	            echo "${submenu_indentation}	${default_entry}"$
  1517	        fi$
  1518	    fi$
  1519	$
  1520	    # Use ELILO's generic "efifb" when it's known to be available.$
  1521	    # FIXME: We need an interface to select vesafb in case efifb can't be used.$
  1522	    if [ "${GRUB_GFXPAYLOAD_LINUX}" = "" ]; then$
  1523	        echo "${submenu_indentation}	load_video"$
  1524	    else$
  1525	        if [ "${GRUB_GFXPAYLOAD_LINUX}" != "text" ]; then$
  1526	            echo "${submenu_indentation}	load_video"$
  1527	        fi$
  1528	    fi$
  1529	$
  1530	    if ([ "${ubuntu_recovery}" = 0 ] || [ "${type}" != "recovery" ]) && \$
  1531	        ([ "${GRUB_GFXPAYLOAD_LINUX}" != "" ] || [ "${gfxpayload_dynamic}" = 1 ]); then$
  1532	        echo "${submenu_indentation}	gfxmode \${linux_gfx_mode}"$
  1533	    fi$
  1534	$
  1535	    echo "${submenu_indentation}	insmod gzio"$
  1536	    echo "${submenu_indentation}	if [ \"\${grub_platform}\" = xen ]; then insmod xzio; insmod lzopio; fi"$
  1537	$
  1538	    if [ -n "$boot_devices" ]; then$
  1539	        for device in ${boot_devices}; do$
  1540	            echo "${submenu_indentation}	if [ "${boot_device}" = "${device}" ]; then"$
  1541	            echo "$(prepare_grub_to_access_device_cached "${device}" $(( submenu_level +1 )) )"$
  1542	            echo "${submenu_indentation}	fi"$
  1543	        done$
  1544	    else$
  1545	        echo "$(prepare_grub_to_access_device_cached "${boot_device}" "${submenu_level}")"$
  1546	    fi$
  1547	$
  1548	    if [ "${quiet_boot}" = 0 ] || [ "${type}" != simple ]; then$
  1549	        echo "${submenu_indentation}	echo $(gettext_printf "Loading Linux %s ..." ${kernel_version} | grub_quote)"$
  1550	    fi$
  1551	$
  1552	    linux_default_args="${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"$
  1553	    if [ ${type} = "recovery" ]; then$
  1554	        linux_default_args="${GRUB_CMDLINE_LINUX_RECOVERY} ${GRUB_CMDLINE_LINUX}"$
  1555	    fi$
  1556	$
  1557	    # echo in echo trims end of line spaces$
  1558	    echo "${submenu_indentation}	linux	\"${kernel}\" root=ZFS=\"${dataset}\" ro $(echo ${linux_default_args} ${kernel_additional_args})"$
  1559	$
  1560	    if [ "${quiet_boot}" = 0 ] || [ "${type}" != simple ]; then$
  1561	        echo "${submenu_indentation}	echo '$(gettext_printf "Loading initial ramdisk ..." | grub_quote)'"$
  1562	    fi$
  1563	    echo "${submenu_indentation}	initrd	\"${initrd}\""$
  1564	    echo "${submenu_indentation}}"$
  1565	}$
  1566	$
  1567	# Generate a GRUB Menu from menu meta data$
  1568	# $1 menu metadata$
  1569	generate_grub_menu() {$
  1570	    local menu_metadata="$1"$
  1571	    local last_section=""$
  1572	    local main_dataset_name=""$
  1573	    local main_dataset=""$
  1574	    local have_zsys=""$
  1575	$
  1576	    if [ -z "${menu_metadata}" ]; then$
  1577	        return$
  1578	    fi$
  1579	$
  1580	    CLASS="--class gnu-linux --class gnu --class os"$
  1581	$
  1582	    if [ "${GRUB_DISTRIBUTOR}" = "" ] ; then$
  1583	        OS=GNU/Linux$
  1584	    else$
  1585	        case ${GRUB_DISTRIBUTOR} in$
  1586	            Ubuntu|Kubuntu)$
  1587	            OS="${GRUB_DISTRIBUTOR}"$
  1588	            ;;$
  1589	            *)$
  1590	            OS="${GRUB_DISTRIBUTOR} GNU/Linux"$
  1591	            ;;$
  1592	        esac$
  1593	        CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1 | LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}"$
  1594	    fi$
  1595	$
  1596	    if [ -x /lib/recovery-mode/recovery-menu ]; then$
  1597	        GRUB_CMDLINE_LINUX_RECOVERY=recovery$
  1598	    else$
  1599	        GRUB_CMDLINE_LINUX_RECOVERY=single$
  1600	    fi$
  1601	    if [ "${ubuntu_recovery}" = 1 ]; then$
  1602	        GRUB_CMDLINE_LINUX_RECOVERY="${GRUB_CMDLINE_LINUX_RECOVERY} nomodeset"$
  1603	    fi$
  1604	$
  1605	    case "$GENKERNEL_ARCH" in$
  1606	        x86*) GRUB_CMDLINE_LINUX_RECOVERY="$GRUB_CMDLINE_LINUX_RECOVERY dis_ucode_ldr";;$
  1607	    esac$
  1608	$
  1609	$
  1610	    if [ "${vt_handoff}" = 1 ]; then$
  1611	        for word in ${GRUB_CMDLINE_LINUX_DEFAULT}; do$
  1612	            if [ "${word}" = splash ]; then$
  1613	                GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_DEFAULT} \${vt_handoff}"$
  1614	            fi$
  1615	        done$
  1616	    fi$
  1617	$
  1618	    print_menu_prologue$
  1619	$
  1620	    cat<<'EOF'$
  1621	function zsyshistorymenu {$
  1622		# $1: root dataset (eg rpool/ROOT/ubuntu_2zhm07@autozsys_k56fr6)$
  1623		# $2: boot device id (eg 411f29ce1557bfed)$
  1624		# $3: initrd (eg /BOOT/ubuntu_2zhm07@autozsys_k56fr6/initrd.img-5.4.0-21-generic)$
  1625		# $4: kernel (eg /BOOT/ubuntu_2zhm07@autozsys_k56fr6/vmlinuz-5.4.0-21-generic)$
  1626		# $5: kernel_version (eg 5.4.0-21-generic)$
  1627	$
  1628		set root_dataset="${1}"$
  1629		set boot_device="${2}"$
  1630		set initrd="${3}"$
  1631		set kernel="${4}"$
  1632		set kversion="${5}"$
  1633	$
  1634	EOF$
  1635	    boot_devices=$(echo "${menu_metadata}" | cut -d"$(printf '\t')" -f6 | sort -u)$
  1636	$
  1637	    title=$(gettext_printf "Revert system only")$
  1638	    zfs_linux_entry 1 "${title}" "simple" '${root_dataset}' '${boot_device}' '${initrd}' '${kernel}' '${kversion}' '' "${boot_devices}"$
  1639	$
  1640	    title="$(gettext_printf "Revert system and user data")"$
  1641	    zfs_linux_entry 1 "${title}" "simple" '${root_dataset}' '${boot_device}' '${initrd}' '${kernel}' '${kversion}' 'zsys-revert=userdata' "${boot_devices}"$
  1642	$
  1643	    GRUB_DISABLE_RECOVERY="${GRUB_DISABLE_RECOVERY:-}"$
  1644	    if [ "${GRUB_DISABLE_RECOVERY}" != "true" ]; then$
  1645	        title="$(gettext_printf "Revert system only (%s)" "$(gettext "${GRUB_RECOVERY_TITLE}")")"$
  1646	        zfs_linux_entry 1 "${title}" "recovery" '${root_dataset}' '${boot_device}' '${initrd}' '${kernel}' '${kversion}' '' "${boot_devices}"$
  1647	$
  1648	        title="$(gettext_printf "Revert system and user data (%s)" "$(gettext "${GRUB_RECOVERY_TITLE}")")"$
  1649	        zfs_linux_entry 1 "${title}" "recovery" '${root_dataset}' '${boot_device}' '${initrd}' '${kernel}' '${kversion}' 'zsys-revert=userdata' "${boot_devices}"$
  1650	    fi$
  1651	echo "}"$
  1652	echo$
  1653	$
  1654	    # IFS is set to TAB (ASCII 0x09)$
  1655	    echo "${menu_metadata}" |$
  1656	    {$
  1657	        at_least_one_entry=0$
  1658	        have_zsys="$(which zsysd || true)"$
  1659	        while IFS="$(printf '\t')" read -r machineid iszsys section name dataset device initrd kernel opt; do$
  1660	$
  1661	            # Disable history for non zsys system or if systems is a zsys one and zsys isn't installed.$
  1662	            # In pure zfs systems, we identified multiple issues due to the mount generator$
  1663	            # in upstream zfs which makes it incompatible. Don't show history for now.$
  1664	            if [ "${section}" = "history" ]; then$
  1665	                if [ "${iszsys}" != "yes" ] || [ "${iszsys}" = "yes" -a -z "${have_zsys}" ]; then$
  1666	                    continue$
  1667	                fi$
  1668	            fi$
  1669	$
  1670	            if [ "${last_section}" != "${section}" -a -n "${last_section}" ]; then$
  1671	                # Close previous section wrapper$
  1672	                if [ "${last_section}" != "main" ]; then$
  1673	                    echo "}"    # Add grub_tabs$
  1674	                    at_least_one_entry=0$
  1675	                fi$
  1676	            fi$
  1677	$
  1678	            case "${section}" in$
  1679	                main)$
  1680	                    title="${name}"$
  1681	                    main_dataset_name="${name}"$
  1682	                    main_dataset="${dataset}"$
  1683	$
  1684	                    kernel_version=$(basename "${kernel}" | sed -e "s,^[^0-9]*-,,g")$
  1685	                    zfs_linux_entry 0 "${title}" "simple" "${dataset}" "${device}" "${initrd}" "${kernel}" "${kernel_version}"$
  1686	                    at_least_one_entry=1$
  1687	                ;;$
  1688	                advanced)$
  1689	                    # normal and recovery entries for a given kernel$
  1690	                    if [ "${last_section}" != "${section}" ]; then$
  1691	                        echo "submenu '$(gettext_printf "Advanced options for %s" "${main_dataset_name}" | grub_quote)' \${menuentry_id_option} 'gnulinux-advanced-${main_dataset}' {"$
  1692	                    fi$
  1693	$
  1694	                    last_booted_kernel_marker=""$
  1695	                    if [ "${opt}" = "true" ]; then$
  1696	                        last_booted_kernel_marker="* "$
  1697	                    fi$
  1698	$
  1699	                    kernel_version=$(basename "${kernel}" | sed -e "s,^[^0-9]*-,,g")$
  1700	                    title="$(gettext_printf "%s%s, with Linux %s" "${last_booted_kernel_marker}" "${name}" "${kernel_version}")"$
  1701	                    zfs_linux_entry 1 "${title}" "advanced" "${dataset}" "${device}" "${initrd}" "${kernel}" "${kernel_version}"$
  1702	$
  1703	                    GRUB_DISABLE_RECOVERY=${GRUB_DISABLE_RECOVERY:-}$
  1704	                    if [ "${GRUB_DISABLE_RECOVERY}" != "true" ]; then$
  1705	                        title="$(gettext_printf "%s%s, with Linux %s (%s)" "${last_booted_kernel_marker}" "${name}" "${kernel_version}" "$(gettext "${GRUB_RECOVERY_TITLE}")")"$
  1706	                        zfs_linux_entry 1 "${title}" "recovery" "${dataset}" "${device}" "${initrd}" "${kernel}" "${kernel_version}"$
  1707	                    fi$
  1708	                    at_least_one_entry=1$
  1709	                ;;$
  1710	                history)$
  1711	                    # Revert to a snapshot$
  1712	                    # revert system, revert system and user data and associated recovery entries$
  1713	                    if [ "${last_section}" != "${section}" ]; then$
  1714	                        echo "submenu '$(gettext_printf "History for %s" "${main_dataset_name}" | grub_quote)' \${menuentry_id_option} 'gnulinux-history-${main_dataset}' {"$
  1715	                    fi$
  1716	$
  1717	                    if [ "${iszsys}" = "yes" ]; then$
  1718	                        title="$(gettext_printf "Revert to %s" "${name}" | grub_quote)"$
  1719	                    else$
  1720	                        title="$(gettext_printf "Boot on %s" "${name}" | grub_quote)"$
  1721	                    fi$
  1722	                    echo "	submenu '${title}' \${menuentry_id_option} 'gnulinux-history-${dataset}' {"$
  1723	$
  1724	                    kernel_version=$(basename "${kernel}" | sed -e "s,^[^0-9]*-,,g")$
  1725	$
  1726	                    # Zsys only: let revert system without destroying snapshots$
  1727	                    if [ "${iszsys}" = "yes" ]; then$
  1728	                        echo "${grub_tab}${grub_tab}zsyshistorymenu" \"${dataset}\" \"${device}\" \"${initrd}\" \"${kernel}\" \"${kernel_version}\"$
  1729	                    # Non-zsys: boot temporarly on snapshots or rollback (destroying intermediate snapshots)$
  1730	                    else$
  1731	                        title="$(gettext_printf "One time boot")"$
  1732	                        zfs_linux_entry 2 "${title}" "simple" "${dataset}" "${device}" "${initrd}" "${kernel}" "${kernel_version}"$
  1733	$
  1734	                        GRUB_DISABLE_RECOVERY="${GRUB_DISABLE_RECOVERY:-}"$
  1735	                        if [ "${GRUB_DISABLE_RECOVERY}" != "true" ]; then$
  1736	                            title="$(gettext_printf "One time boot (%s)" "$(gettext "${GRUB_RECOVERY_TITLE}")")"$
  1737	                            zfs_linux_entry 2 "${title}" "recovery" "${dataset}" "${device}" "${initrd}" "${kernel}" "${kernel_version}"$
  1738	                        fi$
  1739	$
  1740	                        title="$(gettext_printf "Revert system (all intermediate snapshots will be destroyed)")"$
  1741	                        zfs_linux_entry 2 "${title}" "simple" "${dataset}" "${device}" "${initrd}" "${kernel}" "${kernel_version}" "rollback=yes"$
  1742	                    fi$
  1743	$
  1744	                    echo "	}"$
  1745	                    at_least_one_entry=1$
  1746	                ;;$
  1747	                *)$
  1748	                    grub_warn "unknown section: ${section}. Ignoring entry ${name} for ${dataset}"$
  1749	                ;;$
  1750	            esac$
  1751	            last_section="${section}"$
  1752	        done$
  1753	$
  1754	        if [ "${at_least_one_entry}" -eq 1 ]; then$
  1755	            echo "}"$
  1756	        fi$
  1757	    }$
  1758	}$
  1759	$
  1760	# don't add trailing newline of variable is empty$
  1761	# $1: content to write$
  1762	# $2: destination file$
  1763	trailing_newline_if_not_empty() {$
  1764	    content="$1"$
  1765	    dest="$2"$
  1766	$
  1767	    if [ -z "${content}" ]; then$
  1768	        rm -f "${dest}"$
  1769	        touch "${dest}"$
  1770	        return$
  1771	    fi$
  1772	    echo "${content}" > "${dest}"$
  1773	}$
  1774	$
  1775	$
  1776	GRUB_LINUX_ZFS_TEST="${GRUB_LINUX_ZFS_TEST:-}"$
  1777	case "${GRUB_LINUX_ZFS_TEST}" in$
  1778	    bootlist)$
  1779	        # Import all available pools on the system and return imported list$
  1780	        imported_pools=$(import_pools)$
  1781	        boot_list="$(bootlist ${MNTDIR})"$
  1782	        trailing_newline_if_not_empty "${boot_list}" "${GRUB_LINUX_ZFS_TEST_OUTPUT}"$
  1783	        break$
  1784	    ;;$
  1785	    metamenu)$
  1786	        boot_list="$(cat ${GRUB_LINUX_ZFS_TEST_INPUT})"$
  1787	        menu_metadata="$(generate_grub_menu_metadata "${boot_list}")"$
  1788	        trailing_newline_if_not_empty "${menu_metadata}" "${GRUB_LINUX_ZFS_TEST_OUTPUT}"$
  1789	        break$
  1790	    ;;$
  1791	    grubmenu)$
  1792	        menu_metadata="$(cat ${GRUB_LINUX_ZFS_TEST_INPUT})"$
  1793	        grub_menu=$(generate_grub_menu "${menu_metadata}")$
  1794	        trailing_newline_if_not_empty "${grub_menu}" "${GRUB_LINUX_ZFS_TEST_OUTPUT}"$
  1795	        break$
  1796	    ;;$
  1797	    *)$
  1798	        # Import all available pools on the system and return imported list$
  1799	        imported_pools=$(import_pools)$
  1800	        # Generate the complete list of boot entries$
  1801	        boot_list="$(bootlist ${MNTDIR})"$
  1802	        # Create boot menu meta data from the list of boot entries$
  1803	        menu_metadata="$(generate_grub_menu_metadata "${boot_list}")"$
  1804	        # Create boot menu meta data from the list of boot entries$
  1805	        grub_menu="$(generate_grub_menu "${menu_metadata}")"$
  1806	        if [ -n "${grub_menu}" ]; then$
  1807	            # We want the trailing newline as a marker will be added$
  1808	            echo "${grub_menu}"$
  1809	        fi$
  1810	    ;;$
  1811	esac$
  1812	#! /bin/sh$
  1813	set -e$
  1814	$
  1815	# grub-mkconfig helper script.$
  1816	# Copyright (C) 2006,2007,2008,2009,2010  Free Software Foundation, Inc.$
  1817	#$
  1818	# GRUB is free software: you can redistribute it and/or modify$
  1819	# it under the terms of the GNU General Public License as published by$
  1820	# the Free Software Foundation, either version 3 of the License, or$
  1821	# (at your option) any later version.$
  1822	#$
  1823	# GRUB is distributed in the hope that it will be useful,$
  1824	# but WITHOUT ANY WARRANTY; without even the implied warranty of$
  1825	# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$
  1826	# GNU General Public License for more details.$
  1827	#$
  1828	# You should have received a copy of the GNU General Public License$
  1829	# along with GRUB.  If not, see <http://www.gnu.org/licenses/>.$
  1830	$
  1831	prefix="/usr"$
  1832	exec_prefix="/usr"$
  1833	datarootdir="/usr/share"$
  1834	$
  1835	. "$pkgdatadir/grub-mkconfig_lib"$
  1836	$
  1837	export TEXTDOMAIN=grub$
  1838	export TEXTDOMAINDIR="${datarootdir}/locale"$
  1839	$
  1840	CLASS="--class gnu-linux --class gnu --class os --class xen"$
  1841	$
  1842	if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then$
  1843	  OS=GNU/Linux$
  1844	else$
  1845	  OS="${GRUB_DISTRIBUTOR} GNU/Linux"$
  1846	  CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}"$
  1847	fi$
  1848	$
  1849	# loop-AES arranges things so that /dev/loop/X can be our root device, but$
  1850	# the initrds that Linux uses don't like that.$
  1851	case ${GRUB_DEVICE} in$
  1852	  /dev/loop/*|/dev/loop[0-9])$
  1853	    GRUB_DEVICE=`losetup ${GRUB_DEVICE} | sed -e "s/^[^(]*(\([^)]\+\)).*/\1/"`$
  1854	    # We can't cope with devices loop-mounted from files here.$
  1855	    case ${GRUB_DEVICE} in$
  1856	      /dev/*) ;;$
  1857	      *) exit 0 ;;$
  1858	    esac$
  1859	  ;;$
  1860	esac$
  1861	$
  1862	: ${GRUB_CMDLINE_LINUX_RECOVERY:=single}$
  1863	$
  1864	# Default to disabling partition uuid support to maintian compatibility with$
  1865	# older kernels.$
  1866	: ${GRUB_DISABLE_LINUX_PARTUUID=true}$
  1867	$
  1868	# btrfs may reside on multiple devices. We cannot pass them as value of root= parameter$
  1869	# and mounting btrfs requires user space scanning, so force UUID in this case.$
  1870	if ( [ "x${GRUB_DEVICE_UUID}" = "x" ] && [ "x${GRUB_DEVICE_PARTUUID}" = "x" ] ) \$
  1871	    || ( [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \$
  1872		&& [ "x${GRUB_DISABLE_LINUX_PARTUUID}" = "xtrue" ] ) \$
  1873	    || ( ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \$
  1874		&& ! test -e "/dev/disk/by-partuuid/${GRUB_DEVICE_PARTUUID}" ) \$
  1875	    || ( test -e "${GRUB_DEVICE}" && uses_abstraction "${GRUB_DEVICE}" lvm ); then$
  1876	  LINUX_ROOT_DEVICE=${GRUB_DEVICE}$
  1877	elif [ "x${GRUB_DEVICE_UUID}" = "x" ] \$
  1878	    || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ]; then$
  1879	  LINUX_ROOT_DEVICE=PARTUUID=${GRUB_DEVICE_PARTUUID}$
  1880	else$
  1881	  LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}$
  1882	fi$
  1883	$
  1884	# Allow overriding GRUB_CMDLINE_LINUX and GRUB_CMDLINE_LINUX_DEFAULT.$
  1885	if [ "${GRUB_CMDLINE_LINUX_XEN_REPLACE}" ]; then$
  1886	  GRUB_CMDLINE_LINUX="${GRUB_CMDLINE_LINUX_XEN_REPLACE}"$
  1887	fi$
  1888	if [ "${GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT}" ]; then$
  1889	  GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT}"$
  1890	fi$
  1891	$
  1892	case x"$GRUB_FS" in$
  1893	    xbtrfs)$
  1894		rootsubvol="`make_system_path_relative_to_its_root /`"$
  1895		rootsubvol="${rootsubvol#/}"$
  1896		if [ "x${rootsubvol}" != x ]; then$
  1897		    GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"$
  1898		fi;;$
  1899	    xzfs)$
  1900		rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true`$
  1901		bootfs="`make_system_path_relative_to_its_root / | sed -e "s,@$,,"`"$
  1902		LINUX_ROOT_DEVICE="ZFS=${rpool}${bootfs%/}"$
  1903		;;$
  1904	esac$
  1905	$
  1906	title_correction_code=$
  1907	$
  1908	linux_entry ()$
  1909	{$
  1910	  linux_entry_xsm "$@" false$
  1911	  linux_entry_xsm "$@" true$
  1912	}$
  1913	linux_entry_xsm ()$
  1914	{$
  1915	  os="$1"$
  1916	  version="$2"$
  1917	  entry_xen_version="$3"$
  1918	  type="$4"$
  1919	  args="$5"$
  1920	  xen_args="$6"$
  1921	  xsm="$7"$
  1922	  # If user wants to enable XSM support, make sure there's$
  1923	  # corresponding policy file.$
  1924	  xenpolicy=$
  1925	  if ${xsm} ; then$
  1926	      xenpolicy="xenpolicy-$entry_xen_version"$
  1927	      if test ! -e "${xen_dirname}/${xenpolicy}" ; then$
  1928		  return$
  1929	      fi$
  1930	      xen_args="$xen_args flask=enforcing"$
  1931	      entry_xen_version="$(gettext_printf "%s (XSM enabled)" "$entry_xen_version")"$
  1932	      # entry_xen_version is used for messages only; actual file is xen_basename$
  1933	  fi$
  1934	  if [ -z "$boot_device_id" ]; then$
  1935	      boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"$
  1936	  fi$
  1937	  if [ x$type != xsimple ] ; then$
  1938	      if [ x$type = xrecovery ] ; then$
  1939		  title="$(gettext_printf "%s, with Xen %s and Linux %s (%s)" "${os}" "${entry_xen_version}" "${version}" "$(gettext "${GRUB_RECOVERY_TITLE}")")"$
  1940	      else$
  1941		  title="$(gettext_printf "%s, with Xen %s and Linux %s" "${os}" "${entry_xen_version}" "${version}")"$
  1942	      fi$
  1943	      replacement_title="$(echo "Advanced options for ${OS}" | sed 's,>,>>,g')>$(echo "$title" | sed 's,>,>>,g')"$
  1944	      if [ x"Xen ${entry_xen_version}>$title" = x"$GRUB_ACTUAL_DEFAULT" ]; then$
  1945	         quoted="$(echo "$GRUB_ACTUAL_DEFAULT" | grub_quote)"$
  1946	         title_correction_code="${title_correction_code}if [ \"x\$default\" = '$quoted' ]; then default='$(echo "$replacement_title" | grub_quote)'; fi;"$
  1947	         grub_warn "$(gettext_printf "Please don't use old title \`%s' for GRUB_DEFAULT, use \`%s' (for versions before 2.00) or \`%s' (for 2.00 or later)" "$GRUB_ACTUAL_DEFAULT" "$replacement_title" "gnulinux-advanced-$boot_device_id>gnulinux-$version-$type-$boot_device_id")"$
  1948	      fi$
  1949	      echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'xen-gnulinux-$version-$type-$boot_device_id' {" | sed "s/^/$submenu_indentation/"$
  1950	  else$
  1951	      title="$(gettext_printf "%s, with Xen hypervisor" "${os}")"$
  1952	      echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'xen-gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/"$
  1953	  fi$
  1954	  if [ x$type != xrecovery ] ; then$
  1955	      save_default_entry | grub_add_tab | sed "s/^/$submenu_indentation/"$
  1956	  fi$
  1957	$
  1958	  if [ -z "${prepare_boot_cache}" ]; then$
  1959	    prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | grub_add_tab)"$
  1960	  fi$
  1961	  printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"$
  1962	  xmessage="$(gettext_printf "Loading Xen %s ..." ${entry_xen_version})"$
  1963	  lmessage="$(gettext_printf "Loading Linux %s ..." ${version})"$
  1964	  sed "s/^/$submenu_indentation/" << EOF$
  1965		echo	'$(echo "$xmessage" | grub_quote)'$
  1966	        if [ "\$grub_platform" = "pc" -o "\$grub_platform" = "" ]; then$
  1967	            xen_rm_opts=$
  1968	        else$
  1969	            xen_rm_opts="no-real-mode edd=off"$
  1970	        fi$
  1971		${xen_loader}	${rel_xen_dirname}/${xen_basename} placeholder ${xen_args} \${xen_rm_opts}$
  1972		echo	'$(echo "$lmessage" | grub_quote)'$
  1973		${module_loader}	${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args}$
  1974	EOF$
  1975	  if test -n "${initrd}" ; then$
  1976	    # TRANSLATORS: ramdisk isn't identifier. Should be translated.$
  1977	    message="$(gettext_printf "Loading initial ramdisk ...")"$
  1978	    initrd_path=$
  1979	    for i in ${initrd}; do$
  1980	       initrd_path="${rel_dirname}/${i}"$
  1981	       sed "s/^/$submenu_indentation/" << EOF$
  1982		echo	'$(echo "$message" | grub_quote)'$
  1983		${module_loader}	--nounzip   $(echo $initrd_path)$
  1984	EOF$
  1985	    done$
  1986	  fi$
  1987	  if ${xsm} && test -n "${xenpolicy}" ; then$
  1988	    message="$(gettext_printf "Loading XSM policy ...")"$
  1989	    sed "s/^/$submenu_indentation/" << EOF$
  1990		echo	'$(echo "$message" | grub_quote)'$
  1991		${module_loader}     ${rel_dirname}/${xenpolicy}$
  1992	EOF$
  1993	  fi$
  1994	  sed "s/^/$submenu_indentation/" << EOF$
  1995	}$
  1996	EOF$
  1997	}$
  1998	$
  1999	linux_list=$
  2000	for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* /boot/kernel-*; do$
  2001	    if grub_file_is_not_garbage "$i"; then$
  2002	    	basename=$(basename $i)$
  2003		version=$(echo $basename | sed -e "s,^[^0-9]*-,,g")$
  2004		dirname=$(dirname $i)$
  2005		config=$
  2006		for j in "${dirname}/config-${version}" "${dirname}/config-${alt_version}" "/etc/kernels/kernel-config-${version}" ; do$
  2007		    if test -e "${j}" ; then$
  2008			config="${j}"$
  2009			break$
  2010		    fi$
  2011		done$
  2012	        if (grep -qx "CONFIG_XEN_DOM0=y" "${config}" 2> /dev/null || grep -qx "CONFIG_XEN_PRIVILEGED_GUEST=y" "${config}" 2> /dev/null); then linux_list="$linux_list $i" ; fi$
  2013	    fi$
  2014	done$
  2015	if [ "x${linux_list}" = "x" ] ; then$
  2016	    exit 0$
  2017	fi$
  2018	$
  2019	file_is_not_xen_garbage () {$
  2020	    case "$1" in$
  2021		*/xen-syms-*)$
  2022		    return 1;;$
  2023		*/xenpolicy-*)$
  2024		    return 1;;$
  2025		*/*.config)$
  2026		    return 1;;$
  2027		*)$
  2028		    return 0;;$
  2029	    esac$
  2030	}$
  2031	$
  2032	xen_list=$
  2033	for i in /boot/xen*; do$
  2034	    if grub_file_is_not_garbage "$i" && file_is_not_xen_garbage "$i" ; then xen_list="$xen_list $i" ; fi$
  2035	done$
  2036	prepare_boot_cache=$
  2037	boot_device_id=$
  2038	$
  2039	title_correction_code=$
  2040	$
  2041	machine=`uname -m`$
  2042	$
  2043	case "$machine" in$
  2044	    i?86) GENKERNEL_ARCH="x86" ;;$
  2045	    mips|mips64) GENKERNEL_ARCH="mips" ;;$
  2046	    mipsel|mips64el) GENKERNEL_ARCH="mipsel" ;;$
  2047	    arm*) GENKERNEL_ARCH="arm" ;;$
  2048	    *) GENKERNEL_ARCH="$machine" ;;$
  2049	esac$
  2050	$
  2051	# Extra indentation to add to menu entries in a submenu. We're not in a submenu$
  2052	# yet, so it's empty. In a submenu it will be equal to '\t' (one tab).$
  2053	submenu_indentation=""$
  2054	$
  2055	# Perform a reverse version sort on the entire xen_list and linux_list.$
  2056	# Temporarily replace the '.old' suffix by ' 1' and append ' 2' for all$
  2057	# other files to order the '.old' files after their non-old counterpart$
  2058	# in reverse-sorted order.$
  2059	$
  2060	reverse_sorted_xen_list=$(echo ${xen_list} | tr ' ' '\n' | sed -e 's/\.old$/ 1/; / 1$/! s/$/ 2/' | version_sort -r | sed -e 's/ 1$/.old/; s/ 2$//')$
  2061	reverse_sorted_linux_list=$(echo ${linux_list} | tr ' ' '\n' | sed -e 's/\.old$/ 1/; / 1$/! s/$/ 2/' | version_sort -r | sed -e 's/ 1$/.old/; s/ 2$//')$
  2062	$
  2063	if [ "x$GRUB_TOP_LEVEL_XEN" != x ]; then$
  2064	  reverse_sorted_xen_list=$(grub_move_to_front "$GRUB_TOP_LEVEL_XEN" ${reverse_sorted_xen_list})$
  2065	fi$
  2066	if [ "x$GRUB_TOP_LEVEL" != x ]; then$
  2067	  reverse_sorted_linux_list=$(grub_move_to_front "$GRUB_TOP_LEVEL" ${reverse_sorted_linux_list})$
  2068	fi$
  2069	$
  2070	is_top_level=true$
  2071	$
  2072	for current_xen in ${reverse_sorted_xen_list}; do$
  2073	    xen_basename=`basename ${current_xen}`$
  2074	    xen_dirname=`dirname ${current_xen}`$
  2075	    rel_xen_dirname=`make_system_path_relative_to_its_root $xen_dirname`$
  2076	    xen_version=`echo $xen_basename | sed -e "s,.gz$,,g;s,^xen-,,g"`$
  2077	    if [ -z "$boot_device_id" ]; then$
  2078		boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"$
  2079	    fi$
  2080	    if [ "x$is_top_level" != xtrue ]; then$
  2081		echo "	submenu '$(gettext_printf "Xen hypervisor, version %s" "${xen_version}" | grub_quote)' \$menuentry_id_option 'xen-hypervisor-$xen_version-$boot_device_id' {"$
  2082	    fi$
  2083	    if ($grub_file --is-arm64-efi $current_xen); then$
  2084		xen_loader="xen_hypervisor"$
  2085		module_loader="xen_module"$
  2086	    else$
  2087		if ($grub_file --is-x86-multiboot2 $current_xen); then$
  2088		    xen_loader="multiboot2"$
  2089		    module_loader="module2"$
  2090		else$
  2091		    xen_loader="multiboot"$
  2092		    module_loader="module"$
  2093	        fi$
  2094	    fi$
  2095	$
  2096	    initrd_early=$
  2097	    for i in ${GRUB_EARLY_INITRD_LINUX_STOCK} \$
  2098	             ${GRUB_EARLY_INITRD_LINUX_CUSTOM}; do$
  2099	       if test -e "${xen_dirname}/${i}" ; then$
  2100	          initrd_early="${initrd_early} ${i}"$
  2101	       fi$
  2102	    done$
  2103	$
  2104	    for linux in ${reverse_sorted_linux_list}; do$
  2105		gettext_printf "Found linux image: %s\n" "$linux" >&2$
  2106		basename=`basename $linux`$
  2107		dirname=`dirname $linux`$
  2108		rel_dirname=`make_system_path_relative_to_its_root $dirname`$
  2109		version=`echo $basename | sed -e "s,^[^0-9]*-,,g"`$
  2110		alt_version=`echo $version | sed -e "s,\.old$,,g"`$
  2111		linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"$
  2112	$
  2113		initrd_real=$
  2114		for i in "initrd.img-${version}" "initrd-${version}.img" \$
  2115		   "initrd-${alt_version}.img.old" "initrd-${version}.gz" \$
  2116		   "initrd-${alt_version}.gz.old" "initrd-${version}" \$
  2117		   "initramfs-${version}.img" "initramfs-${alt_version}.img.old" \$
  2118		   "initrd.img-${alt_version}" "initrd-${alt_version}.img" \$
  2119		   "initrd-${alt_version}" "initramfs-${alt_version}.img" \$
  2120		   "initramfs-genkernel-${version}" \$
  2121		   "initramfs-genkernel-${alt_version}" \$
  2122		   "initramfs-genkernel-${GENKERNEL_ARCH}-${version}" \$
  2123		   "initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}" ; do$
  2124		    if test -e "${dirname}/${i}" ; then$
  2125			initrd_real="$i"$
  2126			break$
  2127		    fi$
  2128		done$
  2129	$
  2130		initrd=$
  2131		if test -n "${initrd_early}" || test -n "${initrd_real}"; then$
  2132		    # Xen assumes the real initrd is the first module after the kernel.$
  2133		    # Additional (later) initrds can also be used for microcode update,$
  2134		    # with Xen option 'ucode=<scan|module number> (non-default anyway).$
  2135		    initrd="${initrd_real} ${initrd_early}"$
  2136	$
  2137		    initrd_display=$
  2138		    for i in ${initrd}; do$
  2139			initrd_display="${initrd_display} ${dirname}/${i}"$
  2140		    done$
  2141		    gettext_printf "Found initrd image: %s\n" "$(echo $initrd_display)" >&2$
  2142		fi$
  2143	$
  2144		if test -z "${initrd_real}"; then$
  2145	    # "UUID=" magic is parsed by initrds.  Since there's no initrd, it can't work here.$
  2146		    if [ "x${GRUB_DEVICE_PARTUUID}" = "x" ] \$
  2147			|| [ "x${GRUB_DISABLE_LINUX_PARTUUID}" = "xtrue" ]; then$
  2148	$
  2149			linux_root_device_thisversion=${GRUB_DEVICE}$
  2150		    else$
  2151			linux_root_device_thisversion=PARTUUID=${GRUB_DEVICE_PARTUUID}$
  2152		    fi$
  2153		fi$
  2154	$
  2155		# The GRUB_DISABLE_SUBMENU option used to be different than others since it was$
  2156		# mentioned in the documentation that has to be set to 'y' instead of 'true' to$
  2157		# enable it. This caused a lot of confusion to users that set the option to 'y',$
  2158		# 'yes' or 'true'. This was fixed but all of these values must be supported now.$
  2159		if [ "x${GRUB_DISABLE_SUBMENU}" = xyes ] || [ "x${GRUB_DISABLE_SUBMENU}" = xy ]; then$
  2160		    GRUB_DISABLE_SUBMENU="true"$
  2161		fi$
  2162	$
  2163		if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xtrue ]; then$
  2164		    linux_entry "${OS}" "${version}" "${xen_version}" simple \$
  2165			"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" "${GRUB_CMDLINE_XEN} ${GRUB_CMDLINE_XEN_DEFAULT}"$
  2166	$
  2167		    submenu_indentation="$grub_tab$grub_tab"$
  2168	    $
  2169		    if [ -z "$boot_device_id" ]; then$
  2170			boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"$
  2171		    fi$
  2172	            # TRANSLATORS: %s is replaced with an OS name$
  2173		    echo "submenu '$(gettext_printf "Advanced options for %s (with Xen hypervisor)" "${OS}" | grub_quote)' \$menuentry_id_option 'gnulinux-advanced-$boot_device_id' {"$
  2174		echo "	submenu '$(gettext_printf "Xen hypervisor, version %s" "${xen_version}" | grub_quote)' \$menuentry_id_option 'xen-hypervisor-$xen_version-$boot_device_id' {"$
  2175		   is_top_level=false$
  2176		fi$
  2177	$
  2178		linux_entry "${OS}" "${version}" "${xen_version}" advanced \$
  2179		    "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" "${GRUB_CMDLINE_XEN} ${GRUB_CMDLINE_XEN_DEFAULT}"$
  2180		if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then$
  2181		    linux_entry "${OS}" "${version}" "${xen_version}" recovery \$
  2182			"${GRUB_CMDLINE_LINUX_RECOVERY} ${GRUB_CMDLINE_LINUX}" "${GRUB_CMDLINE_XEN}"$
  2183		fi$
  2184	    done$
  2185	    if [ x"$is_top_level" != xtrue ]; then$
  2186		echo '	}'$
  2187	    fi$
  2188	done$
  2189	$
  2190	# If at least one kernel was found, then we need to$
  2191	# add a closing '}' for the submenu command.$
  2192	if [ x"$is_top_level" != xtrue ]; then$
  2193	  echo '}'$
  2194	fi$
  2195	$
  2196	echo "$title_correction_code"$
  2197	#!/bin/sh$
  2198	#THIS IS A GRUB PROXY SCRIPT$
  2199	'/etc/grub.d/proxifiedScripts/memtest86+' | /etc/grub.d/bin/grubcfg_proxy "+*$
  2200	-'Memory test (memtest86+x64.efi)'~2b2d667fa64149ea7e7dd799fd935128~$
  2201	-'Memory test (memtest86+x64.efi, serial console)'~ef03989aaaf96425e681b2303753d8f7~$
  2202	"#!/bin/sh$
  2203	#THIS IS A GRUB PROXY SCRIPT$
  2204	'/etc/grub.d/proxifiedScripts/os-prober' | /etc/grub.d/bin/grubcfg_proxy "-'Windows Boot Manager (on /dev/nvme0n1p1)'~de20f8367656d13763b692aadbca3155~$
  2205	+*$
  2206	+'Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'~134dd03574b43585791efd6c2e827b71~$
  2207	+'SUBMENU' as 'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'{+'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/*, +'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Ubuntu (on /dev/nvme0n1p5)'~cc96c467383f79e632e1c88452fb38c8~, +'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Ubuntu, with Linux 6.14.0-24-generic (on /dev/nvme0n1p5)'~cc96c467383f79e632e1c88452fb38c8~, +'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Ubuntu, with Linux 6.14.0-24-generic (recovery mode) (on /dev/nvme0n1p5)'~72bfd870d8385ef96ffd975793c6ebb4~, +'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Memory test (memtest86+x64.efi)'~b29573a9321427edec4848bf641e981d~, +'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Memory test (memtest86+x64.efi, serial console)'~234e2b4d9d9d2c68b1789be49d33100e~, +'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Memory test (memtest86+ia32.efi)'~ca310618ac9120fe40de012fcd221c51~, +'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Memory test (memtest86+ia32.efi, serial console)'~fa192ec1dac1db67fd402fd7f99a6a7b~, +'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Memory test (memtest86+x64.bin)'~83bfbf79f9d2e5222d74305efb85ae52~, +'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Memory test (memtest86+x64.bin, serial console)'~6d2876c39f2b193378d0f2915a68b6aa~, +'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Memory test (memtest86+ia32.bin)'~d408d4759af95ef87faaa5f55f282c75~, +'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Memory test (memtest86+ia32.bin, serial console)'~b446cb7716f5bd64334d1ae61b99b671~}$
  2208	+#text$
  2209	"#!/bin/sh$
  2210	#THIS IS A GRUB PROXY SCRIPT$
  2211	'/etc/grub.d/proxifiedScripts/memtest86+' | /etc/grub.d/bin/grubcfg_proxy "+'Memory test (memtest86+x64.efi)'~2b2d667fa64149ea7e7dd799fd935128~$
  2212	+'Memory test (memtest86+x64.efi, serial console)'~ef03989aaaf96425e681b2303753d8f7~$
  2213	-*$
  2214	"#! /bin/sh$
  2215	set -e$
  2216	$
  2217	# grub-mkconfig helper script.$
  2218	# Copyright (C) 2023  Free Software Foundation, Inc.$
  2219	#$
  2220	# GRUB is free software: you can redistribute it and/or modify$
  2221	# it under the terms of the GNU General Public License as published by$
  2222	# the Free Software Foundation, either version 3 of the License, or$
  2223	# (at your option) any later version.$
  2224	#$
  2225	# GRUB is distributed in the hope that it will be useful,$
  2226	# but WITHOUT ANY WARRANTY; without even the implied warranty of$
  2227	# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$
  2228	# GNU General Public License for more details.$
  2229	#$
  2230	# You should have received a copy of the GNU General Public License$
  2231	# along with GRUB.  If not, see <http://www.gnu.org/licenses/>.$
  2232	$
  2233	cat << EOF$
  2234	if [ "\$grub_platform" = "efi" ]; then$
  2235	  insmod bli$
  2236	fi$
  2237	EOF$
  2238	#!/bin/sh$
  2239	#THIS IS A GRUB PROXY SCRIPT$
  2240	'/etc/grub.d/proxifiedScripts/os-prober' | /etc/grub.d/bin/grubcfg_proxy "-*$
  2241	-'Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'~134dd03574b43585791efd6c2e827b71~$
  2242	-'SUBMENU' as 'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'{-'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/*, -'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Ubuntu (on /dev/nvme0n1p5)'~cc96c467383f79e632e1c88452fb38c8~, -'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Ubuntu, with Linux 6.14.0-24-generic (on /dev/nvme0n1p5)'~cc96c467383f79e632e1c88452fb38c8~, -'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Ubuntu, with Linux 6.14.0-24-generic (recovery mode) (on /dev/nvme0n1p5)'~72bfd870d8385ef96ffd975793c6ebb4~, -'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Memory test (memtest86+x64.efi)'~b29573a9321427edec4848bf641e981d~, -'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Memory test (memtest86+x64.efi, serial console)'~234e2b4d9d9d2c68b1789be49d33100e~, -'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Memory test (memtest86+ia32.efi)'~ca310618ac9120fe40de012fcd221c51~, -'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Memory test (memtest86+ia32.efi, serial console)'~fa192ec1dac1db67fd402fd7f99a6a7b~, -'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Memory test (memtest86+x64.bin)'~83bfbf79f9d2e5222d74305efb85ae52~, -'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Memory test (memtest86+x64.bin, serial console)'~6d2876c39f2b193378d0f2915a68b6aa~, -'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Memory test (memtest86+ia32.bin)'~d408d4759af95ef87faaa5f55f282c75~, -'Advanced options for Ubuntu 25.04 (25.04) (on /dev/nvme0n1p5)'/'Memory test (memtest86+ia32.bin, serial console)'~b446cb7716f5bd64334d1ae61b99b671~}$
  2243	-#text$
  2244	-'Windows Boot Manager (on /dev/nvme0n1p1)'~de20f8367656d13763b692aadbca3155~$
  2245	"#! /bin/sh$
  2246	set -e$
  2247	$
  2248	# grub-mkconfig helper script.$
  2249	# Copyright (C) 2020  Free Software Foundation, Inc.$
  2250	#$
  2251	# GRUB is free software: you can redistribute it and/or modify$
  2252	# it under the terms of the GNU General Public License as published by$
  2253	# the Free Software Foundation, either version 3 of the License, or$
  2254	# (at your option) any later version.$
  2255	#$
  2256	# GRUB is distributed in the hope that it will be useful,$
  2257	# but WITHOUT ANY WARRANTY; without even the implied warranty of$
  2258	# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$
  2259	# GNU General Public License for more details.$
  2260	#$
  2261	# You should have received a copy of the GNU General Public License$
  2262	# along with GRUB.  If not, see <http://www.gnu.org/licenses/>.$
  2263	$
  2264	prefix="/usr"$
  2265	exec_prefix="/usr"$
  2266	datarootdir="/usr/share"$
  2267	$
  2268	export TEXTDOMAIN=grub$
  2269	export TEXTDOMAINDIR="${datarootdir}/locale"$
  2270	$
  2271	. "$pkgdatadir/grub-mkconfig_lib"$
  2272	$
  2273	LABEL="UEFI Firmware Settings"$
  2274	$
  2275	gettext_printf "Adding boot menu entry for UEFI Firmware Settings ...\n" >&2$
  2276	$
  2277	cat << EOF$
  2278	if [ "\$grub_platform" = "efi" ]; then$
  2279		fwsetup --is-supported$
  2280		if [ "\$?" = 0 ]; then$
  2281			menuentry '$LABEL' \$menuentry_id_option 'uefi-firmware' {$
  2282				fwsetup$
  2283			}$
  2284		fi$
  2285	fi$
  2286	EOF$
  2287	#! /bin/sh$
  2288	# SPDX-License-Identifier: LGPL-2.1+$
  2289	set -e$
  2290	$
  2291	[ -d ${pkgdatadir:?} ]$
  2292	# shellcheck source=/dev/null$
  2293	. "$pkgdatadir/grub-mkconfig_lib"$
  2294	$
  2295	if [ -f /var/lib/fwupd/uefi_capsule.conf ] &&$
  2296	   ls /sys/firmware/efi/efivars/fwupd-*-0abba7dc-e516-4167-bbf5-4d9d1c739416 1>/dev/null 2>&1; then$
  2297	      . /var/lib/fwupd/uefi_capsule.conf$
  2298	      if [ "${EFI_PATH}" != "" ] && [ "${ESP}" != "" ]; then$
  2299	      echo "Adding Linux Firmware Updater entry" >&2$
  2300	cat << EOF$
  2301	menuentry 'Linux Firmware Updater' \$menuentry_id_option 'fwupd' {$
  2302	EOF$
  2303	      ${grub_probe:?} --version > /dev/null$
  2304	      prepare_grub_to_access_device "$(${grub_probe} --target=device ${ESP})" | sed -e "s/^/\t/"$
  2305	cat << EOF$
  2306		chainloader ${EFI_PATH}$
  2307	}$
  2308	EOF$
  2309	      fi$
  2310	fi$
  2311	#!/bin/sh$
  2312	exec tail -n +3 $0$
  2313	# This file provides an easy way to add custom menu entries.  Simply type the$
  2314	# menu entries you want to add after this comment.  Be careful not to change$
  2315	# the 'exec tail' line above.$
  2316	#!/bin/sh$
  2317	cat <<EOF$
  2318	if [ -f  \${config_directory}/custom.cfg ]; then$
  2319	  source \${config_directory}/custom.cfg$
  2320	elif [ -z "\${config_directory}" -a -f  \$prefix/custom.cfg ]; then$
  2321	  source \$prefix/custom.cfg$
  2322	fi$
  2323	EOF$
  2324	$
cat: /etc/grub.d/backup: est un dossier
cat: /etc/grub.d/bin: est un dossier
cat: /etc/grub.d/proxifiedScripts: est un dossier
  2325	$
  2326	All executable files in this directory are processed in shell expansion order.$
  2327	$
  2328	  00_*: Reserved for 00_header.$
  2329	  10_*: Native boot entries.$
  2330	  20_*: Third party apps (e.g. memtest86+).$
  2331	$
  2332	The number namespace in-between is configurable by system installer and/or$
  2333	administrator.  For example, you can add an entry to boot another OS as$
  2334	01_otheros, 11_otheros, etc, depending on the position you want it to occupy in$
  2335	the menu; and then adjust the default setting via /etc/default/grub.$
chanchris126@chanchris126-MS-7D48:~$ 

Hors ligne

#19 Le 23/07/2025, à 20:21

Chanchris

Re : Ubuntu 24.04.02 LTS

chanchris126@chanchris126-MS-7D48:~$ cat -n -e /etc/default/grub
     1	# If you change this file, run 'update-grub' afterwards to update$
     2	# /boot/grub/grub.cfg.$
     3	# For full documentation of the options in this file, see:$
     4	#   info -f grub -n 'Simple configuration'$
     5	$
     6	GRUB_DEFAULT="0"$
     7	GRUB_TIMEOUT_STYLE="hidden"$
     8	GRUB_TIMEOUT="5"$
     9	GRUB_DISTRIBUTOR="`( . /etc/os-release; echo ${NAME:-Ubuntu} ) 2>/dev/null || echo Ubuntu`"$
    10	GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"$
    11	GRUB_CMDLINE_LINUX=""$
    12	$
    13	# If your computer has multiple operating systems installed, then you$
    14	# probably want to run os-prober. However, if your computer is a host$
    15	# for guest OSes installed via LVM or raw disk devices, running$
    16	# os-prober can cause damage to those guest OSes as it mounts$
    17	# filesystems to look for things.$
    18	#GRUB_DISABLE_OS_PROBER="false"$
    19	$
    20	# Uncomment to enable BadRAM filtering, modify to suit your needs$
    21	# This works with Linux (no patch required) and with any kernel that obtains$
    22	# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)$
    23	#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"$
    24	$
    25	# Uncomment to disable graphical terminal$
    26	#GRUB_TERMINAL="console"$
    27	$
    28	# The resolution used on graphical terminal$
    29	# note that you can use only modes which your graphic card supports via VBE$
    30	# you can see them in real GRUB with the command `vbeinfo'$
    31	#GRUB_GFXMODE="640x480"$
    32	$
    33	# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux$
    34	#GRUB_DISABLE_LINUX_UUID="true"$
    35	$
    36	# Uncomment to disable generation of recovery mode menu entries$
    37	#GRUB_DISABLE_RECOVERY="true"$
    38	$
    39	# Uncomment to get a beep at grub start$
    40	#GRUB_INIT_TUNE="480 440 1"$
    41	$
    42	export GRUB_COLOR_NORMAL="light-gray/black"$
    43	export GRUB_COLOR_HIGHLIGHT="yellow/black"$
    44	export GRUB_MENU_PICTURE="/root/snap/20250409_125006_042.jpg"chanchris126@chanchris126-MS-7D48:~$ 

Hors ligne

#20 Le 23/07/2025, à 21:29

geole

Re : Ubuntu 24.04.02 LTS

Chanchris a écrit :

voici mon fichier Grub.cfg

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT="0"
GRUB_TIMEOUT_STYLE="hidden"
GRUB_TIMEOUT="5"
GRUB_DISTRIBUTOR="`( . /etc/os-release; echo ${NAME:-Ubuntu} ) 2>/dev/null || echo Ubuntu`"
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

# If your computer has multiple operating systems installed, then you
# probably want to run os-prober. However, if your computer is a host
# for guest OSes installed via LVM or raw disk devices, running
# os-prober can cause damage to those guest OSes as it mounts
# filesystems to look for things.
#GRUB_DISABLE_OS_PROBER="false"

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal
#GRUB_TERMINAL="console"

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE="640x480"

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID="true"

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

export GRUB_COLOR_NORMAL="light-gray/black"
export GRUB_COLOR_HIGHLIGHT="yellow/black"
export GRUB_MENU_PICTURE="/root/snap/20250409_125006_042.jpg"

Il n'y a pas chanchris126@chanchris126-MS à la dernière ligne ??

Il me semble pourtant bien que oui!

$
    42	export GRUB_COLOR_NORMAL="light-gray/black"$
    43	export GRUB_COLOR_HIGHLIGHT="yellow/black"$
    44	export GRUB_MENU_PICTURE="/root/snap/20250409_125006_042.jpg"chanchris126@chanchris126-MS-7D48:~$ 

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

Hors ligne

#21 Le 24/07/2025, à 08:41

Chanchris

Re : Ubuntu 24.04.02 LTS

Ca vient du copier coller de la fenêtre du terminal.
Dans le fichier grub.cfg il n'y a pas chanchris126@chanchris126-MS

Hors ligne

#22 Le 24/07/2025, à 09:38

geole

Re : Ubuntu 24.04.02 LTS

Bonjour.
Dans cas, cette dernière est mal formée. Il faudrait le symbol $ derrière .jpg
Absence du caractère fin de ligne. Le plus simple serait de la refrapper ou de la mettre en commentaire afin de vérifier qu’elle est bien la cause.


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

Hors ligne

#23 Le 24/07/2025, à 17:17

Chanchris

Re : Ubuntu 24.04.02 LTS

Cà n'a rien changé ....:mad:

Hors ligne

#24 Le 24/07/2025, à 17:41

geole

Re : Ubuntu 24.04.02 LTS

 ls -l  /etc/grub.d
cat -A -n /etc/default/grub

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

Hors ligne

#25 Le 25/07/2025, à 15:10

Chanchris

Re : Ubuntu 24.04.02 LTS

chanchris126@chanchris126-MS-7D48:~$ ls -l  /etc/grub.d
total 152
-rwxr-xr-x 1 root root 10661 sept. 11  2024 00_header
-rwxr-xr-x 1 root root  6260 sept. 11  2024 05_debian_theme
-rwxr-xr-x 1 root root   694 juil. 20 11:05 10_linux_proxy
-rwxr-xr-x 1 root root  2029 juil. 20 11:05 30_os-prober_proxy
-rwxr-xr-x 1 root root   714 juil. 20 11:05 31_linux_proxy
-rwxr-xr-x 1 root root  2029 juil. 20 11:05 32_os-prober_proxy
-rwxr-xr-x 1 root root   714 juil. 20 11:05 33_linux_proxy
-rwxr-xr-x 1 root root 43202 sept. 11  2024 34_linux_zfs
-rwxr-xr-x 1 root root 14513 sept. 11  2024 35_linux_xen
-rwxr-xr-x 1 root root   272 juil. 20 11:05 36_memtest86+_proxy
-rwxr-xr-x 1 root root  2029 juil. 20 11:05 37_os-prober_proxy
-rwxr-xr-x 1 root root   272 juil. 20 11:05 38_memtest86+_proxy
-rwxr-xr-x 1 root root   786 sept. 11  2024 39_bli
-rwxr-xr-x 1 root root  2029 juil. 20 11:05 40_os-prober_proxy
-rwxr-xr-x 1 root root  1174 sept. 11  2024 41_uefi-firmware
-rwxr-xr-x 1 root root   722 déc.   5  2024 42_fwupd
-rwxr-xr-x 1 root root   214 sept. 11  2024 43_custom
-rwxr-xr-x 1 root root   215 sept. 11  2024 44_custom
drwxr-xr-x 4 root root  4096 juin  10 14:59 backup
drwxr-xr-x 2 root root  4096 juin  10 14:59 bin
drwxr-xr-x 2 root root  4096 juil. 20 11:05 proxifiedScripts
-rw-r--r-- 1 root root   483 sept. 11  2024 README
chanchris126@chanchris126-MS-7D48:~$ cat -A -n /etc/default/grub
     1	# If you change this file, run 'update-grub' afterwards to update$
     2	# /boot/grub/grub.cfg.$
     3	# For full documentation of the options in this file, see:$
     4	#   info -f grub -n 'Simple configuration'$
     5	$
     6	GRUB_DEFAULT="0"$
     7	GRUB_TIMEOUT_STYLE="hidden"$
     8	GRUB_TIMEOUT="5"$
     9	GRUB_DISTRIBUTOR="`( . /etc/os-release; echo ${NAME:-Ubuntu} ) 2>/dev/null || echo Ubuntu`"$
    10	GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"$
    11	GRUB_CMDLINE_LINUX=""$
    12	$
    13	# If your computer has multiple operating systems installed, then you$
    14	# probably want to run os-prober. However, if your computer is a host$
    15	# for guest OSes installed via LVM or raw disk devices, running$
    16	# os-prober can cause damage to those guest OSes as it mounts$
    17	# filesystems to look for things.$
    18	#GRUB_DISABLE_OS_PROBER="false"$
    19	$
    20	# Uncomment to enable BadRAM filtering, modify to suit your needs$
    21	# This works with Linux (no patch required) and with any kernel that obtains$
    22	# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)$
    23	#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"$
    24	$
    25	# Uncomment to disable graphical terminal$
    26	#GRUB_TERMINAL="console"$
    27	$
    28	# The resolution used on graphical terminal$
    29	# note that you can use only modes which your graphic card supports via VBE$
    30	# you can see them in real GRUB with the command `vbeinfo'$
    31	#GRUB_GFXMODE="640x480"$
    32	$
    33	# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux$
    34	#GRUB_DISABLE_LINUX_UUID="true"$
    35	$
    36	# Uncomment to disable generation of recovery mode menu entries$
    37	#GRUB_DISABLE_RECOVERY="true"$
    38	$
    39	# Uncomment to get a beep at grub start$
    40	#GRUB_INIT_TUNE="480 440 1"$
    41	$
    42	export GRUB_COLOR_NORMAL="light-gray/black"$
    43	export GRUB_COLOR_HIGHLIGHT="yellow/black"$
    44	export GRUB_MENU_PICTURE="/root/snap/20250409_125006_042.jpg"$
chanchris126@chanchris126-MS-7D48:~$ 

Hors ligne