Bug#423268: grub-pc: system unbootable when /boot and separate partion, doesnt detect other installed OSes.

Robert Millan rmh at aybabtu.com
Fri May 11 15:40:54 UTC 2007


On Fri, May 11, 2007 at 12:15:57PM -0300, Otavio Salvador wrote:
> Robert Millan <rmh at aybabtu.com> writes:
> 
> > On Fri, May 11, 2007 at 11:06:12AM -0300, Otavio Salvador wrote:
> >> Robert Millan <rmh at aybabtu.com> writes:
> >> 
> >> >> > After upgrading to the newer version of Grub2, postinst runs update-grub which
> >> >> > uses hooks in /etc/grub.d/. If /boot is mounted on separate partition the
> >> >> > grub.cfg still retains /boot/vmlinuz-* as the location for the kernel and
> >> >> > similarly for initrd. This renders the system unbootable.
> >> >> 
> >> >> This bug has already been fixed on development version.
> >> >
> >> > Are you sure?  I don't see any updates in SVN or CVS that indicate this is
> >> > fixed.
> >> 
> >> I said that since you said you have spoted it out. That's why.
> >
> > I spotted it, but since it's not trivial I left it for later.  Sorry :-)
> 
> Can you explain what you've found?

Sure.  10_linux adds linux / initrd images with absolute paths, just as they're
found.  However, when /boot is a separate partition, the path relative to grub's
root will not contain "/boot".  So instead of:

	linux	/boot/vmlinuz-2.6.18-4-amd64 ...

we should have:

	linux /vmlinuz-2.6.18-4-amd64 ...

To do this portably, I think the best is a C program that, for a given path,
climbs to its parent directory iteratively untill a directory that belongs to
another filesystem is found.  If we reach / and this didn't happen, then we
can use absolute paths.

grub-probe (or the biosdisk functions it uses) already has code to check
which filesystem does a file belong to.  Maybe the same interfaces can be
shared.

-- 
Robert Millan

My spam trap is honeypot at aybabtu.com.  Note: this address is only intended
for spam harvesters.  Writing to it will get you added to my black list.




More information about the Pkg-grub-devel mailing list