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 20/10/2020, à 16:28

Dezta

[Résolu] Problème avec Grub et Apt

Bonjour,
je rencontre un problème un peu délicat avec apt et grub...
Je suis sous lubuntu 20.04, que je viens d'installer a coté d'un windows et en gardant une vielle installe 16.04 (donc en tri-boot).
Depuis le nouveau système en 20.04, j'ai fait un

sudo os-prober
sudo update-grub
sudo grub-install /dev/sda

pour déplacer mon installe de grub du 16.04 vers l'installe en 20.04 ( je compte supprimé la 16.04 qd j'en aurai plus besoin, il fallait donc que je le fasse pour garder un grub qui marche).

Puis, alors que tout marchait très bien, j'ai eu la brillante idée de modifier les entrés avec grub-customizer...

Non seulement ça n'a pas marché, mais en plus, je ne peux plus mettre a jours mon grub :

(moi)@(monpc)-lubuntu:~$ sudo update-grub 
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Création du fichier de configuration GRUB…
Image Linux trouvée : /boot/vmlinuz-5.4.0-48-generic
Image mémoire initiale trouvée : /boot/initrd.img-5.4.0-48-generic
Image Linux trouvée : /boot/vmlinuz-5.4.0-47-generic
Image mémoire initiale trouvée : /boot/initrd.img-5.4.0-47-generic
Image Linux trouvée : /boot/vmlinuz-5.4.0-48-generic
Image mémoire initiale trouvée : /boot/initrd.img-5.4.0-48-generic
Image Linux trouvée : /boot/vmlinuz-5.4.0-47-generic
Image mémoire initiale trouvée : /boot/initrd.img-5.4.0-47-generic
Windows 7 trouvé sur /dev/sda1
Windows 7 trouvé sur /dev/sda2
Ubuntu 16.04.6 LTS (16.04) trouvé sur /dev/sda4
Image Linux trouvée : /boot/vmlinuz-5.4.0-48-generic
Image mémoire initiale trouvée : /boot/initrd.img-5.4.0-48-generic
Image Linux trouvée : /boot/vmlinuz-5.4.0-47-generic
Image mémoire initiale trouvée : /boot/initrd.img-5.4.0-47-generic
Image Linux trouvée : /boot/vmlinuz-5.4.0-48-generic
Image mémoire initiale trouvée : /boot/initrd.img-5.4.0-48-generic
Image Linux trouvée : /boot/vmlinuz-5.4.0-47-generic
Image mémoire initiale trouvée : /boot/initrd.img-5.4.0-47-generic
Windows 7 trouvé sur /dev/sda1
Windows 7 trouvé sur /dev/sda2
Ubuntu 16.04.6 LTS (16.04) trouvé sur /dev/sda4
erreur : syntax error.
erreur : Incorrect command.
erreur : syntax error.
Erreur de syntaxe à la ligne 177
Des erreurs de syntaxe sont détectées dans le fichier de configuration
de GRUB. Veuillez vérifier qu'il n'y a pas d'erreur dans les fichiers
/etc/default/grub et /etc/grub.d/*. Sinon veuillez signaler un bogue
en joignant le fichier /boot/grub/grub.cfg.new.

Grub-customizer à fait nawak avec mon installe grub. Du coup, j'aimerai bien le virer et remettre une installe grub propre.

Sauf que je ne peux plus l'enlever ! En effet  :

moi@monpc-lubuntu:~$ sudo apt purge grub-customizer -y
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances       
Lecture des informations d'état... Fait
Les paquets suivants ont été installés automatiquement et ne sont plus nécessaires :
  hwinfo libhd21 libllvm9 libqt5opengl5 libx86emu2 qtgstreamer-plugins-qt5
Veuillez utiliser « sudo apt autoremove » pour les supprimer.
Les paquets suivants seront ENLEVÉS :
  grub-customizer* linux-image-5.4.0-26-generic
0 mis à jour, 0 nouvellement installés, 2 à enlever et 34 non mis à jour.
2 partiellement installés ou enlevés.
Après cette opération, 15,2 Mo d'espace disque seront libérés.
(Lecture de la base de données... 309332 fichiers et répertoires déjà installés.)
Suppression de linux-image-5.4.0-26-generic (5.4.0-26.30) ...
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-5.4.0-26-generic
/etc/kernel/postrm.d/zz-update-grub:
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Création du fichier de configuration GRUB…
Image Linux trouvée : /boot/vmlinuz-5.4.0-48-generic
Image mémoire initiale trouvée : /boot/initrd.img-5.4.0-48-generic
Image Linux trouvée : /boot/vmlinuz-5.4.0-47-generic
Image mémoire initiale trouvée : /boot/initrd.img-5.4.0-47-generic
Image Linux trouvée : /boot/vmlinuz-5.4.0-48-generic
Image mémoire initiale trouvée : /boot/initrd.img-5.4.0-48-generic
Image Linux trouvée : /boot/vmlinuz-5.4.0-47-generic
Image mémoire initiale trouvée : /boot/initrd.img-5.4.0-47-generic
Windows 7 trouvé sur /dev/sda1
Windows 7 trouvé sur /dev/sda2
Ubuntu 16.04.6 LTS (16.04) trouvé sur /dev/sda4
Image Linux trouvée : /boot/vmlinuz-5.4.0-48-generic
Image mémoire initiale trouvée : /boot/initrd.img-5.4.0-48-generic
Image Linux trouvée : /boot/vmlinuz-5.4.0-47-generic
Image mémoire initiale trouvée : /boot/initrd.img-5.4.0-47-generic
Image Linux trouvée : /boot/vmlinuz-5.4.0-48-generic
Image mémoire initiale trouvée : /boot/initrd.img-5.4.0-48-generic
Image Linux trouvée : /boot/vmlinuz-5.4.0-47-generic
Image mémoire initiale trouvée : /boot/initrd.img-5.4.0-47-generic
Windows 7 trouvé sur /dev/sda1
Windows 7 trouvé sur /dev/sda2
Ubuntu 16.04.6 LTS (16.04) trouvé sur /dev/sda4
erreur : syntax error.
erreur : Incorrect command.
erreur : syntax error.
Erreur de syntaxe à la ligne 177
Des erreurs de syntaxe sont détectées dans le fichier de configuration
de GRUB. Veuillez vérifier qu'il n'y a pas d'erreur dans les fichiers
/etc/default/grub et /etc/grub.d/*. Sinon veuillez signaler un bogue
en joignant le fichier /boot/grub/grub.cfg.new.
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 1
dpkg: erreur de traitement du paquet linux-image-5.4.0-26-generic (--remove) :
 installed linux-image-5.4.0-26-generic package post-removal script subprocess returned error exit status 1
dpkg: trop d'erreurs, arrêt
Des erreurs ont été rencontrées pendant l'exécution :
 linux-image-5.4.0-26-generic
L'exécution a été arrêtée car il y avait trop d'erreurs.
E: Sub-process /usr/bin/dpkg returned an error code (1)

Je précise que le problème se pose avec toute commande apt instal ou purge ...
Quelqu'un peut-il m'aider à débloquer mon os svp ?
merci d'avance

Dernière modification par Dezta (Le 20/10/2020, à 18:44)

Hors ligne

#2 Le 20/10/2020, à 16:40

malbo

Re : [Résolu] Problème avec Grub et Apt

Bonjour,
Depuis une session de ton Lubuntu 20.04, je te prie de passer la commande suivante dans un terminal (utilise le copier-coller pour éviter les erreurs de frappe) :

dpkg -l | grep grub

Et de donner le retour complet de cette commande dans ta réponse.

Dernière modification par malbo (Le 20/10/2020, à 16:41)

Hors ligne

#3 Le 20/10/2020, à 16:46

Qid

Re : [Résolu] Problème avec Grub et Apt

hum... joli coups... perso à l'époque ou je jouais avec je n'ai jamais rencontré de souci de ce style
mais déjà au moins on a une piste sérieuse à exploiter :

Erreur de syntaxe à la ligne 177
Des erreurs de syntaxe sont détectées dans le fichier de configuration
de GRUB. Veuillez vérifier qu'il n'y a pas d'erreur dans les fichiers
/etc/default/grub et /etc/grub.d/*. Sinon veuillez signaler un bogue
en joignant le fichier /boot/grub/grub.cfg.new.

donc stratégie de base : regarder les lignes 177 de tous les fichiers dont il est question
et non je n'ai pas de ligne de commande ou de script pour nous mâcher le travail


"GNU/Linux c'est que du bon mais M$ Windows ce n'est pas si mal"
Référent technique Ubuntu d'un Groupe d'Utilisateur du Libre
plus d'info sur mon profil

Hors ligne

#4 Le 20/10/2020, à 16:56

Dezta

Re : [Résolu] Problème avec Grub et Apt

@malbo

pkg -l | grep grub
ii  grub-common                                                 2.04-1ubuntu26.4                      amd64        GRand Unified Bootloader (common files)
ii  grub-customizer                                             5.1.0-2                               amd64        GUI to configure GRUB2 and BURG
ii  grub-efi-amd64-bin                                          2.04-1ubuntu26.4                      amd64        GRand Unified Bootloader, version 2 (EFI-AMD64 modules)
ii  grub-efi-amd64-signed                                       1.142.6+2.04-1ubuntu26.4              amd64        GRand Unified Bootloader, version 2 (EFI-AMD64 version, signed)
ii  grub-gfxpayload-lists                                       0.7                                   amd64        GRUB gfxpayload blacklist
ii  grub-pc                                                     2.04-1ubuntu26.4                      amd64        GRand Unified Bootloader, version 2 (PC/BIOS version)
ii  grub-pc-bin                                                 2.04-1ubuntu26.4                      amd64        GRand Unified Bootloader, version 2 (PC/BIOS modules)
ii  grub2-common                                                2.04-1ubuntu26.4                      amd64        GRand Unified Bootloader (common files for version 2)
ii  grub2-themes-ubuntustudio                                   0.3                                   all          GRand Unified Bootloader, version 2 (Ubuntu Studio theme)

@qid
Il y a malheuresement 17 pages qui s'ouvrent quand je fais sudo nano /etc/grub.d/*  ... je copie/colle le contenu ici ?

Hors ligne

#5 Le 20/10/2020, à 16:57

nany

Re : [Résolu] Problème avec Grub et Apt

Bonjour,



Qid a écrit :

et non je n'ai pas de ligne de commande ou de script pour nous mâcher le travail

cat /etc/default/grub{,.d/*}

Et :

ls -lR /etc/default

Hors ligne

#6 Le 20/10/2020, à 17:00

Qid

Re : [Résolu] Problème avec Grub et Apt

nany a écrit :
Qid a écrit :

et non je n'ai pas de ligne de commande ou de script pour nous mâcher le travail

cat /etc/default/grub{,.d/*}

hum... j'aime... merci beaucoup pour cette astuce par contre je ne vois pas comment ça va nous donner la ligne 177 de chacun des fichiers wink


"GNU/Linux c'est que du bon mais M$ Windows ce n'est pas si mal"
Référent technique Ubuntu d'un Groupe d'Utilisateur du Libre
plus d'info sur mon profil

Hors ligne

#7 Le 20/10/2020, à 17:00

Dezta

Re : [Résolu] Problème avec Grub et Apt

Merci beaucoup @nami big_smile

 cat /etc/default/grub{,.d/*}
# 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="0"
GRUB_DISTRIBUTOR="`lsb_release -i -s 2> /dev/null || echo Debian`"
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

# 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-pc only)
#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"
# Work around a bug in the obsolete init-select package which broke
# grub-mkconfig when init-select was removed but not purged.  This file does
# nothing and will be removed in a later release.
#
# See:
#   https://bugs.debian.org/858528
#   https://bugs.debian.org/863801
moi@pc-lubuntu:~$ ls -lR /etc/default
/etc/default:
total 128
-rw-r--r-- 1 root root  346 nov.  28  2019 acpid
-rw-r--r-- 1 root root 4922 janv. 31  2019 acpi-support
-rw-r--r-- 1 root root  638 avril 23 09:36 alsa
-rw-r--r-- 1 root root  328 déc.  21  2019 amd64-microcode
-rw-r--r-- 1 root root  830 juil. 16  2019 anacron
-rw-r--r-- 1 root root  149 déc.   4  2019 apport
-rw-r--r-- 1 root root  219 août  21  2018 avahi-daemon
-rw-r--r-- 1 root root  222 déc.  29  2017 bsdmainutils
-rw-r--r-- 1 root root  285 avril 23 09:32 console-setup
-rw-r--r-- 1 root root  549 août  23  2014 crda
-rw-r--r-- 1 root root  150 févr. 11  2020 cron
-rw-r--r-- 1 root root  460 févr.  4  2020 cryptdisks
-rw-r--r-- 1 root root  297 sept. 30  2019 dbus
-rw-r--r-- 1 root root  105 avril  3  2020 gdomap
-rw-r--r-- 1 root root 1223 sept. 20 20:36 grub
drwxr-xr-x 2 root root 4096 sept. 20 19:59 grub.d
-rw-r--r-- 1 root root  130 juil. 17  2017 haveged
-rw-r--r-- 1 root root 1159 mars  25  2020 im-config
-rw-r--r-- 1 root root 1029 nov.  17  2019 intel-microcode
-rw-r--r-- 1 root root  931 févr. 13  2020 irqbalance
-rw-r--r-- 1 root root   84 mai   19  2017 kerneloops
-rw-r--r-- 1 root root  164 sept. 20 20:21 keyboard
-rw-r--r-- 1 root root  230 sept. 20 19:52 locale
-rw-r--r-- 1 root root  270 oct.   2 11:42 mono-xsp4
-rw-r--r-- 1 root root  152 août  19  2019 networkd-dispatcher
-rw-r--r-- 1 root root 1756 avril 14  2020 nss
-rw-r--r-- 1 root root 2062 oct.  15  2019 rsync
-rw-r--r-- 1 root root  110 oct.   2 13:18 saned
-rw-r--r-- 1 root root  133 mai   29 09:33 ssh
-rw-r--r-- 1 root root 1897 avril  2  2020 ufw
-rw-r--r-- 1 root root 1118 févr.  7  2020 useradd

/etc/default/grub.d:
total 4
-rw-r--r-- 1 root root 274 avril 15  2020 init-select.cfg

Dernière modification par Dezta (Le 20/10/2020, à 17:01)

Hors ligne

#8 Le 20/10/2020, à 17:02

nany

Re : [Résolu] Problème avec Grub et Apt

Il ne donnera pas la ligne 177. hmm
Mais peut-être s’agit-il de la ligne 177 de /boot/grub/grub.cfg.new :

cat -n /boot/grub/grub.cfg.new

Hors ligne

#9 Le 20/10/2020, à 17:04

Dezta

Re : [Résolu] Problème avec Grub et Apt

nany a écrit :

Il ne donnera pas la ligne 177. hmm
Mais peut-être s’agit-il de la ligne 177 de /boot/grub/grub.cfg.new :

cat -n /boot/grub/grub.cfg.new

cat -n /boot/grub/grub.cfg.new
     1  #
     2  # DO NOT EDIT THIS FILE
     3  #
     4  # It is automatically generated by grub-mkconfig using templates
     5  # from /etc/grub.d and settings from /etc/default/grub
     6  #
     7
     8  ### BEGIN /etc/grub.d/00_header ###
     9  if [ -s $prefix/grubenv ]; then
    10    set have_grubenv=true
    11    load_env
    12  fi
    13  if [ "${initrdfail}" = 2 ]; then
    14     set initrdfail=
    15  elif [ "${initrdfail}" = 1 ]; then
    16     set next_entry="${prev_entry}"
    17     set prev_entry=
    18     save_env prev_entry
    19     if [ "${next_entry}" ]; then
    20        set initrdfail=2
    21     fi
    22  fi
    23  if [ "${next_entry}" ] ; then
    24     set default="${next_entry}"
    25     set next_entry=
    26     save_env next_entry
    27     set boot_once=true
    28  else
    29     set default="0"
    30  fi
    31
    32  if [ x"${feature_menuentry_id}" = xy ]; then
    33    menuentry_id_option="--id"
    34  else
    35    menuentry_id_option=""
    36  fi
    37
    38  export menuentry_id_option
    39
    40  if [ "${prev_saved_entry}" ]; then
    41    set saved_entry="${prev_saved_entry}"
    42    save_env saved_entry
    43    set prev_saved_entry=
    44    save_env prev_saved_entry
    45    set boot_once=true
    46  fi
    47
    48  function savedefault {
    49    if [ -z "${boot_once}" ]; then
    50      saved_entry="${chosen}"
    51      save_env saved_entry
    52    fi
    53  }
    54  function initrdfail {
    55      if [ -n "${have_grubenv}" ]; then if [ -n "${partuuid}" ]; then
    56        if [ -z "${initrdfail}" ]; then
    57          set initrdfail=1
    58          if [ -n "${boot_once}" ]; then
    59            set prev_entry="${default}"
    60            save_env prev_entry
    61          fi
    62        fi
    63        save_env initrdfail
    64      fi; fi
    65  }
    66  function recordfail {
    67    set recordfail=1
    68    if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; fi
    69  }
    70  function load_video {
    71    if [ x$feature_all_video_module = xy ]; then
    72      insmod all_video
    73    else
    74      insmod efi_gop
    75      insmod efi_uga
    76      insmod ieee1275_fb
    77      insmod vbe
    78      insmod vga
    79      insmod video_bochs
    80      insmod video_cirrus
    81    fi
    82  }
    83
    84  if [ x$feature_default_font_path = xy ] ; then
    85     font=unicode
    86  else
    87  insmod part_msdos
    88  insmod ext2
    89  set root='hd0,msdos5'
    90  if [ x$feature_platform_search_hint = xy ]; then
    91    search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5  3a99e146-f457-46a6-8726-e075a86b9b9a
    92  else
    93    search --no-floppy --fs-uuid --set=root 3a99e146-f457-46a6-8726-e075a86b9b9a
    94  fi
    95      font="/usr/share/grub/unicode.pf2"
    96  fi
    97
    98  if loadfont $font ; then
    99    set gfxmode=auto
   100    load_video
   101    insmod gfxterm
   102    set locale_dir=$prefix/locale
   103    set lang=fr_FR
   104    insmod gettext
   105  fi
   106  terminal_output gfxterm
   107  if [ "${recordfail}" = 1 ] ; then
   108    set timeout=30
   109  else
   110    if [ x$feature_timeout_style = xy ] ; then
   111      set timeout_style=hidden
   112      set timeout=0
   113    # Fallback hidden-timeout code in case the timeout_style feature is
   114    # unavailable.
   115    elif sleep --interruptible 0 ; then
   116      set timeout=0
   117    fi
   118  fi
   119  ### END /etc/grub.d/00_header ###
   120
   121  ### BEGIN /etc/grub.d/05_debian_theme ###
   122  set menu_color_normal=white/black
   123  set menu_color_highlight=black/light-gray
   124  if background_color 0,0,0; then
   125    clear
   126  fi
   127
   128  color_normal=white/black
   129
   130  if [ -e ${prefix}/themes/ubuntustudio/theme.txt ]; then
   131    insmod png
   132    theme=${prefix}/themes/ubuntustudio/theme.txt
   133  fi
   134  ### END /etc/grub.d/05_debian_theme ###
   135
   136  ### BEGIN /etc/grub.d/10_linux_proxy ###
   137
   138  function gfxmode {
   139          set gfxpayload="${1}"
   140          if [ "${1}" = "keep" ]; then
   141                  set vt_handoff=vt.handoff=7
   142          else
   143                  set vt_handoff=
   144          fi
   145  }
   146  if [ "${recordfail}" != 1 ]; then
   147    if [ -e ${prefix}/gfxblacklist.txt ]; then
   148      if hwmatch ${prefix}/gfxblacklist.txt 3; then
   149        if [ ${match} = 0 ]; then
   150          set linux_gfx_mode=keep
   151        else
   152          set linux_gfx_mode=text
   153        fi
   154      else
   155        set linux_gfx_mode=text
   156      fi
   157    else
   158      set linux_gfx_mode=keep
   159    fi
   160  else
   161    set linux_gfx_mode=text
   162  fi
   163  export linux_gfx_mode
   164
   165
   166
   167  ### END /etc/grub.d/10_linux_proxy ###
   168
   169  ### BEGIN /etc/grub.d/40_custom_proxy ###
   170  ### END /etc/grub.d/40_custom_proxy ###
   171
   172  ### BEGIN /etc/grub.d/41_linux_proxy ###
   173  ### END /etc/grub.d/41_linux_proxy ###
   174
   175  ### BEGIN /etc/grub.d/42_custom_proxy ###
   176  menuentry "Ubuntu 20.04 LTS" --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-3a99e146-f457-46a6-8726-e075a86b9b9a' {
   177  }
   178  ### END /etc/grub.d/42_custom_proxy ###
   179
   180  ### BEGIN /etc/grub.d/45_os-prober_proxy ###
   181  menuentry "Windows 7 (sur /dev/sda2)" --class windows --class os $menuentry_id_option 'osprober-chain-A4C667F8C667C95E' {
   182          insmod part_msdos
   183          insmod ntfs
   184          set root='hd0,msdos2'
   185          if [ x$feature_platform_search_hint = xy ]; then
   186            search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2  A4C667F8C667C95E
   187          else
   188            search --no-floppy --fs-uuid --set=root A4C667F8C667C95E
   189          fi
   190          parttool ${root} hidden-
   191          chainloader +1
   192  }
   193  menuentry "Ubuntu 16.04.6 LTS (16.04) (sur /dev/sda4)" --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-d4af8b02-b68c-4127-a189-f82977775f64' {
   194          insmod part_msdos
   195          insmod ext2
   196          set root='hd0,msdos4'
   197          if [ x$feature_platform_search_hint = xy ]; then
   198            search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4  d4af8b02-b68c-4127-a189-f82977775f64
   199          else
   200            search --no-floppy --fs-uuid --set=root d4af8b02-b68c-4127-a189-f82977775f64
   201          fi
   202          linux /boot/vmlinuz-4.15.0-76-generic root=UUID=d4af8b02-b68c-4127-a189-f82977775f64 ro quiet splash $vt_handoff
   203          initrd /boot/initrd.img-4.15.0-76-generic
   204  }
   205  ### END /etc/grub.d/45_os-prober_proxy ###
   206
   207  ### BEGIN /etc/grub.d/46_linux_proxy ###
   208  submenu "Options avancées pour Ubuntu"{
   209  menuentry "Ubuntu, avec Linux 5.4.0-48-generic" --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.4.0-48-generic-advanced-3a99e146-f457-46a6-8726-e075a86b9b9a' {
   210                  recordfail
   211                  load_video
   212                  gfxmode $linux_gfx_mode
   213                  insmod gzio
   214                  if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
   215                  insmod part_msdos
   216                  insmod ext2
   217                  set root='hd0,msdos5'
   218                  if [ x$feature_platform_search_hint = xy ]; then
   219                    search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5  3a99e146-f457-46a6-8726-e075a86b9b9a
   220                  else
   221                    search --no-floppy --fs-uuid --set=root 3a99e146-f457-46a6-8726-e075a86b9b9a
   222                  fi
   223                  echo    'Chargement de Linux 5.4.0-48-generic…'
   224                  linux   /boot/vmlinuz-5.4.0-48-generic root=UUID=3a99e146-f457-46a6-8726-e075a86b9b9a ro  quiet splash $vt_handoff
   225                  echo    'Chargement du disque mémoire initial…'
   226                  initrd  /boot/initrd.img-5.4.0-48-generic
   227  }
   228  menuentry "Ubuntu, avec Linux 5.4.0-48-generic (recovery mode)" --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.4.0-48-generic-recovery-3a99e146-f457-46a6-8726-e075a86b9b9a' {
   229                  recordfail
   230                  load_video
   231                  insmod gzio
   232                  if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
   233                  insmod part_msdos
   234                  insmod ext2
   235                  set root='hd0,msdos5'
   236                  if [ x$feature_platform_search_hint = xy ]; then
   237                    search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5  3a99e146-f457-46a6-8726-e075a86b9b9a
   238                  else
   239                    search --no-floppy --fs-uuid --set=root 3a99e146-f457-46a6-8726-e075a86b9b9a
   240                  fi
   241                  echo    'Chargement de Linux 5.4.0-48-generic…'
   242                  linux   /boot/vmlinuz-5.4.0-48-generic root=UUID=3a99e146-f457-46a6-8726-e075a86b9b9a ro recovery nomodeset dis_ucode_ldr 
   243                  echo    'Chargement du disque mémoire initial…'
   244                  initrd  /boot/initrd.img-5.4.0-48-generic
   245  }
   246  menuentry "Ubuntu, avec Linux 5.4.0-47-generic" --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.4.0-47-generic-advanced-3a99e146-f457-46a6-8726-e075a86b9b9a' {
   247                  recordfail
   248                  load_video
   249                  gfxmode $linux_gfx_mode
   250                  insmod gzio
   251                  if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
   252                  insmod part_msdos
   253                  insmod ext2
   254                  set root='hd0,msdos5'
   255                  if [ x$feature_platform_search_hint = xy ]; then
   256                    search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5  3a99e146-f457-46a6-8726-e075a86b9b9a
   257                  else
   258                    search --no-floppy --fs-uuid --set=root 3a99e146-f457-46a6-8726-e075a86b9b9a
   259                  fi
   260                  echo    'Chargement de Linux 5.4.0-47-generic…'
   261                  linux   /boot/vmlinuz-5.4.0-47-generic root=UUID=3a99e146-f457-46a6-8726-e075a86b9b9a ro  quiet splash $vt_handoff
   262                  echo    'Chargement du disque mémoire initial…'
   263                  initrd  /boot/initrd.img-5.4.0-47-generic
   264  }
   265  menuentry "Ubuntu, avec Linux 5.4.0-47-generic (recovery mode)" --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.4.0-47-generic-recovery-3a99e146-f457-46a6-8726-e075a86b9b9a' {
   266                  recordfail
   267                  load_video
   268                  insmod gzio
   269                  if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
   270                  insmod part_msdos
   271                  insmod ext2
   272                  set root='hd0,msdos5'
   273                  if [ x$feature_platform_search_hint = xy ]; then
   274                    search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos5 --hint-efi=hd0,msdos5 --hint-baremetal=ahci0,msdos5  3a99e146-f457-46a6-8726-e075a86b9b9a
   275                  else
   276                    search --no-floppy --fs-uuid --set=root 3a99e146-f457-46a6-8726-e075a86b9b9a
   277                  fi
   278                  echo    'Chargement de Linux 5.4.0-47-generic…'
   279                  linux   /boot/vmlinuz-5.4.0-47-generic root=UUID=3a99e146-f457-46a6-8726-e075a86b9b9a ro recovery nomodeset dis_ucode_ldr 
   280                  echo    'Chargement du disque mémoire initial…'
   281                  initrd  /boot/initrd.img-5.4.0-47-generic
   282  }
   283  }
   284  ### END /etc/grub.d/46_linux_proxy ###
   285
   286  ### BEGIN /etc/grub.d/47_linux_proxy ###
   287  ### END /etc/grub.d/47_linux_proxy ###
   288
   289  ### BEGIN /etc/grub.d/48_linux_zfs ###
   290  ### END /etc/grub.d/48_linux_zfs ###
   291
   292  ### BEGIN /etc/grub.d/49_linux_xen ###
   293
   294  ### END /etc/grub.d/49_linux_xen ###
   295
   296  ### BEGIN /etc/grub.d/50_os-prober_proxy ###
   297
   298
   299
   300
   301
   302
   303  set timeout_style=menu
   304  if [ "${timeout}" = 0 ]; then
   305    set timeout=10
   306  fi
   307  submenu "Options avancées pour Ubuntu 16.04.6 LTS (16.04) (sur /dev/sda4)"{
   308  menuentry "Ubuntu (sur /dev/sda4)" --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-4.15.0-76-generic--d4af8b02-b68c-4127-a189-f82977775f64' {
   309                  insmod part_msdos
   310                  insmod ext2
   311                  set root='hd0,msdos4'
   312                  if [ x$feature_platform_search_hint = xy ]; then
   313                    search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4  d4af8b02-b68c-4127-a189-f82977775f64
   314                  else
   315                    search --no-floppy --fs-uuid --set=root d4af8b02-b68c-4127-a189-f82977775f64
   316                  fi
   317                  linux /boot/vmlinuz-4.15.0-76-generic root=UUID=d4af8b02-b68c-4127-a189-f82977775f64 ro quiet splash $vt_handoff
   318                  initrd /boot/initrd.img-4.15.0-76-generic
   319  }
   320  menuentry "Ubuntu, avec Linux 4.15.0-76-generic (sur /dev/sda4)" --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-4.15.0-76-generic--d4af8b02-b68c-4127-a189-f82977775f64' {
   321                  insmod part_msdos
   322                  insmod ext2
   323                  set root='hd0,msdos4'
   324                  if [ x$feature_platform_search_hint = xy ]; then
   325                    search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4  d4af8b02-b68c-4127-a189-f82977775f64
   326                  else
   327                    search --no-floppy --fs-uuid --set=root d4af8b02-b68c-4127-a189-f82977775f64
   328                  fi
   329                  linux /boot/vmlinuz-4.15.0-76-generic root=UUID=d4af8b02-b68c-4127-a189-f82977775f64 ro quiet splash $vt_handoff
   330                  initrd /boot/initrd.img-4.15.0-76-generic
   331  }
   332  menuentry "Ubuntu, with Linux 4.15.0-76-generic (recovery mode) (sur /dev/sda4)" --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-4.15.0-76-generic-root=UUID=d4af8b02-b68c-4127-a189-f82977775f64 ro recovery nomodeset-d4af8b02-b68c-4127-a189-f82977775f64' {
   333                  insmod part_msdos
   334                  insmod ext2
   335                  set root='hd0,msdos4'
   336                  if [ x$feature_platform_search_hint = xy ]; then
   337                    search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4  d4af8b02-b68c-4127-a189-f82977775f64
   338                  else
   339                    search --no-floppy --fs-uuid --set=root d4af8b02-b68c-4127-a189-f82977775f64
   340                  fi
   341                  linux /boot/vmlinuz-4.15.0-76-generic root=UUID=d4af8b02-b68c-4127-a189-f82977775f64 ro recovery nomodeset
   342                  initrd /boot/initrd.img-4.15.0-76-generic
   343  }
   344  menuentry "Ubuntu, avec Linux 4.15.0-74-generic (sur /dev/sda4)" --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-4.15.0-74-generic--d4af8b02-b68c-4127-a189-f82977775f64' {
   345                  insmod part_msdos
   346                  insmod ext2
   347                  set root='hd0,msdos4'
   348                  if [ x$feature_platform_search_hint = xy ]; then
   349                    search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4  d4af8b02-b68c-4127-a189-f82977775f64
   350                  else
   351                    search --no-floppy --fs-uuid --set=root d4af8b02-b68c-4127-a189-f82977775f64
   352                  fi
   353                  linux /boot/vmlinuz-4.15.0-74-generic root=UUID=d4af8b02-b68c-4127-a189-f82977775f64 ro quiet splash $vt_handoff
   354                  initrd /boot/initrd.img-4.15.0-74-generic
   355  }
   356  menuentry "Ubuntu, with Linux 4.15.0-74-generic (recovery mode) (sur /dev/sda4)" --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-/boot/vmlinuz-4.15.0-74-generic-root=UUID=d4af8b02-b68c-4127-a189-f82977775f64 ro recovery nomodeset-d4af8b02-b68c-4127-a189-f82977775f64' {
   357                  insmod part_msdos
   358                  insmod ext2
   359                  set root='hd0,msdos4'
   360                  if [ x$feature_platform_search_hint = xy ]; then
   361                    search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos4 --hint-efi=hd0,msdos4 --hint-baremetal=ahci0,msdos4  d4af8b02-b68c-4127-a189-f82977775f64
   362                  else
   363                    search --no-floppy --fs-uuid --set=root d4af8b02-b68c-4127-a189-f82977775f64
   364                  fi
   365                  linux /boot/vmlinuz-4.15.0-74-generic root=UUID=d4af8b02-b68c-4127-a189-f82977775f64 ro recovery nomodeset
   366                  initrd /boot/initrd.img-4.15.0-74-generic
   367  }
   368  }
   369  ### END /etc/grub.d/50_os-prober_proxy ###
   370
   371  ### BEGIN /etc/grub.d/51_uefi-firmware ###
   372  ### END /etc/grub.d/51_uefi-firmware ###
   373
   374  ### BEGIN /etc/grub.d/52_custom_proxy ###
   375
   376  # This file provides an easy way to add custom menu entries.  Simply type the
   377  # menu entries you want to add after this comment.  Be careful not to change
   378  # the 'exec tail' line above.
   379
   380  ### END /etc/grub.d/52_custom_proxy ###
   381
   382  ### BEGIN /etc/grub.d/53_custom ###
   383  if [ -f  ${config_directory}/custom.cfg ]; then
   384    source ${config_directory}/custom.cfg
   385  elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
   386    source $prefix/custom.cfg;
   387  fi
   388  ### END /etc/grub.d/53_custom ###

Hors ligne

#10 Le 20/10/2020, à 17:06

malbo

Re : [Résolu] Problème avec Grub et Apt

Je voudrais vérifier quelques points. Je te prie de faire un Boot-info et de donner l'URL de ce Boot-info dans ta réponse.

Hors ligne

#11 Le 20/10/2020, à 17:07

nany

Re : [Résolu] Problème avec Grub et Apt

OK, c’est donc dans /etc/grub.d que grub-customizer a mis le bazar.

Donne le retour de :

ls -lR /etc/grub.d

Hors ligne

#12 Le 20/10/2020, à 17:10

Dezta

Re : [Résolu] Problème avec Grub et Apt

Merci du coup de main, malbo
Malheuresement, impossible de l'installer hmm

sudo apt install -y boot-info && boot-info
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances       
Lecture des informations d'état... Fait
Les paquets suivants ont été installés automatiquement et ne sont plus nécessaires :
  libllvm9 libqt5opengl5 qtgstreamer-plugins-qt5
Veuillez utiliser « sudo apt autoremove » pour les supprimer.
Les paquets supplémentaires suivants seront installés : 
  boot-sav boot-sav-extra glade2script glade2script-python3
Paquets suggérés :
  boot-repair mdadm os-uninstaller gir1.2-appindicator3-0.1
Les paquets suivants seront ENLEVÉS :
  linux-image-5.4.0-26-generic
Les NOUVEAUX paquets suivants seront installés :
  boot-info boot-sav boot-sav-extra glade2script glade2script-python3
0 mis à jour, 5 nouvellement installés, 1 à enlever et 34 non mis à jour.
2 partiellement installés ou enlevés.
Il est nécessaire de prendre 632 ko dans les archives.
Après cette opération, 8724 ko d'espace disque seront libérés.
Réception de :1 http://ppa.launchpad.net/yannubuntu/boot-repair/ubuntu focal/main amd64 glade2script-python3 all 3.2.4~ppa23 [35,9 kB]
Réception de :2 http://ppa.launchpad.net/yannubuntu/boot-repair/ubuntu focal/main amd64 glade2script all 3.2.4~ppa23 [2204 B]
Réception de :3 http://ppa.launchpad.net/yannubuntu/boot-repair/ubuntu focal/main amd64 boot-sav all 4ppa125 [443 kB]
Réception de :4 http://ppa.launchpad.net/yannubuntu/boot-repair/ubuntu focal/main amd64 boot-info all 4ppa125 [7104 B]
Réception de :5 http://ppa.launchpad.net/yannubuntu/boot-repair/ubuntu focal/main amd64 boot-sav-extra all 4ppa125 [143 kB]
632 ko réceptionnés en 1s (479 ko/s)      
(Lecture de la base de données... 309332 fichiers et répertoires déjà installés.)
Suppression de linux-image-5.4.0-26-generic (5.4.0-26.30) ...
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-5.4.0-26-generic
/etc/kernel/postrm.d/zz-update-grub:
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Création du fichier de configuration GRUB…
Image Linux trouvée : /boot/vmlinuz-5.4.0-48-generic
Image mémoire initiale trouvée : /boot/initrd.img-5.4.0-48-generic
Image Linux trouvée : /boot/vmlinuz-5.4.0-47-generic
Image mémoire initiale trouvée : /boot/initrd.img-5.4.0-47-generic
Image Linux trouvée : /boot/vmlinuz-5.4.0-48-generic
Image mémoire initiale trouvée : /boot/initrd.img-5.4.0-48-generic
Image Linux trouvée : /boot/vmlinuz-5.4.0-47-generic
Image mémoire initiale trouvée : /boot/initrd.img-5.4.0-47-generic
Windows 7 trouvé sur /dev/sda1
Windows 7 trouvé sur /dev/sda2
Ubuntu 16.04.6 LTS (16.04) trouvé sur /dev/sda4
Image Linux trouvée : /boot/vmlinuz-5.4.0-48-generic
Image mémoire initiale trouvée : /boot/initrd.img-5.4.0-48-generic
Image Linux trouvée : /boot/vmlinuz-5.4.0-47-generic
Image mémoire initiale trouvée : /boot/initrd.img-5.4.0-47-generic
Image Linux trouvée : /boot/vmlinuz-5.4.0-48-generic
Image mémoire initiale trouvée : /boot/initrd.img-5.4.0-48-generic
Image Linux trouvée : /boot/vmlinuz-5.4.0-47-generic
Image mémoire initiale trouvée : /boot/initrd.img-5.4.0-47-generic
Windows 7 trouvé sur /dev/sda1
Windows 7 trouvé sur /dev/sda2
Ubuntu 16.04.6 LTS (16.04) trouvé sur /dev/sda4
erreur : syntax error.
erreur : Incorrect command.
erreur : syntax error.
Erreur de syntaxe à la ligne 177
Des erreurs de syntaxe sont détectées dans le fichier de configuration
de GRUB. Veuillez vérifier qu'il n'y a pas d'erreur dans les fichiers
/etc/default/grub et /etc/grub.d/*. Sinon veuillez signaler un bogue
en joignant le fichier /boot/grub/grub.cfg.new.
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 1
dpkg: erreur de traitement du paquet linux-image-5.4.0-26-generic (--remove) :
 installed linux-image-5.4.0-26-generic package post-removal script subprocess returned error exit status 1
dpkg: trop d'erreurs, arrêt
Des erreurs ont été rencontrées pendant l'exécution :
 linux-image-5.4.0-26-generic
L'exécution a été arrêtée car il y avait trop d'erreurs.
E: Sub-process /usr/bin/dpkg returned an error code (1)

Hors ligne

#13 Le 20/10/2020, à 17:11

ylag

Re : [Résolu] Problème avec Grub et Apt

Bonjour,

Vu au #9:

 174
   175  ### BEGIN /etc/grub.d/42_custom_proxy ###
   176  menuentry "Ubuntu 20.04 LTS" --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-3a99e146-f457-46a6-8726-e075a86b9b9a' {
   177  }
   178  ### END /etc/grub.d/42_custom_proxy ###
   179

Le fautif serait le fichier /etc/grub.d/42_custom_proxy ?
Ça semble être une configuration rajoutée ?

A+

Hors ligne

#14 Le 20/10/2020, à 17:13

Qid

Re : [Résolu] Problème avec Grub et Apt

par la force des choses : faudrait le faire en live mais je n'en vois pas l'interet au final :
on a assez d'élément pour creuser... et d'ailleurs on aurait pas une solution radical : supprimer la totalité de la conf de grub et la réinitialiser avec un reconfigure ou un reinstall ?


"GNU/Linux c'est que du bon mais M$ Windows ce n'est pas si mal"
Référent technique Ubuntu d'un Groupe d'Utilisateur du Libre
plus d'info sur mon profil

Hors ligne

#15 Le 20/10/2020, à 17:13

Dezta

Re : [Résolu] Problème avec Grub et Apt

 ls -lR /etc/grub.d
/etc/grub.d:
total 140
-rwxr-xr-x 1 root root 10627 avril 15  2020 00_header
-rwxr-xr-x 1 root root  6258 avril 15  2020 05_debian_theme
-rwxr-xr-x 1 root root   702 sept. 20 20:36 10_linux_proxy
-rwxr-xr-x 1 root root   175 sept. 20 20:36 40_custom_proxy
-rwxr-xr-x 1 root root   702 sept. 20 20:36 41_linux_proxy
-rwxr-xr-x 1 root root   175 sept. 20 20:36 42_custom_proxy
-rwxr-xr-x 1 root root  1281 sept. 20 20:36 45_os-prober_proxy
-rwxr-xr-x 1 root root   702 sept. 20 20:36 46_linux_proxy
-rwxr-xr-x 1 root root   702 sept. 20 20:36 47_linux_proxy
-rwxr-xr-x 1 root root 42359 sept.  8 12:24 48_linux_zfs
-rwxr-xr-x 1 root root 12894 avril 15  2020 49_linux_xen
-rwxr-xr-x 1 root root  1285 sept. 20 20:36 50_os-prober_proxy
-rwxr-xr-x 1 root root  1424 avril 15  2020 51_uefi-firmware
-rwxr-xr-x 1 root root   223 sept. 20 20:36 52_custom_proxy
-rwxr-xr-x 1 root root   216 avril 15  2020 53_custom
drwxr-xr-x 4 root root  4096 sept. 20 20:36 backup
drwxr-xr-x 2 root root  4096 sept. 20 20:36 bin
drwxr-xr-x 2 root root  4096 sept. 20 20:36 proxifiedScripts
-rw-r--r-- 1 root root   483 avril 15  2020 README

/etc/grub.d/backup:
total 16
drwxr-xr-x 3 root root 4096 sept. 20 20:36 boot_grub
-rw-r--r-- 1 root root 1223 sept. 20 20:36 default_grub
drwxr-xr-x 2 root root 4096 sept. 20 20:36 etc_grub_d
-rw-r--r-- 1 root root  519 sept. 20 20:36 RESTORE_INSTRUCTIONS

/etc/grub.d/backup/boot_grub:
total 2368
-rw-r--r-- 1 root root     712 sept. 20 20:36 gfxblacklist.txt
-rw-r--r-- 1 root root   15733 sept. 20 20:36 grub.cfg
-rw-r--r-- 1 root root    1024 sept. 20 20:36 grubenv
drwxr-xr-x 3 root root    4096 sept. 20 20:36 themes
-rw-r--r-- 1 root root 2395475 sept. 20 20:36 unicode.pf2

/etc/grub.d/backup/boot_grub/themes:
total 4
drwxr-xr-x 2 root root 4096 sept. 20 20:36 ubuntustudio

/etc/grub.d/backup/boot_grub/themes/ubuntustudio:
total 56
-rw-r--r-- 1 root root  333 sept. 20 20:36 highlight_c.png
-rw-r--r-- 1 root root 2047 sept. 20 20:36 highlight_w.png
-rw-r--r-- 1 root root   76 sept. 20 20:36 menu_frame_c.png
-rw-r--r-- 1 root root   84 sept. 20 20:36 menu_frame_e.png
-rw-r--r-- 1 root root 2816 sept. 20 20:36 menu_frame_ne.png
-rw-r--r-- 1 root root   92 sept. 20 20:36 menu_frame_n.png
-rw-r--r-- 1 root root 2828 sept. 20 20:36 menu_frame_nw.png
-rw-r--r-- 1 root root 2821 sept. 20 20:36 menu_frame_se.png
-rw-r--r-- 1 root root  101 sept. 20 20:36 menu_frame_s.png
-rw-r--r-- 1 root root 2790 sept. 20 20:36 menu_frame_sw.png
-rw-r--r-- 1 root root   86 sept. 20 20:36 menu_frame_w.png
-rw-r--r-- 1 root root   82 sept. 20 20:36 progress_frame_c.png
-rw-r--r-- 1 root root   76 sept. 20 20:36 progress_highlight_c.png
-rw-r--r-- 1 root root 2204 sept. 20 20:36 theme.txt

/etc/grub.d/backup/etc_grub_d:
total 132
-rw-r--r-- 1 root root 10627 sept. 20 20:36 00_header
-rw-r--r-- 1 root root  6258 sept. 20 20:36 05_debian_theme
-rw-r--r-- 1 root root 17622 sept. 20 20:36 10_linux
-rw-r--r-- 1 root root 42359 sept. 20 20:36 10_linux_zfs
-rw-r--r-- 1 root root 12894 sept. 20 20:36 20_linux_xen
-rw-r--r-- 1 root root  1992 sept. 20 20:36 20_memtest86+
-rw-r--r-- 1 root root 12059 sept. 20 20:36 30_os-prober
-rw-r--r-- 1 root root  1424 sept. 20 20:36 30_uefi-firmware
-rw-r--r-- 1 root root   214 sept. 20 20:36 40_custom
-rw-r--r-- 1 root root   216 sept. 20 20:36 41_custom
-rw-r--r-- 1 root root   483 sept. 20 20:36 README

/etc/grub.d/bin:
total 136
-rwxr-xr-x 1 root root 137704 sept. 20 20:36 grubcfg_proxy

/etc/grub.d/proxifiedScripts:
total 40
-rwxr-xr-x 1 root root   380 sept. 20 20:36 custom
-rwxr-xr-x 1 root root 17622 sept.  8 12:24 linux
-rwxr-xr-x 1 root root  1992 févr. 14  2020 memtest86+
-rwxr-xr-x 1 root root 12059 avril 15  2020 os-prober

@nany

@Qid C'est la solution que je préférerais je crois : pourquoi passé du temps a débugger des fichiers créer qui ont été créer automatiquement, quand on peut les recreer wink ?

Dernière modification par Dezta (Le 20/10/2020, à 17:14)

Hors ligne

#16 Le 20/10/2020, à 17:15

Qid

Re : [Résolu] Problème avec Grub et Apt

hum ! je vois qu'on a un dossier de backup avec des instructions de restauration
ça pourrait être intéressant de les regarder avant de tenter la méthode brute que j'ai proposé dans mon poste précédent


"GNU/Linux c'est que du bon mais M$ Windows ce n'est pas si mal"
Référent technique Ubuntu d'un Groupe d'Utilisateur du Libre
plus d'info sur mon profil

Hors ligne

#17 Le 20/10/2020, à 17:16

Qid

Re : [Résolu] Problème avec Grub et Apt

Dezta a écrit :

@Qid C'est la solution que je préférerais je crois : pourquoi passé du temps a débugger des fichiers créer qui ont été créer automatiquement, quand on peut les recreer wink ?

c'est quand même contre-pédagogique wink


"GNU/Linux c'est que du bon mais M$ Windows ce n'est pas si mal"
Référent technique Ubuntu d'un Groupe d'Utilisateur du Libre
plus d'info sur mon profil

Hors ligne

#18 Le 20/10/2020, à 17:23

Dezta

Re : [Résolu] Problème avec Grub et Apt

Bonne nouvelle encore : j'ai pu reboot sur ma partition en 16.04 et y faire le boot-info smile
voici le resultat :

   
boot-info-4ppa125                                              [20201020_1718]

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

 => Grub2 (v2.00) is installed in the MBR of /dev/sda and looks at sector 1 of 
    the same hard drive for core.img. core.img is at this location and looks 
    for (,msdos5)/boot/grub. It also embeds following components:
    
    modules
    ---------------------------------------------------------------------------
    fshelp ext2 part_msdos biosdisk
    ---------------------------------------------------------------------------

sda1: __________________________________________________________________________

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

sda2: __________________________________________________________________________

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

sda3: __________________________________________________________________________

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

sda5: __________________________________________________________________________

    File system:       ext4
    Boot sector type:  -
    Boot sector info: 
    Operating System:  Ubuntu 20.04.1 LTS
    Boot files:        /boot/grub/grub.cfg /etc/fstab /etc/default/grub 
                       /boot/grub/i386-pc/core.img

sda4: __________________________________________________________________________

    File system:       ext4
    Boot sector type:  -
    Boot sector info: 
    Operating System:  Ubuntu 16.04.6 LTS
    Boot files:        /boot/grub/grub.cfg /etc/fstab /etc/default/grub 
                       /boot/grub/i386-pc/core.img


================================ 4 OS detected =================================

OS#1:   L'OS actuellement utilisé - Ubuntu 16.04.6 LTS CurrentSession on sda4
OS#2:   Windows 7 (loader) (boot) on sda1
OS#3:   Windows 7 (loader) on sda2
OS#4:   Ubuntu 20.04.1 LTS on sda5

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

CPU architecture: 64-bit
BOOT_IMAGE of the installed session in use:
/boot/vmlinuz-4.15.0-76-generic root=UUID=d4af8b02-b68c-4127-a189-f82977775f64 ro quiet splash


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

This installed-session is not in EFI-mode.



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

Disks info: ____________________________________________________________________

sda	: notGPT,	no-BIOSboot,	has-noESP, 	not-usb,	not-mmc, has-os,	2048 sectors * 512 bytes

Partitions info (1/3): _________________________________________________________

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

Partitions info (2/3): _________________________________________________________

sda4	: isnotESP,	fstab-without-efi,	no-nt,	no-winload,	no-recov-nor-hid,	no-bmgr,	notwinboot
sda1	: isnotESP,	part-has-no-fstab,	no-nt,	no-winload,	no-recov-nor-hid,	bootmgr,	is-winboot
sda2	: isnotESP,	part-has-no-fstab,	no-nt,	haswinload,	no-recov-nor-hid,	bootmgr,	is-winboot
sda5	: isnotESP,	fstab-without-efi,	no-nt,	no-winload,	no-recov-nor-hid,	no-bmgr,	notwinboot

Partitions info (3/3): _________________________________________________________

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

fdisk -l (filtered): ___________________________________________________________

Disk sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Disk identifier: 0x4bad045c
      Boot      Start        End    Sectors   Size Id Type
sda1  *          2048     206847     204800   100M  7 HPFS/NTFS/exFAT
sda2           206848 1643401215 1643194368 783.5G  7 HPFS/NTFS/exFAT
sda3       1643401216 1854828543  211427328 100.8G  5 Extended
sda4       1854828544 1936748543   81920000  39.1G 83 Linux
sda5       1643403264 1854828543  211425280 100.8G 83 Linux
Partition table entries are not in disk order.

parted -lm (filtered): _________________________________________________________

sda:1000GB:scsi:512:512:msdos:ATA Samsung SSD 860:;
1:1049kB:106MB:105MB:ntfs::boot;
2:106MB:841GB:841GB:ntfs::;
3:841GB:950GB:108GB:::;
5:841GB:950GB:108GB:ext4::;
4:950GB:992GB:41.9GB:ext4::;

blkid (filtered): ______________________________________________________________

NAME   FSTYPE   UUID                                 PARTUUID                             LABEL              PARTLABEL
sda                                                                                                          
├─sda4 ext4     d4af8b02-b68c-4127-a189-f82977775f64 4bad045c-04                                             
├─sda2 ntfs     A4C667F8C667C95E                     4bad045c-02                                             
├─sda5 ext4     3a99e146-f457-46a6-8726-e075a86b9b9a 4bad045c-05                                             
├─sda3                                               4bad045c-03                                             
└─sda1 ntfs     4084667D846674F6                     4bad045c-01                          Réservé au système 

df (filtered): _________________________________________________________________

        Avail Use% Mounted on
sda1    75.7M  24% /mnt/boot-sav/sda1
sda2   428.5G  45% /mnt/boot-sav/sda2
sda4     5.2G  81% /
sda5    81.2G  13% /mnt/boot-sav/sda5

Mount options: __________________________________________________________________

sda1   rw,relatime,user_id=0,group_id=0,allow_other,blksize=4096
sda2   rw,relatime,user_id=0,group_id=0,allow_other,blksize=4096
sda4   rw,relatime,errors=remount-ro,data=ordered
sda5   rw,relatime,data=ordered

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

Ubuntu   3a99e146-f457-46a6-8726-e075a86b9b9a
Ubuntu, avec Linux 5.4.0-47-generic   3a99e146-f457-46a6-8726-e075a86b9b9a
Ubuntu, avec Linux 5.4.0-26-generic   3a99e146-f457-46a6-8726-e075a86b9b9a
Windows 7 (sur sda1)   4084667D846674F6
Windows 7 (sur sda2)   A4C667F8C667C95E
Ubuntu 16.04.6 LTS (16.04) (sur sda4)   d4af8b02-b68c-4127-a189-f82977775f64
Ubuntu (sur sda4)   d4af8b02-b68c-4127-a189-f82977775f64
Ubuntu, avec Linux 4.15.0-76-generic (sur sda4)   d4af8b02-b68c-4127-a189-f82977775f64
Ubuntu, avec Linux 4.15.0-74-generic (sur sda4)   d4af8b02-b68c-4127-a189-f82977775f64
### END /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_uefi-firmware ###

========================== sda5/etc/fstab (filtered) ===========================

rien a voir ici ! 

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

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

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

           GiB - GB             File                                 Fragment(s)
 867.773624420 = 931.764834304  boot/grub/grub.cfg                             3
 867.944965363 = 931.948810240  boot/grub/i386-pc/core.img                     1
 788.482555389 = 846.626697216  boot/vmlinuz                                   1
 787.162235260 = 845.209014272  boot/vmlinuz-5.4.0-47-generic                  1
 788.482555389 = 846.626697216  boot/vmlinuz-5.4.0-48-generic                  1
 787.162235260 = 845.209014272  boot/vmlinuz.old                               1
 792.362300873 = 850.792542208  boot/initrd.img                                5
 787.962543488 = 846.068338688  boot/initrd.img-5.4.0-47-generic               2
 792.362300873 = 850.792542208  boot/initrd.img-5.4.0-48-generic               5
 787.962543488 = 846.068338688  boot/initrd.img.old                            2

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

-rwxr-xr-x 1 root root   702 sept. 20 20:36 10_linux_proxy
-rwxr-xr-x 1 root root   175 sept. 20 20:36 40_custom_proxy
-rwxr-xr-x 1 root root   702 sept. 20 20:36 41_linux_proxy
-rwxr-xr-x 1 root root   175 sept. 20 20:36 42_custom_proxy
-rwxr-xr-x 1 root root  1281 sept. 20 20:36 45_os-prober_proxy
-rwxr-xr-x 1 root root   702 sept. 20 20:36 46_linux_proxy
-rwxr-xr-x 1 root root   702 sept. 20 20:36 47_linux_proxy
-rwxr-xr-x 1 root root 42359 sept.  8 12:24 48_linux_zfs
-rwxr-xr-x 1 root root 12894 avril 15  2020 49_linux_xen
-rwxr-xr-x 1 root root  1285 sept. 20 20:36 50_os-prober_proxy
-rwxr-xr-x 1 root root  1424 avril 15  2020 51_uefi-firmware
-rwxr-xr-x 1 root root   223 sept. 20 20:36 52_custom_proxy
-rwxr-xr-x 1 root root   216 avril 15  2020 53_custom
drwxr-xr-x 4 root root  4096 sept. 20 20:36 backup
drwxr-xr-x 2 root root  4096 sept. 20 20:36 bin
drwxr-xr-x 2 root root  4096 sept. 20 20:36 proxifiedScripts

======================= sda5/etc/grub.d/40_custom_proxy ========================

#!/bin/sh
#THIS IS A GRUB PROXY SCRIPT
'/etc/grub.d/proxifiedScripts/custom' | /etc/grub.d/bin/grubcfg_proxy "-*
-'Ubuntu 20.04 LTS'~5e732a1878be2342dbfeff5fe3ca5aa3~
-#text
"

======================== sda5/etc/grub.d/41_linux_proxy ========================

#!/bin/sh
#THIS IS A GRUB PROXY SCRIPT
'/etc/grub.d/proxifiedScripts/linux' | /etc/grub.d/bin/grubcfg_proxy "-'SUBMENU' as 'Options avancées pour Ubuntu'{-'Options avancées pour Ubuntu'/*, -'Options avancées pour Ubuntu'/'Ubuntu, avec Linux 5.4.0-47-generic'~163285687faa8b1fc63b966b273945f4~, -'Options avancées pour Ubuntu'/'Ubuntu, avec Linux 5.4.0-47-generic (recovery mode)'~e7a9395faaedbb6e302862f04b3f6d27~, -'Options avancées pour Ubuntu'/'Ubuntu, avec Linux 5.4.0-26-generic'~bf58d4de97a0462833fa5bf088e16d95~, -'Options avancées pour Ubuntu'/'Ubuntu, avec Linux 5.4.0-26-generic (recovery mode)'~ef335c88377d28691a7056dec357891a~}
-*
-#text
-'Ubuntu'~2dbcfd07f1d3fc42609ed34106242d80~
"

======================= sda5/etc/grub.d/42_custom_proxy ========================

#!/bin/sh
#THIS IS A GRUB PROXY SCRIPT
'/etc/grub.d/proxifiedScripts/custom' | /etc/grub.d/bin/grubcfg_proxy "-#text
+*
+'Ubuntu 20.04 LTS'~5e732a1878be2342dbfeff5fe3ca5aa3~
"

====================== sda5/etc/grub.d/45_os-prober_proxy ======================

#!/bin/sh
#THIS IS A GRUB PROXY SCRIPT
'/etc/grub.d/proxifiedScripts/os-prober' | /etc/grub.d/bin/grubcfg_proxy "+'Windows 7 (sur /dev/sda2)'~7f261b655eb49bd18834f7ddb1b055f0~
+'Ubuntu 16.04.6 LTS (16.04) (sur /dev/sda4)'~9b55e0102ce834da50eb4af16b26e053~
-*
-#text
-'Windows 7 (sur /dev/sda1)'~277e3733d6c745e82b12dfd2f414233b~
-'SUBMENU' as 'Options avancées pour Ubuntu 16.04.6 LTS (16.04) (sur /dev/sda4)'{-'Options avancées pour Ubuntu 16.04.6 LTS (16.04) (sur /dev/sda4)'/*, -'Options avancées pour Ubuntu 16.04.6 LTS (16.04) (sur /dev/sda4)'/'Ubuntu (sur /dev/sda4)'~21efdfd58be5ae083609c81dffed73d3~, -'Options avancées pour Ubuntu 16.04.6 LTS (16.04) (sur /dev/sda4)'/'Ubuntu, avec Linux 4.15.0-76-generic (sur /dev/sda4)'~21efdfd58be5ae083609c81dffed73d3~, -'Options avancées pour Ubuntu 16.04.6 LTS (16.04) (sur /dev/sda4)'/'Ubuntu, with Linux 4.15.0-76-generic (recovery mode) (sur /dev/sda4)'~6d51d0bec50e7439c5fbf65fe20ab6dd~, -'Options avancées pour Ubuntu 16.04.6 LTS (16.04) (sur /dev/sda4)'/'Ubuntu, avec Linux 4.15.0-74-generic (sur /dev/sda4)'~8bb3ada67d106299b2c76613815474d6~, -'Options avancées pour Ubuntu 16.04.6 LTS (16.04) (sur /dev/sda4)'/'Ubuntu, with Linux 4.15.0-74-generic (recovery mode) (sur /dev/sda4)'~80cda67e2181259243dbb9cae3323b31~}
"

======================== sda5/etc/grub.d/46_linux_proxy ========================

#!/bin/sh
#THIS IS A GRUB PROXY SCRIPT
'/etc/grub.d/proxifiedScripts/linux' | /etc/grub.d/bin/grubcfg_proxy "-*
-#text
-'Ubuntu'~2dbcfd07f1d3fc42609ed34106242d80~
+'SUBMENU' as 'Options avancées pour Ubuntu'{+'Options avancées pour Ubuntu'/*, +'Options avancées pour Ubuntu'/'Ubuntu, avec Linux 5.4.0-47-generic'~163285687faa8b1fc63b966b273945f4~, +'Options avancées pour Ubuntu'/'Ubuntu, avec Linux 5.4.0-47-generic (recovery mode)'~e7a9395faaedbb6e302862f04b3f6d27~, +'Options avancées pour Ubuntu'/'Ubuntu, avec Linux 5.4.0-26-generic'~bf58d4de97a0462833fa5bf088e16d95~, +'Options avancées pour Ubuntu'/'Ubuntu, avec Linux 5.4.0-26-generic (recovery mode)'~ef335c88377d28691a7056dec357891a~}
"

======================== sda5/etc/grub.d/47_linux_proxy ========================

#!/bin/sh
#THIS IS A GRUB PROXY SCRIPT
'/etc/grub.d/proxifiedScripts/linux' | /etc/grub.d/bin/grubcfg_proxy "-*
-#text
-'Ubuntu'~2dbcfd07f1d3fc42609ed34106242d80~
-'SUBMENU' as 'Options avancées pour Ubuntu'{-'Options avancées pour Ubuntu'/*, -'Options avancées pour Ubuntu'/'Ubuntu, avec Linux 5.4.0-47-generic'~163285687faa8b1fc63b966b273945f4~, -'Options avancées pour Ubuntu'/'Ubuntu, avec Linux 5.4.0-47-generic (recovery mode)'~e7a9395faaedbb6e302862f04b3f6d27~, -'Options avancées pour Ubuntu'/'Ubuntu, avec Linux 5.4.0-26-generic'~bf58d4de97a0462833fa5bf088e16d95~, -'Options avancées pour Ubuntu'/'Ubuntu, avec Linux 5.4.0-26-generic (recovery mode)'~ef335c88377d28691a7056dec357891a~}
"

========================= sda5/etc/grub.d/48_linux_zfs =========================

#! /bin/sh
set -e
# grub-mkconfig helper script.
# Copyright (C) 2019 Canonical Ltd.
#
# GRUB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GRUB is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
prefix="/usr"
datarootdir="/usr/share"
ubuntu_recovery="1"
quiet_boot="1"
quick_boot="1"
gfxpayload_dynamic="1"
vt_handoff="1"
. "${pkgdatadir}/grub-mkconfig_lib"
export TEXTDOMAIN=grub
export TEXTDOMAINDIR="${datarootdir}/locale"
set -u
## Skip early if zfs utils isn't installed (instead of failing on first zpool list)
if ! `which zfs >/dev/null 2>&1`; then
    exit 0
fi
imported_pools=""
MNTDIR="$(mktemp -d ${TMPDIR:-/tmp}/zfsmnt.XXXXXX)"
ZFSTMP="$(mktemp -d ${TMPDIR:-/tmp}/zfstmp.XXXXXX)"
machine="$(uname -m)"
case "${machine}" in
    i?86) GENKERNEL_ARCH="x86" ;;
    mips|mips64) GENKERNEL_ARCH="mips" ;;
    mipsel|mips64el) GENKERNEL_ARCH="mipsel" ;;
    arm*) GENKERNEL_ARCH="arm" ;;
    *) GENKERNEL_ARCH="${machine}" ;;
esac
RC=0
on_exit() {
    # Restore initial zpool import state
    for pool in ${imported_pools}; do
        zpool export "${pool}"
    done
    mountpoint -q "${MNTDIR}"  && umount "${MNTDIR}" || true
    rmdir "${MNTDIR}"
    rm -rf "${ZFSTMP}"
    exit "${RC}"
}
trap on_exit EXIT INT QUIT ABRT PIPE TERM
# List ONLINE and DEGRADED pools
import_pools() {
    # We have to ignore zpool import output, as potentially multiple / will be available,
    # and we need to autodetect all zpools this way with their real mountpoints.
    local initial_pools="$(zpool list | awk '{if (NR>1) print $1}')"
    local all_pools=""
    local imported_pools=""
    local err=""
    set +e
    err="$(zpool import -f -a -o cachefile=none -o readonly=on -N 2>&1)"
    # Only print stderr if the command returned an error
    # (it can echo "No zpool to import" with success, which we don't want)
    if [ $? -ne 0 ]; then
        echo "Some pools couldn't be imported and will be ignored:\n${err}" >&2
    fi
    set -e
    all_pools="$(zpool list | awk '{if (NR>1) print $1}')"
    for pool in ${all_pools}; do
        if echo "${initial_pools}" | grep -wq "${pool}"; then
            continue
        fi
        imported_pools="${imported_pools} ${pool}"
    done
    echo "${imported_pools}"
}
# List all the dataset with a root mountpoint
get_root_datasets() {
    local pools="$(zpool list | awk '{if (NR>1) print $1}')"
    for p in ${pools}; do
        local rel_pool_root=$(zpool get -H altroot ${p} | awk '{print $3}')
        if [ "${rel_pool_root}" = "-" ]; then
            rel_pool_root="/"
        fi
        zfs list -H -o name,canmount,mountpoint -t filesystem | grep -E '^'"${p}"'(\s|/[[:print:]]*\s)(on|noauto)\s'"${rel_pool_root}"'$' | awk '{print $1}'
    done
}
# find if given datasets can be mounted for directory and return its path (snapshot or real path)
# $1 is our current dataset name
# $2 directory path we look for (cannot contains /)
# $3 is the temporary mount directory to use
# $4 is the optional snapshot name
# return path for directory (which can be a mountpoint)
validate_system_dataset() {
    local dataset="$1"
    local directory="$2"
    local mntdir="$3"
    local snapshot_name="$4"
    local mount_path="${mntdir}/${directory}"
    if ! zfs list "${dataset}" >/dev/null 2>&1; then
        return
    fi
    if ! mount -o noatime,zfsutil -t zfs "${dataset}" "${mount_path}"; then
        grub_warn "Failed to find a valid directory '${directory}' for dataset '${dataset}@${snapshot_name}'. Ignoring"
        return
    fi
    local candidate_path="${mount_path}"
    if [ -n "${snapshot_name}" ]; then
        # WORKAROUND a bug https://github.com/zfsonlinux/zfs/issues/9958
        # Reading the content of a snapshot fails if it is not the first mount
        # for a given dataset
        first_mntdir=$(awk '{if ($1 == "'${dataset}'") {print $2; exit;}}' /proc/mounts)
        if [ "${first_mntdir}" = "/" ]; then
            # prevents // on candidate_path
            first_mntdir=""
        fi
        candidate_path="${first_mntdir}/.zfs/snapshot/${snapshot_name}"
    fi
    if [ -n "$(ls ${candidate_path} 2>/dev/null)" ]; then
        echo "${candidate_path}"
        return
    else
        mountpoint -q "${mount_path}" && umount "${mount_path}" || true
    fi
}
# Detect system directory relevant to the other, trying to find the ones associated on the current dataset or snapshot/
# System directory should be at most a direct child dataset of main datasets (no recursivity)
# We can fallback trying other zfs pools if no match has been found.
# $1 is our current dataset name (which can have @snapshot name)
# $2 directory path we look for (cannot contains /)
# $3 restrict_to_same_pool (true|false) force looking for dataset with the same basename in the current dataset pool only
# $4 is the temporary mount directory to use
# $5 is the optional etc directory (if not $2 is not etc itself)
# return path for directory (which can be a mountpoint)
get_system_directory() {
    local dataset_path="$1"
    local directory="$2"
    local restrict_to_same_pool="$3"
    local mntdir="$4"
    local etc_dir="$5"
    if [ -z "${etc_dir}" ]; then
        etc_dir="${mntdir}/etc"
    fi
    local candidate_path="${mntdir}/${directory}"
    # 1. Look for /etc/fstab first (which will mount even on top of non empty $directory)
    local mounted_fstab_entry="false"
    if [ -f "${etc_dir}/fstab" ]; then
        mount_args=$(awk '/^[^#].*[ \t]\/'"${directory}"'[ \t]/ {print "-t", $3, $1}' "${etc_dir}/fstab")
        if [ -n "${mount_args}" ]; then
            mounted_fstab_entry="true"
            mount -o noatime ${mount_args} "${candidate_path}" || mounted_fstab_entry="false"
        fi
    fi
    # If directory isn't empty. Only count if coming from /etc/fstab. Will be
    # handled below otherwise as we are interested in potential snapshots.
    if [ "${mounted_fstab_entry}" = "true" -a -n "$(ls ${candidate_path} 2>/dev/null)" ]; then
        echo "${candidate_path}"
        return
    fi
    # 2. Handle zfs case, which can be a snapshots.
    local base_dataset_path="${dataset_path}"
    local snapshot_name=""
    # For snapshots we extract the parent dataset
    if echo "${dataset_path}" | grep -q '@'; then
        base_dataset_path=$(echo "${dataset_path}" | cut -d '@' -f1)
        snapshot_name=$(echo "${dataset_path}" | cut -d '@' -f2)
    fi
    base_dataset_name="${base_dataset_path##*/}"
    base_pool="$(echo "${base_dataset_path}" | cut -d'/' -f1)"
    # 2.a) Look for child dataset included in base dataset, which needs to hold same snapshot if any
    candidate_path=$(validate_system_dataset "${base_dataset_path}/${directory}" "${directory}" "${mntdir}" "${snapshot_name}")
    if [ -n "${candidate_path}" ]; then
        echo "${candidate_path}"
        return
    fi
    # 2.b) Look for current dataset (which is already mounted as /)
    candidate_path="${mntdir}/${directory}"
    if [ -n "${snapshot_name}" ]; then
        # WORKAROUND a bug https://github.com/zfsonlinux/zfs/issues/9958
        # Reading the content of a snapshot fails if it is not the first mount
        # for a given dataset
        first_mntdir=$(awk '{if ($1 == "'${base_dataset_path}'") {print $2; exit;}}' /proc/mounts)
        if [ "${first_mntdir}" = "/" ]; then
            # prevents // on candidate_path
            first_mntdir=""
        fi
        candidate_path="${first_mntdir}/.zfs/snapshot/${snapshot_name}/${directory}"
    fi
    if [ -n "$(ls ${candidate_path} 2>/dev/null)" ]; then
        echo "${candidate_path}"
        return
    fi
    # 2.c) Look for every datasets in every pool which isn't the current dataset which holds:
    # - the same dataset name (last section) than our base_dataset_name
    # - mountpoint=directory
    # - canmount!=off
    all_same_base_dataset_name="$(zfs list -H -t filesystem -o name,canmount | awk '/^[^ ]+\/'"${base_dataset_name}"'[ \t](on|noauto)/ {print $1}') "
    # order by local pool datasets first
    current_pool_same_base_datasets=""
    other_pools_same_base_datasets=""
    root_pool=$(echo "${dataset_path%%/*}")
    for d in ${all_same_base_dataset_name}; do
        cur_dataset_pool=$(echo "${d%%/*}")
        if echo "${cur_dataset_pool}" | grep -wq "${root_pool}" 2>/dev/null ; then
            current_pool_same_base_datasets="${current_pool_same_base_datasets} ${d}"
        else
            other_pools_same_base_datasets="${other_pools_same_base_datasets} ${d}"
        fi
    done
    ordered_same_base_datasets="${current_pool_same_base_datasets} ${other_pools_same_base_datasets}"
    if [ "${restrict_to_same_pool}" = "true" ]; then
        ordered_same_base_datasets="${current_pool_same_base_datasets}"
    fi
    # now, loop over them
    for d in ${ordered_same_base_datasets}; do
        cur_dataset_pool=$(echo "${d%%/*}")
        rel_pool_root=$(zpool get -H altroot ${cur_dataset_pool} | awk '{print $3}')
        if [ "${rel_pool_root}" = "-" ]; then
            rel_pool_root=""
        fi
        # check mountpoint match
        candidate_dataset=$(zfs get -H mountpoint ${d} | grep -E "mountpoint\s${rel_pool_root}/${directory}\s" | awk '{print $1}')
        if [ -z "${candidate_dataset}" ]; then
            continue
        fi
        candidate_path=$(validate_system_dataset "${candidate_dataset}" "${directory}" "${mntdir}" "${snapshot_name}")
        if [ -n "${candidate_path}" ]; then
            echo "${candidate_path}"
            return
        fi
    done
    # 2.d) If we didn't find anything yet: check for persistent datasets corresponding to our mountpoint, with canmount=on without any snapshot associated:
    # Note: we go over previous datasets as well, but this is ok, as we didn't include them before.
    all_mountable_datasets="$(zfs list -t filesystem -o name,canmount | awk  '/^[^ ]+[ \t]+on/ {print $1}')"
    # order by local pool datasets first
    current_pool_datasets=""
    other_pools_datasets=""
    root_pool=$(echo "${dataset_path%%/*}")
    for d in ${all_mountable_datasets}; do
        cur_dataset_pool=$(echo "${d%%/*}")
        if echo "${cur_dataset_pool}" | grep -wq "${root_pool}" 2>/dev/null ; then
            current_pool_datasets="${current_pool_datasets} ${d}"
        else
            other_pools_datasets="${other_pools_datasets} ${d}"
        fi
    done
    ordered_datasets="${current_pool_datasets} ${other_pools_datasets}"
    if [ "${restrict_to_same_pool}" = "true" ]; then
        ordered_datasets="${current_pool_datasets}"
    fi
    for d in ${ordered_datasets}; do
        cur_dataset_pool=$(echo "${d%%/*}")
        rel_pool_root=$(zpool get -H altroot ${cur_dataset_pool} | awk '{print $3}')
        if [ "${rel_pool_root}" = "-" ]; then
            rel_pool_root=""
        fi
        # check mountpoint match
        candidate_dataset=$(zfs get -H mountpoint ${d} | grep -E "mountpoint\s${rel_pool_root}/${directory}\s" | awk '{print $1}')
        if [ -z "${candidate_dataset}" ]; then
            continue
        fi
        candidate_path=$(validate_system_dataset "${d}" "${directory}" "${mntdir}" "")
        if [ -n "${candidate_path}" ]; then
            echo "${candidate_path}"
            return
        fi
    done
    grub_warn "Failed to find a valid directory '${directory}' for dataset '${dataset_path}'. Ignoring"
    return
}
# Try our default layout bpool as a prefered layout (fast path)
# This is get_system_directory for boot optimized for our default installation layout
# $1 is our current dataset name (which can have @snapshot name)
# $2 is the temporary mount directory to use
# return path for directory (which can be a mountpoint) if found
try_default_layout_bpool() {
    local root_dataset_path="$1"
    local mntdir="$2"
    dataset_basename="${root_dataset_path##*/}"
    candidate_dataset="bpool/BOOT/${dataset_basename}"
    dataset_properties="$(zfs get -H mountpoint,canmount ${candidate_dataset} | cut -f3 | paste -sd ' ')"
    if [ -z "${dataset_properties}" ]; then
        return
    fi
    rel_pool_root=$(zpool get -H altroot bpool | awk '{print $3}')
    if [ "${rel_pool_root}" = "-" ]; then
        rel_pool_root=""
    fi
    snapshot_name="${dataset_basename##*@}"
    [ "${snapshot_name}" = "${dataset_basename}" ] && snapshot_name=""
    if [ -z "${snapshot_name}" ]; then
        if ! echo "${dataset_properties}" | grep -Eq "${rel_pool_root}/boot (on|noauto)"; then
            return
        fi
    else
        candidate_dataset=$(echo "${candidate_dataset}" | cut -d '@' -f1)
    fi
    validate_system_dataset "${candidate_dataset}" "boot" "${mntdir}" "${snapshot_name}"
}
# Return if secure boot is enabled on that system
is_secure_boot_enabled() {
    if LANG=C mokutil --sb-state 2>/dev/null | grep -qi enabled; then
        echo "true"
        return
    fi
    echo "false"
    return
}
# Given a filesystem or snapshot dataset, returns dataset|machine id|pretty name|last used
# $1 is dataset we want information from
# $2 is the temporary mount directory to use
get_dataset_info() {
    local dataset="$1"
    local mntdir="$2"
    local base_dataset="${dataset}"
    local etc_dir="${mntdir}/etc"
    local is_snapshot="false"
    # For snapshot we extract the parent dataset
    if echo "${dataset}" | grep -q '@'; then
        base_dataset=$(echo "${dataset}" | cut -d '@' -f1)
        is_snapshot="true"
    fi
    mount -o noatime,zfsutil -t zfs "${base_dataset}" "${mntdir}"
    # read machine-id/os-release from /etc
    etc_dir=$(get_system_directory "${dataset}" "etc" "true" "${mntdir}" "")
    if [ -z  "${etc_dir}" ]; then
        grub_warn "Ignoring ${dataset}"
        mountpoint -q "${mntdir}/etc" && umount "${mntdir}/etc" || true
        umount "${mntdir}"
        return
    fi
    machine_id=""
    if [ -f "${etc_dir}/machine-id" ]; then
        machine_id=$(cat "${etc_dir}/machine-id")
    fi
    # We have to use a random temporary id if we don't have any machine-id file or if this one is empty
    # (mostly the case of new installations before first boot).
    # Let's use the dataset name directly for this.
    # Consequence is that all datasets are then separated.
    if [ -z "${machine_id}" ]; then
        machine_id="${dataset}"
    fi
    pretty_name=$(. "${etc_dir}/os-release" && echo "${PRETTY_NAME}")
    mountpoint -q "${mntdir}/etc" && umount "${mntdir}/etc" || true
    # read available kernels from /boot
    boot_dir="$(try_default_layout_bpool "${dataset}" "${mntdir}")"
    if [ -z "${boot_dir}" ]; then
        boot_dir=$(get_system_directory "${dataset}" "boot" "false" "${mntdir}" "${etc_dir}")
    fi
    if [ -z  "${boot_dir}" ]; then
        grub_warn "Ignoring ${dataset}"
        mountpoint -q "${mntdir}/boot" && umount "${mntdir}/boot" || true
        umount "${mntdir}"
        return
    fi
    initrd_list=""
    kernel_list=""
    list=$(find "${boot_dir}" -maxdepth 1 -type f -regex '.*/\(vmlinuz\|vmlinux\|kernel\)-.*')
    while [ "x$list" != "x" ] ; do
        linux=`version_find_latest $list`
        list=`echo $list | tr ' ' '\n' | fgrep -vx "$linux" | tr '\n' ' '`
        if ! grub_file_is_not_garbage "${linux}" ; then
            continue
        fi
        # Filters entry if efi/non efi.
        # Note that for now we allow kernel without .efi.signed as those are signed kernel
        # on ubuntu, loaded by the shim.
        case "${linux}" in
            *.efi.signed)
                if [ "$(is_secure_boot_enabled)" = "false" ]; then
                    continue
                fi
            ;;
        esac
        linux_basename=$(basename "${linux}")
        linux_dirname=$(dirname "${linux}")
        version=$(echo "${linux_basename}" | sed -e "s,^[^0-9]*-,,g")
        alt_version=$(echo "${version}" | sed -e "s,\.old$,,g")
        gettext_printf "Found linux image: %s in %s\n" "${linux_basename}" "${dataset}" >&2
        initrd=""
        for i in "initrd.img-${version}" "initrd-${version}.img" "initrd-${version}.gz" \
            "initrd-${version}" "initramfs-${version}.img" \
            "initrd.img-${alt_version}" "initrd-${alt_version}.img" \
            "initrd-${alt_version}" "initramfs-${alt_version}.img" \
            "initramfs-genkernel-${version}" \
            "initramfs-genkernel-${alt_version}" \
            "initramfs-genkernel-${GENKERNEL_ARCH}-${version}" \
            "initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}"; do
            if test -e "${linux_dirname}/${i}" ; then
                initrd="$i"
                break
            fi
        done
        if test -z "${initrd}" ; then
            grub_warn "Couldn't find any valid initrd for dataset ${dataset}."
            continue
        fi
        gettext_printf "Found initrd image: %s in %s\n" "${initrd}" "${dataset}" >&2
        rel_linux_dirname=$(make_system_path_relative_to_its_root "${linux_dirname}")
        initrd_list="${initrd_list}|${rel_linux_dirname}/${initrd}"
        kernel_list="${kernel_list}|${rel_linux_dirname}/${linux_basename}"
    done
    initrd_list="${initrd_list#|}"
    kernel_list="${kernel_list#|}"
    initrd_device=$(${grub_probe} --target=device "${boot_dir}" | head -1)
    mountpoint -q "${mntdir}/boot" && umount "${mntdir}/boot" || true
    # We needed to look in / for snapshots on root dataset, umount there before zfs lazily unmount it
    case "${boot_dir}" in /boot/.zfs/snapshot/*)
        umount "${boot_dir}" || true
        ;;
    esac
    # for zsys snapshots: we want to know which kernel we successful last booted with
    last_booted_kernel=$(zfs get -H com.ubuntu.zsys:last-booted-kernel "${dataset}" | awk '{print $3}')
    # snapshot: last_used is dataset creation time
    if [ "${is_snapshot}" = "true" ]; then
        last_used="$(zfs get -pH creation "${dataset}" | awk -F '\t' '{print $3}')"
    # otherwise, last_used is manually marked at boot/shutdown on a root dataset for zsys
    else
        # if current system, take current time
        if zfs mount | awk '/[ \t]+\/$/ {print $1}' | grep -q ${dataset}; then
            last_used=$(date +%s)
        else
            last_used=$(zfs get -H com.ubuntu.zsys:last-used "${dataset}" | awk '{print $3}')
            # case of non zsys, or zsys without annotation, take /etc/machine-id stat (as we mounted with noatime).
            # However, as systems can be relatime, if system is current mounted one, set current time (case of clone + reboot
            # within the same d).
            if [ "${last_used}" = "-" ]; then
                last_used=$(stat --printf="%X" "${mntdir}/etc/os-release")
                if [ -f "${mntdir}/etc/machine-id" ]; then
                    last_used=$(stat --printf="%X" "${mntdir}/etc/machine-id")
                fi
            fi
        fi
    fi
    is_zsys=$(zfs get -H com.ubuntu.zsys:bootfs "${base_dataset}" | awk '{print $3}')
    if [ -n "${initrd_list}" -a -n "${kernel_list}" ]; then
        echo "${dataset}\t${is_zsys}\t${machine_id}\t${pretty_name}\t${last_used}\t${initrd_device}\t${initrd_list}\t${kernel_list}\t${last_booted_kernel}"
    else
        grub_warn "didn't find any valid initrd or kernel."
    fi
    umount "${mntdir}" || true
    # We needed to look in / for snapshots on root dataset, umount the snapshot for etc before zfs lazily unmount it
    case "${etc_dir}" in /.zfs/snapshot/*/etc)
        snapshot_path="$(findmnt -n -o TARGET -T ${etc_dir})"
        umount "${snapshot_path}" || true
        ;;
    esac
}
# Scan available boot options and returns in a formatted list
# $1 is the temporary mount directory to use
bootlist() {
    local mntdir="$1"
    local boot_list=""
    for dataset in $(get_root_datasets); do
        # get information from current root dataset
        boot_list="${boot_list}$(get_dataset_info ${dataset} ${mntdir})\n"
        # get information from snapshots of this root dataset
        for snapshot_dataset in $(zfs list -H -o name -t snapshot "${dataset}"); do
            boot_list="${boot_list}$(get_dataset_info ${snapshot_dataset} ${mntdir})\n"
        done
    done
    echo "${boot_list}"
}
# Order machine ids by last_used from their main entry
get_machines_sorted() {
    local bootlist="$1"
    local machineids="$(echo "${bootlist}" | awk '{print $3}' | sort -u)"
    for machineid in ${machineids}; do
        echo "${bootlist}" | awk 'BEGIN{FS="\t"} $1 !~ /.*@.*/  {print $5, $3}' | sort -nr | grep -E "[^^]\b${machineid}\b" | head -1
    done | sort -nr | awk '{print $2}'
}
# Sort entries by last_used for a given machineid
sort_entries_for_machineid() {
    local bootlist="$1"
    local machineid="$2"
    tab="$(printf '\t')"
    echo "${bootlist}" | grep -E "[^^]\b${machineid}\b" | sort -k5,5r -k1,1 -t "${tab}"
}
# Return main entry index
get_main_entry() {
    local entries="$1"
    echo "${entries}" | awk 'BEGIN{FS="\t"} $1 !~ /.*@.*/  {print}' | head -1
}
# Return specific field at index from entry
get_field_from_entry() {
    local entry="$1"
    local index="$2"
    echo "${entry}" | awk "BEGIN{FS=\"\t\"} {print \$$index}"
}
# Get the main entry metadata
main_entry_meta() {
    local main_entry="$1"
    initrd=$(get_field_from_entry "${main_entry}" 7 | cut -d'|' -f1)
    kernel=$(get_field_from_entry "${main_entry}" 8 | cut -d'|' -f1)
    # Take first element (most recent entry) which is not a snapshot
    echo "${main_entry}" | awk "BEGIN{ FS=\"\t\"; OFS=\"\t\"} {print \$3, \$2, \"main\", \$4, \$1, \$6, \"$initrd\", \"$kernel\"}"
}
# Get advanced entries metadata
advanced_entries_meta() {
    local main_entry="$1"
    last_used_kernel="$(get_field_from_entry "${main_entry}" 9 )"
    # We must align initrds with kernels.
    # Adds initrds to the stack then pop them 1 by 1 as we process the kernels
    set -- $(get_field_from_entry "${main_entry}" 7 | tr "|" " ")
    for kernel in $(get_field_from_entry "${main_entry}" 8 | tr "|" " "); do
        # get initrd and pop to the next one
        initrd="$1"; shift
        was_last_used_kernel="false"
        kernel_basename=$(basename "${kernel}")
        if [ "${kernel_basename}" = "${last_used_kernel}" ]; then
            was_last_used_kernel="true"
        fi
        echo "${main_entry}" | awk "BEGIN{ FS=\"\t\"; OFS=\"\t\"}    {print \$3, \$2, \"advanced\", \$4, \$1, \$6, \"$initrd\", \"$kernel\", \"$was_last_used_kernel\"}"
    done
}
# Get history metadata
history_entries_meta() {
    local entries="$1"
    local main_dataset_name="$2"
    local main_dataset_releasename="$3"
    if [ -z "${entries}" ]; then
        return
    fi
    # Traverse snapshots and clones
    echo "${entries}" | while read entry; do
        name=""
        # Compute snapshot/filesystem dataset name
        snap_dataset_name="$(get_field_from_entry "${entry}" 1)"
        snapname="${snap_dataset_name##*@}"
        # If, this is a clone, take what is after main_dataset_name
        if [ "${snapname}" = "${snap_dataset_name}" ]; then
            snapname="${snap_dataset_name##${main_dataset_name}_}"
            # Handle manual user clone (not prefixed by "main_dataset_name")
            snapname="${snapname##*/}"
        fi
        # We keep the snapname only if it is not only a zsys auto snapshot
        if echo "${snapname}" | grep -q "^autozsys_"; then
            snapname=""
        fi
        # We store the release only if it different from main dataset release (snapshot before a release upgrade)
        releasename=$(get_field_from_entry "${entry}" 4)
        if [ "${releasename}" = "${main_dataset_releasename}" ]; then
            releasename=""
        fi
        # Snapshot date
        foo="$(get_field_from_entry "${entry}" 5)"
        snapdate="$(date -d @$(get_field_from_entry "${entry}" 5) "+%x @ %H:%M")"
        # For snapshots/clones the name can have the following formats:
        # 	<DATE>: autozsys, same release
        #   <OLD_RELEASE> on <DATE>: autozsys, different release
        #   <SNAPNAME> on <DATE>: Manual snapshot, same release
        #   <SNAPNAME>, <OLD_RELEASE> on <DATE>: Manual snapshot, different release
        if [ "${snapname}" = "" -a "${releasename}" = "" ]; then
            name="${snapdate}"
        elif [ "${snapname}" = "" -a "${releasename}" != "" ]; then
            name=$(gettext_printf "%s on %s" "${releasename}" "${snapdate}")
        elif [ "${snapname}" != "" -a "${releasename}" = "" ]; then
            name=$(gettext_printf "%s on %s" "${snapname}" "${snapdate}")
        else # snapname != "" && releasename != ""
            name=$(gettext_printf "%s, %s on %s" "${snapname}" "${releasename}" "${snapdate}")
        fi
        # Choose kernel and initrd if the snapshot was booted successfully on a specific kernel before
        # Take latest by default if no match
        initrd=$(get_field_from_entry "${entry}" 7 | cut -d'|' -f1)
        kernel=$(get_field_from_entry "${entry}" 8 | cut -d'|' -f1)
        last_used_kernel="$(get_field_from_entry "${entry}" 9)"
        # We must align initrds with kernels.
        # Adds initrds to the stack then pop them 1 by 1 as we process the kernels
        set -- $(get_field_from_entry "${entry}" 7 | tr "|" " ")
        for k in $(get_field_from_entry "${entry}" 8|tr "|" " "); do
            # get initrd and pop to the next one
            candidate_initrd="$1"; shift
            kernel_basename=$(basename "${k}")
            if [ "${kernel_basename}" = "${last_used_kernel}" ]; then
                kernel="${k}"
                initrd="${candidate_initrd}"
                break
            fi
        done
        echo "${entry}" | awk "BEGIN{ FS=\"\t\"; OFS=\"\t\"}    {print \$3, \$2, \"history\", \"$name\", \$1, \$6, \"$initrd\", \"$kernel\"}"
    done
}
# Generate metadata from a BOOTLIST that will subsequently used to generate
# the final grub menu entries
generate_grub_menu_metadata() {
    local bootlist="$1"
    # Sort machineids by last_used from their main entry
    for machineid in $(get_machines_sorted "${bootlist}"); do
        entries="$(sort_entries_for_machineid "${bootlist}" ${machineid})"
        main_entry="$(get_main_entry "${entries}")"
        if [ -z "$main_entry" ]; then
            continue
        fi
        main_entry_meta "${main_entry}"
        advanced_entries_meta "${main_entry}"
        main_dataset_name="$(get_field_from_entry "${main_entry}" 1)"
        main_dataset_releasename="$(get_field_from_entry "${main_entry}" 4)"
        # grep -v errcode != 0 if there is no match. || true to not fail with -e
        other_entries="$(echo "${entries}" | grep -v "${main_entry}" || true)"
        history_entries_meta "${other_entries}" "${main_dataset_name}" "${main_dataset_releasename}"
    done
}
# Print the configuration part common to all sections
# Note:
#   If 10_linux runs these part will be defined twice in grub configuration
print_menu_prologue() {
    cat << 'EOF'
function gfxmode {
	set gfxpayload="${1}"
EOF
    if [ "${vt_handoff}" = 1 ]; then
        cat << 'EOF'
	if [ "${1}" = "keep" ]; then
		set vt_handoff=vt.handoff=1
	else
		set vt_handoff=
	fi
EOF
    fi
    cat << EOF
}
EOF
    # Use ELILO's generic "efifb" when it's known to be available.
    # FIXME: We need an interface to select vesafb in case efifb can't be used.
    GRUB_GFXPAYLOAD_LINUX="${GRUB_GFXPAYLOAD_LINUX:-}"
    if [ "${GRUB_GFXPAYLOAD_LINUX}" != "" ] || [ "${gfxpayload_dynamic}" = 0 ]; then
        echo "set linux_gfx_mode=${GRUB_GFXPAYLOAD_LINUX}"
    else
        cat << EOF
if [ "\${recordfail}" != 1 ]; then
  if [ -e \${prefix}/gfxblacklist.txt ]; then
    if hwmatch \${prefix}/gfxblacklist.txt 3; then
      if [ \${match} = 0 ]; then
        set linux_gfx_mode=keep
      else
        set linux_gfx_mode=text
      fi
    else
      set linux_gfx_mode=text
    fi
  else
    set linux_gfx_mode=keep
  fi
else
  set linux_gfx_mode=text
fi
EOF
    fi
    cat << EOF
export linux_gfx_mode
EOF
}
# Cache for prepare_grub_to_access_device call
# $1: boot_device
# $2: submenu_level
prepare_grub_to_access_device_cached() {
    local boot_device="$1"
    local submenu_level="$2"
    local boot_device_idx="$(echo ${boot_device} | tr '/' '_')"
    cache_file="${ZFSTMP}/$(echo boot_device${boot_device_idx})"
    if [ ! -f "${cache_file}" ]; then
        set +u
        echo "$(prepare_grub_to_access_device "${boot_device}")" > "${cache_file}"
        set -u
        for i in 0 1 2; do
            submenu_indentation="$(printf %${i}s | tr " " "${grub_tab}")"
            sed "s/^/${submenu_indentation}	/" "${cache_file}" > "${cache_file}--${i}"
        done
    fi
    cat "${cache_file}--${submenu_level}"
}
# Print a grub menu entry
zfs_linux_entry () {
    submenu_level="$1"
    title="$2"
    type="$3"
    dataset="$4"
    boot_device="$5"
    initrd="$6"
    kernel="$7"
    kernel_version="$8"
    kernel_additional_args="${9:-}"
    boot_devices="${10:-}"
    submenu_indentation="$(printf %${submenu_level}s | tr " " "${grub_tab}")"
    echo "${submenu_indentation}menuentry '$(echo "${title}" | grub_quote)' ${CLASS} \${menuentry_id_option} 'gnulinux-${dataset}-${kernel_version}' {"
    if [ "${quick_boot}" = 1 ]; then
        echo "${submenu_indentation}	recordfail"
    fi
    if [ "${type}" != "recovery" ] ; then
        GRUB_SAVEDEFAULT=${GRUB_SAVEDEFAULT:-}
        default_entry="$(save_default_entry)"
        if [ -n "${default_entry}" ]; then
            echo "${submenu_indentation}	${default_entry}"
        fi
    fi
    # Use ELILO's generic "efifb" when it's known to be available.
    # FIXME: We need an interface to select vesafb in case efifb can't be used.
    if [ "${GRUB_GFXPAYLOAD_LINUX}" = "" ]; then
        echo "${submenu_indentation}	load_video"
    else
        if [ "${GRUB_GFXPAYLOAD_LINUX}" != "text" ]; then
            echo "${submenu_indentation}	load_video"
        fi
    fi
    if ([ "${ubuntu_recovery}" = 0 ] || [ "${type}" != "recovery" ]) && \
        ([ "${GRUB_GFXPAYLOAD_LINUX}" != "" ] || [ "${gfxpayload_dynamic}" = 1 ]); then
        echo "${submenu_indentation}	gfxmode \${linux_gfx_mode}"
    fi
    echo "${submenu_indentation}	insmod gzio"
    echo "${submenu_indentation}	if [ \"\${grub_platform}\" = xen ]; then insmod xzio; insmod lzopio; fi"
    if [ -n "$boot_devices" ]; then
        for device in ${boot_devices}; do
            echo "${submenu_indentation}	if [ "${boot_device}" = "${device}" ]; then"
            echo "$(prepare_grub_to_access_device_cached "${device}" $(( submenu_level +1 )) )"
            echo "${submenu_indentation}	fi"
        done
    else
        echo "$(prepare_grub_to_access_device_cached "${boot_device}" "${submenu_level}")"
    fi
    if [ "${quiet_boot}" = 0 ] || [ "${type}" != simple ]; then
        echo "${submenu_indentation}	echo $(gettext_printf "Loading Linux %s ..." ${kernel_version} | grub_quote)"
    fi
    linux_default_args="${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
    if [ ${type} = "recovery" ]; then
        linux_default_args="${GRUB_CMDLINE_LINUX_RECOVERY} ${GRUB_CMDLINE_LINUX}"
    fi
    echo "${submenu_indentation}	linux	${kernel} root=ZFS=${dataset} ro ${linux_default_args} ${kernel_additional_args}"
    if [ "${quiet_boot}" = 0 ] || [ "${type}" != simple ]; then
        echo "${submenu_indentation}	echo '$(gettext_printf "Loading initial ramdisk ..." | grub_quote)'"
    fi
    echo "${submenu_indentation}	initrd	${initrd}"
    echo "${submenu_indentation}}"
}
# Generate a GRUB Menu from menu meta data
# $1 menu metadata
generate_grub_menu() {
    local menu_metadata="$1"
    local last_section=""
    local main_dataset_name=""
    local main_dataset=""
    local have_zsys=""
    if [ -z "${menu_metadata}" ]; then
        return
    fi
    CLASS="--class gnu-linux --class gnu --class os"
    if [ "${GRUB_DISTRIBUTOR}" = "" ] ; then
        OS=GNU/Linux
    else
        case ${GRUB_DISTRIBUTOR} in
            Ubuntu|Kubuntu)
            OS="${GRUB_DISTRIBUTOR}"
            ;;
            *)
            OS="${GRUB_DISTRIBUTOR} GNU/Linux"
            ;;
        esac
        CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1 | LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}"
    fi
    if [ -x /lib/recovery-mode/recovery-menu ]; then
        GRUB_CMDLINE_LINUX_RECOVERY=recovery
    else
        GRUB_CMDLINE_LINUX_RECOVERY=single
    fi
    if [ "${ubuntu_recovery}" = 1 ]; then
        GRUB_CMDLINE_LINUX_RECOVERY="${GRUB_CMDLINE_LINUX_RECOVERY} nomodeset"
    fi
    case "$GENKERNEL_ARCH" in
        x86*) GRUB_CMDLINE_LINUX_RECOVERY="$GRUB_CMDLINE_LINUX_RECOVERY dis_ucode_ldr";;
    esac
    if [ "${vt_handoff}" = 1 ]; then
        for word in ${GRUB_CMDLINE_LINUX_DEFAULT}; do
            if [ "${word}" = splash ]; then
                GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_DEFAULT} \${vt_handoff}"
            fi
        done
    fi
    print_menu_prologue
    cat<<'EOF'
function zsyshistorymenu {
	# $1: root dataset (eg rpool/ROOT/ubuntu_2zhm07@autozsys_k56fr6)
	# $2: boot device id (eg 411f29ce1557bfed)
	# $3: initrd (eg /BOOT/ubuntu_2zhm07@autozsys_k56fr6/initrd.img-5.4.0-21-generic)
	# $4: kernel (eg /BOOT/ubuntu_2zhm07@autozsys_k56fr6/vmlinuz-5.4.0-21-generic)
	# $5: kernel_version (eg 5.4.0-21-generic)
	set root_dataset="${1}"
	set boot_device="${2}"
	set initrd="${3}"
	set kernel="${4}"
	set kversion="${5}"
EOF
    boot_devices=$(echo "${menu_metadata}" | cut -d"$(printf '\t')" -f6 | sort -u)
    title=$(gettext_printf "Revert system only")
    zfs_linux_entry 1 "${title}" "simple" '${root_dataset}' '${boot_device}' '${initrd}' '${kernel}' '${kversion}' '' "${boot_devices}"
    title="$(gettext_printf "Revert system and user data")"
    zfs_linux_entry 1 "${title}" "simple" '${root_dataset}' '${boot_device}' '${initrd}' '${kernel}' '${kversion}' 'zsys-revert=userdata' "${boot_devices}"
    GRUB_DISABLE_RECOVERY="${GRUB_DISABLE_RECOVERY:-}"
    if [ "${GRUB_DISABLE_RECOVERY}" != "true" ]; then
        title="$(gettext_printf "Revert system only (%s)" "$(gettext "${GRUB_RECOVERY_TITLE}")")"
        zfs_linux_entry 1 "${title}" "recovery" '${root_dataset}' '${boot_device}' '${initrd}' '${kernel}' '${kversion}' '' "${boot_devices}"
        title="$(gettext_printf "Revert system and user data (%s)" "$(gettext "${GRUB_RECOVERY_TITLE}")")"
        zfs_linux_entry 1 "${title}" "recovery" '${root_dataset}' '${boot_device}' '${initrd}' '${kernel}' '${kversion}' 'zsys-revert=userdata' "${boot_devices}"
    fi
echo "}"
echo
    # IFS is set to TAB (ASCII 0x09)
    echo "${menu_metadata}" |
    {
        at_least_one_entry=0
        have_zsys="$(which zsysd || true)"
        while IFS="$(printf '\t')" read -r machineid iszsys section name dataset device initrd kernel opt; do
            # Disable history for non zsys system or if systems is a zsys one and zsys isn't installed.
            # In pure zfs systems, we identified multiple issues due to the mount generator
            # in upstream zfs which makes it incompatible. Don't show history for now.
            if [ "${section}" = "history" ]; then
                if [ "${iszsys}" != "yes" ] || [ "${iszsys}" = "yes" -a -z "${have_zsys}" ]; then
                    continue
                fi
            fi
            if [ "${last_section}" != "${section}" -a -n "${last_section}" ]; then
                # Close previous section wrapper
                if [ "${last_section}" != "main" ]; then
                    echo "}"    # Add grub_tabs
                    at_least_one_entry=0
                fi
            fi
            case "${section}" in
                main)
                    title="${name}"
                    main_dataset_name="${name}"
                    main_dataset="${dataset}"
                    kernel_version=$(basename "${kernel}" | sed -e "s,^[^0-9]*-,,g")
                    zfs_linux_entry 0 "${title}" "simple" "${dataset}" "${device}" "${initrd}" "${kernel}" "${kernel_version}"
                    at_least_one_entry=1
                ;;
                advanced)
                    # normal and recovery entries for a given kernel
                    if [ "${last_section}" != "${section}" ]; then
                        echo "submenu '$(gettext_printf "Advanced options for %s" "${main_dataset_name}" | grub_quote)' \${menuentry_id_option} 'gnulinux-advanced-${main_dataset}' {"
                    fi
                    last_booted_kernel_marker=""
                    if [ "${opt}" = "true" ]; then
                        last_booted_kernel_marker="* "
                    fi
                    kernel_version=$(basename "${kernel}" | sed -e "s,^[^0-9]*-,,g")
                    title="$(gettext_printf "%s%s, with Linux %s" "${last_booted_kernel_marker}" "${name}" "${kernel_version}")"
                    zfs_linux_entry 1 "${title}" "advanced" "${dataset}" "${device}" "${initrd}" "${kernel}" "${kernel_version}"
                    GRUB_DISABLE_RECOVERY=${GRUB_DISABLE_RECOVERY:-}
                    if [ "${GRUB_DISABLE_RECOVERY}" != "true" ]; then
                        title="$(gettext_printf "%s%s, with Linux %s (%s)" "${last_booted_kernel_marker}" "${name}" "${kernel_version}" "$(gettext "${GRUB_RECOVERY_TITLE}")")"
                        zfs_linux_entry 1 "${title}" "recovery" "${dataset}" "${device}" "${initrd}" "${kernel}" "${kernel_version}"
                    fi
                    at_least_one_entry=1
                ;;
                history)
                    # Revert to a snapshot
                    # revert system, revert system and user data and associated recovery entries
                    if [ "${last_section}" != "${section}" ]; then
                        echo "submenu '$(gettext_printf "History for %s" "${main_dataset_name}" | grub_quote)' \${menuentry_id_option} 'gnulinux-history-${main_dataset}' {"
                    fi
                    if [ "${iszsys}" = "yes" ]; then
                        title="$(gettext_printf "Revert to %s" "${name}" | grub_quote)"
                    else
                        title="$(gettext_printf "Boot on %s" "${name}" | grub_quote)"
                    fi
                    echo "	submenu '${title}' \${menuentry_id_option} 'gnulinux-history-${dataset}' {"
                    kernel_version=$(basename "${kernel}" | sed -e "s,^[^0-9]*-,,g")
                    # Zsys only: let revert system without destroying snapshots
                    if [ "${iszsys}" = "yes" ]; then
                        echo "${grub_tab}${grub_tab}zsyshistorymenu" \"${dataset}\" \"${device}\" \"${initrd}\" \"${kernel}\" \"${kernel_version}\"
                    # Non-zsys: boot temporarly on snapshots or rollback (destroying intermediate snapshots)
                    else
                        title="$(gettext_printf "One time boot")"
                        zfs_linux_entry 2 "${title}" "simple" "${dataset}" "${device}" "${initrd}" "${kernel}" "${kernel_version}"
                        GRUB_DISABLE_RECOVERY="${GRUB_DISABLE_RECOVERY:-}"
                        if [ "${GRUB_DISABLE_RECOVERY}" != "true" ]; then
                            title="$(gettext_printf "One time boot (%s)" "$(gettext "${GRUB_RECOVERY_TITLE}")")"
                            zfs_linux_entry 2 "${title}" "recovery" "${dataset}" "${device}" "${initrd}" "${kernel}" "${kernel_version}"
                        fi
                        title="$(gettext_printf "Revert system (all intermediate snapshots will be destroyed)")"
                        zfs_linux_entry 2 "${title}" "simple" "${dataset}" "${device}" "${initrd}" "${kernel}" "${kernel_version}" "rollback=yes"
                    fi
                    echo "	}"
                    at_least_one_entry=1
                ;;
                *)
                    grub_warn "unknown section: ${section}. Ignoring entry ${name} for ${dataset}"
                ;;
            esac
            last_section="${section}"
        done
        if [ "${at_least_one_entry}" -eq 1 ]; then
            echo "}"
        fi
    }
}
# don't add trailing newline of variable is empty
# $1: content to write
# $2: destination file
trailing_newline_if_not_empty() {
    content="$1"
    dest="$2"
    if [ -z "${content}" ]; then
        rm -f "${dest}"
        touch "${dest}"
        return
    fi
    echo "${content}" > "${dest}"
}
GRUB_LINUX_ZFS_TEST="${GRUB_LINUX_ZFS_TEST:-}"
case "${GRUB_LINUX_ZFS_TEST}" in
    bootlist)
        # Import all available pools on the system and return imported list
        imported_pools=$(import_pools)
        boot_list="$(bootlist ${MNTDIR})"
        trailing_newline_if_not_empty "${boot_list}" "${GRUB_LINUX_ZFS_TEST_OUTPUT}"
        break
    ;;
    metamenu)
        boot_list="$(cat ${GRUB_LINUX_ZFS_TEST_INPUT})"
        menu_metadata="$(generate_grub_menu_metadata "${boot_list}")"
        trailing_newline_if_not_empty "${menu_metadata}" "${GRUB_LINUX_ZFS_TEST_OUTPUT}"
        break
    ;;
    grubmenu)
        menu_metadata="$(cat ${GRUB_LINUX_ZFS_TEST_INPUT})"
        grub_menu=$(generate_grub_menu "${menu_metadata}")
        trailing_newline_if_not_empty "${grub_menu}" "${GRUB_LINUX_ZFS_TEST_OUTPUT}"
        break
    ;;
    *)
        # Import all available pools on the system and return imported list
        imported_pools=$(import_pools)
        # Generate the complete list of boot entries
        boot_list="$(bootlist ${MNTDIR})"
        # Create boot menu meta data from the list of boot entries
        menu_metadata="$(generate_grub_menu_metadata "${boot_list}")"
        # Create boot menu meta data from the list of boot entries
        grub_menu="$(generate_grub_menu "${menu_metadata}")"
        if [ -n "${grub_menu}" ]; then
            # We want the trailing newline as a marker will be added
            echo "${grub_menu}"
        fi
    ;;
esac

========================= sda5/etc/grub.d/49_linux_xen =========================

#! /bin/sh
set -e
# grub-mkconfig helper script.
# Copyright (C) 2006,2007,2008,2009,2010  Free Software Foundation, Inc.
#
# GRUB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GRUB is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
prefix="/usr"
exec_prefix="/usr"
datarootdir="/usr/share"
. "$pkgdatadir/grub-mkconfig_lib"
export TEXTDOMAIN=grub
export TEXTDOMAINDIR="${datarootdir}/locale"
CLASS="--class gnu-linux --class gnu --class os --class xen"
SUPPORTED_INITS="sysvinit:/lib/sysvinit/init systemd:/lib/systemd/systemd upstart:/sbin/upstart"
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
  OS=GNU/Linux
else
  OS="${GRUB_DISTRIBUTOR} GNU/Linux"
  CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}"
fi
# loop-AES arranges things so that /dev/loop/X can be our root device, but
# the initrds that Linux uses don't like that.
case ${GRUB_DEVICE} in
  /dev/loop/*|/dev/loop[0-9])
    GRUB_DEVICE=`losetup ${GRUB_DEVICE} | sed -e "s/^[^(]*(\([^)]\+\)).*/\1/"`
    # We can't cope with devices loop-mounted from files here.
    case ${GRUB_DEVICE} in
      /dev/*) ;;
      *) exit 0 ;;
    esac
  ;;
esac
# Default to disabling partition uuid support to maintian compatibility with
# older kernels.
GRUB_DISABLE_LINUX_PARTUUID=${GRUB_DISABLE_LINUX_PARTUUID-true}
# btrfs may reside on multiple devices. We cannot pass them as value of root= parameter
# and mounting btrfs requires user space scanning, so force UUID in this case.
if ( [ "x${GRUB_DEVICE_UUID}" = "x" ] && [ "x${GRUB_DEVICE_PARTUUID}" = "x" ] ) \
    || ( [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \
	&& [ "x${GRUB_DISABLE_LINUX_PARTUUID}" = "xtrue" ] ) \
    || ( ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \
	&& ! test -e "/dev/disk/by-partuuid/${GRUB_DEVICE_PARTUUID}" ) \
    || ( test -e "${GRUB_DEVICE}" && uses_abstraction "${GRUB_DEVICE}" lvm ); then
  LINUX_ROOT_DEVICE=${GRUB_DEVICE}
elif [ "x${GRUB_DEVICE_UUID}" = "x" ] \
    || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ]; then
  LINUX_ROOT_DEVICE=PARTUUID=${GRUB_DEVICE_PARTUUID}
else
  LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
fi
# Allow overriding GRUB_CMDLINE_LINUX and GRUB_CMDLINE_LINUX_DEFAULT.
if [ "${GRUB_CMDLINE_LINUX_XEN_REPLACE}" ]; then
  GRUB_CMDLINE_LINUX="${GRUB_CMDLINE_LINUX_XEN_REPLACE}"
fi
if [ "${GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT}" ]; then
  GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT}"
fi
case x"$GRUB_FS" in
    xbtrfs)
	rootsubvol="`make_system_path_relative_to_its_root /`"
	rootsubvol="${rootsubvol#/}"
	if [ "x${rootsubvol}" != x ]; then
	    GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"
	fi;;
    xzfs)
	rpool=`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2>/dev/null || true`
	bootfs="`make_system_path_relative_to_its_root / | sed -e "s,@$,,"`"
	LINUX_ROOT_DEVICE="ZFS=${rpool}${bootfs%/}"
	;;
esac
title_correction_code=
linux_entry ()
{
  os="$1"
  version="$2"
  xen_version="$3"
  type="$4"
  args="$5"
  xen_args="$6"
  if [ -z "$boot_device_id" ]; then
      boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
  fi
  if [ x$type != xsimple ] ; then
      if [ x$type = xrecovery ] ; then
	  title="$(gettext_printf "%s, with Xen %s and Linux %s (%s)" "${os}" "${xen_version}" "${version}" "$(gettext "${GRUB_RECOVERY_TITLE}")")"
      elif [ "${type#init-}" != "$type" ] ; then
	  title="$(gettext_printf "%s, with Xen %s and Linux %s (%s)" "${os}" "${xen_version}" "${version}" "${type#init-}")"
      else
	  title="$(gettext_printf "%s, with Xen %s and Linux %s" "${os}" "${xen_version}" "${version}")"
      fi
      replacement_title="$(echo "Advanced options for ${OS}" | sed 's,>,>>,g')>$(echo "$title" | sed 's,>,>>,g')"
      if [ x"Xen ${xen_version}>$title" = x"$GRUB_ACTUAL_DEFAULT" ]; then
         quoted="$(echo "$GRUB_ACTUAL_DEFAULT" | grub_quote)"
         title_correction_code="${title_correction_code}if [ \"x\$default\" = '$quoted' ]; then default='$(echo "$replacement_title" | grub_quote)'; fi;"
         grub_warn "$(gettext_printf "Please don't use old title \`%s' for GRUB_DEFAULT, use \`%s' (for versions before 2.00) or \`%s' (for 2.00 or later)" "$GRUB_ACTUAL_DEFAULT" "$replacement_title" "gnulinux-advanced-$boot_device_id>gnulinux-$version-$type-$boot_device_id")"
      fi
      echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'xen-gnulinux-$version-$type-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
  else
      title="$(gettext_printf "%s, with Xen hypervisor" "${os}")"
      echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'xen-gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
  fi
  if [ x$type != xrecovery ] ; then
      save_default_entry | grub_add_tab | sed "s/^/$submenu_indentation/"
  fi
  if [ -z "${prepare_boot_cache}" ]; then
    prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | grub_add_tab)"
  fi
  printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
  xmessage="$(gettext_printf "Loading Xen %s ..." ${xen_version})"
  lmessage="$(gettext_printf "Loading Linux %s ..." ${version})"
  sed "s/^/$submenu_indentation/" << EOF
	echo	'$(echo "$xmessage" | grub_quote)'
        if [ "\$grub_platform" = "pc" -o "\$grub_platform" = "" ]; then
            xen_rm_opts=
        else
            xen_rm_opts="no-real-mode edd=off"
        fi
	${xen_loader}	${rel_xen_dirname}/${xen_basename} placeholder ${xen_args} \${xen_rm_opts}
	echo	'$(echo "$lmessage" | grub_quote)'
	${module_loader}	${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args}
EOF
  if test -n "${initrd}" ; then
    # TRANSLATORS: ramdisk isn't identifier. Should be translated.
    message="$(gettext_printf "Loading initial ramdisk ...")"
    initrd_path=
    for i in ${initrd}; do
       initrd_path="${initrd_path} ${rel_dirname}/${i}"
    done
    sed "s/^/$submenu_indentation/" << EOF
	echo	'$(echo "$message" | grub_quote)'
	${module_loader}	--nounzip   $(echo $initrd_path)
EOF
  fi
  sed "s/^/$submenu_indentation/" << EOF
}
EOF
}
linux_list=
for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* /boot/kernel-*; do
    if grub_file_is_not_garbage "$i"; then
    	basename=$(basename $i)
	version=$(echo $basename | sed -e "s,^[^0-9]*-,,g")
	dirname=$(dirname $i)
	config=
	for j in "${dirname}/config-${version}" "${dirname}/config-${alt_version}" "/etc/kernels/kernel-config-${version}" ; do
	    if test -e "${j}" ; then
		config="${j}"
		break
	    fi
	done
        if (grep -qx "CONFIG_XEN_DOM0=y" "${config}" 2> /dev/null || grep -qx "CONFIG_XEN_PRIVILEGED_GUEST=y" "${config}" 2> /dev/null); then linux_list="$linux_list $i" ; fi
    fi
done
if [ "x${linux_list}" = "x" ] ; then
    exit 0
fi
file_is_not_sym () {
    case "$1" in
	*/xen-syms-*)
	    return 1;;
	*)
	    return 0;;
    esac
}
xen_list=
for i in /boot/xen*; do
    if grub_file_is_not_garbage "$i" && file_is_not_sym "$i" ; then xen_list="$xen_list $i" ; fi
done
prepare_boot_cache=
boot_device_id=
title_correction_code=
machine=`uname -m`
case "$machine" in
    i?86) GENKERNEL_ARCH="x86" ;;
    mips|mips64) GENKERNEL_ARCH="mips" ;;
    mipsel|mips64el) GENKERNEL_ARCH="mipsel" ;;
    arm*) GENKERNEL_ARCH="arm" ;;
    *) GENKERNEL_ARCH="$machine" ;;
esac
# Extra indentation to add to menu entries in a submenu. We're not in a submenu
# yet, so it's empty. In a submenu it will be equal to '\t' (one tab).
submenu_indentation=""
is_top_level=true
while [ "x${xen_list}" != "x" ] ; do
    list="${linux_list}"
    current_xen=`version_find_latest $xen_list`
    xen_basename=`basename ${current_xen}`
    xen_dirname=`dirname ${current_xen}`
    rel_xen_dirname=`make_system_path_relative_to_its_root $xen_dirname`
    xen_version=`echo $xen_basename | sed -e "s,.gz$,,g;s,^xen-,,g"`
    if [ -z "$boot_device_id" ]; then
	boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
    fi
    if [ "x$is_top_level" != xtrue ]; then
	echo "	submenu '$(gettext_printf "Xen hypervisor, version %s" "${xen_version}" | grub_quote)' \$menuentry_id_option 'xen-hypervisor-$xen_version-$boot_device_id' {"
    fi
    if ($grub_file --is-arm64-efi $current_xen); then
	xen_loader="xen_hypervisor"
	module_loader="xen_module"
    else
	if ($grub_file --is-x86-multiboot2 $current_xen); then
	    xen_loader="multiboot2"
	    module_loader="module2"
	else
	    xen_loader="multiboot"
	    module_loader="module"
        fi
    fi
    initrd_early=
    for i in ${GRUB_EARLY_INITRD_LINUX_STOCK} \
             ${GRUB_EARLY_INITRD_LINUX_CUSTOM}; do
       if test -e "${xen_dirname}/${i}" ; then
          initrd_early="${initrd_early} ${i}"
       fi
    done
    while [ "x$list" != "x" ] ; do
	linux=`version_find_latest $list`
	gettext_printf "Found linux image: %s\n" "$linux" >&2
	basename=`basename $linux`
	dirname=`dirname $linux`
	rel_dirname=`make_system_path_relative_to_its_root $dirname`
	version=`echo $basename | sed -e "s,^[^0-9]*-,,g"`
	alt_version=`echo $version | sed -e "s,\.old$,,g"`
	linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
	initrd_real=
	for i in "initrd.img-${version}" "initrd-${version}.img" "initrd-${version}.gz" \
	   "initrd-${version}" "initramfs-${version}.img" \
	   "initrd.img-${alt_version}" "initrd-${alt_version}.img" \
	   "initrd-${alt_version}" "initramfs-${alt_version}.img" \
	   "initramfs-genkernel-${version}" \
	   "initramfs-genkernel-${alt_version}" \
	   "initramfs-genkernel-${GENKERNEL_ARCH}-${version}" \
	   "initramfs-genkernel-${GENKERNEL_ARCH}-${alt_version}" ; do
	    if test -e "${dirname}/${i}" ; then
		initrd_real="$i"
		break
	    fi
	done
	initrd=
	if test -n "${initrd_early}" || test -n "${initrd_real}"; then
	    initrd="${initrd_early} ${initrd_real}"
	    initrd_display=
	    for i in ${initrd}; do
		initrd_display="${initrd_display} ${dirname}/${i}"
	    done
	    gettext_printf "Found initrd image: %s\n" "$(echo $initrd_display)" >&2
	fi
	if test -z "${initrd_real}"; then
    # "UUID=" magic is parsed by initrds.  Since there's no initrd, it can't work here.
	    if [ "x${GRUB_DEVICE_PARTUUID}" = "x" ] \
		|| [ "x${GRUB_DISABLE_LINUX_PARTUUID}" = "xtrue" ]; then
		linux_root_device_thisversion=${GRUB_DEVICE}
	    else
		linux_root_device_thisversion=PARTUUID=${GRUB_DEVICE_PARTUUID}
	    fi
	fi
	if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xy ]; then
	    linux_entry "${OS}" "${version}" "${xen_version}" simple \
		"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" "${GRUB_CMDLINE_XEN} ${GRUB_CMDLINE_XEN_DEFAULT}"
	    submenu_indentation="$grub_tab$grub_tab"
    
	    if [ -z "$boot_device_id" ]; then
		boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
	    fi
            # TRANSLATORS: %s is replaced with an OS name
	    echo "submenu '$(gettext_printf "Advanced options for %s (with Xen hypervisor)" "${OS}" | grub_quote)' \$menuentry_id_option 'gnulinux-advanced-$boot_device_id' {"
	echo "	submenu '$(gettext_printf "Xen hypervisor, version %s" "${xen_version}" | grub_quote)' \$menuentry_id_option 'xen-hypervisor-$xen_version-$boot_device_id' {"
	   is_top_level=false
	fi
	linux_entry "${OS}" "${version}" "${xen_version}" advanced \
	    "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" "${GRUB_CMDLINE_XEN} ${GRUB_CMDLINE_XEN_DEFAULT}"
	for supported_init in ${SUPPORTED_INITS}; do
	    init_path="${supported_init#*:}"
	    if [ -x "${init_path}" ] && [ "$(readlink -f /sbin/init)" != "$(readlink -f "${init_path}")" ]; then
		linux_entry "${OS}" "${version}" "${xen_version}" "init-${supported_init%%:*}" \
		    "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT} init=${init_path}" "${GRUB_CMDLINE_XEN} ${GRUB_CMDLINE_XEN_DEFAULT}"
	    fi
	done
	if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
	    linux_entry "${OS}" "${version}" "${xen_version}" recovery \
		"single ${GRUB_CMDLINE_LINUX}" "${GRUB_CMDLINE_XEN}"
	fi
	list=`echo $list | tr ' ' '\n' | fgrep -vx "$linux" | tr '\n' ' '`
    done
    if [ x"$is_top_level" != xtrue ]; then
	echo '	}'
    fi
    xen_list=`echo $xen_list | tr ' ' '\n' | fgrep -vx "$current_xen" | tr '\n' ' '`
done
# If at least one kernel was found, then we need to
# add a closing '}' for the submenu command.
if [ x"$is_top_level" != xtrue ]; then
  echo '}'
fi
echo "$title_correction_code"

====================== sda5/etc/grub.d/50_os-prober_proxy ======================

#!/bin/sh
#THIS IS A GRUB PROXY SCRIPT
'/etc/grub.d/proxifiedScripts/os-prober' | /etc/grub.d/bin/grubcfg_proxy "+*
+#text
-'Windows 7 (sur /dev/sda2)'~7f261b655eb49bd18834f7ddb1b055f0~
-'Ubuntu 16.04.6 LTS (16.04) (sur /dev/sda4)'~9b55e0102ce834da50eb4af16b26e053~
-'Windows 7 (sur /dev/sda1)'~277e3733d6c745e82b12dfd2f414233b~
+'SUBMENU' as 'Options avancées pour Ubuntu 16.04.6 LTS (16.04) (sur /dev/sda4)'{+'Options avancées pour Ubuntu 16.04.6 LTS (16.04) (sur /dev/sda4)'/*, +'Options avancées pour Ubuntu 16.04.6 LTS (16.04) (sur /dev/sda4)'/'Ubuntu (sur /dev/sda4)'~21efdfd58be5ae083609c81dffed73d3~, +*, +'Options avancées pour Ubuntu 16.04.6 LTS (16.04) (sur /dev/sda4)'/'Ubuntu, avec Linux 4.15.0-76-generic (sur /dev/sda4)'~21efdfd58be5ae083609c81dffed73d3~, +'Options avancées pour Ubuntu 16.04.6 LTS (16.04) (sur /dev/sda4)'/'Ubuntu, with Linux 4.15.0-76-generic (recovery mode) (sur /dev/sda4)'~6d51d0bec50e7439c5fbf65fe20ab6dd~, +'Options avancées pour Ubuntu 16.04.6 LTS (16.04) (sur /dev/sda4)'/'Ubuntu, avec Linux 4.15.0-74-generic (sur /dev/sda4)'~8bb3ada67d106299b2c76613815474d6~, +'Options avancées pour Ubuntu 16.04.6 LTS (16.04) (sur /dev/sda4)'/'Ubuntu, with Linux 4.15.0-74-generic (recovery mode) (sur /dev/sda4)'~80cda67e2181259243dbb9cae3323b31~}
"

======================= sda5/etc/grub.d/51_uefi-firmware =======================

#! /bin/sh
set -e
# grub-mkconfig helper script.
# Copyright (C) 2012  Free Software Foundation, Inc.
#
# GRUB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GRUB is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
prefix="/usr"
exec_prefix="/usr"
datarootdir="/usr/share"
export TEXTDOMAIN=grub
export TEXTDOMAINDIR="${datarootdir}/locale"
. "${datarootdir}/grub/grub-mkconfig_lib"
efi_vars_dir=/sys/firmware/efi/vars
EFI_GLOBAL_VARIABLE=8be4df61-93ca-11d2-aa0d-00e098032b8c
OsIndications="$efi_vars_dir/OsIndicationsSupported-$EFI_GLOBAL_VARIABLE/data"
if [ -e "$OsIndications" ] && \
   [ "$(( $(printf 0x%x \'"$(cat $OsIndications | cut -b1)") & 1 ))" = 1 ]; then
  LABEL="UEFI Firmware Settings"
  gettext_printf "Adding boot menu entry for UEFI Firmware Settings\n" >&2
  onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
  cat << EOF
menuentry '$LABEL' \$menuentry_id_option 'uefi-firmware' {
	fwsetup
}
EOF
fi

======================= sda5/etc/grub.d/52_custom_proxy ========================

#!/bin/sh
#THIS IS A GRUB PROXY SCRIPT
'/etc/grub.d/proxifiedScripts/custom' | /etc/grub.d/bin/grubcfg_proxy "-*
-'Ubuntu 20.04 LTS'~5e732a1878be2342dbfeff5fe3ca5aa3~
+#text
-~bd2103035a8021942390a78a431ba0c4~ as 'Ubuntu'
"

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

Ubuntu   d4af8b02-b68c-4127-a189-f82977775f64
Ubuntu, avec Linux 4.15.0-76-generic   d4af8b02-b68c-4127-a189-f82977775f64
Ubuntu, avec Linux 4.15.0-74-generic   d4af8b02-b68c-4127-a189-f82977775f64
Windows 7 (loader) (sur sda1)   4084667D846674F6
Windows 7 (loader) (sur sda2)   A4C667F8C667C95E
Ubuntu 20.04 LTS (20.04) (sur sda5)   3a99e146-f457-46a6-8726-e075a86b9b9a
Ubuntu 20.04 LTS (20.04) (sur sda5)   3a99e146-f457-46a6-8726-e075a86b9b9a
Ubuntu 20.04 LTS (20.04) (sur sda5)   3a99e146-f457-46a6-8726-e075a86b9b9a
Ubuntu 20.04 LTS (20.04) (sur sda5)   3a99e146-f457-46a6-8726-e075a86b9b9a
Ubuntu 20.04 LTS (20.04) (sur sda5)   3a99e146-f457-46a6-8726-e075a86b9b9a
Ubuntu 20.04 LTS (20.04) (sur sda5)   3a99e146-f457-46a6-8726-e075a86b9b9a
Ubuntu 20.04 LTS (20.04) (sur sda5)   3a99e146-f457-46a6-8726-e075a86b9b9a
Ubuntu 20.04 LTS (20.04) (sur sda5)   3a99e146-f457-46a6-8726-e075a86b9b9a
Ubuntu 20.04 LTS (20.04) (sur sda5)   3a99e146-f457-46a6-8726-e075a86b9b9a
Ubuntu 20.04 LTS (20.04) (sur sda5)   3a99e146-f457-46a6-8726-e075a86b9b9a
Ubuntu 20.04 LTS (20.04) (sur sda5)   3a99e146-f457-46a6-8726-e075a86b9b9a
### END /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_uefi-firmware ###

========================== sda4/etc/fstab (filtered) ===========================

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda5 during installation
UUID=d4af8b02-b68c-4127-a189-f82977775f64 /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda6 during installation
admin@lasagne-ramolli.mooo.com:/downloads/ /home/kierian/00NAS/downloads/ fuse.sshfs port=2140,umask=0,defaults,auto,user,noatime,allow_other,_netdev 0 0
admin@lasagne-ramolli.mooo.com:/video/ /home/kierian/00NAS/video/ fuse.sshfs port=2140,umask=0,defaults,auto,user,noatime,allow_other,_netdev 0 0
admin@lasagne-ramolli.mooo.com:/music/ /home/kierian/00NAS/music/ fuse.sshfs port=2140,umask=0,defaults,auto,user,noatime,allow_other,_netdev 0 0
admin@lasagne-ramolli.mooo.com:/photo/ /home/kierian/00NAS/photo/ fuse.sshfs port=2140,umask=0,defaults,auto,user,noatime,allow_other,_netdev 0 0
admin@lasagne-ramolli.mooo.com:/homes/ /home/kierian/00NAS/homes/ fuse.sshfs port=2140,umask=0,defaults,auto,user,noatime,allow_other,_netdev 0 0

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

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

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

           GiB - GB             File                                 Fragment(s)
 891.168128967 = 956.884492288  boot/grub/grub.cfg                             1
 890.881114960 = 956.576313344  boot/grub/i386-pc/core.img                     1
 915.207710266 = 982.696796160  boot/vmlinuz-4.15.0-74-generic                 4
 900.194877625 = 966.576889856  boot/vmlinuz-4.15.0-76-generic                 5
 900.194877625 = 966.576889856  vmlinuz                                        5
 915.207710266 = 982.696796160  vmlinuz.old                                    4
 916.721992493 = 984.322744320  boot/initrd.img-4.15.0-74-generic              2
 916.706371307 = 984.305971200  boot/initrd.img-4.15.0-76-generic              4
 916.706371307 = 984.305971200  initrd.img                                     4
 916.721992493 = 984.322744320  initrd.img.old                                 2

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

-rwxr-xr-x 1 root root 12512 mars  21  2018 10_linux
-rwxr-xr-x 1 root root 11082 mars  21  2018 20_linux_xen
-rwxr-xr-x 1 root root 11692 mars  21  2018 30_os-prober
-rwxr-xr-x 1 root root  1418 mars  21  2018 30_uefi-firmware
-rwxr-xr-x 1 root root   214 mars  21  2018 40_custom
-rwxr-xr-x 1 root root   216 mars  21  2018 41_custom


Suggested repair: ______________________________________________________________

The default repair of the Boot-Repair utility would reinstall the grub2 of
sda4 into the MBR of sda.
Additional repair would be performed: unhide-bootmenu-10s

Dernière modification par Dezta (Le 20/10/2020, à 17:28)

Hors ligne

#19 Le 20/10/2020, à 17:26

ylag

Re : [Résolu] Problème avec Grub et Apt

Peut-être tenter de désactiver le contenu du fichier /etc/grub.d/42_custom_proxy, repasser sudo update-grub et redémarrer ?

Hors ligne

#20 Le 20/10/2020, à 17:29

Dezta

Re : [Résolu] Problème avec Grub et Apt

@ylag
Je fais ça comment ?

Hors ligne

#21 Le 20/10/2020, à 17:33

Qid

Re : [Résolu] Problème avec Grub et Apt

Dezta a écrit :

@ylag
Je fais ça comment ?

en foutant des # au début de chaque ligne du fichier


"GNU/Linux c'est que du bon mais M$ Windows ce n'est pas si mal"
Référent technique Ubuntu d'un Groupe d'Utilisateur du Libre
plus d'info sur mon profil

Hors ligne

#22 Le 20/10/2020, à 17:35

ylag

Re : [Résolu] Problème avec Grub et Apt

Bonjour,

Soit tu édites le fichier et en commente toutes les lignes non-commentées, soit tu déplaces le fichier dans un autre répertoire (ton /home, par exemple):

sudo mv /etc/grub.d/42_custom_proxy ~/42_custom_proxy

...puis sudo update-grub suivi d'une tentative de redémarrage?

Édit: suis plutôt les proposiitions de @nany, qui s'y connaît passablement plus que moi en ce domaine. smile

A+

Dernière modification par ylag (Le 20/10/2020, à 17:40)

Hors ligne

#23 Le 20/10/2020, à 17:35

nany

Re : [Résolu] Problème avec Grub et Apt

Bon, allons-y :

sudo find /etc/grub.d -maxdepth 1 -type f ! -name README -delete
sudo cp -vt /etc/grub.d /etc/grub.d/backup/etc_grub_d/*
find /etc/grub.d -maxdepth 1 -type f ! -name README -exec sudo chmod -c +x '{}' \;
sudo update-grub

Hors ligne

#24 Le 20/10/2020, à 17:38

Qid

Re : [Résolu] Problème avec Grub et Apt

nany a écrit :

Bon, allons-y :

sudo find /etc/grub.d -maxdepth 1 -type f ! -name README -delete
sudo cp -vt /etc/grub.d /etc/grub.d/backup/etc_grub_d/*
find /etc/grub.d -maxdepth 1 -type f ! -name README -exec sudo chmod -c +x '{}' \;
sudo update-grub

à tes souhaits
un peu de pédagogie et donc d'explication serait les bienvenues wink


"GNU/Linux c'est que du bon mais M$ Windows ce n'est pas si mal"
Référent technique Ubuntu d'un Groupe d'Utilisateur du Libre
plus d'info sur mon profil

Hors ligne

#25 Le 20/10/2020, à 17:50

Dezta

Re : [Résolu] Problème avec Grub et Apt

sudo update-grub
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Création du fichier de configuration GRUB…
Image Linux trouvée : /boot/vmlinuz-5.4.0-48-generic
Image mémoire initiale trouvée : /boot/initrd.img-5.4.0-48-generic
Image Linux trouvée : /boot/vmlinuz-5.4.0-47-generic
Image mémoire initiale trouvée : /boot/initrd.img-5.4.0-47-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
Windows 7 trouvé sur /dev/sda1
Windows 7 trouvé sur /dev/sda2
Ubuntu 16.04.6 LTS (16.04) trouvé sur /dev/sda4
fait

wink
https://youtu.be/qWX5f0HTx8U

Hors ligne