Skip to main content

Update #8 - Syncthing Systemd Recovery After Upgrade

Date: May 10, 2025
Category: System Maintenance / Automation
Backlink: Update #7 – Syncthing UFW Rule Automation with DDNS Integration

Overview

After performing a system upgrade on the VPS hosting BookStack and Syncthing, it was discovered that Syncthing no longer started correctly under the user-level systemctl --user session. Attempts to restart the service resulted in a Failed to connect to bus: Connection refused error, likely due to the user session being interrupted by the upgrade process.


The Problem

  • After the package upgrades, the Syncthing service appeared to be inactive.

  • Running:

    systemctl --user restart syncthing
    

    resulted in:

    Failed to connect to bus: Connection refused
    

The Solution

Switched Syncthing from a user-level service to a system-wide service tied to the user account.

Steps Taken:

  1. Stopped any failed user service attempts (optional but safe):

    systemctl --user stop syncthing
    
  2. Enabled the system-wide service instead:

    sudo systemctl enable syncthing@<username>.service
    sudo systemctl start syncthing@<username>.service
    
  3. Verified Syncthing is active:

    sudo systemctl status syncthing@<username>.service
    

 Optional Consideration

If future system upgrades disrupt services again, I will consider using a simple systemd timer or cron job to periodically check and restart Syncthing, though this is not currently necessary due to the stability of the system-wide service.