Bug 5191

Summary: grub not working on Mageia 2b2 (x86_64) rescue system
Product: Mageia Reporter: Herbert Poetzl <herbert>
Component: Release (media or process)Assignee: Thierry Vignaud <thierry.vignaud>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: Normal CC: dmorganec, herbert, sysadmin-bugs
Version: CauldronKeywords: NEEDINFO
Target Milestone: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Source RPM: drakx-installer-rescue CVE:
Status comment:

Description Herbert Poetzl 2012-04-02 02:33:36 CEST
Description of problem:
when activating the rescue system, grub doesn't work

[root@rescue /]# /sbin/grub
bash: /sbin/grub: No such file or directory

[root@rescue /]# which grub
/sbin/grub
[root@rescue /]# ll /sbin/grub
-rwxr-xr-x 1 root root 119512 Mar 12 21:42 /sbin/grub*
[root@rescue /]# file /sbin/grub
/sbin/grub: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped

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

How reproducible:
always

Steps to Reproduce:
1. boot into rescue system from DVD
2. try to start grub
3.
Comment 1 Manuel Hiebel 2012-04-04 01:03:38 CEST
thierry any ideas ?

Assignee: bugsquad => thierry.vignaud
Source RPM: (none) => drakx-installer-rescue

Comment 2 Thierry Vignaud 2012-04-04 11:06:31 CEST
Tried strace?
It may miss some file (eg: you may not have mounted /boot) and grub reports a bogus error
Comment 3 D Morgan 2012-04-04 11:24:48 CEST
just to complete if it doesn't work seems x86_64 only because i juste tested and works on i586

CC: (none) => dmorganec

Comment 4 Thierry Vignaud 2012-04-04 11:25:30 CEST
You meant you failed to rescue a 32bit system with a 64bit rescue?
Comment 5 Herbert Poetzl 2012-04-04 12:33:28 CEST
(In reply to comment #2)
> Tried strace?

# strace -fF grub
execve("/sbin/grub", ["grub"], [/* 17 vars */]) = -1 ENOENT (No such file or directory)
dup(2)                                  = 3
fcntl(3, F_GETFL)                       = 0x8002 (flags O_RDWR|O_LARGEFILE)
fstat(3, {st_mode=S_IFCHR|0600, st_rdev=makedev(4, 64), ...}) = 0
ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B9600 opost isig icanon echo ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fbc36cdd000
lseek(3, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)
write(3, "strace: exec: No such file or di"..., 40strace: exec: No such file or directory
) = 40
close(3)                                = 0
munmap(0x7fbc36cdd000, 4096)            = 0
exit_group(1)                           = ?

my guess would be that it requires certain 32bit libraries which are not present

CC: (none) => herbert

Comment 6 Herbert Poetzl 2012-04-04 12:44:23 CEST
# ldd /sbin/grub 
	linux-gate.so.1 =>  (0xffffe000)
	libc.so.6 => /lib/libc.so.6 (0xf7597000)
	/lib/ld-linux.so.2 => not found
Comment 7 Thierry Vignaud 2012-04-04 14:02:31 CEST
you should _chroot_

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

Comment 8 Thierry Vignaud 2012-04-04 14:03:06 CEST
And you didn't answer comment #4

Keywords: (none) => NEEDINFO

Comment 9 Herbert Poetzl 2012-04-04 14:20:20 CEST
(In reply to comment #4)
> You meant you failed to rescue a 32bit system with a 64bit rescue?

nope, I'm trying to write a grub boot block onto a disk, (previous install was 64bit)
normally I'd just start 'grub' and get a grub shell to fix issues (like a broken grub boot block or setup)

(In reply to comment #7)
> you should _chroot_

chroot where? and why isn't that done when I open a rescue shell if it is required?

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

Comment 10 Thierry Vignaud 2012-04-04 15:00:52 CEST
If you don't use the repair menu and ask for a console, you got a console on the rescue system.
If you asked to mount your system, then it's in /mnt and you should chroot in it
Comment 11 Herbert Poetzl 2012-04-04 15:30:32 CEST
as I tried to communicate (several times, but obviously failed), the _grub_ binary on the _64bit_ _install_dvd_ when booting in _rescue_ mode and entering the console doesn't work, most likely because the binary is 32bit dynamic and the required library is missing.

here the precise steps to recreate the issue on your system:

1a. qemu-kvm -cdrom Mageia-2-beta2-x86_64-DVD.iso or
1b. boot from the actual DVD

2. select 'Rescue System'
3. select 'Go to console'
4. grub
Comment 12 Thierry Vignaud 2012-04-04 17:44:37 CEST
as I tried to communicate (several times, but obviously failed), you need to mount your / (see the menu), then the library will be automatically found from /mnt/lib

Status: REOPENED => RESOLVED
Resolution: (none) => INVALID

Comment 13 Herbert Poetzl 2012-04-04 18:35:43 CEST
well, I tried, here are the steps:

1a. qemu-kvm -hda mga2b2.qcow2 -cdrom Mageia-2-beta2-x86_64-DVD.iso -boot d
1b. boot from the actual DVD and have a preinstalled system (64bit)

2. select 'Rescue System'
3. select 'Mount your partitions under /mnt'
3. select 'Go to console'
4. grub

[root@rescue /]# grub
bash: /sbin/grub: No such file or directory

[root@rescue /]# df
Filesystem     1K-blocks   Used Available Use% Mounted on
/dev/loop0         24832  24832         0 100% /tmp/stage2
tmpfs              59988      4     59984   1% /run
devtmpfs           51120      0     51120   0% /dev
tmpfs              59988      0     59988   0% /dev/shm
/dev/sda1        1802600 400212   1312076  24% /mnt

and what a surprise, adding the _missing_ ld-linux.so.2 to the stage2 /lib makes grub work as intended.

Status: RESOLVED => REOPENED
Resolution: INVALID => (none)

Comment 14 Herbert Poetzl 2012-04-04 18:50:22 CEST
note that if it is not planned to actually _use_ the /sbin/grub binary from the 64bit ISO, then you can safely remove /lib/libc.so.6 as well, as the grub binary seems to be the only dynamic 32bit binary depending on it ...
Comment 15 Thierry Vignaud 2012-04-05 15:46:49 CEST
Fixed in git

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