Software, electronics and anything else

Transmission 4.0 on Ubuntu 22.04

Transmission

Having set up a headless server with Transmission 3.0 from the default Ubuntu 22.04 repositories, I discovered an issue: there is apparently a memory leak! Transmission will slowly eat more and more RAM and over the course of a few hours (8-12) will have used up around 1GB. Apparently, this problem has been fixed in newer versions like 4.0, but to get it you need to compile it yourself; there are no official builds available or even unofficial PPAs from the developers.

Building Transmission is fairly straightforward – the official guide is complete and easy to follow. The problem is running it on a headless server. By default, the build does not include essential files like the service that starts Transmission on boot – you’ll need to take care of this yourself. The .deb on Ubuntu/Debian includes this by default by the way.

First, install libsystemd as part of the build dependencies. This is necessary for running Transmission as a service:

sudo apt install libsystemd-dev

Then follow the official build guide. After running sudo make install in the CMake build directory, you’ll need to copy over the Transmission service file from the extracted tarball. In my case:

sudo cp ~/transmission-4.0.2/daemon/transmission-daemon.service /lib/systemd/system/

I chose to make a few modifications to the file. Namely, I add some dependencies on remote filesystems being mounted (where my torrents are normally stored) and fix the daemon’s path – for some reason, it’s set to /usr/bin when by default it installs to /usr/local/bin. First, to create the user:

sudo adduser --system --group transmission

Then to modify the service, run sudo nano /lib/systemd/system/transmission-daemon.service and modify the file to be as such:

[Unit]
Description=Transmission BitTorrent Daemon
Wants=network-online.target
After=network-online.target remote-fs.target
Before=umount.target
Conflicts=umount.target

[Service]
User=transmission
Group=transmission
Type=notify
ExecStart=/usr/local/bin/transmission-daemon -f --log-level=error
ExecReload=/bin/kill -s HUP $MAINPID
NoNewPrivileges=true
MemoryDenyWriteExecute=true
ProtectSystem=true
PrivateTmp=true

[Install]
WantedBy=multi-user.target

Then refresh the services and start Transmission, as well as enable it at boot:

sudo systemctl daemon-reload
sudo systemctl start transmission-daemon.service
sudo systemctl enable transmission-daemon.service

After starting transmission, you can stop it and modify the config file to enable Web access and whatever else as desired in /home/transmission/.config/transmission-daemon/settings.json or wherever you set the home directory of the transmission user to.

One thought on “Transmission 4.0 on Ubuntu 22.04

  1. I’ve always liked transmission, simple and fairly light.
    Thanks for noticing the “memory leak” on (headless) transmission 3.*, and the info on building latest (headless) transmission 4.* (which fixes that leak) on linux.
    I’m surprised that Ubuntu, Linux Mint, …, still haven’t upgraded their transmission pkgs to the newer stable transmission 4.* -which has been out for almost a year.?

    anyway, thanks again.

Leave a Reply

Your email address will not be published. Required fields are marked *