Plinth does not auto-start after restoring from backup

Problem Description
Firstly, thanks to everyone behind this project. It is a very convenient way of “self-hosting” many services necessary for daily digital life while preserving privacy.

I was running my Freedombox instance for many years until I managed to damage it to the point of no return :slight_smile: Fortunatelly, I had backups (via custom Duplicity script). Unfortunately, my approach to restoring them was quite crude. I reinstalled the system (clean installation of Freedombox) then selectively copied files from the backup into the fresh system - mostly from /etc and /home folders. This lead to all sorts of issues with permissions and inconsistencies between the installed packages and the file system, but I brute-forced my way to more-or-less working system.

One issue remained, however: Plinth (and therefore the rest of the Freedombox) fails to auto-start after reboot. Systemctl status page prints: (code=exited, status=2) (complete output below).
Manually starting plinth as root, using either:

  • plinth or
  • /usr/bin/plinth > /var/log/plinth.log 2> /var/log/plinth-error.log or
  • sudo -H -u plinth bash -c 'plinth'

works as expected and produces no errors (just one warning: WARNING django.security.csrf Forbidden (CSRF token missing or incorrect.): /plinth/accounts/sso/login/).

Steps to Reproduce

  1. Reboot the system
  2. Try to open the web interface

Expected Results
Web interface available.

Actual results
Web interface not available. After ssh-ing in and checking the status of the service, error below.

Information

  • FreedomBox version: 23.6.2
  • Hardware: Physical server, AMD Ryzen 5 5600G
  • How did you install FreedomBox?: ‘apt install freedombox’ and then above-described backup restoration process.

Systemctl status output:

● plinth.service - FreedomBox Service (Plinth)
     Loaded: loaded (/etc/systemd/system/plinth.service; enabled; preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Tue 2023-09-12 10:07:46 CEST; 684ms ago
       Docs: man:plinth(1)
    Process: 129421 ExecStart=/usr/bin/plinth > /var/log/plinth.log 2> /var/log/plinth-error.log (code=exited, status=2)
   Main PID: 129421 (code=exited, status=2)
        CPU: 399ms

/etc/systemd/system/plinth.service has following contents:

# SPDX-License-Identifier: AGPL-3.0-or-later                                 
                                                                             
[Unit]                                                                       
Description=FreedomBox Service (Plinth)                                      
Documentation=man:plinth(1)                                                  
After=network.target                                                         
StartLimitIntervalSec=0                                                      
                                                                             
[Service]                                                                    
ExecStart=/usr/bin/plinth > /var/log/plinth.log 2> /var/log/plinth-error.log 
Restart=on-failure                                                           
RestartSec=5                                                                 
ExecReload=/bin/kill -HUP $MAINPID                                           
User=plinth                                                                  
Group=plinth                                                                 
StandardOutput=null                                                          
StandardError=null                                                           
                                                                             
[Install]                                                                    
WantedBy=multi-user.target                                                   

Is there any error shown in /var/log/plinth-error.log?

Thanks for the reply.

Looks like I finally managed to solve it by actually removing the service file and the systemd. I guess the service file was part of my botched backup recovery and the actually used file has moved to other location?

Systemd output now prints:

 plinth.service - FreedomBox Service (Plinth)
    Loaded: loaded (/lib/systemd/system/plinth.service; enabled; preset: enabled)
    Active: active (running) since Thu 2023-09-14 09:30:57 CEST; 54s ago
      Docs: man:plinth(1)
  Main PID: 939 (plinth)
     Tasks: 15 (limit: 16509)
    Memory: 151.2M
       CPU: 2.438s
    CGroup: /system.slice/plinth.service
            └─939 /usr/bin/python3 /usr/bin/plinth

So, all seems good. :+1:


Original answer:

No, neither of the logs in this directory gets populated. The journalctl log contains endless sequences of following:

Sep 14 09:22:39 Freedombox systemd[1]: plinth.service: Scheduled restart job, restart counter is at 36219.         
Sep 14 09:22:39 Freedombox systemd[1]: Stopped plinth.service - FreedomBox Service (Plinth).                       
Sep 14 09:22:39 Freedombox systemd[1]: Started plinth.service - FreedomBox Service (Plinth).                       
Sep 14 09:22:39 Freedombox systemd[1]: plinth.service: Main process exited, code=exited, status=2/INVALIDARGUMENT  
Sep 14 09:22:39 Freedombox systemd[1]: plinth.service: Failed with result 'exit-code'.                             
1 Like