Bug 8717 - On installing a new kernel on a system with root on LVM, root=/dev/VGname/LVname gets mangled to root=/dev/
Summary: On installing a new kernel on a system with root on LVM, root=/dev/VGname/LVn...
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: Cauldron
Hardware: x86_64 Linux
Priority: Normal normal
Target Milestone: ---
Assignee: Thierry Vignaud
QA Contact:
URL:
Whiteboard: MGA2TOO
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-17 08:27 CET by Buchan Milne
Modified: 2013-04-05 18:03 CEST (History)
5 users (show)

See Also:
Source RPM: bootloader-utils-1.15-7.mga3.src.rpm
CVE:
Status comment:


Attachments
potential fix + debug (807 bytes, patch)
2013-04-02 21:08 CEST, Thierry Vignaud
Details | Diff
real fix (665 bytes, patch)
2013-04-02 21:26 CEST, Thierry Vignaud
Details | Diff
potential fix + debug (808 bytes, patch)
2013-04-02 21:28 CEST, Thierry Vignaud
Details | Diff
Output when installing kernel with attachment 3686 (36.00 KB, text/x-log)
2013-04-03 08:48 CEST, Buchan Milne
Details
/etc/fstab (437 bytes, text/plain)
2013-04-03 09:42 CEST, Buchan Milne
Details
fix (1.28 KB, patch)
2013-04-03 19:08 CEST, Thierry Vignaud
Details | Diff

Description Buchan Milne 2013-01-17 08:27:29 CET
Description of problem:
After installation of a new kernel on a system with rootfs on LVM, the default bootloader entry will not boot by default, as the root=/dev/VGname/LVname value gets changed to root=/dev/


Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. Install a new system with root on LVM (in my case Mageia 3 beta 1)
2. Install a kernel update (e.g. the current kernel from cauldron)
3. Observe the root= value is mangled in the default entry and the newly added entry.

This is the diff between the previous grub menu.lst, and the one from after installing a new kernel:

[root@localhost ~]# diff -u /boot/grub/menu.lst{,.2013-01-17}
--- /boot/grub/menu.lst 2013-01-17 08:59:53.000000000 +0200
+++ /boot/grub/menu.lst.2013-01-17      2013-01-13 19:54:13.000000000 +0200
@@ -4,7 +4,7 @@
 default 0
 
 title linux
-kernel (hd0,4)/vmlinuz BOOT_IMAGE=linux root=/dev/ nokmsboot splash quiet resume=/dev/VGsys/swap vga=788
+kernel (hd0,4)/vmlinuz BOOT_IMAGE=linux root=/dev/VGsys/mga_root nokmsboot splash quiet resume=/dev/VGsys/swap vga=788
 root (hd0,4)
 initrd /initrd.img
 
@@ -42,8 +42,3 @@
 kernel (hd0,4)/vmlinuz-3.8.0-desktop-0.rc3.1.mga3 BOOT_IMAGE=desktop_3.8.0rc3-1.mga3 root=/dev/VGsys/mga_root nokmsboot splash quiet resume=/dev/VGsys/swap vga=788
 root (hd0,4)
 initrd /initrd-3.8.0-desktop-0.rc3.1.mga3.img
-
-title desktop 3.8.0rc3-2.mga3
-kernel (hd0,4)/vmlinuz-3.8.0-desktop-0.rc3.2.mga3 BOOT_IMAGE=desktop_3.8.0rc3-2.mga3 root=/dev/ nokmsboot splash quiet resume=/dev/VGsys/swap vga=788
-root (hd0,4)
-initrd /initrd-3.8.0-desktop-0.rc3.2.mga3.img
Manuel Hiebel 2013-01-18 22:26:23 CET

CC: (none) => dmorganec, tmb
Assignee: bugsquad => thierry.vignaud

Comment 1 Morgan Leijström 2013-01-19 15:07:01 CET
This is somewhat similar to Bug 8738  where in grub list the root partition get set to /dev/sda1 instead of /dev/vg-mga/root which is a LVM partition, LVM on LUKS.

CC: (none) => fri

Thomas Bigot 2013-02-09 17:08:05 CET

CC: (none) => thomas.bigot

Comment 2 Thierry Vignaud 2013-04-02 21:08:31 CEST
Created attachment 3684 [details]
potential fix + debug

Can you try this patch?
Thierry Vignaud 2013-04-02 21:08:44 CEST

CC: (none) => thierry.vignaud

Comment 3 Thierry Vignaud 2013-04-02 21:26:44 CEST
Created attachment 3685 [details]
real fix

Attachment 3684 is obsolete: 0 => 1

Comment 4 Thierry Vignaud 2013-04-02 21:28:24 CEST
Created attachment 3686 [details]
potential fix + debug

Attachment 3685 is obsolete: 0 => 1

Comment 5 Buchan Milne 2013-04-03 08:47:11 CEST
Using the attached patch, no changes are made to the bootloader configuration.

[root@buchan-laptop ~]# wget 'https://bugs.mageia.org/attachment.cgi?id=3686' -O bug8717-att3686.patch
--2013-04-03 08:29:48--  https://bugs.mageia.org/attachment.cgi?id=3686
Resolving bugs.mageia.org (bugs.mageia.org)... 212.85.158.146, 2a02:2178:2:7::2
Connecting to bugs.mageia.org (bugs.mageia.org)|212.85.158.146|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 808 [text/plain]
Saving to: âbug8717-att3686.patchâ

100%[===========================================>] 808         --.-K/s   in 0s      

2013-04-03 08:29:51 (22.1 MB/s) - âbug8717-att3686.patchâ saved [808/808]

[root@buchan-laptop ~]# cp -a /usr/sbin/bootloader-config{,.orig}
[root@buchan-laptop ~]# patch /usr/sbin/boo
bootloader-config       bootloader-config.orig  
[root@buchan-laptop ~]# patch /usr/sbin/bootloader-config bug8717-att3686.patch
patching file /usr/sbin/bootloader-config
Hunk #1 succeeded at 154 (offset 1 line).
[root@buchan-laptop ~]# cp -a /boot/grub/menu.lst{,.2013-04-03-before}
[root@buchan-laptop ~]# urpmi kernel-desktop-latest 2>&1 | tee /tmp/bug-8717.log



[root@buchan-laptop ~]# cp -a /boot/grub/menu.lst{,.2013-04-03-after}
[root@buchan-laptop ~]# diff -u /boot/grub/menu.lst.2013-04-03-{before,after}
[root@buchan-laptop ~]#
Comment 6 Buchan Milne 2013-04-03 08:48:22 CEST
Created attachment 3688 [details]
Output when installing kernel with attachment 3686 [details]
Comment 7 Buchan Milne 2013-04-03 08:48:58 CEST
[root@buchan-laptop ~]# df
Filesystem                    Size  Used Avail Use% Mounted on
rootfs                        7.8G  7.1G  280M  97% /
devtmpfs                      3.9G     0  3.9G   0% /dev
tmpfs                         3.9G  1.9M  3.9G   1% /dev/shm
tmpfs                         3.9G  944K  3.9G   1% /run
/dev/mapper/VGsys-mga_root    7.8G  7.1G  280M  97% /
tmpfs                         3.9G     0  3.9G   0% /sys/fs/cgroup
tmpfs                         3.9G  672K  3.9G   1% /tmp
/dev/sda4                     2.0G  9.0M  2.0G   1% /media/win_f
/dev/sda5                     119M   84M   30M  74% /boot
/dev/sda2                      50G   34G   17G  68% /mnt/win_c
/dev/sda7                      36G   27G  9.5G  74% /mnt/win_d
/dev/mapper/crypt_VGsys_home   20G   15G  4.6G  77% /home
tmpfs                         3.9G  944K  3.9G   1% /var/spool/postfix/run/saslauthd
Comment 8 Buchan Milne 2013-04-03 09:42:43 CEST
Created attachment 3689 [details]
/etc/fstab

[root@buchan-laptop ~]# blkid 
/dev/sda1: LABEL="System Reserved" UUID="A63C33173C32E1CB" TYPE="ntfs" 
/dev/sda2: UUID="569C71FD9C71D847" TYPE="ntfs" 
/dev/sda4: LABEL="HP_TOOLS" UUID="F0B7-7A81" TYPE="vfat" 
/dev/sda5: UUID="d7cb12cb-f67d-4b54-b6e3-b1b06ac74a4a" TYPE="ext3" 
/dev/sda6: UUID="aeregK-EDgM-kfWh-Xbc1-gLLR-E9NK-DdO8fL" TYPE="LVM2_member" 
/dev/sda7: LABEL="Data" UUID="8CA86CE2A86CCBF0" TYPE="ntfs" 
/dev/mapper/VGsys-mga_root: UUID="0d428025-3a1a-4420-8f93-7198e61bbc2a" TYPE="ext4" 
/dev/mapper/VGsys-swap: UUID="0d6695a8-19c6-4b88-8287-841970a90a99" TYPE="swap" 
/dev/mapper/VGsys-home: UUID="cfeb2209-ecb1-4fc2-bcb5-cb8cec3abb4a" TYPE="crypto_LUKS" 
/dev/mapper/crypt_VGsys_home: UUID="c147fae3-0526-4e69-8260-ddcf1d0a9b20" TYPE="ext4"
Comment 9 Thierry Vignaud 2013-04-03 19:08:54 CEST
Created attachment 3691 [details]
fix

Can you reverse the previous patch and apply this one?

It prevends adding bogus dev=...
and fallback to another method to find out / partition
Thierry Vignaud 2013-04-03 19:09:01 CEST

Keywords: (none) => NEEDINFO

Comment 10 Thierry Vignaud 2013-04-04 15:48:25 CEST
Fixed in next drakxtools.
Please reopen if you still the issue then.
Comment 11 Morgan Leijström 2013-04-04 19:32:10 CEST
Thank you guys! :)
Comment 12 Buchan Milne 2013-04-05 01:11:56 CEST
Doesn't seem to work as intended. Maybe just a warning that the root filesystem does not appear in /etc/fstab would be sufficient.

This machine had a number of partitioning changes done after I had installed Mageia (done with diskdrake), due to some issues with the Windows installation.

[root@buchan-laptop ~]# ll /etc/fstab*
-rw-rw-r-- 1 root root 437 Jan  9 17:01 /etc/fstab
-rw-r--r-- 1 root root 439 Jan  9 16:41 /etc/fstab.old
-rw-r--r-- 1 root root  29 Mar 15  2012 /etc/fstab.rpmnew

[root@buchan-laptop ~]# ll drakx/install.log 
-rw-r--r-- 1 root root 200321 Jan  9 09:27 drakx/install.log

[root@buchan-laptop ~]# cat /etc/fstab.old 
# Entry for /dev/sda5 :
UUID=d7cb12cb-f67d-4b54-b6e3-b1b06ac74a4a /boot ext3 acl,noatime 1 2
# Entry for /dev/sda4 :
UUID=F0B7-7A81 /media/win_f vfat umask=000,iocharset=utf8 0 0
# Entry for /dev/sda2 :
#UUID=14E2D9FAE2D9DFD2 /mnt/win_c ntfs-3g defaults,umask=000 0 0
# Entry for /dev/sda7 :
#UUID=7C75F7510A827903 /mnt/win_d ntfs-3g defaults,umask=000 0 0
none /proc proc defaults 0 0
/dev/mapper/crypt_VGsys_home /home ext4 defaults 0 0

So, possibly use of diskdrake could have mangled the fstab (removing the rootfs entry)? I don't think I edited fstab manually.


[root@buchan-laptop ~]# cp -af /usr/sbin/bootloader-config{.orig,}
[root@buchan-laptop ~]# cp -a /usr/lib/libDrakX/fs/get.pm{,.orig}
[root@buchan-laptop ~]# curl -s 'https://bugs.mageia.org/attachment.cgi?id=3691'|patch -d / -p0
patching file /usr/lib/libDrakX/fs/get.pm
patching file /usr/sbin/bootloader-config                                            
Hunk #1 succeeded at 154 (offset 1 line).                                            
[root@buchan-laptop ~]# /sbin/installkernel 3.8.5-desktop-1.mga3 2>&1 | tee /tmp/bug-8717.log

[...]

[root@buchan-laptop ~]# diff -u /boot/grub/menu.lst{.2013-04-03-before,}
--- /boot/grub/menu.lst.2013-04-03-before       2013-03-21 16:27:01.000000000 +0200
+++ /boot/grub/menu.lst 2013-04-05 00:47:00.000000000 +0200
@@ -4,7 +4,7 @@
 default 0
 
 title linux
-kernel (hd0,4)/vmlinuz BOOT_IMAGE=linux root=/dev/VGsys/mga_root nokmsboot splash quiet resume=/dev/VGsys/swap nokmsboot vga=788
+kernel (hd0,4)/vmlinuz BOOT_IMAGE=linux root=/dev/ splash quiet nokmsboot resume=/dev/VGsys/swap vga=788
 root (hd0,4)
 initrd /initrd.img
 
@@ -34,6 +34,11 @@
 initrd /initrd-3.7.1-desktop-1.mga3.img
 
 title desktop 3.8.1-1.mga3
-kernel (hd0,4)/vmlinuz-3.8.1-desktop-1.mga3 BOOT_IMAGE=desktop_3.8.1-1.mga3 root=/dev/VGsys/mga_root nokmsboot splash quiet resume=/dev/VGsys/swap vga=788
+kernel (hd0,4)/vmlinuz-3.8.1-desktop-1.mga3 BOOT_IMAGE=desktop_3.8.1-1.mga3 root=/dev/VGsys/mga_root nokmsboot splash quiet resume=/dev/VGsys/swap nokmsboot vga=788
 root (hd0,4)
 initrd /initrd-3.8.1-desktop-1.mga3.img
+
+title desktop 3.8.5-1.mga3
+kernel (hd0,4)/vmlinuz-3.8.5-desktop-1.mga3 BOOT_IMAGE=desktop_3.8.5-1.mga3 root=/dev/ splash quiet nokmsboot resume=/dev/VGsys/swap vga=788
+root (hd0,4)
+initrd /initrd-3.8.5-desktop-1.mga3.img


On another machine installed from the same media as my laptop at the end of Feb, also with root on LVM, rootfs is in /etc/fstab:
[root@media ~]# grep root /etc/fstab
/dev/vg_rhevh2/lv_root / ext4 acl,noatime 1 1

The problem doesn't occur there:
[root@media ~]# diff -u /boot/grub/menu.lst{.good,}
--- /boot/grub/menu.lst.good    2013-04-01 09:21:54.000000000 +0200
+++ /boot/grub/menu.lst 2013-04-04 22:57:34.000000000 +0200
@@ -4,7 +4,7 @@
 default 0
 
 title linux
-kernel (hd0,0)/vmlinuz BOOT_IMAGE=linux root=/dev/vg_rhevh2/lv_root splash quiet resume=/dev/vg_rhevh2/lv_swap nokmsboot
+kernel (hd0,0)/vmlinuz BOOT_IMAGE=linux root=/dev/vg_rhevh2/lv_root splash quiet nokmsboot resume=/dev/vg_rhevh2/lv_swap
 root (hd0,0)
 initrd /initrd.img
 
@@ -12,3 +12,13 @@
 kernel (hd0,0)/vmlinuz BOOT_IMAGE=failsafe root=/dev/vg_rhevh2/lv_root nokmsboot failsafe
 root (hd0,0)
 initrd /initrd.img
+
+title desktop 3.7.0-1.mga3
+kernel (hd0,0)/vmlinuz-3.7.0-desktop-1.mga3 BOOT_IMAGE=desktop_3.7.0-1.mga3 root=/dev/vg_rhevh2/lv_root splash quiet resume=/dev/vg_rhevh2/lv_swap nokmsboot
+root (hd0,0)
+initrd /initrd-3.7.0-desktop-1.mga3.img
+
+title desktop 3.8.5-1.mga3
+kernel (hd0,0)/vmlinuz-3.8.5-desktop-1.mga3 BOOT_IMAGE=desktop_3.8.5-1.mga3 root=/dev/vg_rhevh2/lv_root splash quiet nokmsboot resume=/dev/vg_rhevh2/lv_swap
+root (hd0,0)
+initrd /initrd-3.8.5-desktop-1.mga3.img
Comment 13 Thierry Vignaud 2013-04-05 07:40:48 CEST
When you say "Doesn't seem to work as intended", did you try adding a kernel with drakxtools-15.33?
Comment 14 Morgan Leijström 2013-04-05 09:33:58 CEST
I am no programmer, do not know how to handle patch as above.
I could not find new drakxtools on repos, is it pushed?


A couple thoughts from my side:

While it is running on an installed system, could it not just keep the / entry as is?

( The worst thing about this bug is that automatic update may render a system unbootable, and most users are not able to fix this.  I administers familys computers and that is the situation here, and most places i believe. )


Regardless of solving this I do think 
There should be some sanity checks in diskdrake before writing fstab, bug 5818.
To guard against any hiding or future bugs like this.
It could check that the mount points are sane (actually exist, and test if possible without risking disturbing running system), and that there do exist a non commented out entry for / .
Comment 15 Thierry Vignaud 2013-04-05 10:00:46 CEST
You should update your mirrors.
At least http://distrib-coffee.ipsl.jussieu.fr/pub/linux/Mageia/distrib/cauldron/x86_64/media/core/release is up to date

As for diskdrake, we don't have any proof that it's it that removed the entry (but on one special case where you cloned a system). 

And as for unbootable systems, it cannot as the current kernel entry will remain as it is.
So there would always be a working boot entry.
Comment 16 Morgan Leijström 2013-04-05 10:44:03 CEST
Ah, i do not have cauldron atm, so i searched on mga2 where i had same problem.
So i believe this bug should have MGA2TOO added, and updated drakxtools too...

Yes you are correct the user may select another entry to boot old kernel, but i think none in my family would have thought of selecting "another entry than the one that used to work".  (Seen from their perspective)
Comment 17 Thierry Vignaud 2013-04-05 15:49:10 CEST
works for me as of drakxtools-15.35

Status: NEW => RESOLVED
Resolution: (none) => FIXED

Comment 18 Morgan Leijström 2013-04-05 18:03:24 CEST
I just repeated the issue on two slightly different mga2
So please Thierry update the mga 2 drakxtools also

Keywords: NEEDINFO => (none)
Whiteboard: (none) => MGA2TOO


Note You need to log in before you can comment on or make changes to this bug.