Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

systemd-sysext is causing issue to install the custom kernel modules #1448

Open
kavinnath opened this issue May 17, 2024 · 2 comments
Open

Comments

@kavinnath
Copy link

kavinnath commented May 17, 2024

systemd-sysext is causing issue to install the custom kernel modules. Since i am using systemd-sysext image to install latest docker/containerd version and which mounts /opt as read only.

Ref:

systemd-sysext status
HIERARCHY EXTENSIONS SINCE
/opt none -
/usr docker-24.0.9

As per following doc if i try to install custom kernel modules on /opt then it will fail due to systemd-sysext.

So if i set modules path to some other writable location and use lowerdir=/usr/lib64/modules then it works fine. But the problem is /usr/lib64/modules are symlink and hence /etc/systemd/system/usr-lib64-modules.mount throws below exception.

Mount Ref:
sudo mount
-o "lowerdir=/usr/lib64/modules,upperdir=${modules},workdir=${modules}.wd"
-t overlay overlay /usr/lib64/modules

Exception logs:

usr-lib64-modules.mount: Mount path /usr/lib64/modules is not canonical (contains a symlink).
usr-lib64-modules.mount: Failed to run 'mount' task: Too many levels of symbolic links
usr-lib64-modules.mount: Failed with result 'resources'.
Failed to mount usr-lib64-modules.mount

Hence i tried to point source root i.e /usr/lib/modules and systemd service started but overlay mount is not working. Could you please help me out here ?

@pothos
Copy link
Member

pothos commented May 18, 2024

I don't fully understand what you mean with /opt becoming read-only. That would only be the case if you have sysext images that extend /opt.

Thanks for pointing out that the docs are outdated!
Instead of the custom mount action for /usr, with systemd-sysext you have to migrate it to be a sysext itself: Create a folder /var/lib/extensions/kernel-modules/usr/lib64/modules/ for your modules and a file /var/lib/extensions/kernel-modules/usr/lib/extension-release.d/extension-release.kernel-modules containing the line ID=_any. Afterwards they will be mounted on boot by systemd-sysext.service.
We should update https://www.flatcar.org/docs/latest/reference/developer-guides/kernel-modules/ Not sure if Before=local-fs.target would make sense as drop-in for systemd-sysext.service.

@kavinnath
Copy link
Author

kavinnath commented May 20, 2024

As suggested i created the sysext directory extension and got some exception.

systemd-sysext list
NAME TYPE PATH TIME
docker-24.0.9 raw /etc/extensions/docker-24.0.9.raw -
kernel-modules directory /var/lib/extensions/kernel-modules -

df -h /usr/lib64/modules/
Filesystem Size Used Avail Use% Mounted on
sysext 32G 12K 32G 1% /usr

And created development container and fails.

sudo systemd-nspawn
--bind=/usr/lib64/modules
--image=flatcar_developer_container.bin

Error:
flatcardevelopercontainer /usr/lib64/modules # touch a.txt
touch: cannot touch 'a.txt': Read-only file system

Note: Using Flatcar Container Linux by Kinvolk 3510.2.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📝 Needs Triage
Development

No branches or pull requests

2 participants