Manually

OS:

🐧 Linux

Follow this guide to set up Desomnia on Linux manually, with full control over the binary placement and service configuration.

Prerequisites

Desomnia requires the .NET Runtime. If it is not provided as a package by your distribution, use the official script to download and install it into the default location, where it will be found automatically:

curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel 10.0 -runtime dotnet --install-dir /usr/share/dotnet

For monitoring network services, the libpcap library is required. It is usually already present on most distributions. If it is missing, install it via your package manager. On Debian-based distributions (Ubuntu, Raspbian, etc.):

apt-get install libpcap0.8t64

In order to automatically configure your network interface for Wake-on-LAN and temporarily assign static address mappings, Desomnia additionally needs the following optional network tools:

apt-get install ethtool iproute2

Native build

For 64-bit systems, a native build is offered in addition to the standard one β€” the Desomnia_<version>_linux-<arch>-native.zip asset on the GitHub Releases page. It is compiled ahead of time into a single self-contained binary that does not require the .NET Runtime, so you can skip the runtime step under Prerequisites above and simply place the binary. It also uses considerably less memory β€” around 48 MB instead of ~130 MB β€” which makes it a good fit for always-on devices such as a Raspberry Pi acting as a Wake-on-LAN or Sleep Proxy. See Performance for the reasoning.

Constraints

  • It runs on 64-bit Linux only (linux-x64 and linux-arm64) and requires glibc 2.35 or newer β€” Debian 12 β€œBookworm”, Ubuntu 22.04, Raspberry Pi OS (Bookworm), or later. For 32-bit systems, other architectures, or older systems, use the standard build.

  • Plugins cannot be loaded at runtime; the Firewall Knock Operator is included, but other plugins are not available.

Everything else, including local sleep management via systemd-logind, behaves as in the standard build.

The libpcap library and the optional network tools above are still required to install; only the .NET Runtime becomes unnecessary.

Portable mode

To verify that Desomnia is compatible with your system and network infrastructure before committing to a full installation, you can run it in portable mode.

Download the appropriate binary for your platform from the GitHub Releases page. Set the executable permission with chmod +x ./desomniad, then create a suitable configuration file and place it next to the binary. Additional plugin archives can be placed in a subdirectory named plugins. Run the application as root with ./desomniad.

Filesystem layout

For a persistent installation, use the following locations in alignment with the Filesystem Hierarchy Standard (FHS):

/usr/sbin

The daemon binary.

Set the executable permission with chmod +x /usr/sbin/desomniad.

/etc/desomnia

Configuration directory. Place your monitor.xml here; you can also add an NLog.config for additional logging.

/var/log/desomnia

Log output, if file logging is enabled in NLog.config and used ${var:logDir} as base path.

/var/lib/desomnia/plugins

Drop your additional plugins here; these will be loaded when the programs starts.

Service configuration

Create a systemd service unit to manage automatic start and stop:

/etc/systemd/system/desomnia.service
[Unit]
Description=Desomnia

[Service]
ExecStartPre=find /var/log/desomnia/ -type f -delete
ExecStart=desomniad
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target

The ExecStartPre statement clears the log folder on each start, which is useful for debugging.

Starting and stopping

After creating or modifying the configuration file, reload systemd with systemctl daemon-reload. To start Desomnia automatically with the system, enable it with systemctl enable desomnia. Start the service with systemctl start desomnia and stop it gracefully with systemctl stop desomnia.

Journal

The INFO-level console output shows the most important actions Desomnia takes β€” such as waking remote hosts or sending knock packets β€” giving a quick overview of what the service is doing at any point in time. Warnings and errors are included as well.

To follow the live output from the systemd journal, run:

journalctl -u desomnia -f -n 80