casper-helpers:where_is_mounted fails in obscure cases
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
casper (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Binary package hint: casper
where_is_mounted() in casper-helpers contains the following line:
grep "^$device " /proc/mounts | read d mountpoint rest
This will not work, as the read command is executed in a subshell because of the pipeline and so does not set the variables in the main script. The following should work instead:
mountpoint=`grep "^$device " /proc/mounts | awk '{print $2}'`
(tested at the commandline from an interrupted initramfs)
This will only cause problems if casper is looking for files to mount persistently on an already-mounted device, and that device is not mounted on whatever directory was left in $mountpoint from its previous use. The situation I encountered it in was trying to loopback mount an ext3 casper-rw file which was on the same partition as an iso image I was using with "iso-scan/
This might explain bug #258990.
(OT: is there a reason to restrict find_cow_device to only looking for loopback-mountable images on vfat filesystems?)
Thanks. The only modification I'd make is the insertion of a head -n1, just in case it's already mounted in multiple places.
Regarding your question about find_cow_device, see bug 230703.