Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions TRIXIE_SUDO_PATCH.md
Original file line number Diff line number Diff line change
@@ -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.
4 changes: 4 additions & 0 deletions stage3_homebridge/01-homebridge/00-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand Down
Original file line number Diff line number Diff line change
@@ -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