diff options
| -rwxr-xr-x | archsetup | 6 | ||||
| -rw-r--r-- | assets/2026-01-21-grub-timeout-request.txt | 4 | ||||
| -rw-r--r-- | assets/2026-01-21-syncthing-service-conflict.org | 72 | ||||
| -rwxr-xr-x | dotfiles/system/.local/bin/airplanemodetoggle | 4 | ||||
| -rw-r--r-- | scripts/testing/lib/validation.sh | 9 |
5 files changed, 90 insertions, 5 deletions
@@ -1263,7 +1263,9 @@ desktop_environment() { action="Sync Services" && display "subtitle" "$action" pacman_install syncthing - systemctl enable "syncthing@$username.service" >> "$logfile" 2>&1 || error "error" "$action" "$?" + # Use user service (not system service) to avoid lock file conflicts if both get enabled + loginctl enable-linger "$username" + sudo -u "$username" systemctl --user enable syncthing.service # Desktop Environment Utilities @@ -1638,7 +1640,7 @@ EOF action="configuring boot menu for silence and bootsplash" && display "task" "$action" if [ -f /etc/default/grub ]; then action="resetting timeouts and adjusting log levels on grub boot" && display "task" "$action" - sed -i "s/.*GRUB_TIMEOUT=.*/GRUB_TIMEOUT=0/g" /etc/default/grub + sed -i "s/.*GRUB_TIMEOUT=.*/GRUB_TIMEOUT=2/g" /etc/default/grub sed -i "s/.*GRUB_DEFAULT=.*/GRUB_DEFAULT=0/g" /etc/default/grub sed -i 's/.*GRUB_TERMINAL_OUTPUT=console/GRUB_TERMINAL_OUTPUT=gfxterm/' /etc/default/grub sed -i 's/.*GRUB_GFXMODE=auto/GRUB_GFXMODE=1024x768/' /etc/default/grub diff --git a/assets/2026-01-21-grub-timeout-request.txt b/assets/2026-01-21-grub-timeout-request.txt new file mode 100644 index 0000000..fa03f62 --- /dev/null +++ b/assets/2026-01-21-grub-timeout-request.txt @@ -0,0 +1,4 @@ +* TODO Increase GRUB_TIMEOUT to 2 seconds +Currently setting GRUB_TIMEOUT=0 which doesn't give users time to access GRUB menu. +Change to GRUB_TIMEOUT=2 for a reasonable delay while keeping boot fast. + diff --git a/assets/2026-01-21-syncthing-service-conflict.org b/assets/2026-01-21-syncthing-service-conflict.org new file mode 100644 index 0000000..7f86b39 --- /dev/null +++ b/assets/2026-01-21-syncthing-service-conflict.org @@ -0,0 +1,72 @@ +#+TITLE: Syncthing Service Conflict Issue +#+DATE: 2026-01-21 + +* Problem + +archsetup enables the system service: +#+begin_src bash +systemctl enable "syncthing@$username.service" +#+end_src + +However, the user service can also get enabled (either by default or manually): +#+begin_src bash +systemctl --user enable syncthing.service +#+end_src + +When BOTH services are enabled, they fight over the same lock file: +=~/.local/state/syncthing/syncthing.lock= + +This causes one or both to fail with: +: Failed to acquire lock: is another Syncthing instance already running? + +* Symptoms + +- Syncthing fails to start or keeps crashing +- Lock file errors in journalctl +- Two syncthing processes running with different parent services +- Config changes don't persist (one service overwrites the other) + +* Recommendation + +Standardize on ONE service type. Options: + +** Option A: User Service (recommended for desktops) + +Runs when user logs in. Cleaner for desktop use. + +Change archsetup from: +#+begin_src bash +systemctl enable "syncthing@$username.service" +#+end_src + +To: +#+begin_src bash +# Enable user service (requires user session) +sudo -u "$username" systemctl --user enable syncthing.service +#+end_src + +Note: User services require lingering or an active session: +#+begin_src bash +loginctl enable-linger "$username" +#+end_src + +** Option B: System Service (recommended for headless/servers) + +Runs at boot without user login. Better for servers. + +Keep current archsetup config, but ensure user service is disabled: +#+begin_src bash +systemctl enable "syncthing@$username.service" +# Explicitly disable user service to prevent conflicts +sudo -u "$username" systemctl --user disable syncthing.service 2>/dev/null || true +#+end_src + +* Resolution on ratio (2026-01-21) + +Disabled system service, kept user service: +#+begin_src bash +sudo systemctl stop syncthing@cjennings.service +sudo systemctl disable syncthing@cjennings.service +systemctl --user enable syncthing.service +systemctl --user start syncthing.service +#+end_src diff --git a/dotfiles/system/.local/bin/airplanemodetoggle b/dotfiles/system/.local/bin/airplanemodetoggle index c98e144..038a0d6 100755 --- a/dotfiles/system/.local/bin/airplanemodetoggle +++ b/dotfiles/system/.local/bin/airplanemodetoggle @@ -6,7 +6,7 @@ then sudo systemctl stop bluetooth.service sudo systemctl stop expressvpn.service sudo systemctl stop sshd.service - sudo systemctl stop syncthing@cjennings.service + systemctl --user stop syncthing.service sudo systemctl stop avahi-daemon.service sudo systemctl stop cronie.service sudo systemctl stop cups.service @@ -25,7 +25,7 @@ else sudo systemctl start bluetooth.service sudo systemctl start expressvpn.service sudo systemctl start sshd.service - sudo systemctl start syncthing@cjennings.service + systemctl --user start syncthing.service sudo systemctl start avahi-daemon.service sudo systemctl start cronie.service sudo systemctl start cups.service diff --git a/scripts/testing/lib/validation.sh b/scripts/testing/lib/validation.sh index 280f435..cdc33c5 100644 --- a/scripts/testing/lib/validation.sh +++ b/scripts/testing/lib/validation.sh @@ -550,7 +550,14 @@ validate_all_services() { validate_service_optional "cups" "enabled" validate_service_optional "docker" "enabled" validate_service_optional "tailscaled" "enabled" - validate_service_optional "syncthing@cjennings" "enabled" + # Syncthing uses user service (not system), check lingering is enabled + step "Checking user lingering for syncthing" + local linger_enabled=$(ssh_cmd "ls /var/lib/systemd/linger/cjennings 2>/dev/null && echo yes || echo no") + if [ "$linger_enabled" = "yes" ]; then + validation_pass "User lingering enabled for syncthing user service" + else + validation_warn "User lingering not enabled (syncthing may not autostart)" + fi # Filesystem-specific validate_zfs_services |
