Bug 16918 - grub's device.map is bogusly modified on kernel upgrades (hard drives: disorder in numbering)
Summary: grub's device.map is bogusly modified on kernel upgrades (hard drives: disord...
Status: RESOLVED OLD
Alias: None
Product: Mageia
Classification: Unclassified
Component: Installer (show other bugs)
Version: Cauldron
Hardware: x86_64 Linux
Priority: Normal normal
Target Milestone: ---
Assignee: Thierry Vignaud
QA Contact:
URL: http://http://www.mageialinux-online....
Whiteboard: MGA5TOO
Keywords: NEEDINFO, PATCH
: 17000 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-10-07 13:11 CEST by kalagani kalagani
Modified: 2021-06-19 14:53 CEST (History)
4 users (show)

See Also:
Source RPM: drakxtools
CVE:
Status comment:


Attachments
grub: only update devices.map when installing grub (1.26 KB, patch)
2016-06-17 14:43 CEST, Thierry Vignaud
Details | Diff
grub: only overwrite install.sh when installing (2.56 KB, patch)
2016-06-17 14:43 CEST, Thierry Vignaud
Details | Diff

Description kalagani kalagani 2015-10-07 13:11:41 CEST
Description of problem:
disorder described for Mageia5 but already occured on my previously Mageia4
on the same PCs BIOS/MBR

A) PC with Grub Legacy, 2 DD, double boot Linux and XP on each DD
A1) after successfull Mageia5 installation (formatting /home and /, installing boot in /, not in MBR), the first starting do not occur and stop on Erreur 17

So, need to change in the menu.lst 
numbering order, hd0 becoming hd1 for Linux input
and for XP input
removing map (0x80)(0x81)
         map (0x81)(0x80)
         make active

below my menu.lst after modification
timeout 10
color black/cyan yellow/cyan
gfxmenu (hd1,1)/boot/gfxmenu
default 0
 
title linux
kernel (hd1,1)/boot/vmlinuz BOOT_IMAGE=linux root=UUID=d50bc87f-b1ba-47fb-8d21-e36d21ee8d57  nokmsboot splash quiet noiswmd resume=UUID=74f4bbef-5d16-4db8-b937-516b19a53e12 vga=788
root (hd1,1)
initrd /boot/initrd.img                                                                                                                     
title linux-nonfb                                                                                                                           
kernel (hd1,1)/boot/vmlinuz BOOT_IMAGE=linux-nonfb root=UUID=d50bc87f-b1ba-47fb-8d21-e36d21ee8d57  nokmsboot resume=UUID=74f4bbef-5d16-4db8-b937-516b19a53e12                                                                                                                           
root (hd1,1)                                                                                                                                
initrd /boot/initrd.img                                                                                                                     
title failsafe                                                                                                                              
kernel (hd1,1)/boot/vmlinuz BOOT_IMAGE=failsafe root=UUID=d50bc87f-b1ba-47fb-8d21-e36d21ee8d57  nokmsboot failsafe noiswmd                  
root (hd1,1)
initrd /boot/initrd.img
 
title windows XP
root (hd0,0)
chainloader +1

A2) UPGRADING from 3.1.9 to 4.18 kernel
Starting menu shows 5 inputs, while the menu.lst will show 6!!!
but in fact there are 2 ERROR 17 due also to disorder for 2 about Linux, 
not about XP
Surprise: none input to start on the old 3.1.9 kernel
So I started thanks to the fourth input

Below menu.lst not modified after upgrade

timeout 10
color black/cyan yellow/cyan
gfxmenu (hd1,1)/boot/gfxmenu
default 0
 
title linux
kernel (hd0,1)/boot/vmlinuz BOOT_IMAGE=linux root=UUID=d50bc87f-b1ba-47fb-8d21-e36d21ee8d57 nokmsboot splash quiet noiswmd resume=UUID=74f4bbef-5d16-4db8-b937-516b19a53e12 vga=788
root (hd0,1)
initrd /boot/initrd.img
 
title linux-nonfb
kernel (hd1,1)/boot/vmlinuz BOOT_IMAGE=linux-nonfb root=UUID=d50bc87f-b1ba-47fb-8d21-e36d21ee8d57  nokmsboot resume=UUID=74f4bbef-5d16-4db8-b937-516b19a53e12
root (hd1,1)
initrd /boot/initrd.img
 
title failsafe
kernel (hd1,1)/boot/vmlinuz BOOT_IMAGE=failsafe root=UUID=d50bc87f-b1ba-47fb-8d21-e36d21ee8d57  nokmsboot failsafe noiswmd
root (hd1,1)
initrd /boot/initrd.img
 
title windows XP
root (hd0,0)
chainloader +1
 
title linux
kernel (hd1,1)/boot/vmlinuz BOOT_IMAGE=linux root=UUID=d50bc87f-b1ba-47fb-8d21-e36d21ee8d57  nokmsboot splash quiet noiswmd resume=UUID=74f4bbef-5d16-4db8-b937-516b19a53e12 vga=788
root (hd1,1)
initrd /boot/initrd.img
 
title desktop 4.1.8-1.mga5
kernel (hd0,1)/boot/vmlinuz-4.1.8-desktop-1.mga5 BOOT_IMAGE=desktop_4.1.8-1.mga5 root=UUID=d50bc87f-b1ba-47fb-8d21-e36d21ee8d57 nokmsboot splash quiet noiswmd resume=UUID=74f4bbef-5d16-4db8-b937-516b19a53e12 vga=788
root (hd0,1)
initrd /boot/initrd-4.1.8-desktop-1.mga5.img


B) another PC with Grub2, 4 DD, multiboot with 3 OS, Linux and 2 XP on 3 different DD
B1) same succesfull Mageia5 installation
but at first starting, none Erreur 17 but the french truncated message
"Erreur de chargement du système d'exploitat"
So need to change boot DD order (third DD becoming the first) in the BIOS to start on the grub and to have the message
GRUB loading.
Welcome to GRUB

error: unknown filesystem.
Entering rescue mode...
Grub rescue>
Like I am a beginner with Grub2, I retrieve PC using DVD Boot-Repair-Disk which 
reinstalling boot in MBR on the 4 DD, so I return back to the original boot DD order in the BIOS

B2) UPGRADING from 3.1.9 to 4.18 kernel
I am falling in another problem kernel panic
https://bugs.mageia.org/show_bug.cgi?id=16879




Reproducible: 

Steps to Reproduce:
Rémi Verschelde 2015-10-07 13:36:03 CEST

CC: (none) => zen25000
Assignee: bugsquad => thierry.vignaud

Comment 1 Rémi Verschelde 2015-10-07 13:37:19 CEST
Setting version to Cauldron as installer bugs can only be fixed there (if it's later established that there's a grub/kernel issue with regard to the kernel upgrade issue described above, it can of course lead to an update for Mageia 5).

Version: 5 => Cauldron

Comment 2 kalagani kalagani 2015-10-07 14:31:34 CEST
I understand Rémi,
nevertheless, config about PC with Grub Legacy
inxi -F
System:    Host: localhost Kernel: 4.1.8-desktop-1.mga5 x86_64 (64 bit) Desktop: KDE 4.14.5 
           Distro: Mageia 5 thornicroft 
Machine:   Mobo: ASUSTeK model: P5B v: Rev 1.xx Bios: American Megatrends v: 2104 date: 03/09/2009
CPU:       Single core Intel Pentium 4 (-HT-) cache: 2048 KB 
           Clock Speeds: 1: 3000 MHz 2: 3000 MHz
Graphics:  Card: NVIDIA NV44 [Quadro NVS 285]
           Display Server: X.Org 1.16.4 drivers: nvidia,v4l Resolution: 1280x1024@60.02hz
           GLX Renderer: Quadro NVS 285/PCIe/SSE2 GLX Version: 2.1.2 NVIDIA 304.125
Audio:     Card Intel 82801H (ICH8 Family) HD Audio Controller driver: snd_hda_intel 
           Sound: Advanced Linux Sound Architecture v: k4.1.8-desktop-1.mga5
Network:   Card: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller driver: r8169
           IF: enp3s0 state: up speed: 1000 Mbps duplex: full mac: 00:18:f3:0a:2c:3b
Drives:    HDD Total Size: 580.1GB (70.5% used) ID-1: /dev/sda model: MAXTOR_STM380811 size: 80.0GB
           ID-2: /dev/sdb model: WDC_WD5000AAKS size: 500.1GB
Partition: ID-1: / size: 12G used: 5.1G (46%) fs: ext3 dev: /dev/sdb2 
           ID-2: /home size: 18G used: 11G (61%) fs: ext3 dev: /dev/sdb3 
           ID-3: swap-1 size: 4.30GB used: 0.00GB (0%) fs: swap dev: /dev/sdb1 
RAID:      No RAID devices: /proc/mdstat, md_mod kernel module present
Sensors:   System Temperatures: cpu: 64.5C mobo: 53.0C gpu: 74C 
           Fan Speeds (in rpm): cpu: 4383 psu: 0 sys-1: 0 sys-2: 0 
Info:      Processes: 166 Uptime: 6 min Memory: 1619.7/3449.5MB Client: Shell (bash) inxi: 2.1.96
Comment 3 Barry Jackson 2015-10-07 19:08:00 CEST
These sort of issues have been around for years and are well known with grub legacy.
They are BIOS dependant and are virtually impossible to resolve.

When multi-booting I would always recommend using a single very small partition with it's own installation of grub. Grub2 preferably.

The BIOS always boots this partition which runs it's own grub2 menu.
This menu is hand made and _never_ updated by any operating system. It simply chainloads into whichever OS is selected.

Each OS would be configured to only update it's own partitions and not write to the MBR of any drive.

If you would like to test this in principle by creating a grub2 boot CD, DVD or USB stick (rather than using a HD partition) then there is a script here that should create one for you. https://wiki.mageia.org/en/User:Barjac Note this is for PC-BIOS only NOT UEFI.
Comment 4 kalagani kalagani 2015-10-08 18:32:50 CEST
Hello Barry,
I agree it is virtually impossible to resolve with Grub Legacy at installation,
but about my second case A2) when kernel upgrade is made?
and about my third case B1) installation with Grub2?
Comment 5 Dave Hodgins 2015-10-08 19:19:10 CEST
Changing version back to 5. This is not an installer problem, it's a problem
with installing new kernel versions in an already installed system.

In the installer, when selecting sdb as the place to install the boot loader,
it asks which device will be used for booting.

Selecting sdb as the boot device, it correctly puts
(hd0) /dev/sdb
(hd1) /dev/sda
in /boot/grub/device.map and uses (hd0,0) (for sdb1) in /boot/grub/menu.lst.

When installing a new kernel, device.map gets changed to
(hd0) /dev/sda
(hd1) /dev/sdb
and it uses (hd1,0) in menu.lst for the new kernel.

I've occasionally forgotten to fix device.map and menu.lst on a new kernel
install, resulting in https://bugs.mageia.org/show_bug.cgi?id=16655#c42

I think the correct fix would likely be for the kernel-install to check whether
or not /boot/device.map already exists, and if it does, assume it's correct,
though that would require extensive testing to ensure it does not break new
installations.

Version: Cauldron => 5
CC: (none) => davidwhodgins

Comment 6 Dave Hodgins 2015-10-08 19:27:17 CEST
Changing back to cauldron, as it's likely affected too, and adding
MGA5TOO.

Whiteboard: (none) => MGA5TOO
Version: 5 => Cauldron

Comment 7 Thierry Vignaud 2016-06-17 14:43:34 CEST
Created attachment 8015 [details]
grub: only update devices.map when installing grub
Comment 8 Thierry Vignaud 2016-06-17 14:43:35 CEST
Created attachment 8016 [details]
grub: only overwrite install.sh when installing
Comment 9 Thierry Vignaud 2016-06-17 14:45:08 CEST
Do those patches help?
You can try them by applying them as root in a terminal (assuming you downloaded them in /tmp):

cd /usr/lib/libDrakX
patch -p2 </tmp/0001-grub-only-update-devices.map-when-installing-grub.patch  
patch -p2 </tmp/0002-grub-only-update-devices.map-when-installing-grub.patch

Keywords: (none) => NEEDINFO, PATCH

Comment 10 Rémi Verschelde 2016-06-17 14:48:13 CEST
> patch -p2 </tmp/0002-grub-only-update-devices.map-when-installing-grub.patch

This line being meant as:

patch -p2 </tmp/0002-grub-only-overwrite-install.sh-when-installing.patch
Comment 11 Thierry Vignaud 2016-06-17 14:52:41 CEST
indeed
Thierry Vignaud 2016-06-17 15:20:09 CEST

Summary: When several hard drives: disorder in numbering at installation or kernel upgrade => grub's device.map is bogusly modified on kernel upgrades (hard drives: disorder in numbering)

Thierry Vignaud 2016-07-16 09:16:51 CEST

Source RPM: (none) => drakxtools

Comment 12 Thierry Vignaud 2016-07-16 09:17:05 CEST
*** Bug 17000 has been marked as a duplicate of this bug. ***

CC: (none) => luigiwalser

Comment 13 Marja Van Waes 2021-06-19 14:50:00 CEST
There was no feedback from the reporter or anyone else on the proposed patches from five years ago.
Also, the reporter and the reporter of the duplicate bug both used grub legacy, which has become rare.

Closing as OLD

CC: (none) => marja11
Status: NEW => RESOLVED
Resolution: (none) => OLD

Comment 14 David Walser 2021-06-19 14:53:01 CEST
Hopefully the patches got committed.

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