Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 841491 - When live-images are booted with overlayfs and docache parameters, initrd mounts squashfs image from hard store instead of mounting from tmpfs
Summary: When live-images are booted with overlayfs and docache parameters, initrd mou...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: genkernel (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Genkernel Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-04-28 16:07 UTC by burak
Modified: 2022-04-28 16:07 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description burak 2022-04-28 16:07:59 UTC
gentoo livegui and minimal-install images can be booted under efi system. When these images are booted, there is an grub option like
LiveCD ... (cached) in grub menu (this is second option and it is not a default one).

The difference between these two options is that the second one has only the docache parameter. It means, docache copies squashfs image to tmpfs according to genkernel(8) man page. 

(For the BIOS boots, the relevant docache parameters should be added manually to isolinux. When booting with EFI, GRUB loader is used and the cached option appears in the grub menu and this option does not come under the syslinux screen so it is easier to locate problem under EFI systems. It is necessary to add the overlayfs parameter manually for the installcd images unlike livegui images)

I did the test with livegui image in here.
After copying the squashfs file, the boot process continues from the squashfs file in the hardstore, instead of the squashfs image copied to tmpfs.


To better explain the error, the livegui image is booted here with the gk debug parameter.


<blabla>
[    1.117192]     BOOT_IMAGE=/boot/gentoo
[    1.117473]     looptype=squashfs
[    1.117726]     loop=/image.squashfs
>> Genkernel 4.2.6 (2022-04-18 01:07:32 UTC). Linux kernel 5.15.32-gentoo-r1-x86_64
>> Starting debug shell as requested by "debug" option.
>> Run 'gksosreport' to generate debug report
>> in case you want to file a bug report.
>> Stopping by: before starting udevd

>> Welcome to Genkernel 4.2.6 (2022-04-18 01:07:32 UTC) rescue shell!
>> ...running Linux kernel 5.15.32-gentoo-r1-x86_64

rescueshell / # exit

>> Activating udev ...
>> Hint: Use scandelay[=seconds] if your live medium is slow and boot fails
>> Starting debug shell as requested by "debug" option.
>> Run 'gksosreport' to generate debug report
>> in case you want to file a bug report.
>> Stopping by: before setting up the root filesystem

>> Welcome to Genkernel 4.2.6 (2022-04-18 01:07:32 UTC) rescue shell!
>> ...running Linux kernel 5.15.32-gentoo-r1-x86_64

rescueshell / # exit

>> Making tmpfs for /newroot
mknod: /newroot/dev/tty0: File exists
>> Looking for the cdrom
>> Attempting to mount media: /dev/sr0
>> Media found on /dev/sr0
>> Determining root device (trying /dev/sr0) ...
>> Root device detected as /dev/sr0!
>> Determining looptype ...
>> Copying loop file for caching ...
>> Mounting squashfs filesystem
>> Starting debug shell as requested by "debug" option.
>> Run 'gksosreport' to generate debug report
>> in case you want to file a bug report.
>> Stopping by: overlayfs

>> Welcome to Genkernel 4.2.6 (2022-04-18 01:07:32 UTC) rescue shell!
>> ...running Linux kernel 5.15.32-gentoo-r1-x86_64

rescueshell /newroot # mount
none on / type rootfs (rw)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
none on /run type tmpfs (rw,nosuid,nodev,relatime,mode=755,inode64)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=10240k,nr_inodes=2046245,mode=755,inode64)
devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,inode64)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /newroot type tmpfs (rw,relatime,inode64)
/dev/sr0 on /mnt/cdrom type iso9660 (ro,relatime,nojoliet,check=s,map=n,blocksize=2048,iocharset=utf8)
rescueshell /newroot # cd
rescueshell / # mount | grep /mnt/cdrom
/dev/sr0 on /mnt/cdrom type iso9660 (ro,relatime,nojoliet,check=s,map=n,blocksize=2048,iocharset=utf8)
rescueshell / # md5sum /newroot/mnt/image.squashfs /mnt/cdrom/image.squashfs
5f15d76e162789624d80c057af06aa37  /newroot/mnt/image.squashfs
5f15d76e162789624d80c057af06aa37  /mnt/cdrom/image.squashfs


Copied squashfs file located under /newroot and mounted /newroot with tmpfs.

After the boot process is resumed.


rescueshell / # exit

>> Loading overlayfs
>> No cdupdate.sh script found, skipping ...
>> Starting debug shell as requested by "debug" option.
>> Run 'gksosreport' to generate debug report
>> in case you want to file a bug report.
>> Stopping by: before switch_root

>> Welcome to Genkernel 4.2.6 (2022-04-18 01:07:32 UTC) rescue shell!
>> ...running Linux kernel 5.15.32-gentoo-r1-x86_64

rescueshell /newroot #
rescueshell /newroot #
rescueshell /newroot # mount
none on / type rootfs (rw)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
none on /run type tmpfs (rw,nosuid,nodev,relatime,mode=755,inode64)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=10240k,nr_inodes=2046245,mode=755,inode64)
devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,inode64)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /newroot type tmpfs (rw,relatime,inode64)
/dev/sr0 on /newroot/mnt/cdrom type iso9660 (ro,relatime,nojoliet,check=s,map=n,blocksize=2048,iocharset=utf8)
/dev/loop0 on /mnt/livecd type squashfs (ro,relatime,errors=continue)
none on /mnt/overlay type tmpfs (rw,relatime,inode64)
overlay on /newroot type overlay (rw,relatime,lowerdir=/mnt/livecd,upperdir=/mnt/overlay/.upper,workdir=/mnt/overlay/.work)
none on /newroot/mnt/overlay type tmpfs (rw,relatime,inode64)
/dev/loop0 on /newroot/mnt/livecd type squashfs (ro,relatime,errors=continue)
rescueshell /newroot # mount | grep /newroot
tmpfs on /newroot type tmpfs (rw,relatime,inode64)
/dev/sr0 on /newroot/mnt/cdrom type iso9660 (ro,relatime,nojoliet,check=s,map=n,blocksize=2048,iocharset=utf8)
overlay on /newroot type overlay (rw,relatime,lowerdir=/mnt/livecd,upperdir=/mnt/overlay/.upper,workdir=/mnt/overlay/.work)
none on /newroot/mnt/overlay type tmpfs (rw,relatime,inode64)
/dev/loop0 on /newroot/mnt/livecd type squashfs (ro,relatime,errors=continue)
rescueshell /newroot # mount | grep livecd
/dev/loop0 on /mnt/livecd type squashfs (ro,relatime,errors=continue)
overlay on /newroot type overlay (rw,relatime,lowerdir=/mnt/livecd,upperdir=/mnt/overlay/.upper,workdir=/mnt/overlay/.work)
/dev/loop0 on /newroot/mnt/livecd type squashfs (ro,relatime,errors=continue)
rescueshell /newroot # mount | grep sr0
/dev/sr0 on /newroot/mnt/cdrom type iso9660 (ro,relatime,nojoliet,check=s,map=n,blocksize=2048,iocharset=utf8)
rescueshell /newroot #
rescueshell /newroot #
rescueshell /newroot #
rescueshell /newroot #
rescueshell /newroot #


lowerdir of overlayfs should points original rootfs that is the mounted squashfs image. related mount option is
 overlay on /newroot type overlay (rw,relatime,lowerdir=/mnt/livecd,upperdir=/mnt/overlay/.upper,workdir=/mnt/overlay/.work)

At this point, to find where the squashfs file is mounted from (hardstore or tmpfs)


rescueshell /newroot # mount | grep /mnt/livecd
/dev/loop0 on /mnt/livecd type squashfs (ro,relatime,errors=continue)
overlay on /newroot type overlay (rw,relatime,lowerdir=/mnt/livecd,upperdir=/mnt/overlay/.upper,workdir=/mnt/overlay/.work)
/dev/loop0 on /newroot/mnt/livecd type squashfs (ro,relatime,errors=continue)
rescueshell /newroot #


rescueshell /newroot # losetup -a
/dev/loop0: 0 /mnt/cdrom/image.squashfs
rescueshell /newroot #
rescueshell /newroot # mount | grep /mnt/cdrom
/dev/sr0 on /newroot/mnt/cdrom type iso9660 (ro,relatime,nojoliet,check=s,map=n,blocksize=2048,iocharset=utf8)
rescueshell /newroot #

That is the case, still looks up /dev/sr0 instead of copied squashfs.


Also there are two minor issues

1- /newroot mounted twice, before the overlayfs mount, fs type of /newroot is tmpfs and filled with squashfs image. After the overlay mount, /newroot is overlayfs mount so /newroot is mounted twice, I think double mount is permitted but it is the dirty way.

2- When the size parameter is not used when tmpfs mount, %50 of memory is allocated by default (man 5 tmpfs). I did not look in detail to see if the size= parameter is used in the boot process, however it seems created tmpfs size is almost 50% of memory size which is the default option. Therefore, the ~5GB squashfs file may not fit in the ramdisk when < 10GB memory systems. When the images are tested under <10GB memory, the docache step fails, gives an error message and continues the boot process, and the system can boot properly because the cached squasfs file is not used in both case of rams are sufficient or insufficient.

Thanks