Bug 28555

Summary: draktools error with harddrive disk swap
Product: Mageia Reporter: Jybz <j.biernacki+mga>
Component: RPM PackagesAssignee: Aurelien Oudelet <ouaurelien>
Status: NEW --- QA Contact:
Severity: critical    
Priority: Normal CC: davidwhodgins, fri, lewyssmith, mageia, ouaurelien
Version: 8Keywords: feedback
Target Milestone: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Source RPM: drakxtools-18.45-1.mga8.src.rpm CVE:
Status comment:

Description Jybz 2021-03-08 16:48:08 CET
Hello,

One french user reports an non-working upgrade, after a closer look, I'm unable to find the problem.

Chronologically :
He installs mga7 on his workstation computer.
Did some kernel updates
Add a drive on his motherboard as backup partition, which swap the root /dev/sda2 to /dev/sdb2.
Since, his tools are non-working. The %post section of kernel updates fails with booloader-config script, the grub is not updated since kernel 5.7.x.
He continues to update and upgrades to mga8 yesterday.
With a small root partition, he decides to light up his system and today I found that he was running an "old" mga7 kernel on his mga8 computer.

Some output :
The fstab:
> # Entry for /dev/sda5 :
> UUID=46b92f6c-a53e-45dd-89c1-5aee5fd3396e / ext4 relatime,acl 1 1
> # Entry for /dev/sda1 :
> UUID=AC742A167429E3B4 /media/win_c ntfs-3g defaults,nofail,umask=000 0 0
> # Entry for /dev/sda2 :
> UUID=01D6BECDFC88B880 /media/win_d ntfs-3g defaults,nofail,umask=000 0 0
> none /proc proc defaults 0 0
> # Entry for /dev/sda6 :
> UUID=75877e91-6e1b-477b-8198-105408865b1f swap swap defaults 0 0
lsblk :
> NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
> sda      8:0    0 931,5G  0 disk 
> └─sda1   8:1    0 931,5G  0 part 
> sdb      8:16   0 931,5G  0 disk 
> ├─sdb1   8:17   0 103,8G  0 part /media/win_c
> ├─sdb2   8:18   0 790,9G  0 part /media/win_d
> ├─sdb3   8:19   0     1K  0 part 
> ├─sdb5   8:21   0  11,7G  0 part /
> ├─sdb6   8:22   0   2,1G  0 part [SWAP]
> └─sdb7   8:23   0    23G  0 part 
> sr0     11:0    1  1024M  0 rom 
blkid :
> /dev/sda1: LABEL="HDD Grange" BLOCK_SIZE="512" UUID="5616B20A16B1EADF" TYPE="ntfs" PARTUUID="f5ba43b4-02"
> /dev/sdb1: LABEL="SSD Vial" BLOCK_SIZE="512" UUID="AC742A167429E3B4" TYPE="ntfs" PARTUUID="9b9e8ed8-01"
> /dev/sdb2: LABEL="SSD Cave" BLOCK_SIZE="512" UUID="01D6BECDFC88B880" TYPE="ntfs" PARTUUID="9b9e8ed8-02"
> /dev/sdb5: UUID="46b92f6c-a53e-45dd-89c1-5aee5fd3396e" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="9b9e8ed8-05"
> /dev/sdb6: UUID="75877e91-6e1b-477b-8198-105408865b1f" TYPE="swap" PARTUUID="9b9e8ed8-06"
> /dev/sdb7: UUID="900756b6-bdda-4856-8758-a0bc8c73240c" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="9b9e8ed8-07"

Everything looks good.

sda2 occurencies in /etc with $ grep -Ri "sda2" /etc/* 2>/dev/null
> /etc/fstab:# Entry for /dev/sda2 :
> /etc/fstab.old:# Entry for /dev/sda2 :

The stderr of grub2-mkconfig -o /tmp/grub.cfg
> Création du fichier de configuration GRUB…
> Thème trouvé : /boot/grub2/themes/maggy/theme.txt
> Image Linux trouvée : /boot/vmlinuz-5.10.20-desktop-2.mga8
> Image Linux trouvée : /boot/vmlinuz-5.10.19-desktop-1.mga8
> Image Linux trouvée : /boot/vmlinuz-5.10.19-desktop-1.mga7
> Image Linux trouvée : /boot/vmlinuz-5.7.19-desktop-3.mga7
> Image mémoire initiale trouvée : /boot/initrd-5.7.19-desktop-3.mga7.img
> Image Linux trouvée : /boot/vmlinuz-5.1.14-desktop-1.mga7
> Image mémoire initiale trouvée : /boot/initrd-5.1.14-desktop-1.mga7.img
> Image Linux trouvée : /boot/vmlinuz-desktop
> Image mémoire initiale trouvée : /boot/initrd-desktop.img
> erreur : ../grub-core/disk/diskfilter.c:502:invalid volume.
> erreur : ../grub-core/disk/diskfilter.c:502:invalid volume.
> erreur : ../grub-core/disk/diskfilter.c:502:invalid volume.
> Windows 10 trouvé sur /dev/sdb1
> fait

The content of $ ls -lsah /boot
> total 92M
> 4,0K drwxr-xr-x  5 root root 4,0K mars   8 09:23 ./
> 4,0K drwxr-xr-x 20 root root 4,0K mars   7 21:31 ../
> 240K -rw-r--r--  1 root root 239K févr. 27 01:26 config-5.10.19-desktop-1.mga7
> 240K -rw-r--r--  1 root root 239K févr. 27 00:02 config-5.10.19-desktop-1.mga8
> 240K -rw-r--r--  1 root root 239K mars   5 20:35 config-5.10.20-desktop-2.mga8
> 216K -rw-r--r--  1 root root 214K juin  22  2019 config-5.1.14-desktop-1.mga7
> 232K -rw-r--r--  1 root root 232K oct.  18 18:20 config-5.7.19-desktop-3.mga7
> 4,0K drwxr-xr-x  2 root root 4,0K déc.  26 15:34 dracut/
> 4,0K drwxr-xr-x  3 root root 4,0K mars   7 21:42 EFI/
> 564K -rwxr-xr-x  1 root root 561K mars   7 21:33 gfxmenu*
> 4,0K drwxr-xr-x  6 root root 4,0K mars   8 10:20 grub2/
>  16M -rw-------  1 root root  16M nov.  20 09:40 initrd-5.1.14-desktop-1.mga7.img
>  18M -rw-------  1 root root  18M mars   7 21:58 initrd-5.7.19-desktop-3.mga7.img
>    0 lrwxrwxrwx  1 root root   32 nov.  20 09:41 initrd-desktop.img -> initrd-5.7.19-desktop-3.mga7.img
>    0 lrwxrwxrwx  1 root root   32 nov.  20 09:41 initrd.img -> initrd-5.7.19-desktop-3.mga7.img
> 200K -rw-r--r--  1 root root 198K févr. 27 01:26 symvers-5.10.19-desktop-1.mga7.xz
> 200K -rw-r--r--  1 root root 198K févr. 27 00:02 symvers-5.10.19-desktop-1.mga8.xz
> 200K -rw-r--r--  1 root root 198K mars   5 20:35 symvers-5.10.20-desktop-2.mga8.xz
> 184K -rw-r--r--  1 root root 182K juin  22  2019 symvers-5.1.14-desktop-1.mga7.xz
> 192K -rw-r--r--  1 root root 191K oct.  18 18:20 symvers-5.7.19-desktop-3.mga7.xz
> 4,9M -rw-r--r--  1 root root 4,9M févr. 27 01:26 System.map-5.10.19-desktop-1.mga7
> 4,8M -rw-r--r--  1 root root 4,8M févr. 27 00:02 System.map-5.10.19-desktop-1.mga8
> 4,8M -rw-r--r--  1 root root 4,8M mars   5 20:35 System.map-5.10.20-desktop-2.mga8
> 3,8M -rw-r--r--  1 root root 3,8M juin  22  2019 System.map-5.1.14-desktop-1.mga7
> 4,6M -rw-r--r--  1 root root 4,6M oct.  18 18:20 System.map-5.7.19-desktop-3.mga7
>    0 lrwxrwxrwx  1 root root   29 nov.  20 09:41 vmlinuz -> vmlinuz-5.7.19-desktop-3.mga7
> 6,5M -rw-r--r--  1 root root 6,5M févr. 27 01:26 vmlinuz-5.10.19-desktop-1.mga7
> 7,7M -rw-r--r--  1 root root 7,6M févr. 27 00:02 vmlinuz-5.10.19-desktop-1.mga8
> 7,7M -rw-r--r--  1 root root 7,6M mars   5 20:35 vmlinuz-5.10.20-desktop-2.mga8
> 6,0M -rw-r--r--  1 root root 6,0M juin  22  2019 vmlinuz-5.1.14-desktop-1.mga7
> 6,2M -rw-r--r--  1 root root 6,2M oct.  18 18:20 vmlinuz-5.7.19-desktop-3.mga7
>    0 lrwxrwxrwx  1 root root   29 nov.  20 09:41 vmlinuz-desktop -> vmlinuz-5.7.19-desktop-3.mga7

Here we start to see a problem :
When he forces to replace the kernel package $ urpmi --replacepkg kernel-desktop-5.10.20-2.mga8
>    http://ftp.free.fr/mirrors/mageia.org/distrib/8/x86_64/media/core/updates/kernel-desktop-5.10.20-2.mga8-1-1.mga8.x86_64.rpm
> installation de kernel-desktop-5.10.20-2.mga8-1-1.mga8.x86_64.rpm depuis /var/cache/urpmi/rpms
> Préparation...                   #############################################
>       1/1: kernel-desktop-5.10.20-2.mga8
>                                  #############################################
>       1/1: désinstallation de kernel-desktop-5.10.20-2.mga8-1-1.mga8.x86_64
>                                  #############################################
> The kernel is still installed in postun, probably a reinstall, skipping cleanup.
> INTERNAL ERROR: unknown device sda2
> MDK::Common::Various::internal_error() called from /usr/lib/libDrakX/devices.pm:131
> devices::entry() called from /usr/lib/libDrakX/devices.pm:146
> devices::make() called from /usr/lib/libDrakX/fs/type.pm:268
> fs::type::call_blkid() called from /usr/lib/libDrakX/fs/type.pm:275
> fs::type::type_subpart_from_magic() called from /usr/lib/libDrakX/fsedit.pm:310
> fsedit::get_hds() called from /sbin/bootloader-config:61
> Vous devriez relancer votre ordinateur pour kernel-desktop-5.10.20-2.mga8

there is a "sda2" occurence somewhere.
His computer does not boot with default mga8 kernel, it make a kernel panic as it does not found the root partition, but there is no initrd ramdiskfs.

When opening the drakconf :
> [root@localhost ~]# drakconf
> Too late to run INIT block at /usr/lib64/perl5/vendor_perl/Glib/Object/Introspection.pm line 257.
> Ignore the following Glib::Object::Introspection & Gtk3 warnings
> Subroutine Gtk3::main redefined at /usr/share/perl5/vendor_perl/Gtk3.pm line 539.
> GLib-GObject-CRITICAL **: g_boxed_type_register_static: assertion 'g_type_from_name (name) == 0' failed at /usr/lib64/perl5/DynaLoader.pm line 210.
> GLib-GObject-CRITICAL **: g_boxed_type_register_static: assertion 'g_type_from_name (name) == 0' failed at /usr/lib64/perl5/DynaLoader.pm line 210.
> GLib-GObject-CRITICAL **: g_boxed_type_register_static: assertion 'g_type_from_name (name) == 0' failed at /usr/lib64/perl5/DynaLoader.pm line 210.
> GLib-GObject-CRITICAL **: g_boxed_type_register_static: assertion 'g_type_from_name (name) == 0' failed at /usr/lib64/perl5/DynaLoader.pm line 210.
> "cannot run /usr/sbin/isodumper" since it is not installed [Writing ISO] at /usr/libexec/drakconf line 833.
> Oops, secure memory pool already initialized
> Oops, secure memory pool already initialized
> 
> [Here he waits, then he opened the hardware menu.]
> 
> Ignore the following Glib::Object::Introspection & Gtk3 warnings
> Subroutine Gtk3::main redefined at /usr/share/perl5/vendor_perl/Gtk3.pm line 539.
> INTERNAL ERROR: unknown device sda2
> MDK::Common::Various::internal_error() called from /usr/lib/libDrakX/devices.pm:131
> devices::entry() called from /usr/lib/libDrakX/devices.pm:146
> devices::make() called from /usr/lib/libDrakX/fs/type.pm:268
> fs::type::call_blkid() called from /usr/lib/libDrakX/fs/type.pm:275

I'm not able to go further.

The user will "wait" sometime, helping use to dig deeper, but in the same time he prepares a new usb key for re-installing mageia 8.
> fs::type::type_subpart_from_magic() called from /usr/lib/libDrakX/fsedit.pm:310
> fsedit::get_hds() called from /usr/libexec/drakhardware:389
Jybz 2021-03-08 18:07:34 CET

Hardware: i586 => x86_64

Comment 1 Dave Hodgins 2021-03-08 18:32:21 CET
Check /boot/grub2/install.sh

CC: (none) => davidwhodgins

Comment 2 Dave Hodgins 2021-03-08 18:40:47 CET
Probably the best thing to do is to go through mcc/boot/Set up boot system
to be sure everything is covered. If that fails to fix it then it's a bug
that needs to be fixed.
Comment 3 Aurelien Oudelet 2021-03-08 20:31:47 CET
Thanks reporting this.

On IRC,
We currently be able to generate a proper initrd for 5.10.20-2.mga8 kernel from dracut command.

Assigning to Mageia Tools maintainers.

Source RPM: (none) => drakxtools-18.45-1.mga8.src.rpm
CC: (none) => ouaurelien

Comment 4 Jybz 2021-03-08 20:48:06 CET
Hi Dave,

He can't open the /mmc/boot/set up boot system menu :
> [kien@localhost ~]$ drakconf
> Too late to run INIT block at /usr/lib64/perl5/vendor_perl/Glib/Object/Introspection.pm line 257.
> Ignore the following Glib::Object::Introspection & Gtk3 warnings
> Subroutine Gtk3::main redefined at /usr/share/perl5/vendor_perl/Gtk3.pm line 539.
> GLib-GObject-CRITICAL **: g_boxed_type_register_static: assertion 'g_type_from_name (name) == 0' failed at /usr/lib64/perl5/DynaLoader.pm line 210.
> GLib-GObject-CRITICAL **: g_boxed_type_register_static: assertion 'g_type_from_name (name) == 0' failed at /usr/lib64/perl5/DynaLoader.pm line 210.
> GLib-GObject-CRITICAL **: g_boxed_type_register_static: assertion 'g_type_from_name (name) == 0' failed at /usr/lib64/perl5/DynaLoader.pm line 210.
> GLib-GObject-CRITICAL **: g_boxed_type_register_static: assertion 'g_type_from_name (name) == 0' failed at /usr/lib64/perl5/DynaLoader.pm line 210.
> "cannot run /usr/sbin/isodumper" since it is not installed [Writing ISO] at /usr/libexec/drakconf line 833.
> Oops, secure memory pool already initialized
> Oops, secure memory pool already initialized
> [Try to open]
> Too late to run INIT block at /usr/lib64/perl5/vendor_perl/Glib/Object/Introspection.pm line 257.
> Ignore the following Glib::Object::Introspection & Gtk3 warnings
> Subroutine Gtk3::main redefined at /usr/share/perl5/vendor_perl/Gtk3.pm line 539.
> INTERNAL ERROR: unknown device sda2
> MDK::Common::Various::internal_error() called from /usr/lib/libDrakX/devices.pm:131
> devices::entry() called from /usr/lib/libDrakX/devices.pm:146
> devices::make() called from /usr/lib/libDrakX/fs/type.pm:268
> fs::type::call_blkid() called from /usr/lib/libDrakX/fs/type.pm:275
> fs::type::type_subpart_from_magic() called from /usr/lib/libDrakX/fsedit.pm:310
> fsedit::get_hds() called from /usr/libexec/drakboot:35
> [try to open]
> Too late to run INIT block at /usr/lib64/perl5/vendor_perl/Glib/Object/Introspection.pm line 257.
> Ignore the following Glib::Object::Introspection & Gtk3 warnings
> Subroutine Gtk3::main redefined at /usr/share/perl5/vendor_perl/Gtk3.pm line 539.
> Too late to run INIT block at /usr/lib64/perl5/vendor_perl/Glib/Object/Introspection.pm line 257.
> Ignore the following Glib::Object::Introspection & Gtk3 warnings
> Subroutine Gtk3::main redefined at /usr/share/perl5/vendor_perl/Gtk3.pm line 539.
> INTERNAL ERROR: unknown device sda2
> MDK::Common::Various::internal_error() called from /usr/lib/libDrakX/devices.pm:131
> devices::entry() called from /usr/lib/libDrakX/devices.pm:146
> devices::make() called from /usr/lib/libDrakX/fs/type.pm:268
> fs::type::call_blkid() called from /usr/lib/libDrakX/fs/type.pm:275
> fs::type::type_subpart_from_magic() called from /usr/lib/libDrakX/fsedit.pm:310
> fsedit::get_hds() called from /usr/libexec/drakboot:35

On the screen :
https://matrix.org/_matrix/media/r0/download/matrix.org/zbcXnTzQyYfQLbXnQpQlVkhu/Capture
Comment 5 Lewis Smith 2021-03-08 21:12:26 CET
> He installs mga7 on his workstation computer.
> Add a drive on his motherboard ... which swap the root /dev/sda2 to /dev/sdb2
I can imagine things getting confused: a system installed on /dev/sda suddenly finds itself on /dev/sdb. Adding a disc which changes the /dev/sdx of installed systems just looks wrong - *unless* UUIDs cover this sort of thing (fstab).
And drakconf does not...

Can he could make the original disc remain as /dev/sda (new one := /dev/sdb)? This is the normal sort of thing that happens when you add discs.
Comment 6 Jybz 2021-03-08 21:22:54 CET
He says that with high pain he successfully reboot his computer with the added disk after multiple manipulations. I believe he is not able to swap sda/sdb.

All the fstab is using UUID, there is no trace (except in comments) of sda2 in the /etc directory. So, why and where drakconf is storing things ?

After running :
> dracut -vf --kver 5.10.20-desktop-2.mga8
> update-grub2
he could boot the lastest kernel.
> uname -r
> 5.10.20-desktop-2.mga8
Morgan Leijström 2021-03-09 10:44:50 CET

CC: (none) => fri

Comment 7 Martin Whitaker 2021-03-10 20:54:03 CET
(In reply to Jybz from comment #6)
> All the fstab is using UUID, there is no trace (except in comments) of sda2
> in the /etc directory. So, why and where drakconf is storing things ?

As Dave said, look in /boot/grub2/install.sh

CC: (none) => mageia

Comment 8 Aurelien Oudelet 2021-03-12 11:15:19 CET
Will take a look to reproduce this on a mine system.

But, original reporter on IRC has Bad TOCCOC? on one of his hard drives.
Comment 9 Lewis Smith 2021-03-12 21:10:42 CET
> As Dave said, look in /boot/grub2/install.sh
Mine (on an EFI/GPT system) has simply:
grub2-install

Are we overlooking ?
 From comment 0:
> $ urpmi --replacepkg kernel-desktop-5.10.20-2.mga8
> INTERNAL ERROR: unknown device sda2
 From comment 4:
> $ drakconf
> INTERNAL ERROR: unknown device sda2      [twice]
Tempted to really assign it to the Tools team; but first...
 From previous comment:
> original reporter on IRC has Bad TOCCOC? on one of his hard drives
Is this worth pursuing (whatever it actually means)?

(In reply to Jybz from comment #6)
> He says that with high pain he successfully reboot his computer with the
> added disk after multiple manipulations.
> All the fstab is using UUID, there is no trace (except in comments) of sda2
> in the /etc directory. So, why and where drakconf is storing things ?
> 
> After running :
> dracut -vf --kver 5.10.20-desktop-2.mga8
> update-grub2
> he could boot the lastest kernel.
> uname -r
> 5.10.20-desktop-2.mga8
Does this mean he has won through? Or that "unknown device sda2" errors still happen? If the latter, this must be assigned to the Tools team.

CC: (none) => lewyssmith

Comment 10 Dave Hodgins 2021-03-12 21:39:14 CET
(In reply to Lewis Smith from comment #9)
> > As Dave said, look in /boot/grub2/install.sh
> Mine (on an EFI/GPT system) has simply:
> grub2-install

Because I did not let the installer default to the mbr of sda, mine has ...
# cat /boot/grub2/install.sh
grub2-install /dev/sdb

I'd like to see what Jybz has in that file.
Comment 11 Martin Whitaker 2021-03-12 21:41:37 CET
(In reply to Lewis Smith from comment #9)
> > As Dave said, look in /boot/grub2/install.sh
> Mine (on an EFI/GPT system) has simply:
> grub2-install

The initial report shows no ESP is present, so I assume it's legacy boot. For legacy boot grub2-install requires the install device to be specified. For UEFI boot it doesn't need that because it knows to install the bootloader in the ESP.
Aurelien Oudelet 2021-03-21 18:00:52 CET

Assignee: bugsquad => ouaurelien

Comment 12 Dave Hodgins 2021-03-22 02:53:49 CET
Jybz still needs to provide the output of "cat /boot/grub2/install.sh".

Keywords: (none) => feedback