[systemd-devel] creating device nodes

Mantas Mikulėnas grawity at gmail.com
Wed Apr 5 08:22:47 UTC 2023


.device units do not mknod, they only represent existing state.

/dev/fuse is usually created through tmpfiles.d (which gets its
configuration via kmod-static-nodes.service).

# kmod static-nodes --format=tmpfiles

On Wed, Apr 5, 2023 at 11:13 AM Richard Hector <richard at walnut.gen.nz>
wrote:

> Hi all,
>
> I want to create a device (/dev/fuse) in an LXC container. The kernel
> bit works; I can mknod manually, but I'd rather use a systemd unit, and
> make it a dependency of mounting filesystems from /etc/fstab.
>
> It looks like .device units are supposed to be created automatically if
> there's an appropriate udev rule with TAG+="systemd" - these lines
> exists in /usr/lib/udev/rules.d/99-systemd.rules:
>
> # Asynchronously mount file systems implemented by these modules as soon
> as they are loaded.
> SUBSYSTEM=="module", KERNEL=="fuse", TAG+="systemd",
> ENV{SYSTEMD_WANTS}+="sys-fs-fuse-connections.mount"
>
> The comment seems to suggest it will cause the filesystems to be mounted
> when the device is created, which is kind of the reverse of what I'm
> after. Do I need a different line?
>
> Or do I need to create a .device unit file manually? I can't see much
> info on doing that.
>
> Cheers,
> Richard
>


-- 
Mantas Mikulėnas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20230405/fd0f1f36/attachment.htm>


More information about the systemd-devel mailing list