update-grub skips last line in /etc/fstab when finding boot device

Bug #275365 reported by WarrenTurkal
2
Affects Status Importance Assigned to Milestone
grub (Ubuntu)
Fix Released
Undecided
Unassigned
Intrepid
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: grub

I have a Dell 1420 laptop that shipped with an earlier version of Ubuntu. I upgraded it to Intrepid and noticed (in a failure to reboot) that the grub-update script was not creating my boot entries properly.

After investigation, I found that update-grub uses read to look at the lines in /etc/fstab. This works fine until the last line is either the /boot volume (and maybe / volume also) and isn't trailed by a newline. The read command will not read the line without a newline.

The last line of my /etc/fstab defines my /boot volume and is not trailed by a newline. That line never gets read, and the update-grub script doesn't know about my /boot volume. This causes the script to have "/boot" on all the kernels and initrds in the menu.lst file even though /boot.

Here's an example of a command not working:

echo -n '0 1 2 3' | read A && echo $A

This command outputs nothing in either bash or dash. I will submit a patch to change the read to awk as soon as I can.

I would like to have this fix in for Intrepid since my Dell 1420 laptop shipped with this partition configuration, and this problem could bite all the folks trying with Dell 1420s when upgrading to Intrepid.

Related branches

WarrenTurkal (wturkal)
description: updated
Revision history for this message
WarrenTurkal (wturkal) wrote :

Here's the patch.

This adds a dependency of awk. That probably need to be reflected in the debian/control file.

Revision history for this message
WarrenTurkal (wturkal) wrote :

I just looked that the debian package. It uses a potentially smarter method of finding the device associated with a volume. You might just want to bump up to the current version of grub in lenny instead of using my patch. However, my patch does fix the immediate problem, and I'm not sure if the debian package has any regressions that we need to be worried about.

Revision history for this message
Steve Langasek (vorlon) wrote :

use of awk does not need to be reflected as a dependency; awk is a "virtually essential" package.

Revision history for this message
WarrenTurkal (wturkal) wrote : Re: [Bug 275365] Re: update-grub skips last line in /etc/fstab when finding boot device

So...does this have a chance of making it in for the Intrepid release?

wt

On Mon, Sep 29, 2008 at 1:40 AM, Steve Langasek
<email address hidden> wrote:
> use of awk does not need to be reflected as a dependency; awk is a
> "virtually essential" package.
>
> --
> update-grub skips last line in /etc/fstab when finding boot device
> https://bugs.launchpad.net/bugs/275365
> You received this bug notification because you are a direct subscriber
> of the bug.
>

Revision history for this message
Steve Langasek (vorlon) wrote :

Yes, this should be a candidate for resolving for release; marking it as such.

The targeted patch using awk is safer than pulling in a new Debian revision, at this point.

One difference between the two implementations, however, is that the awk command will print the /first/ match for the mount point, and the 'read' command prints the /last/ match for the mountpoint. The latter is arguably more correct, so I think we should tune this to use 'tail -n 1' or equivalent.

Changed in grub:
status: New → Triaged
Revision history for this message
Steve Langasek (vorlon) wrote :

Committed to bzr.

Changed in grub:
status: Triaged → Fix Committed
Revision history for this message
WarrenTurkal (wturkal) wrote :

When will this fix be shipped? I noticed it's still not in the current
grub package in intrepid.

On Wed, Oct 1, 2008 at 3:07 PM, Steve Langasek
<email address hidden> wrote:
> Committed to bzr.
>
> ** Changed in: grub (Ubuntu Intrepid)
> Status: Triaged => Fix Committed
>
> --
> update-grub skips last line in /etc/fstab when finding boot device
> https://bugs.launchpad.net/bugs/275365
> You received this bug notification because you are a direct subscriber
> of the bug.
>

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package grub - 0.97-29ubuntu37

---------------
grub (0.97-29ubuntu37) intrepid; urgency=low

  * debian/update-grub: use awk instead of read to find the boot device,
    as the latter fails when the last line of /etc/fstab lacks a
    newline. Thanks to Warren Turkal for the fix. LP: #275365.

 -- Steve Langasek <email address hidden> Wed, 08 Oct 2008 19:06:47 -0700

Changed in grub:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.