The bug concerns update of grub when device names changed between install and upgrade. I am in doubts - are we supposed to handle such a case? How much of corner is the case? Isn't bootloader reinstall (safer) answer in such cases?
--- booty/x86.py | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/booty/x86.py b/booty/x86.py index 3890e69..f90cb86 100644 --- a/booty/x86.py +++ b/booty/x86.py @@ -417,6 +417,31 @@ class x86BootloaderInfo(efiBootloaderInfo):
return config
+ def updateDeviceMap(self, instRoot): + if os.access(instRoot + "/boot/grub/device.map", os.R_OK): + f = open(instRoot + "/boot/grub/device.map", "r") + updatedlines = [] + update = False + for line in f: + line = line.strip() + if line.startswith('(hd'): + (grubdisk, path) = line.split()[:2] + i = int(grubdisk.lstrip('(hd ').rstrip(') ')) + actual_path = self.storage.devicetree.getDeviceByName(self.drivelist[i]).path + if path != actual_path: + line = "%s %s" % (grubdisk, actual_path) + update = True + updatedlines.append(line) + f.close() + + if update: + os.rename(instRoot + "/boot/grub/device.map", + instRoot + "/boot/grub/device.map.rpmsave") + f = open(instRoot + "/boot/grub/device.map", "w+") + upd_comment = "# file updated by anaconda\n" + f.write(upd_comment + '\n'.join(updatedlines) + '\n') + f.close() + # this is a hackish function that depends on the way anaconda writes # out the grub.conf with a #boot= comment # XXX this falls into the category of self.doUpgradeOnly @@ -450,6 +475,9 @@ class x86BootloaderInfo(efiBootloaderInfo): # migrate info to /etc/sysconfig/grub self.writeSysconfig(instRoot, theDev)
+ # update device.map + self.updateDeviceMap(instRoot) + # more suckage. grub-install can't work without a valid /etc/mtab # so we have to do shenanigans to get updated grub installed... # steal some more code above
On Wednesday, July 29 2009, Radek Vykydal said:
The bug concerns update of grub when device names changed between install and upgrade. I am in doubts - are we supposed to handle such a case? How much of corner is the case? Isn't bootloader reinstall (safer) answer in such cases?
This is probably the best we can do. We should eventually move to using uuids here too probably. Luckily, grub2 already uses uuids for most things so we'll get that "for free" when we move in the future
Jeremy
anaconda-devel@lists.fedoraproject.org