Skip to content

Commit

Permalink
Fix issue for using the host udev in unprivileged mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh5 committed Sep 27, 2023
1 parent 8b11bca commit 96d318e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion overlay/etc/cont-init.d/30-configure_udev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,15 @@ rm -rf "${tmp_mount}"

if [[ "${is_privileged}" == "true" ]]; then
# Since this container may also be run with CAP_SYS_ADMIN, ensure we can actually execute "udevadm trigger"
if udevadm trigger &> /dev/null; then
if [ ! -w /sys ]; then
# Disable supervisord script since we are not able to write to sysfs
echo "**** Disable udev - /sys is mounted RO ****";
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/udev.ini
elif [ ! -w /run/udev ]; then
# Disable supervisord script since we are not able to write to udev/data path
echo "**** Disable udev - /run/udev is mounted RO ****";
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/udev.ini
elif udevadm trigger &> /dev/null; then
echo "**** Configure container to run udev management ****";
# Enable supervisord script
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/udev.ini
Expand Down

0 comments on commit 96d318e

Please sign in to comment.