Many of you might seen that a new package landed in centos container some time ago systemd-container.No more need to switch fakesystemd inside the container . all great but......... oh no.
But udevd inside the container doesnt work.
Here some steps you need to do.
ln -s /lib/systemd/system/systemd-udevd-control.socket /lib/systemd/system/sockets.target.wants/systemd-udevd-control.socket; \
ln -s /lib/systemd/system/systemd-udevd-kernel.socket /lib/systemd/system/sockets.target.wants/systemd-udevd-kernel.socket; \
ln -s /lib/systemd/system/systemd-udev-trigger.service /lib/systemd/system/sysinit.target.wants/systemd-udev-trigger.service; \
ln -s /lib/systemd/system/systemd-udevd.service /lib/systemd/system/sysinit.target.wants/systemd-udevd.service; \
systemctl enable systemd-udevd
But udevd inside the container doesnt work.
Here some steps you need to do.
- mount /dev into the container , dont try to have multiple /dev/ managed all together
- enable udevd inside the container
ln -s /lib/systemd/system/systemd-udevd-control.socket /lib/systemd/system/sockets.target.wants/systemd-udevd-control.socket; \
ln -s /lib/systemd/system/systemd-udevd-kernel.socket /lib/systemd/system/sockets.target.wants/systemd-udevd-kernel.socket; \
ln -s /lib/systemd/system/systemd-udev-trigger.service /lib/systemd/system/sysinit.target.wants/systemd-udev-trigger.service; \
ln -s /lib/systemd/system/systemd-udevd.service /lib/systemd/system/sysinit.target.wants/systemd-udevd.service; \
systemctl enable systemd-udevd
- Note the blkid sed command, there is no "built in" utils in container udev , so we need to pull it in as external command.
- But wait. If I already mounted /dev in why would I need udev in the container , the host udev will work for me. Yes but.....
- You will only get kernel events in the container (remember its the same kernel with the host) , but you will not get the udev daemon generated events . Look into this great wiki for more .