radxa-repo / rbuild

Radxa Image Builder (Maintenance mode)
https://radxa-repo.github.io/rbuild/
GNU General Public License v3.0
53 stars 44 forks source link

Swap does not work on ZFS #26

Closed pavhofman closed 11 months ago

pavhofman commented 11 months ago

Hi, recent commits to rbuild added 4GB swapfile to the docker config files. Unfortunately when running on ZFS the swapfile gets created with holes and swapon fails to mount the swapfile (e.g. https://askubuntu.com/questions/1198903/can-not-use-swap-file-on-zfs-files-with-holes )

While it's possible to remove the swap code from the common/*.yaml files manually, it may be useful to have a CLI parameter to the rbuild script to avoid activating the swap. Typically machines running ZFS have large RAM, so no swap should be required.

Thank you.

Pavel.

RadxaYuntian commented 11 months ago

That parameter was needed on my 48GB workstation when building some dkms modules. Not all systems has dkms driver preloaded so your board might be unaffected by this.

Can you try building an image for ROCK 5A for example?

pavhofman commented 11 months ago

I reported the issue in https://forum.radxa.com/t/options-for-running-cm3-on-current-upstream-kernel/13930/17?u=pavel_hofman . The reason rbuild failed when calling swapon was that it created the swapfile swapfile_rbuild via dd on my ZFS partition. ZFS (and btrfs) use COW and swapfiles must be created in a different way to be accepted by swapon.

I just removed the two swap action sections from yaml files and rbuild proceeded OK. That's why I think an rbuild parameter for skipping the swap activation could be useful for ZFS/btrfs users.

RadxaYuntian commented 11 months ago

After reading your forum post I think your issue is due to no KVM device available to the container. I'm on btrfs rootfs and I have no such issue, due to debos is actually running in a virtual machine, and uses a block device for swap instead of a file. Your output showed the code went to swapfile_rbuild path, which means it failed to run in a VM and mount the swap as a block device.

Please check if you have this warning when running `rbuild. If so you can set to 666 as a quick validation to confirm the issue is indeed on /dev/kvm. You can then configure the permission of it properly.

pavhofman commented 11 months ago

You are right, the KVM was not used, my /dev/kvm perms are only crw-rw----.

The build already takes quite long without the virtualization penalty on my quite fast machine (80GB RAM, ZFS with two PCIe NVMes in striped RAID0), I will prefer to run it as is, with the yaml files hacked for the failing swapon on ZFS files. Thanks for your help