Bug 735730

Summary: IOError: [Errno 2] No such file or directory: '/mnt/sysimage/boot/grub2/device.map' : upgrade with 'install new bootloader configuration' fails
Product: [Fedora] Fedora Reporter: Kamil Páral <kparal>
Component: anacondaAssignee: David Lehman <dlehman>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 16CC: anaconda-maint-list, awilliam, BobLfoot, clydekunkel7734, dbaron, elad, jonathan, Lcstyle, lepennec, mads, petersen, pschindl, trever, vanmeeuwen+fedora
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Unspecified   
Whiteboard: abrt_hash:2ab73f453e0e0798b7ca1ec9cf8b39323a16bdda2b79c7068cec46772f1413b8 AcceptedBlocker
Fixed In Version: anaconda-16.18-1.fc16 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 782067 (view as bug list) Environment:
Last Closed: 2011-09-19 23:51:42 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 713564, 782067    
Attachments:
Description Flags
logs
none
storage.log
none
program.log
none
anaconda.log
none
anaconda.log
none
program.log
none
storage.log none

Description Kamil Páral 2011-09-05 08:33:26 UTC
abrt version: 2.0.5
executable:     /usr/bin/python
hashmarkername: anaconda
kernel:         3.1.0-0.rc3.git0.0.fc16.i686
product:        Fedora
reason:         IOError: [Errno 2] No such file or directory: '/mnt/sysimage/boot/grub2/device.map'
time:           Mon Sep  5 04:32:47 2011
version:        16-Beta

description:
:The following was filed automatically by anaconda:
:anaconda 16.16 exception report
:Traceback (most recent call first):
:  File "/usr/lib/python2.7/site-packages/pyanaconda/bootloader.py", line 1548, in write_device_map
:    dev_map = open(map_path, "w")
:  File "/usr/lib/python2.7/site-packages/pyanaconda/bootloader.py", line 1617, in write_config
:    self.write_device_map(install_root=install_root)
:  File "/usr/lib/python2.7/site-packages/pyanaconda/bootloader.py", line 987, in write
:    self.write_config(install_root=install_root)
:  File "/usr/lib/python2.7/site-packages/pyanaconda/bootloader.py", line 2086, in writeBootloader
:    anaconda.bootloader.write(install_root=anaconda.rootPath)
:  File "/usr/lib/python2.7/site-packages/pyanaconda/dispatch.py", line 373, in dispatch
:    self.dir = self.steps[self.step].target(self.anaconda)
:  File "/usr/lib/python2.7/site-packages/pyanaconda/dispatch.py", line 241, in go_forward
:    self.dispatch()
:  File "/usr/lib/python2.7/site-packages/pyanaconda/gui.py", line 1203, in nextClicked
:    self.anaconda.dispatch.go_forward()
:  File "/usr/lib/python2.7/site-packages/pyanaconda/iw/progress_gui.py", line 79, in renderCallback
:    self.intf.icw.nextClicked()
:  File "/usr/lib/python2.7/site-packages/pyanaconda/gui.py", line 1223, in handleRenderCallback
:    self.currentWindow.renderCallback()
:IOError: [Errno 2] No such file or directory: '/mnt/sysimage/boot/grub2/device.map'

Comment 1 Kamil Páral 2011-09-05 08:36:42 UTC
I followed this test case:
https://fedoraproject.org/wiki/QA:Testcase_Anaconda_Upgrade_New_Bootloader

I was upgrading F15 to F16 Beta TC1.

Proposing as Beta blocker:
> The installer must be able to successfully complete an upgrade installation from a clean, fully updated default installation (from any official install medium) of the previous stable Fedora release, either via preupgrade or by booting to the installer manually. The upgraded system must meet all release criteria

Comment 2 Kamil Páral 2011-09-05 08:48:55 UTC
Created attachment 521449 [details]
logs

Comment 3 Chris Lumens 2011-09-05 19:22:49 UTC
Please attach logs as individual files.  Doing so makes it easier for us to search bugzilla in the future.

Comment 4 Kamil Páral 2011-09-06 07:36:45 UTC
Created attachment 521589 [details]
storage.log

Comment 5 Kamil Páral 2011-09-06 07:36:56 UTC
Created attachment 521590 [details]
program.log

Comment 6 Kamil Páral 2011-09-06 07:37:07 UTC
Created attachment 521591 [details]
anaconda.log

Comment 7 Kamil Páral 2011-09-06 07:39:27 UTC
Yes, I have upgraded to python-fedora 0.6.2, so that I can finally use 'bugzilla attach' command and don't have to do it all manually. Logs attached individually.

Comment 8 Petr Schindler 2011-09-06 13:59:59 UTC
Created attachment 521672 [details]
anaconda.log

Comment 9 Petr Schindler 2011-09-06 14:00:27 UTC
Created attachment 521674 [details]
program.log

Comment 10 Petr Schindler 2011-09-06 14:00:55 UTC
Created attachment 521675 [details]
storage.log

Comment 11 Petr Schindler 2011-09-06 14:02:27 UTC
I've reproduced this bug. You can find my logs attached above.

Comment 12 Adam Williamson 2011-09-09 17:30:31 UTC
Discussed at 2011-09-09 blocker review meeting. Accepted as a Beta blocker under criterion "The installer must be able to successfully complete an upgrade installation from a clean, fully updated default installation (from any official install medium) of the previous stable Fedora release, either via preupgrade or by booting to the installer manually. The upgraded system must meet all release criteria". anaconda team, please take a look at this. looks like something is expecting grub2, when f15->f16 upgraded systems still have grub1, at a guess?

Comment 13 David Lehman 2011-09-09 17:39:16 UTC
This bug is related to the fact that ugprades keep grub1 while installs get grub2.

Comment 14 Robert Lightfoot 2011-09-11 03:27:16 UTC
This bug was also seen in f16-Beta.TC2-x86_64 arch test 2011-09-10

Comment 15 Robert Lightfoot 2011-09-11 04:04:45 UTC
Seen in f16-Beta.TC2-i686 test 2011-09-10

Comment 16 Adam Williamson 2011-09-12 20:23:41 UTC
I confirm this bug in the case where you do a clean install of F15 and immediately attempt to upgrade to F16, selecting 'install new bootloader configuration'. You only have two choices of what to do with the bootloader in an F16 upgrade:

1) 'skip bootloader configuration', which leaves you with an unbootable system as per https://bugzilla.redhat.com/show_bug.cgi?id=735785 . This seems to be by design, but still is no use for doing a stock F15 to F16 upgrade.

2) 'install new bootloader configuration', which causes you to hit this bug.

Note that 1) is the default choice, which doesn't seem like the best option now that 'update bootloader configuration' - the previous default - is unavailable. 2) is probably the correct default choice for most F15->F16 upgrades.

Seems like we have two basic options here:

a) make 'install new bootloader configuration' - i.e. migrate from grub1 to grub2, and hopefully get it right in most cases - the default, and fix it.

b) restore 'update bootloader configuration', make it the default again, and have it keep grub1 and update it to boot the f16 kernel. (and probably fix 'install new bootloader configuration' too.)

as things stand, there's no way to achieve a functional default f15->f16 upgrade via anaconda without manual intervention when it comes to the bootloader.

Related bug: https://bugzilla.redhat.com/show_bug.cgi?id=735785

Comment 17 Adam Williamson 2011-09-12 20:27:50 UTC
add a higher-level summary to the description.

Comment 18 Adam Williamson 2011-09-12 21:28:00 UTC
and the obligatory note that rc is due tomorrow or wednesday, and we need this fixed to some extent by then.

Comment 19 Adam Williamson 2011-09-12 23:40:54 UTC
One more scenario to consider: preupgrade. Currently results in grub1 with the F15 kernel, no entry for the F16 kernel. The system does boot to the F15 kernel, and I expect the next attempt to install an F16 kernel would result in a bootloader entry being written.

I'll file a new bug for that.

Comment 20 Adam Williamson 2011-09-12 23:50:57 UTC
https://bugzilla.redhat.com/show_bug.cgi?id=737731 filed for preupgrade case.

Comment 21 Adam Williamson 2011-09-13 23:48:23 UTC
so, dlehman is working on this, and gave me http://dlehman.fedorapeople.org/updates-grub2.1.img to test. with a basic test, it looks good:

* installed a minimal F15 system, all defaults
* yum updated to latest F15
* did an upgrade install with F16 Beta TC2 + updates-grub2.1.img
* 'install new boot loader configuration' was the default choice
* upgrade completed successfully
* upgraded system booted successfully, using grub2, to an F16 kernel (rc3)
* 'yum upgrade kernel' on the upgraded system installed the rc5 kernel and correctly updated grub2's configuration
* the system correctly booted to the rc5 kernel on reboot

problems:

* after upgrade, both grub and grub2 are installed (despite them conflicting)
* the kernel upgrade printed the error "grubby fatal error: unable to find a suitable template" during post: I suspect this may have been while trying to update the grub1 config, which still exists

so it's a bit messy, but it seems to work.

Comment 22 Fedora Update System 2011-09-15 00:43:59 UTC
anaconda-16.18-1.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/anaconda-16.18-1.fc16

Comment 23 Elad Alfassa 2011-09-15 04:57:20 UTC
(In reply to comment #21)
> * after upgrade, both grub and grub2 are installed (despite them conflicting)
Shouldn't grub2 obsolete grub1?
This will make sure only grub2 is installed.

Comment 24 Adam Williamson 2011-09-15 05:01:41 UTC
No, as we need to use grub-legacy for EFI installs.

Comment 25 Elad Alfassa 2011-09-15 05:06:30 UTC
So we could rename grub to grub-legacy, and have grub2 obsolete grub (ie. before the rename), and add just add some code to make sure grub-legacy is installed on EFI systems.

Comment 26 Adam Williamson 2011-09-15 05:15:41 UTC
yeah, that's a possibility, but we haven't really looked at it to make sure there's no other gotchas yet. maybe for final.

Comment 27 Fedora Update System 2011-09-15 15:16:01 UTC
Package anaconda-16.18-1.fc16:
* should fix your issue,
* was pushed to the Fedora 16 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing anaconda-16.18-1.fc16'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/anaconda-16.18-1.fc16
then log in and leave karma (feedback).

Comment 28 Mads Kiilerich 2011-09-15 21:19:24 UTC
(In reply to comment #21)
> * the kernel upgrade printed the error "grubby fatal error: unable to find a
> suitable template" during post: I suspect this may have been while trying to
> update the grub1 config, which still exists

Isn't that fully explained by bug 735785#c32 - the new kernel is (for reasons unknown to me) not installed but updated, and the old kernel removes itself in its %preuninstall, so there _is_ no template to update. (Or actually there probably is ... Grubby refuses to write a config without any entries, but later on grubby also refuses to use the last entry because the vmlinuz it references no longer exists.)

Comment 29 Adam Williamson 2011-09-16 02:49:42 UTC
Confirmed the fix in RC1: I was able to upgrade a fully updated default DVD install of F15 to F16 with all defaults, the upgraded system booted with the rc6 kernel.

The first boot of the upgraded system stalled, but further attempts worked fine, and that's not part of this bug anyway.

Comment 30 Mads Kiilerich 2011-09-16 12:29:56 UTC
I got this with anaconda-16.18-1.fc16 when running from a custom live image, so in my opinion it has not been fixed.

My image was booted by grub2-efi, but there is no "boot loader installer" available, neither grub, grub2 nor grub2-efi. It is thus ok that liveinst fails and I have to install a bootloader somehow myself, but it shouldn't crash.

Comment 31 David Lehman 2011-09-16 14:46:33 UTC
(In reply to comment #30)
> I got this with anaconda-16.18-1.fc16 when running from a custom live image, so
> in my opinion it has not been fixed.

The fix was to make sure grub2 gets installed on upgrades -- not to make it possible to do an install without any bootloader at all. For that you can file an RFE if you like, but it will likely be rejected.

> 
> My image was booted by grub2-efi, but there is no "boot loader installer"
> available, neither grub, grub2 nor grub2-efi. It is thus ok that liveinst fails
> and I have to install a bootloader somehow myself, but it shouldn't crash.

If you are going to compose images with no bootloader package you will need to patch anaconda to skip bootloader installation, perhaps via updates.img. We do not want anaconda to silently fail when no bootloader is available to install as this is typically a fatal error.

Comment 32 Mads Kiilerich 2011-09-16 15:06:53 UTC
(In reply to comment #31)
> The fix was to make sure grub2 gets installed on upgrades

This was on an EFI system, so it would be a bug if it installed the grub2 package.

This was a live install without any network connection, so I wonder how it would be able to install grub2 (or grub or grub2-efi) at all.

> We do
> not want anaconda to silently fail when no bootloader is available to install
> as this is typically a fatal error.

I don't want anaconda to fail silently. I want anaconda to be robust and report fatal errors without crashing. I don't see how this error is different from other "There was an error installing the bootloader. The system may not be bootable." errors.

This ugly workaround hack worked for me and made it possible (with some manual work) to install an EFI system from updates-testing:

--- /usr/lib/python2.7/site-packages/pyanaconda/bootloader.py	2011-09-15 02:33:59.000000000 +0200
+++ bootloader.py	2011-09-16 17:02:34.487386478 +0200
@@ -2091,7 +2091,7 @@
 
     try:
         anaconda.bootloader.write(install_root=anaconda.rootPath)
-    except BootLoaderError as e:
+    except Exception as e:
         if anaconda.intf:
             anaconda.intf.messageWindow(_("Warning"),
                             _("There was an error installing the bootloader.  "

Comment 33 David Lehman 2011-09-16 15:24:08 UTC
If your system is EFI anaconda should not be doing anything related to grub2 on your system. For EFI we still use grub-legacy. If you open a separate bug and attach your logs we can look into why your system is not being detected as EFI.

Comment 34 Raphael Groner 2011-09-16 17:05:46 UTC
I reproduced with Fedora-16-Beta-TC-i686-Live-XFCE.iso to do an upgrade to a long time runned Fedora 14 system with grub1.

So my decision is to reinstall.

Comment 35 Raphael Groner 2011-09-16 17:22:30 UTC
(In reply to comment #34)
Sorry, I meant Fedora-16-Beta-x86_64-netinst.iso

Comment 36 Raphael Groner 2011-09-16 18:55:28 UTC
(In reply to comment #35)
Forget about my comments. RC1 works and installs grub2. Sorry for the noise.

Comment 37 Fedora Update System 2011-09-19 23:51:17 UTC
anaconda-16.18-1.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 38 Erwan LE PENNEC 2011-11-08 16:47:51 UTC
I may have encountered this bug with the official i386 DVD. I've tried to upgrade from my Fedora 15 and I'm stuck with this error during the process...

Comment 39 Mads Kiilerich 2011-11-08 17:29:44 UTC
Erwan, why do think it was this bug you saw?

If you really did use the official final f16 DVD then you should file a new issue for that (unless somebode else already has done that). Make sure you attach anaconda.log and program.log.

Comment 40 Erwan LE PENNEC 2011-11-08 18:00:35 UTC
I had seen the very same error message during my attempt to upgrade... As my computer is a netbook, I don't have a DVD drive and had made a Live USB from the official USB. It seems that this may also trigger an issue. I will have to make a complete backup of my current config before retrying...

Comment 41 Erwan LE PENNEC 2011-11-09 08:34:45 UTC
I have retried and this time everything worked. I however made a slight change in the way I wrote my USB key: I used dd instead of live-iso-to-disk. My guess is that this is related to the automatic detection of the drive to which anaconda install the bootloader. It is triggered if I write my USB with livecd-iso-to-disk but not if I write it with dd...

Comment 42 Mads Kiilerich 2011-11-09 10:04:26 UTC
Erwan: Please file a separate issue for that.

Comment 43 David Baron 2011-12-14 23:46:21 UTC
For the record, Erwan filed bug 752358.

I'd also like to note that I hit this same error message (while trying to do an F15 to F16 upgrade, on x86_64) due to my own error:  I was doing the upgrade from an ISO image of the DVD stored on a different partition, but I made the mistake of pointing the F16 installer (i.e., the DVD's vmlinuz and initrd.img) at the F15 ISO, when I should have updated my grub entry to point to the F16 ISO, i.e. I had failed to update the repo= line below (now updated):

title F16 Installer
        kernel (hd0,5)/F16-vmlinuz lang= devfs=nomount ramdisk_size=64000 repo=hd:LABEL=exthome1:/f16/ ip=192.168.XXX.XXX netmask=255.255.255.0 gateway=192.168.XXX.1 dns=192.168.XXX.1
        initrd (hd0,5)/F16-initrd.img

Comment 44 Ron Gonzalez 2012-01-04 07:07:35 UTC
Upon a failed preupgrade attempt, due to bug 737508, when I tried using the F16 DVD installer to upgrade an installation that was already upgraded I received this bug.  I used the debug reporter to try to file a bug but it found this as a duplicate instead.  I have no logs, I have since installed from scratch.