Public bug reported:
Hi!
I identified a problem for creating persistent live usb sticks when
using a second partition for 'casper-rw'.
Environment:
On the usb stick I created two partitions:
- The first partition (/dev/sda1) is vfat which is used for the live-filesystem
(filesystem.squashfs).
- The second partition (/dev/sda2) is ext4 and labeled 'casper-rw' which is
used for persistence.
cat /proc/cmdline
BOOT_IMAGE=(hd0,msdos1)/casper/vmlinuz file=/preseed/lubuntu.seed boot=casper
quiet splash persistent ignore_uuid ---
Error in initramfs (casper.log) while boot:
mount: mounting /cow on /root failed: Invalid argument
overlay mount failed
Tested versions (Lubuntu):
Lubuntu 18.04 (LTS) - Package casper/now 1.394 amd64
Lubuntu 19.10 - Pacakge casper/eoan 1.427 amd64
Bug:
I found a bug in find_cow_device() function of casper-helpers script from
initram that is responsible for this.
When the setup_unionfs() function of the casper script invokes the
find_cow_device() function, the live filesystem partition that was
mounted in the mountroot() function is unmounted every time the function
tries to search for a persistent file, making it impossible to boot.
When a casper-rw file exists and is used, the problem just doesn't
happen because the partition is mounted and busy, so you can't unmount
it.
To correct the problem, I have included a check to not unmount the
partition if it is the live-filesystem partition. In that case, just
return it to read-only.
My fix for casper-helpers script in Lubuntu 19.10 'casper/eoan 1.427
amd64' package:
/usr/share/initramfs-tools/scripts# diff -u casper-helpers casper-helpers.fix
--- casper-helpers 2019-10-14 12:29:05.000000000 -0300
+++ casper-helpers.fix 2019-10-24 17:09:42.635313048 -0300
@@ -247,8 +247,10 @@
if [ -e "${cow_backing}/${pers_fpath}" ]; then
echo $(setup_loop "${cow_backing}/${pers_fpath}" "loop"
"/sys/block/loop*")
return 0
- else
+ elif [ ${cow_backing} != ${livefs_root} ]; then
umount ${cow_backing}
+ else
+ try_mount "${devname}" "${cow_backing}" "ro"
fi
fi
done
---CUT HERE---
My fix for casper-helpers script in Lubuntu 18.04 (LTS) 'casper/now
1.394 amd64' package:
/usr/share/initramfs-tools/scripts# diff -u casper-helpers casper-helpers.fix
--- casper-helpers 2019-10-24 11:29:58.735085568 -0300
+++ casper-helpers.fix 2019-10-24 16:53:19.375302075 -0300
@@ -223,8 +223,10 @@
if [ -e "${cow_backing_mp}/${pers_fpath}" ]; then
echo $(setup_loop "${cow_backing_mp}/${pers_fpath}" "loop"
"/sys/block/loop*")
return 0
- else
+ elif [ ${cow_backing_mp} != ${livefs_root} ]; then
umount ${cow_backing_mp}
+ else
+ try_mount "${devname}" "${cow_backing}" "ro"
fi
fi
done
---CUT HERE---
** Affects: casper (Ubuntu)
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1849730
Title:
[live-usb-persistent] second partition as casper-rw issue
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/casper/+bug/1849730/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs