diff --git a/TRIXIE_SUDO_PATCH.md b/TRIXIE_SUDO_PATCH.md new file mode 100644 index 0000000..7d78371 --- /dev/null +++ b/TRIXIE_SUDO_PATCH.md @@ -0,0 +1,41 @@ +# Trixie Sudo Permissions Patch + +If you have already installed a Homebridge Raspberry Pi image and upgraded to Debian Trixie, you may experience issues with the restart/shutdown functionality in the Homebridge UI. + +## Quick Fix (One-liner) + +Run the following command to patch your existing installation: + +```bash +curl -fsSL https://raw.githubusercontent.com/homebridge/homebridge-raspbian-image/latest/stage3_homebridge/01-homebridge/files/010_homebridge-nopasswd | sudo tee /etc/sudoers.d/010_homebridge-nopasswd > /dev/null && sudo chmod 0440 /etc/sudoers.d/010_homebridge-nopasswd && sudo visudo -c +``` + +### Alternative (if you prefer to see the content first): + +```bash +sudo bash -c 'cat > /etc/sudoers.d/010_homebridge-nopasswd << "EOF" +# Allow homebridge user to run shutdown/reboot commands without password +# Both /sbin and /usr/sbin paths are included for compatibility across Debian versions +homebridge ALL=(root) NOPASSWD: /sbin/shutdown, /sbin/reboot, /sbin/poweroff, /usr/sbin/shutdown, /usr/sbin/reboot, /usr/sbin/poweroff +EOF +chmod 0440 /etc/sudoers.d/010_homebridge-nopasswd && visudo -c' +``` + +This command will: +1. Create the sudoers configuration file for the homebridge user +2. Set the correct permissions (0440) +3. Validate the sudoers syntax + +## What This Fixes + +This patch allows the homebridge user to run shutdown, reboot, and poweroff commands without requiring a password, which is necessary for the Homebridge UI's restart and shutdown features to work properly in Debian Trixie. + +## Verification + +After applying the patch, you can verify it worked by checking: + +```bash +sudo -l -U homebridge +``` + +You should see output showing that the homebridge user can run shutdown, reboot, and poweroff commands without a password. diff --git a/stage3_homebridge/01-homebridge/00-run.sh b/stage3_homebridge/01-homebridge/00-run.sh index fbdcf2a..c0623cd 100755 --- a/stage3_homebridge/01-homebridge/00-run.sh +++ b/stage3_homebridge/01-homebridge/00-run.sh @@ -17,6 +17,10 @@ install -m 755 files/20-hb-nginx-check "${ROOTFS_DIR}/etc/hb-service/homebridge/ install -m 644 files/first-boot-homebridge.service "${ROOTFS_DIR}/etc/systemd/system/" install -m 755 files/first-boot-homebridge "${ROOTFS_DIR}/usr/local/sbin/" +# Sudoers configuration for homebridge user +install -v -d "${ROOTFS_DIR}/etc/sudoers.d" +install -m 0440 files/010_homebridge-nopasswd "${ROOTFS_DIR}/etc/sudoers.d/" + # # MOTD # diff --git a/stage3_homebridge/01-homebridge/files/010_homebridge-nopasswd b/stage3_homebridge/01-homebridge/files/010_homebridge-nopasswd new file mode 100644 index 0000000..fc20de7 --- /dev/null +++ b/stage3_homebridge/01-homebridge/files/010_homebridge-nopasswd @@ -0,0 +1,3 @@ +# Allow homebridge user to run shutdown/reboot commands without password +# Both /sbin and /usr/sbin paths are included for compatibility across Debian versions +homebridge ALL=(root) NOPASSWD: /sbin/shutdown, /sbin/reboot, /sbin/poweroff, /usr/sbin/shutdown, /usr/sbin/reboot, /usr/sbin/poweroff \ No newline at end of file