Open Martin-Laclaustra opened 2 years ago
As an additional information, /isodevice
mount is absent in linuxmint-21-cinnamon-64bit-beta.iso while present in linuxmint-20.3-cinnamon-64bit.iso also when booted without the toram
kernel option (skipping step 3 in the above to-reproduce section).
This does not make much sense, suggesting that it is a BUG that probably force-unmounts the partition hosting the ISO file, instead of detaching the loop device first and doing a normal unmount. Also it seems to delete /isodevice
mount point. In the case that files are not copied to ram, the ISO must remain accessible, thus the hosting partition should not be unmounted.
I'm moving this towards ubiquity. It's not within the scope for us since it doesn't affect users in general and it's quite technical.
This bug is still present in 21.1 beta. Could you point me to the commits used for releases 20.3 and 21? May be comparing them we could get an idea of where the problem is. With some support I might be able to help in debugging this question.
I have a suspect for the problem:
In casper/scripts/casper-bottom/05mountpoints
the following code could help...
if grep -q '^[^ ]* /isodevice ' /proc/mounts; then
mkdir -p /root/isodevice
mount -n -o move /isodevice /root/isodevice
fi
(This was present in the now extinct package lupin-casper in lupin-0.57build1/casper/scripts/casper-bottom/05mountpoints_lupin
)
It would be great if this could be tested and fixed during current beta for the 20.1 release. Also, if this is the root of the problem, it could be reported upstream.
Upstream, there are also people who seem to be missing this fix. (https://bugs.launchpad.net/ubuntu/+source/lupin/+bug/1960457/comments/33)
The proposed patch in https://github.com/linuxmint/ubiquity/issues/51#issuecomment-1344978596 correctly fixes the issue in the following test. This is the procedure to create the patched ISO:
# mount the original linux mint iso image
mkdir /tmp/isomount
sudo mount -o loop /boot/grml/linuxmint-21.1-cinnamon-64bit.iso /tmp/isomount/
# extract initramfs from the iso image
mkdir /tmp/initrd_out
unmkinitramfs -v /tmp/isomount/casper/initrd.lz /tmp/initrd_out
# PATCH FILE "scripts/casper-bottom/05mountpoints"
sed -i -E "s/mount -n -o move \/cdrom \/root\/cdrom/mount -n -o move \/cdrom \/root\/cdrom\n\nif grep -q \'\^\[\^ \]\* \/isodevice \' \/proc\/mounts; then\n mkdir -p \/root\/isodevice\n mount -n -o move \/isodevice \/root\/isodevice\nfi/" /tmp/initrd_out/main/scripts/casper-bottom/05mountpoints
# create a partial initramd with the patched file
cd /tmp/initrd_out/main/
find . -name 05mountpoints | cpio -H newc -o > /tmp/initrd.partial.lz
# append the partial initramd to the original initramd, last file overwrites the original one at runtime
cat /tmp/isomount/casper/initrd.lz /tmp/initrd.partial.lz > /tmp/initrd.lz
# copy iso contents to a new rw dir
mkdir /tmp/iso_out
rsync -a /tmp/isomount/ /tmp/iso_out
# replace initrd.lz in the new iso
sudo cp /tmp/initrd.lz /tmp/iso_out/casper/
# create the new iso
sudo mkisofs -D -r -V "LIVE" -cache-inodes -J -l -b isolinux/isolinux.bin -c boot.catalog -no-emul-boot -boot-load-size 4 -boot-info-table -o /tmp/custom.iso /tmp/iso_out/
# TEST
And the test that confirms that it is working is the one I mentioned in https://github.com/linuxmint/mint21.1-beta/issues/50#issuecomment-1353943584: the directory /isodevice
reappears in the running live ISO (showing the contents of the device that holds the ISO file from where the system was booted), and the mount is listed with the command mount
. Furthermore, the steps mentioned in the OP (detach the loop device, and then unmount) were also successful.
Do anyone know what is the status with this bug? Looks like it is still not be fixed in Ubuntu based installations. I have manually tested modifying 05mountpoints according to the instructions and after that you can unmount the ISO correctly when I boot an Ubuntu based live ISO from the hard drive. This would be important to get fixed as the fix is simple.
Describe the bug This occurs when installing from an iso file located in the same partition that will be formatted (e.g. as root or as boot) and installed.
The following procedure worked with linuxmint-20.3-cinnamon-64bit.iso.
I have been updating my systems this way so far. In brief, copying the iso file to
/boot/grml
or to/boot/boot-isos
. An entry could be added manually to grub, but I have been using the 'grml-rescueboot' package (installed from the repository withapt install
) or booting from USB with Super Grub Disk. In the boot sequence, in the ISO grub menu, edit the entry (pressing 'e') and add 'toram' to the 'linux' line and then boot ('F10'). After complete boot, in a terminal,losetup
showed a loop for the iso file in the isodevice (the partition that contained the iso file) andmount
showed/isodevice
mount pointing to the partition (MOUNT DOES NOT SHOW THIS LINE ANY MORE IN MINT 21). Then I deleted the loop (withlosetup -d
) and afterwards unmounted/isodevice
(IN MINT 21 THIS PRODUCES AND ERROR BECAUSE THERE IS NOT SUCH MOUNT). After that, I could install normally, formatting the partition that contained the iso file (NOT ANY MORE, NOW IT STOPS WITH AN ERROR BECAUSE THE PARTITION IS USED BY THE SYSTEM).To Reproduce Steps to reproduce the behavior:
Alternatively a manual entry in the grub menu could be added:
linux /casper/vmlinuz file=/cdrom/pressed/linuxmint.seed boot=casper iso-scan/filename=${iso_path} toram quiet splash --
mint@mint:~$ losetup NAME SIZELIMIT OFFSET AUTOCLEAR RO BACK-FILE DIO LOG-SEC /dev/loop1 0 0 0 0 /cdrom/casper/filesystem.squashfs 0 512 /dev/loop0 0 0 0 0 /isodevice/boot/grml/linuxmint-21-cinnamon-64bit-beta.iso 0 512 mint@mint:~$ sudo losetup -d /dev/loop0 mint@mint:~$ mount [[/isodevice IS NOT LISTED]] mint@mint:~$ sudo umount /isodevice umount: /isodevice: no mount point specified. mint@mint:~$
mint@mint:~$ losetup NAME SIZELIMIT OFFSET AUTOCLEAR RO BACK-FILE DIO LOG-SEC /dev/loop1 0 0 0 0 /cdrom/casper/filesystem.squashfs 0 512 /dev/loop0 0 0 0 0 /isodevice/boot/grml/linuxmint-20.3-cinnamon-64bit.iso 0 512 mint@mint:~$ sudo losetup -d /dev/loop0 mint@mint:~$ mount sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime) proc on /proc type proc (rw,nosuid,nodev,noexec,relatime) udev on /dev type devtmpfs (rw,nosuid,noexec,relatime,size=1904916k,nr_inodes=476229,mode=755) devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000) tmpfs on /run type tmpfs (rw,nosuid,nodev,noexec,relatime,size=390432k,mode=755) /dev/sda5 on /isodevice type ext4 (rw,relatime) /dev/shm on /cdrom type tmpfs (rw,relatime,size=2307212k) /dev/loop1 on /rofs type squashfs (ro,noatime) [[... EDITED FOR BREVITY]] mint@mint:~$ sudo umount /isodevice mint@mint:~$