Casper's USB update-initramfs shim should look for initrd.img in /boot

Bug #591207 reported by Mark Shuttleworth
148
This bug affects 26 people
Affects Status Importance Assigned to Milestone
casper (Ubuntu)
Fix Released
High
Colin Watson
Lucid
Fix Released
High
Colin Watson
Maverick
Fix Released
High
Colin Watson

Bug Description

When upgrading a live USB stick, we use a diverted version of update-initramfs installed by casper which arranges for /casper/vmlinuz and /casper/initrd.lz at the top level of the CD to be updated. Unfortunately this script does not quite operate correctly; it assumes that there will be vmlinuz and initrd.gz links in the root directory, when in fact they are often (although not exclusively) in /boot. It needs to try both.

Stable update justification:

Impact: USB stick upgrades fail with obscure errors when upgrading the kernel. This results in very large numbers of duplicate bug reports.

Development branch: Fixed in casper 1.237/1.253/1.254 by making the writable-USB-stick update-initramfs shim handle vmlinuz and initrd.img being in /boot rather than /, making it more robust against the bits it's copying not existing for various reasons, and making it be a separate executable which can be upgraded in ways that don't involve regenerating the USB stick.

Patch:
 http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/lucid/casper/lucid/revision/818?compare_revid=812
 http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/maverick/casper/maverick/revision/843?compare_revid=841

TEST CASE: Create an Ubuntu USB stick, making sure that you do *not* drag the "Stored in reserved extra space" slider all the way to the right in usb-creator (see bug 562312), and upgrade the kernel to the current version in lucid-proposed or maverick-proposed as applicable. 10.04.1 and 10.10 as released should fail. A lucid daily build dating from after this SRU is accepted should succeed (we're unlikely to do more daily builds of maverick), although this only applies if you find a daily build which contains this fixed version of casper but doesn't have the newest version of the kernel in the archive, so don't worry if you can't test this case. Also, if you start from 10.04.1 or 10.10 as released, upgrade the casper package to the current version in lucid-proposed or maverick-proposed after this SRU is accepted, and then run 'sudo update-initramfs -u', that should succeed.

Regression potential: I don't think update-initramfs will fail in any more situations due to this change. Possible sources of regression are problems upgrading the casper package, and testers should also make sure that the upgraded image actually still boots correctly into the new kernel version following this change.

Please note the similar bug 557023, which we're fixing along with this bug, and the related bug 591202 in grub2, which you may run into along the way.

komputes (komputes)
Changed in casper (Ubuntu):
status: New → Confirmed
Colin Watson (cjwatson)
Changed in casper (Ubuntu):
status: Confirmed → Triaged
importance: Undecided → High
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package casper - 1.237

---------------
casper (1.237) maverick; urgency=low

  [ Colin Watson ]
  * Add btrfs support.
  * Make ip=* command-line parsing more precise (thanks, Bill Nickless;
    LP: #586553).
  * Make the USB update-initramfs shim cope with vmlinuz and initrd.img
    being in /boot rather than / (LP: #591207).
  * Depend on file for /etc/init.d/casper (thanks, Alon Swartz;
    LP: #591213).
  * Conflict with live-initramfs, as they overlap and people can pick one or
    the other (LP: #453476).

  [ Martin Pitt ]
  * debian/casper.init: Change shutdown splash message to refer to
    "installation media" instead of "disc"; a lot of installs happen
    from USB sticks these days. Thanks to Debbie Beliveau for the idea.
 -- Colin Watson <email address hidden> Mon, 28 Jun 2010 16:53:17 +0100

Changed in casper (Ubuntu):
status: Triaged → Fix Released
Colin Watson (cjwatson)
description: updated
Changed in casper (Ubuntu Lucid):
status: New → In Progress
Changed in casper (Ubuntu):
assignee: nobody → Colin Watson (cjwatson)
Changed in casper (Ubuntu Lucid):
importance: Undecided → High
assignee: nobody → Colin Watson (cjwatson)
Revision history for this message
Martin Pitt (pitti) wrote : Please test proposed package

Accepted casper into lucid-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in casper (Ubuntu Lucid):
status: In Progress → Fix Committed
tags: added: verification-needed
Revision history for this message
Martin Pitt (pitti) wrote :

Any testers?

Revision history for this message
Martin Pitt (pitti) wrote :

I booted a lucid final live system from a USB stick with 128 MB of persistency, and "sudo update-initramfs -u" fails.

However, after upgrading to the proposed version it still fails:

ubuntu@ubuntu:~$ sudo apt-get install casper
The following packages will be upgraded:
  casper
[...]
Preparing to replace casper 1.236 (using .../casper_1.236.1_amd64.deb) ...
Unpacking replacement casper ...
Processing triggers for man-db ...
Processing triggers for ureadahead ...
Setting up casper (1.236.1) ...
update-initramfs: deferring update (trigger activated)
cp: cannot stat `/vmlinuz': No such file or directory

Processing triggers for initramfs-tools ...
update-initramfs: Generating /boot/initrd.img-2.6.32-21-generic
cp: cannot stat `/vmlinuz': No such file or directory
dpkg: error processing initramfs-tools (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 initramfs-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)

This is exactly the same error message as with the lucid-final version.

There is no /casper/, but /proc/mounts has those:

rootfs / rootfs rw 0 0
/dev/sdb1 /cdrom vfat rw,relatime,fmask=0022,dmask=0022,codepage=cp437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 0 0
/dev/loop0 /rofs squashfs ro,noatime 0 0
/dev/sdb1 /casper-rw-backing vfat rw,relatime,fmask=0022,dmask=0022,codepage=cp437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 0 0
/dev/loop1 /cow ext3 rw,noatime,errors=continue,data=ordered 0 0
aufs / aufs rw,noatime,si=f17d5e79cd286719 0 0

Revision history for this message
Martin Pitt (pitti) wrote :

Interesting, I recreated my USB stick with the current 10.04.1 candidate iso now (which already has the lucid-proposed version), and now I get:

$ sudo update-initramfs -u
update-initramfs: Generating /boot/initrd.img-2.6.32-24-generic
lzma: Encoder error: -2147467259

I'll attach the complete log with -v, but it doesn't give away much more info.

Adding -x to /usr/share/initramfs-tools/scripts/casper-bottom/43disable_updateinitramfs gives:

$ sudo update-initramfs -u -v
[...]
update-initramfs: Generating /boot/initrd.img-2.6.32-24-generic
[...]
Calling hook kbd
Adding binary /bin/setfont
Adding binary /bin/kbd_mode
Adding binary /bin/loadkeys
Calling hook dmsetup
+ PREREQ=
+ DESCRIPTION=Possibly disabling update-initramfs (useless on a live CD)...
+ prereqs
+ echo
+ exit 0
Building cpio /boot/initrd.img-2.6.32-24-generic.new initramfs
lzma: Encoder error: -2147467259

Revision history for this message
Martin Pitt (pitti) wrote :

Looking at the USB stick, I see that the original intent of this patch seems to have worked, it indeed tries to update the USB stick now, but fails in the middle due to that lzma failure:

$ ls -l /media/035E-3183/casper/init*
-rw-r--r-- 1 martin martin 9837789 2010-08-16 07:47 /media/035E-3183/casper/initrd.lz
-rw-r--r-- 1 martin martin 413696 2010-08-16 06:03 /media/035E-3183/casper/initrd.lz.new

Revision history for this message
Martin Pitt (pitti) wrote :

After discussion with Steve I removed the SRU from -proposed, to unblock 10.04.1 images. The SRU doesn't help the actual problem (upgrades fail), and it now leaves a broken file on USB sticks (which takes additional space and might lead to other problems).

tags: removed: verification-needed
Changed in casper (Ubuntu Lucid):
status: Fix Committed → Confirmed
Revision history for this message
Mark Shuttleworth (sabdfl) wrote : Re: [Bug 591207] Re: Casper's USB update-initramfs shim should look for initrd.img in /boot

Thanks for working on this, guys. I think it's OK if we miss 10.4.1 for
this fix, better to do it properly. I would ask though that we address
it for 10.4.2 and also make it part of the testing routine for future
releases (i.e. we commit to making the live USB install image updateable).

Mark

Martin Pitt (pitti)
Changed in casper (Ubuntu Lucid):
milestone: none → ubuntu-10.04.2
Revision history for this message
nh2 (nh2) wrote :

For your interest, there are two other bugs that prevent live USB installs from being updateable:

- Bug #667578 where update-grub dies on live systems
- Bug #562312 in which Startup Disk Creator does not leave space for initrd updates

Both lead to apt being in a conflict state and make Ubuntu Software Center stop working.

Revision history for this message
Colin Watson (cjwatson) wrote :

I've identified two problems with my previous upload attempt of casper, and am preparing an upload now which does a better job. It probably won't be possible to fix this in all upgrade scenarios, because it'll be possible for somebody to do a partial upgrade of the kernel without the new version of casper, but this upload will remove the necessity to generate a new USB stick before the new update-initramfs takes effect.

Martin, your problem is bug 562312, also mentioned by nh2. For the purposes of validating this SRU, I think that we should work around this by ensuring that the usb-creator slider is somewhere in the middle and the stick is a reasonably comfortable size; not to say that that bug shouldn't be fixed, but it shouldn't block this one in my opinion.

As far as I can tell, bug 667578 does not affect lucid, but only maverick and up. I'm not seeing it in my test environment, although I am seeing bug 591202 when upgrading the grub-pc package itself.

Colin Watson (cjwatson)
Changed in casper (Ubuntu):
status: Fix Released → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package casper - 1.254

---------------
casper (1.254) natty; urgency=low

  * More fixes to the USB update-initramfs shim (LP: #591207):
    - Make the shim a proper executable in
      /usr/share/casper/casper-update-initramfs and symlink to it if
      necessary at boot time, so that new versions of this shim are
      automatically installed when casper is upgraded.
    - $bootdir/initrd.img may exist when $bootdir/vmlinuz doesn't; for
      example, if we're running off a fresh live USB stick and the kernel
      hasn't yet been upgraded.
 -- Colin Watson <email address hidden> Thu, 20 Jan 2011 14:18:59 +0000

Changed in casper (Ubuntu):
status: In Progress → Fix Released
Colin Watson (cjwatson)
description: updated
Changed in casper (Ubuntu Maverick):
status: New → Confirmed
importance: Undecided → High
assignee: nobody → Colin Watson (cjwatson)
Revision history for this message
Martin Pitt (pitti) wrote : Please test proposed package

Accepted casper into lucid-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in casper (Ubuntu Lucid):
status: Confirmed → Fix Committed
tags: added: verification-needed
Revision history for this message
Martin Pitt (pitti) wrote :

Accepted casper into maverick-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in casper (Ubuntu Maverick):
status: Confirmed → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package casper - 1.236.2

---------------
casper (1.236.2) lucid-proposed; urgency=low

  * More fixes to the USB update-initramfs shim (thanks, Evan Dandrea;
    LP: #557023, #591207):
    - Make the shim a proper executable in
      /usr/share/casper/casper-update-initramfs and symlink to it if
      necessary at boot time, so that new versions of this shim are
      automatically installed when casper is upgraded.
    - Only copy each of $bootdir/initrd.img and $bootdir/vmlinuz if they
      exist (for example, initrd.img may exist without vmlinuz if we're
      running off a fresh live USB stick and the kernel hasn't yet been
      upgraded).
 -- Colin Watson <email address hidden> Thu, 20 Jan 2011 14:26:57 +0000

Changed in casper (Ubuntu Lucid):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package casper - 1.248.1

---------------
casper (1.248.1) maverick-proposed; urgency=low

  * More fixes to the USB update-initramfs shim (thanks, Evan Dandrea;
    LP: #557023, #591207):
    - Make the shim a proper executable in
      /usr/share/casper/casper-update-initramfs and symlink to it if
      necessary at boot time, so that new versions of this shim are
      automatically installed when casper is upgraded.
    - Only copy each of $bootdir/initrd.img and $bootdir/vmlinuz if they
      exist (for example, initrd.img may exist without vmlinuz if we're
      running off a fresh live USB stick and the kernel hasn't yet been
      upgraded).
 -- Colin Watson <email address hidden> Thu, 20 Jan 2011 14:34:15 +0000

Changed in casper (Ubuntu Maverick):
status: Fix Committed → Fix Released
tags: added: testcase
Revision history for this message
Alan Hoyle (alanh) wrote :

I am still having this problem with a 12.04 live USB install. I installed a basic system to a USB drive and whenever it tries to update the kernel, dpkg gives errors.

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.