homebridge / homebridge-apt-pkg

Debian / Ubuntu package and repo for Homebridge
https://homebridge.io
GNU General Public License v3.0
21 stars 6 forks source link

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

Closed foxt closed 9 months ago

foxt commented 1 year ago

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

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?

github-actions[bot] commented 1 year ago

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.

NorthernMan54 commented 1 year ago

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

github-actions[bot] commented 11 months ago

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 11 months ago

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

github-actions[bot] commented 10 months ago

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 10 months ago

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

donavanbecker commented 10 months ago

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

github-actions[bot] commented 9 months ago

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.

github-actions[bot] commented 9 months ago

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