Syncthing In Toolbox on Fedora Silverblue with systemd

Fedora Silverblue is a popular Linux distribution that emphasizes containerized applications using the OSTree-based system. In this tutorial, we’ll explore how to set up and run Syncthing, a powerful file synchronization tool, within the Silverblue toolbox. By isolating Syncthing within a toolbox, you can maintain system integrity and easily manage its dependencies. Let’s dive in!

Step 1: Create a new toolbox

Let’s create a new toolbox for Syncthing. Choose a suitable name for your toolbox, such as “syncthing-toolbox,” and execute the following command:

1
toolbox create syncthing-toolbox

Step 2: Entering the Toolbox

To enter the newly created toolbox, run the following command:

1
toolbox enter syncthing-toolbox

Step 3: Installing Dependencies

Within the toolbox environment, we’ll install the required dependencies for Syncthing. Execute the following command:

1
sudo dnf install syncthing

Step 4: Starting Syncthing

Now that the necessary dependencies are installed, we can start Syncthing. Execute the following command:

1
syncthing

Step 5: Accessing Syncthing Web Interface

Syncthing provides a web interface to configure and monitor file synchronization. To access it, open a web browser and navigate to http://localhost:8384. You should see the Syncthing interface.

Step 6: Configuring Syncthing

Follow the on-screen instructions to set up Syncthing according to your requirements. Configure folders, device connections, and synchronization settings as needed.

Step 7: Exiting the Toolbox

To exit the toolbox environment, use the exit command or close the terminal window.

Step 8: Create a new service unit file to automatically start Syncthing toolbox container at system startup

To automatically start Syncthing toolbox container when your Silverblue system boots, you can use systemctl to manage the service. Here’s how:

1. Create systemd folder for systemd user service

If folder already exist, go to next step.

1
mkdir -p ${HOME}/.local/share/systemd/user/

2. Generate systemd unit from toolbox container

1
2
3
4
5
6
7
8
cd ${HOME}/.local/share/systemd/user/
podman generate systemd -f -n syncthing-toolbox
# Reload the systemctl daemon to ensure it recognizes the new service:
systemctl --user daemon-reload
# Enable the syncthing-toolbox service to start on boot
systemctl --user enable syncthing-toolbox.service --now
# Start the syncthing-toolbox service immediately
systemctl --user start syncthing-toolbox.service --now

Step 9: Create a new service unit file to automatically start Syncthing at system startup

1. Get syncthing.service file

If your distribution package already contain this file, you can use it instead of using the git repostory verion.

1
wget https://raw.githubusercontent.com/syncthing/syncthing/main/etc/linux-systemd/user/syncthing.service

2. Modify syncthing.service file to start syncthing from toolbox container

1
sed -i "s/ExecStart=/ExecStart=toolbox run --container syncthing-toolbox /" syncthing.service

3. Enable syncthing.service to start on boot

1
2
3
4
5
6
# Reload the systemctl daemon to ensure it recognizes the new service:
systemctl --user daemon-reload
# Enable the syncthing service to start on boot
systemctl --user enable syncthing.service --now
# Start the syncthing service immediately
systemctl --user start syncthing.service --now

From now on, Syncthing will automatically start whenever your Silverblue system boots.

Fedora Silverblue Toolbox OCI permission issue AWS Lightsail Wireguard Unable to access interface: Protocol not supported easy fix

Comments