homebridge/homebridge-apt-pkg

The homebridge package must not be upgraded from the Homebridge UI Terminal.

foxt opened this issue · 9 comments

foxt commented

Analysis

Attempting to upgrade Homebridge inside a LXC container results in

ERROR: The homebridge package must not be upgraded from the Homebridge UI Terminal.

Expected Behavior

The upgrade succeeds

Steps To Reproduce

pct enter 110
apt upgrade

Logs

Fields marked with an asterisk (*) are required.

Configuration

Fields marked with an asterisk (*) are required.

Environment

  • OS: Debian 11.7
  • Software: 1.0.34

Process Supervisor

hb-service

Additional Context

It seems like Homebridge is trying to see if the process indicated by $$ has 'hb-service' anywhere in its process tree (using pstree), however, in LXC it is common for administrators to create a shell that is detached from the main process tree (and thus, doesn't have the init process in it's process tree), this confuses pstree and shows the tree for the init process, which will have hb-service as a child.

For example, in this case, the shell has PID 371043, which has the PPid 370985, which has the PPid 0, without the init process (1) in this chain.

root@homebridge:~# echo $$
371043
root@homebridge:~# cat /proc/$$/task/$$/status | grep PPid
PPid:	370985
root@homebridge:~# cat /proc/370985/task/370985/status | grep PPid
PPid:	0

Calling pstree on pid 0 without -s reveals this.

root@homebridge:~# pstree 0
?─┬─fish───bash───pstree
  └─systemd─┬─3*[agetty]
            ├─cron
            ├─dbus-daemon
            ├─hb-service─┬─homebridge───10*[{homebridge}]
            │            └─10*[{hb-service}]
            ├─master─┬─pickup
            │        └─qmgr
            ├─rsyslogd───2*[{rsyslogd}]
            ├─systemd-journal
            ├─systemd-logind
            ├─systemd-network
            └─systemd-resolve

It might be possible to check if the pstree output doesn't contain or common processes that will never own Homebridge such as systemd-resolve?

Or, you could check that an EnvVar such as HOMEBRIDGE_APT_PACKAGE is not set?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If you stopped Homebridge first with hb-service stop the upgrade should work.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

god i wish my software bugs were fixed by having people not talk about them for a month

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

foxt commented

god i wish my software bugs were fixed by having people not talk about them for a month

@foxt you can submit a PR. Currently have no plans to implement.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

This issue has been closed as no further activity has occurred.