live-media=<device> is no more supported in casper

Bug #653633 reported by phl
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
casper (Ubuntu)
Won't Fix
Undecided
Unassigned

Bug Description

Binary package hint: casper

From Changelog:

casper (1.77+debian-1) unstable; urgency=low
+
+ ......
+ * Added boot parameter "live-media=<device>" to force trying to boot from
+ a specified device.

From man casper (casper_1.246_i386.deb)

{live-media|bootfrom}=DEVICE
If you specify one of this two equivalent forms, casper will first try to find this device for the "/casper" directory where the read-only root filesystem should reside. If it did not find something usable, the normal scan for block devices is performed.

But from some time ago, this feature has disappeared.

In /usr/share/initramfs-tools/scripts/casper, in the function

parse_cmdline ()
{
    PRESEEDS=
    # looking for casper specifics options as kernel parameters
    for x in $(cat /proc/cmdline); do
        case $x in

these two lines are no more here

           bootfrom=*|live-media=*)
                export LIVEMEDIA=${x#*=} ;;

But it seems that support for this feature still exists partially:

find_livefs() {
    timeout="${1}"
    # first look at the one specified in the command line
    if [ ! -z "${LIVEMEDIA}" ]; then
        if check_dev "null" "${LIVEMEDIA}" "skip_uuid_check"; then
            return 0
        fi
    fi
    # don't start autodetection before timeout has expired
    if [ -n "${LIVEMEDIA_TIMEOUT}" ]; then

Actually, more often, this interesting feature never worked well because the misplaced timeout make the only one try to use ${LIVEMEDIA} too early, before USB are ready, so few people noticed its disappearance.

I suggest restoring parse_cmdline () and moving check_dev "null" "${LIVEMEDIA}" after time-out

Ph.L.

Revision history for this message
tarski (guy-laffitte) wrote :

  I have a couple of remarks to formulate about this bug.

1. I have been unable to find where variable LIVEMEDIA_TIMEOUT is set. If is is never set, it is useless. There are thus two solutions : either remove it, or add boot parameter ( for example "live-media-timeout=xx" ) to set it.

2. A user who specifies "live_media" boot parameter ( generally ) does not want to boot on another device. The use of this parameter did not work well because the script fell back in normal scan when the attempt with LIVEMEDIA failed. The race condition is generally not in favour of USB devices faced to other ones, due to latency.
   I prefer not to waste time in case of boot failure if there is a mistake in live-media parameter rather than a successful boot on a wrong device. So, I propose to make scan of LIVEMEDIA and normal scan mutually exclusive. In "find_livefs" the code could be something like this ( letting drop LIVEMEDIA_TIMEOUT ) :

  if [ ! -z "${LIVEMEDIA}" ]; then
    # scan with LIVEMEDIA
  else
    # normal scan
  fi

Revision history for this message
Brian Murray (brian-murray) wrote :

The code for this is significantly different in Oneiric and it seems that it is supported now just with a different name.

            live-media-path=*)
                LIVE_MEDIA_PATH="${x#live-media-path=}"
                export LIVE_MEDIA_PATH
                echo "export LIVE_MEDIA_PATH=\"$LIVE_MEDIA_PATH\"" >> /etc/casper.conf ;;

As such I'm setting this to Won't Fix.

Changed in casper (Ubuntu):
status: New → Won't Fix
Revision history for this message
phl (ubuntu-leledy) wrote :

I think you arre speaking about uuid= , don't you ?
Could you remove reference to live-media-path in man casper. It's a lot of waste time trying this feature which will never work ?
Thanks.

By the way, because of this bug I had to use my own method, more general that the new uuid= because any udev property may be selected, and I rely only on udev for discovering live-media. Casper just waits udev discover the right disk.

Ph.L

Revision history for this message
phl (ubuntu-leledy) wrote :
Download full text (6.7 KiB)

Here is my udev based live-device recognition system. Diff from 10.10 release

--1----------------------------------------------------------------------------------------------------
EXTLINUX config :
kernel ../casper/vmlinuz1
 append initrd=../casper/initramfs-USB-UDEV boot=casper livecasper-dev=udev=UUID=fc0e5af3-e635-4ef9-831d-0ea4f4e70a60 livehome-dev=udev=UUID=695d19b0-78d9-4dc3-ab3f-6f0cf2f315b4
------------------
/etc/udev/rules.d/61-casper-usb.rules:
# Used to make casper event driven instead of repeatedly scan all block devices
# With this rule finding live-media device is mainly udev's job

# Does not work when named 60-xxx.rules but does work whan named 61-xxx.rules

ENV{ID_USB_DRIVER}!="usb-storage", GOTO="end_usb-casper.rules"
ACTION!="add|change", GOTO="end_usb-casper.rules"

IMPORT{cmdline}="livecasper-dev=udev=UUID"
ENV{ID_FS_UUID}!="",\
  PROGRAM=="/bin/sh -c 'test $env{livecasper-dev=udev=UUID}=$env{ID_FS_UUID}'",SYMLINK+=".livecasper"
IMPORT{cmdline}="livehome-dev=udev=UUID"
ENV{ID_FS_UUID}!="", \
  PROGRAM=="/bin/sh -c 'test $env{livehome-dev=udev=UUID} = $env{ID_FS_UUID}'",SYMLINK+=".livehome"

--2---------------------------------------------------------------------------------------------------
--- casper_1.248_i386.deb.d/usr/share/initramfs-tools/scripts/casper 2010-09-16 01:34:18.000000000 +0200
+++ ~/usr/share/initramfs-tools/scripts/casper 2010-11-11 18:52:50.000000000 +0100
@@ -1,5 +1,10 @@
 #!/bin/sh

+# make udev does most of the search
+# -1- livecasper-dev=udev=UUID
+# a) ln -s xxx /dev/.livecasper
+# b) ln -s yyy /dev/.livehome
+# -2- suppress snapshots
 # set -e

 export PATH=/usr/bin:/usr/sbin:/bin:/sbin
@@ -31,7 +36,7 @@

 parse_cmdline() {
     for x in $(cat /proc/cmdline); do
- case $x in
+ case $x in
             showmounts|show-cow)
                 export SHOWMOUNTS='Yes' ;;
             persistent)
@@ -50,6 +55,28 @@
                 export STATICIP ;;
             ignore_uuid)
                 IGNORE_UUID="Yes" ;;
+ livecasper-dev=*)
+ LIVE_CASPER_DEV="${x#livecasper-dev=}"
+ export LIVE_CASPER_DEV
+ echo "export LIVE_CASPER_DEV=\"$LIVE_CASPER_DEV\"" >> /etc/casper.conf
+ case ${LIVE_CASPER_DEV} in
+ udev=UUID=*)
+ LIVE_CASPER_UDEV_UUID="${LIVE_CASPER_DEV#udev=UUID=}"
+ export LIVE_CASPER_UDEV_UUID
+ echo "export LIVE_CASPER_UDEV_UUID=\"$LIVE_CASPER_UDEV_UUID\"" >> /etc/casper.conf ;;
+ esac
+ ;;
+ livehome-dev=*)
+ LIVE_HOME_DEV="${x#livehome-dev=}"
+ export LIVE_HOME_DEV
+ echo "export LIVE_HOME_DEV=\"$LIVE_HOME_DEV\"" >> /etc/casper.conf
+ case ${LIVE_HOME_DEV} in
+ udev=UUID=*)
+ LIVE_HOME_UDEV_UUID="${LIVE_HOME_DEV#udev=UUID=}"
+ export LIVE_HOME_UDEV_UUID
+ echo "export LIVE_HOME_UDEV_UUID=\"$LIVE_HOME_UDEV_UUID\"" >> /etc/casper.conf ;;
+ esac
+ ;;
             live-media-path=*)
                 LIVE_MEDIA_PATH...

Read more...

Revision history for this message
Steven Haber (sthaber) wrote :

I've run into this issue as well. I'm writing a custom Live CD that boots over PXE using memdisk, and I was banging my head against the wall watching casper just search for "nice" block devices rather than using my image. At the very least, take it out of the man pages:

http://manpages.ubuntu.com/manpages/precise/en/man7/casper.7.html

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.