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 29/09/2022, à 14:11

JulesBalarate

[Résolu] Mise à niveau 20.04->22.04 problématique

Hello

J'ai accepté la mise à niveau mais elle ne s'est pas bien passée.
Dans un premier temps j'ai eu disparition de l'affichage de Grub, et non redémarrage du serveur graphique. J'ai cherché à le forcer dans le TTY2 avec "startx" mais il était en erreur. De plus ça bouclait et me ramenait sans cesse sur le TTY1. J'ai laissé passer la nuit.
Ce matin Ubuntu s'est lancé avec l'affichage graphique mais à une résolution d'écran petite, problème que j'ai résolu en désactivant le pilote Nvidia 170 pour Nouveau. Puis j'ai été examiner Grub et là carnage: beaucoup d'entrées, et en double !
J'ai d'abord tenté de purger complètement grub avant de le réinstaller, mais au redémarrage je suis tombé sur Grub rescue. Un coup de "ls" m'a donné 12 partitions. J'ai cherché la bonne partition (File system is ext 2) afin de tenter de booter dessus mais il a refusé.
Depuis un live, Boot Repair refuse également toute réparation
J'ai mis le rapport ici:
http://62.4.21.253/other/Boot-Info_20220929_1115.txt
ou
http://62.4.21.253/other/Boot-Info_20220929_1115.odt
Quelqu'un saurait m'aider à décrypter ce rapport s'il vous plaît ?
Merci d'avance

Ma config: Carte mère Gigabyte Ryzen7 Nvidia 1050 SSD /dev/sda + raid1 logiciel + volume Windows HDD

Dernière modification par Ayral (Le 16/10/2022, à 11:53)


Xunbuntu 22.04 sur Azus TUFgaming B450-plus II Ryzen7 et nv1050ti

Le secret du bonheur n'est peut-être pas forcement de faire ce que l'on aime mais plus sûrement d'aimer ce que l'on fait

Hors ligne

#2 Le 29/09/2022, à 14:16

xubu1957

Re : [Résolu] Mise à niveau 20.04->22.04 problématique

Bonjour,

Collage du Boot-repair, pour les spécialistes :

boot-repair-4ppa200                                              [20220929_1115]

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

 => Syslinux MBR (5.00 and higher) is installed in the MBR of /dev/sda.
 => Grub2 (v2.00) is installed in the MBR of /dev/sdb and looks at sector 1 of 
    the same hard drive for core.img. core.img is at this location and looks 
    for /boot/grub. It also embeds following components:
    
    modules
    ---------------------------------------------------------------------------
    fshelp ext2 part_msdos biosdisk search_fs_uuid
    ---------------------------------------------------------------------------
    
    config script
    ---------------------------------------------------------------------------
    search.fs_uuid 864cd655-970d-420f-8541-5a9a55368263 root hd0,msdos5 
    set prefix=($root)'/boot/grub'
    
    ---------------------------------------------------------------------------
 => Grub2 (v2.00) is installed in the MBR of /dev/sdc and looks at sector 1 of 
    the same hard drive for core.img. core.img is at this location and looks 
    for /boot/grub. It also embeds following components:
    
    modules
    ---------------------------------------------------------------------------
    fshelp ext2 part_msdos biosdisk search_fs_uuid
    ---------------------------------------------------------------------------
    
    config script
    ---------------------------------------------------------------------------
    search.fs_uuid 864cd655-970d-420f-8541-5a9a55368263 root hd0,msdos5 
    set prefix=($root)'/boot/grub'
    
    ---------------------------------------------------------------------------
 => Grub2 (v2.00) is installed in the MBR of /dev/sdd and looks at sector 1 of 
    the same hard drive for core.img. core.img is at this location and looks 
    for /boot/grub. It also embeds following components:
    
    modules
    ---------------------------------------------------------------------------
    fshelp ext2 part_msdos biosdisk search_fs_uuid
    ---------------------------------------------------------------------------
    
    config script
    ---------------------------------------------------------------------------
    search.fs_uuid 864cd655-970d-420f-8541-5a9a55368263 root hd0,msdos5 
    set prefix=($root)'/boot/grub'
    
    ---------------------------------------------------------------------------

sda1: __________________________________________________________________________

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

sda2: __________________________________________________________________________

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

sda5: __________________________________________________________________________

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

sdb1: __________________________________________________________________________

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

sdb2: __________________________________________________________________________

    File system:       ntfs
    Boot sector type:  Windows 8/10/11/2012: NTFS
    Boot sector info:  No errors found in the Boot Parameter Block.
    Operating System:  Windows 8 or 10
    Boot files:        /bootmgr /Boot/BCD /Windows/System32/winload.exe

sdb3: __________________________________________________________________________

    File system:       ntfs
    Boot sector type:  Windows 8/10/11/2012: NTFS
    Boot sector info:  No errors found in the Boot Parameter Block.
    Operating System:  
    Boot files:        

sdb4: __________________________________________________________________________

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

sdc1: __________________________________________________________________________

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

sdd1: __________________________________________________________________________

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

md/1: __________________________________________________________________________

    File system:       ext4
    Boot sector type:  -
    Boot sector info: 
    Mounting failed:   mount: /mnt/BootInfo/MDRaid/md/1: /dev/md1 déjà monté sur /mnt/boot-sav/md1.

sde: ___________________________________________________________________________

    File system:       iso9660
    Boot sector type:  Grub2 (v1.99-2.00)
    Boot sector info:  Grub2 (v1.99-2.00) is installed in the boot sector of 
                       sde and looks at sector 0 of the same hard drive for 
                       core.img, but core.img can not be found at this 
                       location.
    Mounting failed:   mount: /mnt/BootInfo/FD/sde: /dev/sde déjà monté ou point de montage actif.


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

OS#1:   Ubuntu 22.04.1 LTS on sda5
OS#2:   Windows 10 (boot) on sdb1
OS#3:   Windows 10 on sdb2

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

CPU architecture: 64-bit
Video: GP107 [GeForce GTX 1050 Ti] from NVIDIA Corporation
Live-session OS is Ubuntu 64-bit (Ubuntu 22.04.1 LTS, jammy, x86_64)

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

BIOS/UEFI firmware: F2(5.12) from American Megatrends Inc.
The firmware seems EFI-compatible, but this live-session is in Legacy/BIOS/CSM mode (not in EFI mode).



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

Disks info: ____________________________________________________________________

sda	: notGPT,	no-BIOSboot,	has-noESP, 	not-usb,	not-mmc, has-os,	no-wind,	2048 sectors * 512 bytes
sdb	: notGPT,	no-BIOSboot,	has-noESP, 	not-usb,	not-mmc, has-os,	has-win,	2048 sectors * 512 bytes
sdc	: notGPT,	no-BIOSboot,	has-noESP, 	not-usb,	not-mmc, no-os,	no-wind,	2048 sectors * 512 bytes
sdd	: notGPT,	no-BIOSboot,	has-noESP, 	not-usb,	not-mmc, no-os,	no-wind,	2048 sectors * 512 bytes

Partitions info (1/3): _________________________________________________________

sda5	: is-os,	64, apt-get,	grub-pc ,	grub2,	grub-install,	grubenv-ok,	update-grub,	farbios
sdb1	: is-os,	32, nopakmgr,	no-docgrub,	nogrub,	nogrubinstall,	no-grubenv,	noupdategrub,	not-far
sdb2	: is-os,	32, nopakmgr,	no-docgrub,	nogrub,	nogrubinstall,	no-grubenv,	noupdategrub,	farbios
sdb3	: no-os,	32, nopakmgr,	no-docgrub,	nogrub,	nogrubinstall,	no-grubenv,	noupdategrub,	farbios
md1	: no-os,	32, nopakmgr,	no-docgrub,	nogrub,	nogrubinstall,	no-grubenv,	noupdategrub,	not-far

Partitions info (2/3): _________________________________________________________

sda5	: isnotESP,	fstab-without-efi,	no-nt,	no-winload,	no-recov-nor-hid,	no-bmgr,	notwinboot
sdb1	: isnotESP,	part-has-no-fstab,	no-nt,	no-winload,	no-recov-nor-hid,	bootmgr,	is-winboot
sdb2	: isnotESP,	part-has-no-fstab,	no-nt,	haswinload,	no-recov-nor-hid,	bootmgr,	is-winboot
sdb3	: isnotESP,	part-has-no-fstab,	no-nt,	no-winload,	no-recov-nor-hid,	no-bmgr,	notwinboot
md1	: isnotESP,	part-has-no-fstab,	no-nt,	no-winload,	no-recov-nor-hid,	no-bmgr,	notwinboot

Partitions info (3/3): _________________________________________________________

sda5	: not--sepboot,	with-boot,	fstab-without-boot,	not-sep-usr,	with--usr,	fstab-without-usr,	customized,	sda
sdb1	: not--sepboot,	no---boot,	part-has-no-fstab,	not-sep-usr,	no---usr,	part-has-no-fstab,	no--grub.d,	sdb
sdb2	: not--sepboot,	no---boot,	part-has-no-fstab,	not-sep-usr,	no---usr,	part-has-no-fstab,	no--grub.d,	sdb
sdb3	: not--sepboot,	no---boot,	part-has-no-fstab,	not-sep-usr,	no---usr,	part-has-no-fstab,	no--grub.d,	sdb
md1	: maybesepboot,	no---boot,	part-has-no-fstab,	not-sep-usr,	no---usr,	part-has-no-fstab,	no--grub.d,	sda

fdisk -l (filtered): ___________________________________________________________

Disk sda: 111.79 GiB, 120034123776 bytes, 234441648 sectors
Disk identifier: 0x0007bd47
      Boot    Start       End   Sectors   Size Id Type
sda1           2048  11718655  11716608   5.6G 82 Linux swap / Solaris
sda2       11720702 234440993 222720292 106.2G  5 Extended
sda5  *    11720704 234440703 222720000 106.2G 83 Linux
Disk sdb: 465.76 GiB, 500107862016 bytes, 976773168 sectors
Disk identifier: 0xaf8c9e45
      Boot     Start       End   Sectors   Size Id Type
sdb1  *         2048    104447    102400    50M  7 HPFS/NTFS/exFAT
sdb2          104448 965959039 965854592 460.6G  7 HPFS/NTFS/exFAT
sdb3       965959680 967006207   1046528   511M 27 Hidden NTFS WinRE
sdb4       967008256 976773119   9764864   4.7G 82 Linux swap / Solaris
Disk sdc: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk identifier: 0xe3eaa4f9
      Boot Start        End    Sectors   Size Id Type
sdc1        2048 1953523711 1953521664 931.5G fd Linux raid autodetect
Disk sdd: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk identifier: 0x9bbb887d
      Boot Start        End    Sectors   Size Id Type
sdd1        2048 1953523711 1953521664 931.5G fd Linux raid autodetect
Disk sde: 14.46 GiB, 15525216256 bytes, 30322688 sectors
Disk identifier: 4DFFD6B8-661A-469C-8D23-526E4A373B04
        Start      End  Sectors  Size Type
sde1       64  4825603  4825540  2.3G Microsoft basic data
sde2  4825604  4834099     8496  4.1M EFI System
sde3  4834100  4834699      600  300K Microsoft basic data
sde4  4837376 30322624 25485249 12.2G Linux filesystem
Disk md1: 931.39 GiB, 1000068874240 bytes, 1953259520 sectors

parted -lm (filtered): _________________________________________________________

sda:120GB:scsi:512:512:msdos:ATA KINGSTON SH103S3:;
1:1049kB:6000MB:5999MB:linux-swap(v1)::;
2:6001MB:120GB:114GB:::;
5:6001MB:120GB:114GB:ext4::boot;
sdb:500GB:scsi:512:4096:msdos:ATA ST500DM002-1BD14:;
1:1049kB:53.5MB:52.4MB:ntfs::boot;
2:53.5MB:495GB:495GB:ntfs::;
3:495GB:495GB:536MB:ntfs::msftres;
4:495GB:500GB:5000MB:linux-swap(v1)::;
sdc:1000GB:scsi:512:4096:msdos:ATA WDC WD10EZEX-00M:;
1:1049kB:1000GB:1000GB:ext4::raid;
sdd:1000GB:scsi:512:4096:msdos:ATA WDC WD10EZEX-00M:;
1:1049kB:1000GB:1000GB:ext4::raid;
sde:15.5GB:scsi:512:512:gpt:Verbatim STORE N GO:;
1:32.8kB:2471MB:2471MB::ISO9660:hidden, msftdata;
2:2471MB:2475MB:4350kB::Appended2:boot, esp;
3:2475MB:2475MB:307kB::Gap1:hidden, msftdata;
4:2477MB:15.5GB:13.0GB:ext4::;
md1:1000GB:md:512:4096:loop:Linux Software RAID Array:;
1:0.00B:1000GB:1000GB:ext4::;

blkid (filtered): ______________________________________________________________

NAME    FSTYPE            UUID                                 PARTUUID                             LABEL                     PARTLABEL
sda                                                                                                                           
├─sda1  swap              81e49923-7d19-4c45-9322-ef9f0a1044a0 0007bd47-01                                                    
├─sda2                                                         0007bd47-02                                                    
└─sda5  ext4              864cd655-970d-420f-8541-5a9a55368263 0007bd47-05                                                    
sdb                                                                                                                           
├─sdb1  ntfs              CC16DBB816DBA22E                     af8c9e45-01                          Réservé au système        
├─sdb2  ntfs              1670DED670DEBC25                     af8c9e45-02                                                    
├─sdb3  ntfs              DC1A4A9D1A4A7514                     af8c9e45-03                                                    
└─sdb4  swap              7134435a-50fc-49ec-9572-6d87fd8f397a af8c9e45-04                                                    
sdc                                                                                                                           
└─sdc1  linux_raid_member a2452b9b-6fb5-cb65-ba19-8029f4e8b993 e3eaa4f9-01                          jules-H61H2-LM3:1         
  └─md1 ext4              ef802547-a320-4681-9f31-d5b1f21b2bbb                                                                
sdd                                                                                                                           
└─sdd1  linux_raid_member a2452b9b-6fb5-cb65-ba19-8029f4e8b993 9bbb887d-01                          jules-H61H2-LM3:1         
  └─md1 ext4              ef802547-a320-4681-9f31-d5b1f21b2bbb                                                                
sde     iso9660           2022-08-10-18-35-19-00                                                    Xubuntu 22.04.1 LTS amd64 
├─sde1  iso9660           2022-08-10-18-35-19-00               4dffd6b8-661a-469c-8d22-526e4a373b04 Xubuntu 22.04.1 LTS amd64 ISO9660
├─sde2  vfat              8D6C-A9F8                            4dffd6b8-661a-469c-8d21-526e4a373b04 ESP                       Appended2
├─sde3                                                         4dffd6b8-661a-469c-8d20-526e4a373b04                           Gap1
└─sde4  ext4              971c294f-e4e5-4df6-b67b-b0f9e79b5c96 73929488-aea4-6745-8a67-56ac29e4b184 writable                  

Mount points (filtered): _______________________________________________________

                                                               Avail Use% Mounted on
/dev/disk/by-label/writable[/install-logs-2022-09-29.0/crash]  11.2G   0% /var/crash
/dev/disk/by-label/writable[/install-logs-2022-09-29.0/log]    11.2G   0% /var/log
/dev/md1                                                      187.6G  74% /mnt/boot-sav/md1
/dev/sda5                                                      29.7G  66% /media/xubuntu/864cd655-970d-420f-8541-5a9a55368263
/dev/sdb1                                                      23.7M  53% /mnt/boot-sav/sdb1
/dev/sdb2                                                     408.8G  11% /mnt/boot-sav/sdb2
/dev/sdb3                                                      86.4M  83% /mnt/boot-sav/sdb3
/dev/sde1                                                          0 100% /cdrom

Mount options (filtered): ______________________________________________________

/dev/disk/by-label/writable[/install-logs-2022-09-29.0/crash] ext4            rw,relatime
/dev/disk/by-label/writable[/install-logs-2022-09-29.0/log]   ext4            rw,relatime
/dev/md1                                                      ext4            rw,relatime
/dev/sda5                                                     ext4            rw,nosuid,nodev,relatime,errors=remount-ro
/dev/sdb1                                                     fuseblk         rw,relatime,user_id=0,group_id=0,allow_other,blksize=4096
/dev/sdb2                                                     fuseblk         rw,relatime,user_id=0,group_id=0,allow_other,blksize=4096
/dev/sdb3                                                     fuseblk         rw,relatime,user_id=0,group_id=0,allow_other,blksize=4096
/dev/sde1                                                     iso9660         ro,noatime,nojoliet,check=s,map=n,blocksize=2048,iocharset=utf8

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

Ubuntu, with Linux 5.19.5-051905-generic   864cd655-970d-420f-8541-5a9a55368263
Ubuntu, with Linux 5.15.0-48-generic   864cd655-970d-420f-8541-5a9a55368263
Ubuntu, with Linux 5.4.0-74-generic   864cd655-970d-420f-8541-5a9a55368263
Ubuntu, with Linux 5.19.5-051905-generic   864cd655-970d-420f-8541-5a9a55368263
Ubuntu, with Linux 5.15.0-48-generic   864cd655-970d-420f-8541-5a9a55368263
Ubuntu, with Linux 5.4.0-74-generic   864cd655-970d-420f-8541-5a9a55368263
### END /etc/grub.d/30_os-prober_proxy ###
Xubuntu 20.04   864cd655-970d-420f-8541-5a9a55368263
Windows 10   CC16DBB816DBA22E

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

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda5 during installation
UUID=864cd655-970d-420f-8541-5a9a55368263 /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda1 during installation
UUID=81e49923-7d19-4c45-9322-ef9f0a1044a0 none            swap    sw              0       0
/dev/md1 /media/jules/reserve ext4 rw,nosuid,nodev,uhelper=udisks2 0 0

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

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

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

           GiB - GB             File                                 Fragment(s)
  10,106594086 = 10,851872768   boot/grub/grub.cfg                             1
  10,106571198 = 10,851848192   boot/grub/i386-pc/core.img                     1
  99,648502350 = 106,996764672  boot/vmlinuz                                   1
  99,648502350 = 106,996764672  boot/vmlinuz-5.15.0-48-generic                 1
  96,123325348 = 103,211634688  boot/vmlinuz-5.19.5-051905-generic             2
  24,461990356 = 26,265862144   boot/vmlinuz-5.4.0-74-generic                  8
  96,123325348 = 103,211634688  boot/vmlinuz.old                               2
  65,308887482 = 70,124883968   boot/initrd.img                                5
  65,308887482 = 70,124883968   boot/initrd.img-5.15.0-48-generic              5
  93,487300873 = 100,381224960  boot/initrd.img-5.19.5-051905-generic          8
 107,703517914 = 115,645771776  boot/initrd.img-5.4.0-74-generic               2
  93,487300873 = 100,381224960  boot/initrd.img.old                            8

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

-rwxr-xr-x 1 root root   926 Sep 29 06:56 10_linux_proxy
-rwxr-xr-x 1 root root   930 Sep 29 06:56 13_linux.bak_proxy
-rwxr-xr-x 1 root root 43031 Apr 15 21:50 14_linux_zfs
-rwxr-xr-x 1 root root 14180 Apr 15 21:50 20_linux_xen
-rwxr-xr-x 1 root root  2924 Feb  6  2022 21_memtest86+
-rwxr-xr-x 1 root root   314 Sep 29 06:56 30_os-prober_proxy
-rwxr-xr-x 1 root root   220 Sep 29 06:56 40_custom_proxy
-rwxr-xr-x 1 root root  1372 Apr 15 21:50 43_uefi-firmware
-rwxr-xr-x 1 root root   700 Feb 21  2022 44_fwupd
-rwxr-xr-x 1 root root   220 Sep 29 06:56 45_custom_proxy
-rwxr-xr-x 1 root root   215 Apr 15 21:50 46_custom
drwxr-xr-x 4 root root  4096 Nov 26  2021 backup
drwxr-xr-x 2 root root  4096 Nov 26  2021 bin
drwxr-xr-x 2 root root  4096 Sep 29 06:56 proxifiedScripts

====================== sda5/etc/grub.d/13_linux.bak_proxy ======================

#!/bin/sh
#THIS IS A GRUB PROXY SCRIPT
'/etc/grub.d/proxifiedScripts/linux.bak' | /etc/grub.d/bin/grubcfg_proxy "+*
+'SUBMENU' as 'Advanced options for Ubuntu'{+'Advanced options for Ubuntu'/*, +'Advanced options for Ubuntu'/'Ubuntu, with Linux 5.19.5-051905-generic'~ede4202abd2fca73f958707b8e4601d4~, +'Advanced options for Ubuntu'/'Ubuntu, with Linux 5.19.5-051905-generic (recovery mode)'~2a0956d4b90232fd071246f88513422d~, +'Advanced options for Ubuntu'/'Ubuntu, with Linux 5.15.0-48-generic'~ec77d63947f2e622e7adc2dd2b5b59a0~, +'Advanced options for Ubuntu'/'Ubuntu, with Linux 5.15.0-48-generic (recovery mode)'~1577149b1887912fbebf521beab047a0~, +'Advanced options for Ubuntu'/'Ubuntu, with Linux 5.4.0-74-generic'~d28afc0213540b50b67eaa82d52f9a35~, +'Advanced options for Ubuntu'/'Ubuntu, with Linux 5.4.0-74-generic (recovery mode)'~5c517227762a1c2bf1330fbb21358f83~}
+#text
-'Ubuntu'~c3d6ac1c1eb953f115642fe7d0427c6b~
"

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

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

======================= 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 "-'Windows 10'~e620cd1f50eeb7025f6d09c9ab68f2e5~
+*
+#text
+'Xubuntu 20.04'~6007f815199737f3e84fc15dbe47d8b3~
"

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

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

=========================== sda5/etc/grub.d/44_fwupd ===========================

#! /bin/sh
# SPDX-License-Identifier: LGPL-2.1+
set -e
[ -d ${pkgdatadir:?} ]
# shellcheck source=/dev/null
. "$pkgdatadir/grub-mkconfig_lib"
if [ -f /var/lib/fwupd/uefi_capsule.conf ] &&
   ls /sys/firmware/efi/efivars/fwupd-*-0abba7dc-e516-4167-bbf5-4d9d1c739416 1>/dev/null 2>&1; then
      . /var/lib/fwupd/uefi_capsule.conf
      if [ "${EFI_PATH}" != "" ] && [ "${ESP}" != "" ]; then
      echo "Adding Linux Firmware Updater entry" >&2
cat << EOF
menuentry 'Linux Firmware Updater' \$menuentry_id_option 'fwupd' {
EOF
      ${grub_probe:?}
      prepare_grub_to_access_device '`${grub_probe} --target=device \${ESP}` | sed -e "s/^/\t/"'
cat << EOF
	chainloader ${EFI_PATH}
}
EOF
      fi
fi

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

#!/bin/sh
#THIS IS A GRUB PROXY SCRIPT
'/etc/grub.d/proxifiedScripts/custom' | /etc/grub.d/bin/grubcfg_proxy "-*
-#text
-'Xubuntu 20.04'~6007f815199737f3e84fc15dbe47d8b3~
+'Windows 10'~e620cd1f50eeb7025f6d09c9ab68f2e5~
"


=================== blkid (filtered) before raid activation ====================

/dev/sda5: UUID="864cd655-970d-420f-8541-5a9a55368263" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="0007bd47-05"
/dev/sdb1: LABEL="RM-CM-)servM-CM-) au systM-CM-(me" BLOCK_SIZE="512" UUID="CC16DBB816DBA22E" TYPE="ntfs" PARTUUID="af8c9e45-01"
/dev/sdb2: BLOCK_SIZE="512" UUID="1670DED670DEBC25" TYPE="ntfs" PARTUUID="af8c9e45-02"
/dev/sdb3: BLOCK_SIZE="512" UUID="DC1A4A9D1A4A7514" TYPE="ntfs" PARTUUID="af8c9e45-03"
/dev/sdc1: UUID="a2452b9b-6fb5-cb65-ba19-8029f4e8b993" UUID_SUB="9593d318-f44e-7c5a-ee25-71032b25db07" LABEL="jules-H61H2-LM3:1" TYPE="linux_raid_member" PARTUUID="e3eaa4f9-01"
/dev/sdd1: UUID="a2452b9b-6fb5-cb65-ba19-8029f4e8b993" UUID_SUB="97d47951-7298-f6a4-7769-36ffa1434008" LABEL="jules-H61H2-LM3:1" TYPE="linux_raid_member" PARTUUID="9bbb887d-01"
/dev/sde1: BLOCK_SIZE="2048" UUID="2022-08-10-18-35-19-00" LABEL="Xubuntu 22.04.1 LTS amd64" TYPE="iso9660" PARTLABEL="ISO9660" PARTUUID="4dffd6b8-661a-469c-8d22-526e4a373b04"
/dev/sdb4: UUID="7134435a-50fc-49ec-9572-6d87fd8f397a" TYPE="swap" PARTUUID="af8c9e45-04"
/dev/sde2: SEC_TYPE="msdos" LABEL_FATBOOT="ESP" LABEL="ESP" UUID="8D6C-A9F8" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="Appended2" PARTUUID="4dffd6b8-661a-469c-8d21-526e4a373b04"
/dev/sde4: LABEL="writable" UUID="971c294f-e4e5-4df6-b67b-b0f9e79b5c96" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="73929488-aea4-6745-8a67-56ac29e4b184"
/dev/sda1: UUID="81e49923-7d19-4c45-9322-ef9f0a1044a0" TYPE="swap" PARTUUID="0007bd47-01"
/dev/md1: UUID="ef802547-a320-4681-9f31-d5b1f21b2bbb" BLOCK_SIZE="4096" TYPE="ext4"
/dev/sde3: PARTLABEL="Gap1" PARTUUID="4dffd6b8-661a-469c-8d20-526e4a373b04"


==================================== mdadm =====================================
mdadm --assemble --scan

mdadm --detail --scan
ARRAY /dev/md/1 metadata=1.2 name=jules-H61H2-LM3:1 UUID=a2452b9b:6fb5cb65:ba198029:f4e8b993


Suggested repair: ______________________________________________________________

The default repair of the Boot-Repair utility would purge (in order to enable-raid) and reinstall the grub2 of
sda5 into the MBR of sda.
Grub-efi would not be selected by default because no ESP detected.
Additional repair would be performed: unhide-bootmenu-10s

Final advice in case of suggested repair: ______________________________________

Please do not forget to make your BIOS boot on sda (ATA KINGSTON SH103S3) disk!

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

Hors ligne

#3 Le 29/09/2022, à 14:26

geole

Re : [Résolu] Mise à niveau 20.04->22.04 problématique

Bonjour
Je vois que tu as plein de noyaux  ( avec des lignes en double!!!!)

====================== sda5/boot/grub/grub.cfg (filtered) ======================
Ubuntu, with Linux 5.19.5-051905-generic   864cd655-970d-420f-8541-5a9a55368263
Ubuntu, with Linux 5.15.0-48-generic   864cd655-970d-420f-8541-5a9a55368263
Ubuntu, with Linux 5.4.0-74-generic   864cd655-970d-420f-8541-5a9a55368263
Ubuntu, with Linux 5.19.5-051905-generic   864cd655-970d-420f-8541-5a9a55368263
Ubuntu, with Linux 5.15.0-48-generic   864cd655-970d-420f-8541-5a9a55368263
Ubuntu, with Linux 5.4.0-74-generic   864cd655-970d-420f-8541-5a9a55368263
### END /etc/grub.d/30_os-prober_proxy ###
Xubuntu 20.04   864cd655-970d-420f-8541-5a9a55368263
Windows 10   CC16DBB816DBA22E

Normalement le grub s'affiche. Comme tu dis que la mise à niveau ne s'est pas terminée, il faut la finir en bootant  avec un ancien noyau.
Voir chapitre  10 de https://doc.ubuntu-fr.org/migration#mis … efectueuse

sudo dpkg --configure -a
sudo apt-get -f install
sudo apt upgrade
sudo apt full-upgrade

Tu as effectivement un certain nombre de partitions mais que neuf

blkid (filtered): ______________________________________________________________
NAME    FSTYPE            UUID                                 PARTUUID                             LABEL                     PARTLABEL
├─sda1  swap              81e49923-7d19-4c45-9322-ef9f0a1044a0 0007bd47-01                                                    
├─sda2                                                         0007bd47-02                                                    
└─sda5  ext4              864cd655-970d-420f-8541-5a9a55368263 0007bd47-05                                                    
├─sdb1  ntfs              CC16DBB816DBA22E                     af8c9e45-01                          Réservé au système        
├─sdb2  ntfs              1670DED670DEBC25                     af8c9e45-02                                                    
├─sdb3  ntfs              DC1A4A9D1A4A7514                     af8c9e45-03                                                    
└─sdb4  swap              7134435a-50fc-49ec-9572-6d87fd8f397a af8c9e45-04                                                    
└─sdc1  linux_raid_member a2452b9b-6fb5-cb65-ba19-8029f4e8b993 e3eaa4f9-01                          jules-H61H2-LM3:1                                                                     
└─sdd1  linux_raid_member a2452b9b-6fb5-cb65-ba19-8029f4e8b993 9bbb887d-01                          jules-H61H2-LM3:1       
 

   

Cependant, boot-repair propose une bonne réparation   

Suggested repair: ______________________________________________________________

The default repair of the Boot-Repair utility would purge (in order to enable-raid) and reinstall the grub2 of sda5 into the MBR of sda.
Grub-efi would not be selected by default because no ESP detected.
Additional repair would be performed: unhide-bootmenu-10s

Final advice in case of suggested repair: ______________________________________
Please do not forget to make your BIOS boot on sda (ATA KINGSTON SH103S3) disk!      

car

 ============================== Boot Info Summary ===============================
 => Syslinux MBR (5.00 and higher) is installed in the MBR of /dev/sda.

Mais tu peux booter par n'importe lequel des autres disques

 => Grub2 (v2.00) is installed in the MBR of /dev/sdb 
search.fs_uuid 864cd655-970d-420f-8541-5a9a55368263 root hd0,msdos5 
 ---------------------------------------------------------------------------
 => Grub2 (v2.00) is installed in the MBR of /dev/sdc 
    search.fs_uuid 864cd655-970d-420f-8541-5a9a55368263 root hd0,msdos5 
    ---------------------------------------------------------------------------
 => Grub2 (v2.00) is installed in the MBR of /dev/sdd
       search.fs_uuid 864cd655-970d-420f-8541-5a9a55368263 root hd0,msdos5 

Dernière modification par geole (Le 29/09/2022, à 14:47)


Les grilles de l'installateur https://doc.ubuntu-fr.org/tutoriel/inst … _subiquity
"gedit admin:///etc/fstab" est proscrit,  utilisez "pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY xdg-open /etc/fstab" Voir  https://doc.ubuntu-fr.org/gedit
Les partitions EXT4 des disques externes => https://forum.ubuntu-fr.org/viewtopic.p … #p22697248

En ligne

#4 Le 29/09/2022, à 15:43

Xzu Rukneg

Re : [Résolu] Mise à niveau 20.04->22.04 problématique

J'ai accepté la mise à niveau mais elle ne s'est pas bien passée.

Bonjour.
Désolé, juste un rappel: toujours avoir 2 partitions systèmes, l'ancienne LTS sur l'une, la nouvelle sur l'autre. Et comme ça, jamais de mise a niveau de la distribution: résout TOUS les problème de mise à niveau, et le jour où ton système a un problème sérieux, tu retrouve avec bonheur ton ancien système qui sert de secours, et que tu connais bien déjà.
Pour la prochaine fois! wink

Hors ligne

#5 Le 29/09/2022, à 20:10

JulesBalarate

Re : [Résolu] Mise à niveau 20.04->22.04 problématique

Bonjour les gars et merci smile

Problème 1/2 résolu, Grub réinstallé par chroot.
Plus que le pilote de la Nvidia maintenant

[EDIT]
Alors, certains doivent sans doute le savoir mais je l'écris tout de même. Il semblerait que les pilotes Nvidia, enfin: le 470 du moins, soit incompatible avec le noyau 5.19 dont est pourvu Xubuntu 22.04 par défaut, au point d'empêcher Xorg de se lancer, et très mal reconnu par le noyau 5.15 qui vient en second avec Jelly, auquel il confère un affichage très dégradé.
Quand au noyau 5.4 dont est pourvu 20.04, il semble carrément ne pas pouvoir faire tourner Jelly (Kernel Panic)

Dernière modification par JulesBalarate (Le 29/09/2022, à 22:54)


Xunbuntu 22.04 sur Azus TUFgaming B450-plus II Ryzen7 et nv1050ti

Le secret du bonheur n'est peut-être pas forcement de faire ce que l'on aime mais plus sûrement d'aimer ce que l'on fait

Hors ligne

#6 Le 01/10/2022, à 16:32

Xzu Rukneg

Re : [Résolu] Mise à niveau 20.04->22.04 problématique

Plus que le pilote de la Nvidia maintenant

Typiquement le genre de (vieux) problèmes de mise à niveau qu'on évite par une installe fraîche!

Hors ligne

#7 Le 01/10/2022, à 16:34

xubu1957

Re : [Résolu] Mise à niveau 20.04->22.04 problématique

Bonjour,

Ou utiliser le gestionnaire_de_pilotes_proprietaires !

En commande :

ubuntu-drivers devices

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

Hors ligne

#8 Le 02/10/2022, à 19:49

JulesBalarate

Re : [Résolu] Mise à niveau 20.04->22.04 problématique

xubu1957 a écrit :

En commande :

ubuntu-drivers devices
ubuntu-drivers devices
== /sys/devices/pci0000:00/0000:00:03.1/0000:09:00.0 ==
modalias : pci:v000010DEd00001C82sv00001458sd00003733bc03sc00i00
vendor   : NVIDIA Corporation
model    : GP107 [GeForce GTX 1050 Ti]
driver   : nvidia-driver-418-server - distro non-free
driver   : nvidia-driver-510 - distro non-free
driver   : nvidia-driver-390 - distro non-free
driver   : nvidia-driver-515-server - distro non-free
driver   : nvidia-driver-510-server - distro non-free
driver   : nvidia-driver-470 - distro non-free
driver   : nvidia-driver-470-server - distro non-free
driver   : nvidia-driver-515 - distro non-free recommended
driver   : nvidia-driver-450-server - distro non-free
driver   : xserver-xorg-video-nouveau - distro free builtin

Le 515 comme le 470 pas (essayé les autres) empêche le serveur graphique de se lancer avec le noyau 5.19, et avec le noyau 5.15 la bonne résolution d'écran n'est pas disponible (trop petite). Quand à mon vieux noyau 5.4 de 20-04 il ne lance tout simplement pas Xubuntu 22.04: kernel panic. Le 5.19 que j'avais essayé sur 20.04 avait aussi une résolution trop petite, donc je pense à une incompatibilité. On a déjà connu cela, non ? smile
De plus j'ai un souci avec VirtualBox: Kernel driver not installed (rc=-1908)
J'ai pourtant:

sudo apt install lsb-core

puis

modprobe vboxdrv

mais

modprobe: FATAL: Module vboxdrv not found in directory /lib/modules/5.19.5-051905-generic

J'ai laissé Apport envoyer le rapport dans /var/crash
J'ai aussi pas mal de petites choses qui sont étranges, par exemple la disparition d'une icône d'un applet qui pourtant fonctionne, et d'autres menues-bricoles que je n'ai pas encore toutes répertoriées.

Pour moi c'est je pense le noyau 5.19 qui est instable.

Je pense donc plutôt essayer d'autre noyaux vers 4.8 - 4.12 dans un premier temps, en attendant un noyau abouti. Et si vraiment ça veux pas je referais une installe, mais bon 20.04 hmm


Xunbuntu 22.04 sur Azus TUFgaming B450-plus II Ryzen7 et nv1050ti

Le secret du bonheur n'est peut-être pas forcement de faire ce que l'on aime mais plus sûrement d'aimer ce que l'on fait

Hors ligne

#9 Le 02/10/2022, à 19:56

xubu1957

Re : [Résolu] Mise à niveau 20.04->22.04 problématique

Bonjour,

Le noyau 5.19, n'est pas utilisé de base > linux-headers-generic

sauf sur la version 22.10 en cours de finition.

Est-ce un noyau amené par mainline ?

> bugs.launchpad.net/ubuntu/+source/linux/+bug/1988605 linux-tools and linux-cloud-tools for ppa mainline kernels

Dernière modification par xubu1957 (Le 02/10/2022, à 19:58)


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

Hors ligne

#10 Le 03/10/2022, à 08:24

JulesBalarate

Re : [Résolu] Mise à niveau 20.04->22.04 problématique

xubu1957 a écrit :

Le noyau 5.19, n'est pas utilisé de base

En fait je peu assurer que cette mise à niveau a apporté les deux kernels, 5.19 incompatible avec les pilotes Nvidia et Virtualbox, et 5.15 quelque chose (autour de 15 crois-je me rappeler) partiellement compatible avec ces mêmes pilotes,  sans Mainline que je n'utilisais pas mais maintenant oui. Merci xubu1957 smile

Je m'en suis sorti en utilisant les dernières versions. Ainsi les noyaux 5.15.70 et 5.18.19 reconnaissent bien tout.
Je m'étonne d'ailleurs que, au moins sur le deuxième kernel, de secours, une mise à niveau ne propose pas une version plus fin de développement, je trouve perso que ça peut décontenancer de casser des trucs fonctionnels comme ça.

Pour moi c'est bon à présent, la mise à niveau est maintenant correcte smile


Xunbuntu 22.04 sur Azus TUFgaming B450-plus II Ryzen7 et nv1050ti

Le secret du bonheur n'est peut-être pas forcement de faire ce que l'on aime mais plus sûrement d'aimer ce que l'on fait

Hors ligne

#11 Le 03/10/2022, à 08:27

xubu1957

Re : [Résolu] Mise à niveau 20.04->22.04 problématique

Bonjour,

Fournis les noyaux présents :

echo; dpkg -l | awk '!/^rc/ && / linux-(c|g|h|i|lo|m|si|t)/{print $1,$2,$3,$4 | "sort -k3V | column -t"}' ; echo -e "\nNoyau courant : $(uname -mr)"

et :

dpkg -l | grep -v ^ii

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

Hors ligne

#12 Le 16/10/2022, à 11:47

JulesBalarate

Re : [Résolu] Mise à niveau 20.04->22.04 problématique

Arf pardon j'étais barré wink

$ echo; dpkg -l | awk '!/^rc/ && / linux-(c|g|h|i|lo|m|si|t)/{print $1,$2,$3,$4 | "sort -k3V | column -t"}' ; echo -e "\nNoyau courant : $(uname -mr)"

ii  linux-headers-5.15.70-051570                 5.15.70-051570.202209231339  all
ii  linux-headers-5.15.70-051570-generic         5.15.70-051570.202209231339  amd64
ii  linux-image-unsigned-5.15.70-051570-generic  5.15.70-051570.202209231339  amd64
ii  linux-modules-5.15.70-051570-generic         5.15.70-051570.202209231339  amd64
ii  linux-headers-5.18.19-051819                 5.18.19-051819.202208211443  all
ii  linux-headers-5.18.19-051819-generic         5.18.19-051819.202208211443  amd64
ii  linux-image-unsigned-5.18.19-051819-generic  5.18.19-051819.202208211443  amd64
ii  linux-modules-5.18.19-051819-generic         5.18.19-051819.202208211443  amd64

Noyau courant : 5.18.19-051819-generic x86_64

Sacrée commande !

Et

$ dpkg -l | grep -v ^ii
Souhait=inconnU/Installé/suppRimé/Purgé/H=à garder
| État=Non/Installé/fichier-Config/dépaqUeté/échec-conFig/H=semi-installé/W=attend-traitement-déclenchements
|/ Err?=(aucune)/besoin Réinstallation (État,Err: majuscule=mauvais)
||/ Nom                                           Version                                    Architecture Description
+++-=============================================-==========================================-============-========================================================================================
rc  ca-certificates-java                          20190909                                   all          Common CA certificates (JKS keystore)
rc  crda                                          3.18-1build1                               amd64        wireless Central Regulatory Domain Agent
rc  fluid-soundfont-gs                            3.1-5.3                                    all          Fluid (R3) General MIDI SoundFont (GS)
rc  fprintd                                       1.94.2-1ubuntu0.22.04.1                    amd64        D-Bus daemon for fingerprint reader access
rc  fuse                                          2.9.9-3                                    amd64        Filesystem in Userspace
rc  gadmin-samba                                  0.3.2-0ubuntu2                             amd64        GTK+ configuration tool for samba
rc  hddtemp                                       0.3-beta15-53                              amd64        hard drive temperature monitoring utility
rc  intel-microcode                               3.20220809.0ubuntu0.22.04.1                amd64        Processor microcode firmware for Intel CPUs
rc  java-common                                   0.72build2                                 all          Base package for Java runtimes
rc  libc6-i386                                    2.31-0ubuntu9.3                            amd64        GNU C Library: 32-bit shared libraries for AMD64
rc  libkf5attica5:amd64                           5.92.0-0ubuntu1                            amd64        Qt library that implements the Open Collaboration Services API
rc  libkf5kdelibs4support-data                    5.92.0-0ubuntu1                            all          Porting aid from KDELibs4.
rc  libmecab2:amd64                               0.996-10build1                             amd64        Libraries of Mecab
rc  libnvidia-compute-460:amd64                   460.91.03-0ubuntu0.20.04.1                 amd64        NVIDIA libcompute package
rc  libnvidia-compute-470:amd64                   470.141.03-0ubuntu0.22.04.1                amd64        NVIDIA libcompute package
rc  libpython3.8-minimal:amd64                    3.8.10-0ubuntu1~20.04.5                    amd64        Minimal subset of the Python language (version 3.8)
rc  libssl1.1:i386                                1.1.1f-1ubuntu2.16                         i386         Secure Sockets Layer toolkit - shared libraries
rc  libvdpau1:i386                                1.4-3build2                                i386         Video Decode and Presentation API for Unix (libraries)
rc  libwrap0:i386                                 7.6.q-31build2                             i386         Wietse Venema's TCP wrappers library
rc  linux-image-5.4.0-70-generic                  5.4.0-70.78                                amd64        Signed kernel image generic
rc  linux-image-5.4.0-73-generic                  5.4.0-73.82                                amd64        Signed kernel image generic
rc  linux-modules-5.4.0-70-generic                5.4.0-70.78                                amd64        Linux kernel extra modules for version 5.4.0 on 64 bit x86 SMP
rc  linux-modules-5.4.0-73-generic                5.4.0-73.82                                amd64        Linux kernel extra modules for version 5.4.0 on 64 bit x86 SMP
rc  linux-modules-extra-5.4.0-73-generic          5.4.0-73.82                                amd64        Linux kernel extra modules for version 5.4.0 on 64 bit x86 SMP
rc  linux-modules-extra-5.4.0-74-generic          5.4.0-74.83                                amd64        Linux kernel extra modules for version 5.4.0 on 64 bit x86 SMP
rc  mysql-server-8.0                              8.0.30-0ubuntu0.20.04.2                    amd64        MySQL database server binaries and system database setup
rc  nvidia-compute-utils-460                      460.91.03-0ubuntu0.20.04.1                 amd64        NVIDIA compute utilities
rc  nvidia-compute-utils-470                      470.141.03-0ubuntu0.22.04.1                amd64        NVIDIA compute utilities
rc  nvidia-dkms-460                               460.91.03-0ubuntu0.20.04.1                 amd64        NVIDIA DKMS package
rc  nvidia-dkms-470                               470.141.03-0ubuntu0.22.04.1                amd64        NVIDIA DKMS package
rc  nvidia-kernel-common-460                      460.91.03-0ubuntu0.20.04.1                 amd64        Shared files used with the kernel module
rc  nvidia-kernel-common-470                      470.141.03-0ubuntu0.22.04.1                amd64        Shared files used with the kernel module
rc  nvidia-prime                                  0.8.17.1                                   all          Tools to enable NVIDIA's Prime
rc  nvidia-settings                               510.47.03-0ubuntu1                         amd64        Tool for configuring the NVIDIA graphics driver
rc  openjdk-11-jre-headless:amd64                 11.0.16+8-0ubuntu1~22.04                   amd64        OpenJDK Java runtime, using Hotspot JIT (headless)
rc  python3.8-minimal                             3.8.10-0ubuntu1~20.04.5                    amd64        Minimal subset of the Python language (version 3.8)
rc  qemu-kvm                                      1:4.2-3ubuntu6.23                          amd64        QEMU Full virtualization on x86 hardware
rc  screen-resolution-extra                       0.18.2                                     all          Extension for the nvidia-settings control panel
rc  thermald                                      2.4.9-1ubuntu0.1                           amd64        Thermal monitoring and controlling daemon
rc  tk8.6                                         8.6.12-1build1                             amd64        Tk toolkit for Tcl and X11 v8.6 - windowing shell

Xunbuntu 22.04 sur Azus TUFgaming B450-plus II Ryzen7 et nv1050ti

Le secret du bonheur n'est peut-être pas forcement de faire ce que l'on aime mais plus sûrement d'aimer ce que l'on fait

Hors ligne