[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

no /dev/net/tun aka modprobe tun failed when inside container

From: Vladilen Kozin
Subject: no /dev/net/tun aka modprobe tun failed when inside container
Date: Tue, 21 Mar 2023 15:08:02 +0000


I defined a shepherd service with the intention of starting it as part of
my system. Testing and debugging it was kinda, well, not straightforward.
Since it is meant to be instantiated as part of the entire operating
system, I did all the foo-service, foo-service-type ⇒ derivation ⇒ shepherd
service dance, then to test it lowered to store via `shepherd-service-file`
that generates final service definition which I then fed to `sudo herd load
root ...`. And that actually worked, though I find the process less than
straightforward. Is this really how people define system services?

So, it seems to start fine, when I load it into my running desktop
environment via `sudo herd load root ...`, but then I attempted to define
an OS, which would instantiate it on system startup, and run with:

sudo guix system -K -L /home/vlad/Code/fullmeta-guix/channel container
os.scm --network

Container runs fine. We attach and check `herd status` and notice our
service is disabled, cause it failed too many times. Checking
/var/log/messages shows it complaining that it is unable to create TUN and
no /dev/net/tun device exist. Indeed, it doesn't appear inside container
but present on the host.

Message is along the lines of:
> is CONFIG_TUN enabled in your kernel? `modprobe tun` failed with:
> wgengine.NewUserspaceEngine(tun "foo0") error: tstun.New("foo0"):
CreateTUN("foo0") failed; /dev/net/tun does not exist

Service specifies `(requirement '(networking))`. What have I missed? Do I
need to load some kernel modules explicitly? This runs inside a container,
so I would've expected it to share my host kernel, which has everything
seeing how service started fine on the host.

Maybe I am meant to `--expose=/dev/net/tun` and somehow share necessary
kernel modules, but I dunno how to find the equivalent of `/lib/modules`.
Quick look in the sources suggests there's `linux-kernel-module-build`
system, which I suspect handles installing modules, but which module I need
here and how to pass it to kernel, I've no clue. E.g. via
`(kernel-loadable-modules (list some-wg-module))` in the os definition, but
then why does my host system not require it.

Could anyone help me out, please.

Thank you

Best regards
Vlad Kozin

reply via email to

[Prev in Thread] Current Thread [Next in Thread]