[POSSE] Yunohost Peertube upgrade: Stuck at “Starting a systemd service” for hours #358
This is my POSSE copy of my comment on a YunoHost-PeerTube issue, Stuck at “Starting a systemd service” for hours #358.
I think I found the source of the problem. (I am upgrading from peertube 5.1 to 5.2.)
The upgrade script at line 261 is stuck, watching the peertube log file /var/log/peertube/peertube.log
for a line matching HTTP server listening on localhost
, with a timeout of 5400 seconds (1.5 hours):
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="HTTP server listening on localhost" --timeout=5400 --length=200
What actually happens is peertube is logging into the file /var/log/peertube/peertube5.log
(in my case), and so the upgrade script never sees the line where it is watching. See how peertube created multiple log files over time:
$ sudo ls -laF /var/log/peertube/
total 66552
drwxrwxrwx 2 peertube peertube 4096 Jun 10 09:38 ./
drwxr-xr-x 23 root root 4096 Jun 21 00:00 ../
-rw-r--r-- 1 peertube peertube 12595469 Apr 11 11:00 peertube1.log
-rw-r--r-- 1 peertube peertube 12583200 Apr 1 13:00 peertube2.log
-rw-r--r-- 1 peertube peertube 12596028 Jun 21 20:38 peertube3.log
-rw-r--r-- 1 peertube peertube 12584637 Jun 10 09:38 peertube4.log
-rw-r--r-- 1 peertube peertube 5012474 Jun 23 10:13 peertube5.log
-rw-r--r-- 1 peertube peertube 134259 Jun 22 08:42 peertube-audit.log
-rw-r--r-- 1 peertube peertube 12587726 Feb 4 20:58 peertube.log
(I notice that these are not even in date order.)
The upgrade does indeed write the expected line, just not in the expected file:
$ grep "HTTP server listening on localhost:" /var/log/peertube/peertube5.log
[...some previous log entries match too...]
{"level":"info","message":"HTTP server listening on localhost:8095","label":"example.org:443","timestamp":"2023-06-23T10:05:50.145Z"}
Implications
The implication is this bug is going to show up only if the peertube installation has been in place long enough for it to have multiple log files. The log files seem to be rotated (new name chosen) once they reach about 10 MB in size, from my observation, which in my case is around two months.
A temporary work-around
When I manually add the expected line to peertube.log
like this:
$ echo '{"level":"info","message":"HTTP server listening on localhost:8095","label":"example.org:443","timestamp":"2023-06-23T09:09:46.721Z"}' | sudo tee -a /var/log/peertube/peertube.log
then the installation continues, and completes.
(For this work-around I appended a whole, correctly formatted log entry, rather than just the text the script is watching for, in order not to risk breaking the yunohost log viewer or other functions that might possibly try to parse this log file later.)
Using this work-around before the 1.5-hour timeout, I successfully completed the upgrade on two separate installations.
Follow/Feedback/Contact: RSS feed · Fedi follow this blog: @julian@wrily.foad.me.uk · use the Cactus Comments box above · matrix me · Fedi follow me · email me · julian.foad.me.uk Donate: via Liberapay All posts © Julian Foad and licensed CC-BY-ND except quotes, translations, or where stated otherwise