0

I am trying to create custom image for beaglbone. One of the features is enabled openvpn. The problem is that on the first boot there is no /dev/net/tun file despite the fact I have created in while creating rootfs with:

mkdir -p /dev/net
chroot rootfs/ mknod /dev/net/tun c 10 200
chmod 600 /dev/net/tun

If I create it the same way being logged in beaglbone system file persists and openvpn works. So questions are who is responsible for maintaining this file and how to make system create it automatically except for using custom systemd service?

Thank you!

Long Smith
  • 103
  • 1
  • 3

1 Answers1

1

The contents of /dev on your rootfs are not used for anything at all. During early boot, a devtmpfs virtual filesystem is mounted onto /dev and makes the previous contents invisible, like any other mounted filesystem. After this point, the only files visible in /dev are a) created by the kernel itself, or b) created by a service during every boot process.

On modular kernels (where "tun" is a module), certain device nodes are pre-created by a combination of kmod-static-nodes.service and systemd-tmpfiles-setup-dev.service:

  1. kmod-static-nodes reads /lib/modules and generates a list of device nodes to pre-create;
  2. systemd-tmpfiles creates them as part of its "tmpfiles.d" processing.
grawity
  • 501,077