Bug 9334 - Live DVD installer offers grub2, but fails to install it.
Summary: Live DVD installer offers grub2, but fails to install it.
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: Release (media or process) (show other bugs)
Version: Cauldron
Hardware: x86_64 Linux
Priority: release_blocker critical
Target Milestone: ---
Assignee: Mageia Bug Squad
QA Contact:
URL:
Whiteboard: 3RC
Keywords:
: 9898 (view as bug list)
Depends on:
Blocks: 416
  Show dependency treegraph
 
Reported: 2013-03-11 14:20 CET by Barry Jackson
Modified: 2013-05-04 22:39 CEST (History)
11 users (show)

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


Attachments
set $::isInstall while installing bootloader (475 bytes, patch)
2013-04-22 17:48 CEST, Thierry Vignaud
Details | Diff

Description Barry Jackson 2013-03-11 14:20:01 CET
Description of problem:
As Summary.
Using mga3 beta3 KDE Live DVD iso.

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


How reproducible:


Steps to Reproduce:
1.
2.
3.


Reproducible: 

Steps to Reproduce:
Barry Jackson 2013-03-11 14:20:19 CET

Priority: Normal => release_blocker
Severity: normal => critical

Barry Jackson 2013-03-11 14:20:35 CET

Blocks: (none) => 416

Comment 1 Manuel Hiebel 2013-03-11 18:26:07 CET
see errata, you have to take them in /root/grub2 or adding online media

Source RPM: (none) => draklive

Comment 2 Barry Jackson 2013-03-12 01:45:21 CET
(In reply to Manuel Hiebel from comment #1)
> see errata, you have to take them in /root/grub2 or adding online media

I understood that tmb was possibly going to add a small repo to the Live
isos for packages like this that must be installed from rpm on the final hardware.

Does the fact that this has been added to the errata mean that there is no intention to fix it before release?
Comment 3 Dave Hodgins 2013-03-12 03:07:16 CET
(In reply to Barry Jackson from comment #2)
> (In reply to Manuel Hiebel from comment #1)
> > see errata, you have to take them in /root/grub2 or adding online media
> 
> I understood that tmb was possibly going to add a small repo to the Live
> isos for packages like this that must be installed from rpm on the final
> hardware.
> 
> Does the fact that this has been added to the errata mean that there is no
> intention to fix it before release?

Not for the beta 3 live iso images, which have already been
released.

I'll make sure this gets checked when beta 4 is ready for
qa testing.

CC: (none) => davidwhodgins

Comment 4 Thomas Backlund 2013-03-12 19:41:08 CET
(In reply to Barry Jackson from comment #2)
> (In reply to Manuel Hiebel from comment #1)
> > see errata, you have to take them in /root/grub2 or adding online media
> 
> I understood that tmb was possibly going to add a small repo to the Live
> isos for packages like this that must be installed from rpm on the final
> hardware.
> 

Yep, thats the idea.


> Does the fact that this has been added to the errata mean that there is no
> intention to fix it before release?

Nope, I just got sick last week so I havent been able to finish it all up, so its now queued to be fixed for beta4

CC: (none) => tmb

Comment 5 Barry Jackson 2013-03-12 20:12:46 CET
(In reply to Thomas Backlund from comment #4)
OK fine - I hope you're feeling better :)
Comment 6 Glen Ogilvie 2013-03-16 23:20:35 CET
I also found this bug during testing.  Live CD offers grub2, but then can't use it. 

I tried adding the distrib sources on the liveCD, then continuing with the installer.   This allows the installer to intall grub2, but pops up an error:

"ERROR: 'script' failed for grub2-2.00-38.mga3.x86_64:",
then: Mandatory package grub2 is missing.


As the installer allows making /boot on an LVM partition, grub2 should should be available, and also set as the default, where /boot is on LVM.

CC: (none) => nelg

Thierry Vignaud 2013-03-17 10:25:10 CET

CC: (none) => thierry.vignaud, zen25000
Summary: Live DVD installer offers grub2 but fails to install it - "no package grub2 found" => Live DVD installer offers grub2 but fails to install it - "no package grub2 found", script error, missing theme

Comment 7 Malo Deniélou 2013-03-26 12:58:27 CET
Is this still valid with the pre-iso of Beta 4?
Thanks!

CC: (none) => pierre-malo.denielou

Comment 8 Manuel Hiebel 2013-03-26 13:37:16 CET
nop 

[manu@vosdook ~]$ grep grub2-2 /media/data/iso/test/*/*.lst
/media/data/iso/test/Mageia-3-beta4-LiveCD-GNOME-en-i586-CD/Mageia-3-beta4-LiveCD-GNOME-en-i586-CD.lst:grub2-2.00-40.mga3
/media/data/iso/test/Mageia-3-beta4-LiveCD-KDE4-en-i586-CD/Mageia-3-beta4-LiveCD-KDE4-en-i586-CD.lst:grub2-2.00-40.mga3
/media/data/iso/test/Mageia-3-beta4-LiveDVD-GNOME-i586-DVD/Mageia-3-beta4-LiveDVD-GNOME-i586-DVD.lst:grub2-2.00-40.mga3
/media/data/iso/test/Mageia-3-beta4-LiveDVD-GNOME-x86_64-DVD/Mageia-3-beta4-LiveDVD-GNOME-x86_64-DVD.lst:grub2-2.00-40.mga3
/media/data/iso/test/Mageia-3-beta4-LiveDVD-KDE4-i586-DVD/Mageia-3-beta4-LiveDVD-KDE4-i586-DVD.lst:grub2-2.00-40.mga3
/media/data/iso/test/Mageia-3-beta4-LiveDVD-KDE4-x86_64-DVD/Mageia-3-beta4-LiveDVD-KDE4-x86_64-DVD.lst:grub2-2.00-40.mga3

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

Comment 9 Barry Jackson 2013-03-26 17:34:17 CET
Not sure what's been done here, but in beta4 KDE Live DVD I just ran the install to HD in a VM and the missing package error is gone, but grub2 drops to a rescue prompt and is broken on re-boot from HD.

There seem to be corrupted modules from exploring I have done from the rescue prompt.

I also notice that grub2 appears to be installed in the LIVE when it's running, which it should not be, IIUC.

I understood that the grub2 rpm would be available to the live installer for installation in the same way that it is installed during a 'normal' install.

I'm *guessing* that there is conflict between grub2 stuff that was installed before the iso was created and the package installed during the installation to hard drive.

tmb, thierry could you explain just what happens now during install from live as I'm somewhat confused :\

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

Barry Jackson 2013-03-26 17:38:02 CET

Summary: Live DVD installer offers grub2 but fails to install it - "no package grub2 found", script error, missing theme => Live DVD installer offers grub2, installs it, but it's broken

Comment 10 Barry Jackson 2013-03-26 18:18:35 CET
I managed to boot into the installed system without bootloader and discovered that grub2 was installed prior to dumping the installation.
I installed grub2 (since a later version is on mirrors), ran grub2-install and rebooted.
No problems.

From terminal:-

[baz@localhost ~]$ rpm -qa --last|grep grub
grub2-mageia-theme-2.00-40.mga3.x86_64        Sat 23 Mar 2013 21:53:58 GMT
grub-0.97-38.mga3.x86_64                      Sat 23 Mar 2013 21:49:54 GMT
grub2-2.00-40.mga3.x86_64                     Sat 23 Mar 2013 21:49:53 GMT
[baz@localhost ~]$ su
Password: 
[root@localhost baz]# urpmi grub2
To satisfy dependencies, the following packages are going to be installed:
  Package                        Version      Release       Arch    
(medium "Core Release")
  grub2                          2.00         41.mga3       x86_64  
  grub2-mageia-theme             2.00         41.mga3       x86_64  
81B of disk space will be freed.
3.3MB of packages will be retrieved.
Proceed with the installation of the 2 packages? (Y/n) y


    $MIRRORLIST: media/core/release/grub2-mageia-theme-2.00-41.mga3.x86_64.rpm
    $MIRRORLIST: media/core/release/grub2-2.00-41.mga3.x86_64.rpm              
installing grub2-mageia-theme-2.00-41.mga3.x86_64.rpm grub2-2.00-41.mga3.x86_64.rpm from /var/cache/urpmi/rpms
Preparing...                     #############################################
      1/2: grub2                 #############################################
      2/2: grub2-mageia-theme    #############################################
      1/2: removing grub2-mageia-theme-2.00-40.mga3.x86_64
                                 #############################################
      2/2: removing grub2-2.00-40.mga3.x86_64
                                 #############################################
Generating grub.cfg ...
Found theme: /boot/grub2/themes/maggy/theme.txt
Found linux image: /boot/vmlinuz-desktop
Found initrd image: /boot/initrd-desktop.img
Found linux image: /boot/vmlinuz-3.8.3-desktop-2.mga3
Found initrd image: /boot/initrd-3.8.3-desktop-2.mga3.img
done
[root@localhost baz]# grub2-install /dev/sda
Installation finished. No error reported.
[root@localhost baz]# reboot
Comment 11 Barry Jackson 2013-03-26 20:07:55 CET
I repeated the above test but without re-installing grub2.
After booting manually into the installed system (using a grub2 boot disk iso) I ran:
grub2-install /dev/sda
and re-booted.
This worked fine, so *maybe* all that is missing from the installer is
grub2-install <target device>
Comment 12 Barry Jackson 2013-03-27 01:07:30 CET
I have repeated the above test (which was with the KDE Live DVD) with the GNOME Live DVD and again the boot failed (with different errors), but after manually booting the system and running grub2-install /dev/sda the system now boots correctly.
Comment 13 Manuel Hiebel 2013-03-28 16:07:53 CET
maybe a wrong dd used ? 
in a VM with only one / partition it was working fine as default
Comment 14 Dave Hodgins 2013-04-09 00:38:17 CEST
Fails to install when using the 3beta4 iso images with the message
ERROR: 'script' failed for grub2-2.00-41.mga3.x86_64:
After that message is ok'd, the message
"Mandatory package grub2 is missing" is displayed.

Installing with ...
chroot /mnt/install
urpmi grub2
works fine.

This is with a separate /boot, and an encrypted / filesystem.

Whiteboard: (none) => 3beta4

claire robinson 2013-04-09 13:43:30 CEST

CC: (none) => eeeemail

Comment 15 Barry Jackson 2013-04-14 16:19:40 CEST
Same in Live KDE4 DVD RC       (tests done in Vbox)

I aborted the install when grub2 failed to install (with the same errors as prev post) and checked that the contents of /boot looked sane.

I then booted into the install (without bootloader) and deselected the freshly added mirrorlist entries, leaving only the live media (on DVD.iso) selected.

I then installed os-prober and grub2 and ran 'grub2-install /dev/sda' and then re-booted into the HD.
No problems.

So, the rpms are now available on the Live media, but the installer fails to install them.
Barry Jackson 2013-04-14 16:20:26 CEST

Summary: Live DVD installer offers grub2, installs it, but it's broken => Live DVD installer offers grub2, but fails to install it.

Dave Hodgins 2013-04-14 19:39:49 CEST

Whiteboard: 3beta4 => 3RC

Thierry Vignaud 2013-04-21 18:41:22 CEST

Source RPM: draklive => grub2

Comment 16 Barry Jackson 2013-04-22 00:51:03 CEST
Thierry,
I see you changed the package to grub2.

If this is a problem with grub2, then I don't understand where.

As I posted above, *if* grub2 is installed it works.
Comment 17 Dave Hodgins 2013-04-22 02:01:27 CEST
I don't know if it helps to track down where the problem is, but
if boot a live iso, install to the hard drive, and when it gets
to the bootloader selection screen, open a separate terminal,
and run "chroot /mnt/install", "urpmi grub2", exit from the chroot
and terminal, and then select grub2 in draklive, it works.
Comment 18 Dave Hodgins 2013-04-22 02:58:05 CEST
Quickest workaround might be to add "true", as the last command
in the grub2 postinstall scriptlet.
Comment 19 Barry Jackson 2013-04-22 10:40:00 CEST
(In reply to Dave Hodgins from comment #18)
> Quickest workaround might be to add "true", as the last command
> in the grub2 postinstall scriptlet.

It would be handy to know which command is failing, if it's 

%{name}-mkconfig -o /boot/%{name}/grub.cfg

then maybe 

%{name}-mkconfig -o /boot/%{name}/grub.cfg ||:

would work around it.

If you can get at the install target then there may be a clue in 
/var/log/grub2_post.log

I don't have one handy just now and have to go out.
Comment 20 Barry Jackson 2013-04-22 17:01:12 CEST
Ah - this is interesting, from the /var/log/grub2_post.log:-

#-----------------------
Path â/boot/grub2â is not readable by GRUB on boot. Installation is impossible. Aborting.
/usr/sbin/grub2-probe: error: failed to get canonical path of overlayfs.
#-----------------------

I'm guessing that the installer is installing to /mnt/install/ not / which is upsetting grub2.

If I boot the Live and chroot directly into sda1 
( I use this little script to chroot for grub2 use:- http://mtf.no-ip.co.uk/pub/linux/barjac/soft/mychroot )

# mychroot sda1

I can then install grub2 with 

# grub2-install /dev/sda

Post log is here :-

[root@localhost /]# cat /var/log/grub2_post.log
Installation finished. No error reported.
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-desktop
Found initrd image: /boot/initrd-desktop.img
Found linux image: /boot/vmlinuz-3.8.7-desktop-1.mga3
Found initrd image: /boot/initrd-3.8.7-desktop-1.mga3.img
done
[root@localhost /]#

The new install then boots correctly.

So I guess the installer possibly needs to do the same.
Comment 21 Thierry Vignaud 2013-04-22 17:48:21 CEST
Barry, if package is installed in a chroot, post scripts are run in that chroot.
However...

CC: (none) => mageia

Comment 22 Thierry Vignaud 2013-04-22 17:48:27 CEST
Created attachment 3786 [details]
set $::isInstall while installing bootloader

however we do not set $::isInstall for installing bootloader which might have consequencies.
Can someone live patch draklive-install with that patch?
Just copy it in /tmp while running the live ISO, alter the /tmp/copy and run /tmp/draklive-install instead of the /usr/bin one.
Comment 23 Thierry Vignaud 2013-04-22 18:17:33 CEST
For the record, we probably never installed packages at that step in draklive-install (as both grub & lilo usually are part the live cd), so this may wall fix that issue
Comment 24 Thomas Backlund 2013-04-22 18:22:52 CEST
Here install exploded:

  Can't locate install/pkgs.pm in @INC (@INC contains: /usr/lib/libDrakX /usr/lib/perl5/site_perl/5.16.3/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.16.3 /usr/lib/perl5/vendor_perl/5.16.3/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.16.3 /usr/lib/perl5/5.16.3/x86_64-linux-thread-multi /usr/lib/perl5/5.16.3 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.16.2 /usr/lib/perl5/vendor_perl/5.16.2/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.16.0 /usr/lib/perl5/vendor_perl/5.16.0/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl .) at /usr/lib/libDrakX/do_pkgs.pm line 144.
  Perl's trace:
  standalone::bug_handler() called from /usr/lib/libDrakX/do_pkgs.pm:144
  do_pkgs_during_install::new() called from /usr/lib/libDrakX/do_pkgs.pm:5
  do_pkgs::do_pkgs() called from /usr/sbin/draklive-install:328
  main::setup_bootloader() called from /usr/sbin/draklive-install:72
  main::install_live() called from /usr/sbin/draklive-install:42
Comment 25 Thierry Vignaud 2013-04-22 19:15:57 CEST
Humm...
We only have two cases:
- classic installer (with install/*pm) that installs in chroot
- standalone tools that install in currently running OS

None of those matches live cd where we want to install in a chroot as a live OS.
We would need to add a separate case running urpmi --root $::prefix
Comment 26 Barry Jackson 2013-04-23 00:54:16 CEST
(In reply to Thierry Vignaud from comment #22)
> Created attachment 3786 [details]
> set $::isInstall while installing bootloader
> 
> however we do not set $::isInstall for installing bootloader which might
> have consequencies.
> Can someone live patch draklive-install with that patch?
> Just copy it in /tmp while running the live ISO, alter the /tmp/copy and run
> /tmp/draklive-install instead of the /usr/bin one.

I copied /usr/sbin/draklive-install to /tmp/draklive-install patched it with your patch and ran /tmp/draklive-install

It failed with the same error.

installing grub2-2.00-41.mga3.x86_64.rpm os-prober-1.57-5.mga3.x86_64.rpm grub2-mageia-theme-2.00-41.mga3.x86_64.rpm from /var/local/mga_rpms/core
starting installing packages
created transaction for installing on / (remove=0, install=0, upgrade=3)
warning: %post(grub2-2.00-41.mga3.x86_64) scriptlet failed, exit status 1
ERROR: 'script' failed for grub2-2.00-41.mga3.x86_64: 
/usr/sbin/grub2-probe: error: failed to get canonical path of overlayfs.
unlocking urpmi database
unlocking rpm database
Comment 27 Dave Hodgins 2013-04-23 00:59:18 CEST
This bug also affects grub2-efi, when the live image is booted in uefe mode.
Comment 28 Dave Hodgins 2013-04-23 21:39:21 CEST
Wouldn't a simple fix be to have draklive do the equivalent of
package=grub2
if uefi, package=grub2-efi
cmdfile=/mnt/install/root/urpmicmd
printf "%s\n" "urpmi $package">"$cmdfile"
chmod a+x "$cmdfile"
chroot /mnt/install "$cmdfile"
Comment 29 Thierry Vignaud 2013-04-23 21:53:22 CEST
that would be "urpmi --urpmi-root /mnt..."
Comment 30 Thierry Vignaud 2013-04-23 22:19:59 CEST
It would be simpler to just:
- install grub2 in live cd along grub + lilo
- kill grub2's filetrigger that just redo what bootloader does and
  which we do not want when not using grub2 as bootloader
Comment 31 Thomas Backlund 2013-04-23 22:25:57 CEST
Well, the reason for keeping grub2 rpms in separate repo is that it didn't work if already installed on live image...

grub2 idea of being "all-knowing" is actually preventing it to install properly ...
Comment 32 Anne Nicolas 2013-04-29 11:10:39 CEST
Any progress on that bug?

CC: (none) => ennael1

Comment 33 Manuel Hiebel 2013-05-01 11:51:12 CEST
*** Bug 9898 has been marked as a duplicate of this bug. ***

CC: (none) => civil

Comment 34 Malo Deniélou 2013-05-03 15:19:02 CEST
Any new idea on how to fix this?
Comment 35 Barry Jackson 2013-05-03 20:17:39 CEST
(In reply to Thierry Vignaud from comment #30)
> It would be simpler to just:
> - install grub2 in live cd along grub + lilo
> - kill grub2's filetrigger that just redo what bootloader does and
>   which we do not want when not using grub2 as bootloader

I'm guessing that you meant %post not filetrigger?

I have re-built grub2 without %post and %post efi and installed this in a live system running under VBox.

Attempting to install this system to HD in the VM resulted in the error "Unable to copy files to new root" or words to that effect, however after re-starting draklive installer again from the desktop icon it continued to conclusion and on re-boot (using the "boot from HD" option on the Live bootloader) grub2 booted from HD correctly.

I will re-test again from scratch later but this is looking promising ;)
Comment 36 Thomas Backlund 2013-05-03 20:42:10 CEST
I was planning on trying to do the grub2 install in live mode with --noscripts too, to see if it would help... but havent had time yet...
Comment 37 Thierry Vignaud 2013-05-03 22:49:38 CEST
(In reply to Barry Jackson from comment #35)
> I'm guessing that you meant %post not filetrigger?

No really the file triggers.
They're just duplicate with drakboot works.
Comment 38 Barry Jackson 2013-05-04 00:31:39 CEST
(In reply to Thierry Vignaud from comment #37)
> (In reply to Barry Jackson from comment #35)
> > I'm guessing that you meant %post not filetrigger?
> 
> No really the file triggers.
> They're just duplicate with drakboot works.

Oh - I had no idea that drakboot now detects the installation and removal of grub2-mageia-theme and os-prober and deals with kernel updates.
Does it really?
I will do some testing ;)


Regarding this bug - I have done several installs from LIVE both on real hardware and VM using grub2-2.00-42.mga3 (without %post) and other than the first questionable test - all have worked perfectly.

In VM I installed to MBR and on real h/w I installed to partition (created core.img). All installed and boot OK.

Only one possible issue that I see - the installer offers grub2 as default when it is pre-installed.

So, Thomas - could you please prepare a test live iso that pre-installs grub2-2.00-42 and os-prober and grub2-mageia-theme in the live environment?

grub2-2.00-42 is now in updates_testing.
Comment 39 Barry Jackson 2013-05-04 11:15:23 CEST
(In reply to Thomas Backlund from comment #36)
> I was planning on trying to do the grub2 install in live mode with
> --noscripts too, to see if it would help... but havent had time yet...

That sounds even better, as if it works it will need the least changes. Removing the %post would involve changing several docs and also invalidates many forum posts which rely on core.img being created on package installation.
Comment 40 Barry Jackson 2013-05-04 14:43:43 CEST
Thomas I have done many more tests.
Installing grub2 with --noscripts unfortunately applies noscripts to the suggests as well so the theme package does not update /etc/default/grub.
This does work OK in other respects - but leaves the theme broken.

Installing grub2 in the live system prior to install with:
urpmi --noscripts --no-suggests && urpmi grub2-mageia-theme os-prober ||:

The final ||: is to ignore an error from os-prober due to a filetrigger.

This works, however grub2 is suggested as default, which is not for me a problem, but is inconsistent with the classic installer.

Thinking more about this I tested by simply installing grub2 and ignored the errors in the live.

urpmi grub2 ||:
...
echo $?
0

No problems - the install goes fine and the system boots with theme, so maybe you could try adding that to the iso ?
Comment 41 Thomas Backlund 2013-05-04 16:04:23 CEST
yep, I've now tested with both --noscripts and ||: and both works as the tests in comment 40, so I will use ||:

And I will revert this:
http://svnweb.mageia.org/soft/drakx/trunk/perl-install/bootloader.pm?r1=6649&r2=6650&pathrev=6650

on live images so they default to grub legacy
Comment 42 Thomas Backlund 2013-05-04 18:20:14 CEST
The new broadcom test isos also have the grub2 fixed, you can test them:


NOTE! the isos have "CD" in their name, but most of them are bigger
than 700M so you need a DVD media if you want to burn them,
otherwise I suggest to use a usb stick to boot from, using:

dd if=name_of_iso of=/path/to/usb/stick bs=1M

And to find the isos:

http://mirrors.kernel.org/mageia/people/tmb/mga3-wl-test/
http://ftp.acc.umu.se/mirror/mageia/people/tmb/mga3-wl-test/
http://distrib-coffee.ipsl.jussieu.fr/pub/linux/Mageia/people/tmb/mga3-wl-test/

(and soon on any mirror carrying mageia people/tmb/mga3-wl-test/ tree)
Comment 43 Barry Jackson 2013-05-04 22:39:35 CEST
Tested i586 KDE in VM without problems.

Tested x86_64 KDE from USB stick on real h/w (my main system) to MBR with no issues.

In both cases the Mageia theme is active in grub2 and grub legacy is offered as default.

Closing as fixed.

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


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