The 34-Message tmux Install
Date: November 18, 2024 Messages: 34 Issue: Install tmux on Synology NAS Result: Working tmux via Entware
The Problem
I SSH into my Synology NAS regularly. Long-running tasks. Config changes. Monitoring scripts.
The problem: disconnect from SSH and everything dies. Close my laptop and the process stops.
The solution: tmux. Except Synology DSM doesn’t have apt, yum, or any standard package manager.
What DSM Actually Is
Synology’s DSM is Linux, technically. But it’s a heavily customized BusyBox environment. Most standard tools are stripped-down versions. Package management is through their GUI “Package Center.”
There’s no apt install tmux. There’s no tmux package in Package Center.
Option 1: ipkg (Old Way)
The old approach was ipkg, a lightweight package manager. But Synology deprecated it. Modern DSM versions don’t support it.
Dead end.
Option 2: Entware (The Way)
Entware is a package repository for embedded devices. Works on Synology.
First, enable SSH:
- Control Panel → Terminal & SNMP → Enable SSH
Then, install Entware:
# SSH into NAS
ssh admin@synology-ip
# Download and run the installer
wget -O - http://bin.entware.net/x64-k3.2/installer/generic.sh | /bin/sh
For ARM-based Synology units:
wget -O - http://bin.entware.net/armv7sf-k3.2/installer/generic.sh | /bin/sh
The installer creates /opt and sets up the package manager.
The PATH Problem
After installing Entware, the opkg command wasn’t found.
opkg install tmux
# -ash: opkg: not found
Entware lives in /opt/bin, which isn’t in the default PATH.
Fix:
# Add to PATH temporarily
export PATH=/opt/bin:/opt/sbin:$PATH
# Make it permanent
echo 'export PATH=/opt/bin:/opt/sbin:$PATH' >> ~/.profile
Installing tmux
opkg update
opkg install tmux
Installing tmux (3.3a-1) to root...
Downloading http://bin.entware.net/.../tmux_3.3a-1_x64-3.2.ipk
Configuring tmux.
The libevent Problem
First run:
tmux
# tmux: error while loading shared libraries: libevent-2.1.so.7
Missing dependency. Entware’s tmux needed libevent.
opkg install libevent2
Try again:
tmux
# Works!
Surviving Reboots
Synology DSM resets some things on reboot. The Entware symlink might break.
Create a startup script:
# Create task in Task Scheduler (Control Panel → Task Scheduler)
# Triggered: Boot-up
# Command:
#!/bin/bash
# Ensure Entware is properly linked after reboot
if [ ! -L /opt ]; then
ln -sf /volume1/@Entware/opt /opt
fi
This ensures /opt points to the right place even after DSM updates.
Basic tmux Usage
Create a session:
tmux new -s mywork
Detach (leave running):
Ctrl-b d
List sessions:
tmux ls
Reattach:
tmux attach -t mywork
Now I can start a long rsync, detach, close my laptop, and check back hours later. The session survives.
The Config
Created ~/.tmux.conf:
# Better prefix (Ctrl-a instead of Ctrl-b)
set -g prefix C-a
unbind C-b
# Start numbering at 1
set -g base-index 1
# Enable mouse
set -g mouse on
# Vi mode
setw -g mode-keys vi
# Status bar
set -g status-bg black
set -g status-fg white
What I Learned
Synology isn’t standard Linux. Forget apt. Learn Entware.
PATH matters. New tools in new locations need PATH updates.
Dependencies chain. tmux needs libevent. libevent needs other things. Let the package manager handle it.
Reboots break things. DSM updates can reset symlinks. Startup scripts are insurance.
The Result
34 messages for something that should take one command on a normal system. But now tmux works. Long-running NAS tasks survive disconnects. The NAS is finally a proper remote work environment.
On Synology, nothing is simple. But everything is possible.