How to install Signal Desktop on FreeBSD using the Linux Binary Compatibility
Published on 2024-08-22.
FreeBSD provides optional binary compatibility with Linux, commonly referred to as Linuxulator, allowing users to install and run unmodified Linux binaries without the need for virtualization or emulation. In this tutorial I am going to show you how you can use it to install the Signal Desktop application for Linux.
FreeBSD has it's own binary package for the Signal Desktop application, however it is often a couple of versions behind the official application from Signal (that only concern themselves with Ubuntu) and often it will not connect to the Signal servers because it is outdated.
The main problem with Signal Desktop is that it is build upon Electron, a huge pile of Chromium and Node.js spaghetti that is combined into a framework for building applications for the desktop using JavaScript, HTML and CSS. Often it will not build due to dependency issues and FreeBSD cannot, and should not, spend the majority of build resources dealing with problems with Electron.
The fact that Signal Desktop is an Electron based application is such a bad decision on so many levels that it physically hurts, but I will not go further into that now.
I use Signal on a daily basis on my desktop systems and I like to be able to run it on FreeBSD, which is the operating system I primarily use, without getting the annoying message that says that "Signal Desktop has expired" after which I then either have to wait days until the package gets updated, or I try to build the package myself, or launch my Linux based desktop and then run it there.
Happily, FreeBSD can run many native Linux applications right out of the box with it's compatibility layer, including Signal Desktop.
In this tutorial I am going to use Debian Bookworm as the main Linux system and I am going to run Signal Desktop using the official APT repository from Signal.
Following this tutorial commands that must be typed as the root
user is prefixed with the #
pound sign whereas commands that can be typed as the regular user is prefixed with the $
dollar sign.
First we need to enable the Linux compatibility layer:
# sysrc linux_enable="YES"
Once enabled, it can be started without rebooting by executing the following command:
# service linux start
Then we need to install and use debootstrap, a program that can be used to install different Debian versions in a system without using an installation disk.
# pkg install debootstrap
Then we need to setup the correct installation path for debootstrap. Use your favorite text editor and insert the following line in /etc/sysctl.conf
:
compat.linux.emul_path="/compat/debian"
Then we use debootstrap to install the Debian base tools for the Debian Bookworm version:
# debootstrap bookworm /compat/debian
In order for the contents of the home directory to be shared and in order to be able to run X11 applications, the directories /home
and /tmp
should be mounted in the Linux compat
area using nullfs for loopback.
Edit /etc/fstab
and insert the following:
# Device Mountpoint FStype Options Dump Pass# devfs /compat/debian/dev devfs rw,late 0 0 tmpfs /compat/debian/dev/shm tmpfs rw,late,size=1g,mode=1777 0 0 fdescfs /compat/debian/dev/fd fdescfs rw,late,linrdlnk 0 0 linprocfs /compat/debian/proc linprocfs rw,late 0 0 linsysfs /compat/debian/sys linsysfs rw,late 0 0 /tmp /compat/debian/tmp nullfs rw,late 0 0 /home /compat/debian/home nullfs rw,late 0 0
Then execute mount in order to mount everything:
# mount -al
Now we're ready to use chroot to access the Linux system:
# chroot /compat/debian /bin/bash
We can use the uname command to verify that we are located in a Linux environment:
# uname -b Linux 5.15.0 x86_64
Exit the chroot environment by typing exit
and edit and update the APT repositories located in /compat/debian/etc/apt/sources.list
:
deb https://deb.debian.org/debian bookworm contrib main deb https://deb.debian.org/debian bookworm-updates contrib main deb https://deb.debian.org/debian bookworm-backports contrib main deb https://deb.debian.org/debian-security bookworm-security contrib main
I also prefer to disable recommended and suggested packages in /compat/debian/etc/apt/apt.conf
:
APT::Install-Recommends "false"; APT::AutoRemove::RecommendsImportant "false"; APT::AutoRemove::SuggestsImportant "false";
Then we go back into the chroot environment and update APT:
# chroot /compat/debian /bin/bash # apt update
If you get a lot of packages that need upgrading, you can do that before you continue with:
# apt full-upgrade
Then we install a couple of packages:
# apt install wget gnupg
Then we fetch Signal's public signing keys:
# wget -O- https://updates.signal.org/desktop/apt/keys.asc | gpg --dearmor > signal-desktop-keyring.gpg # cat signal-desktop-keyring.gpg | tee -a /usr/share/keyrings/signal-desktop-keyring.gpg > /dev/null
Then we add Signal's APT repository:
# echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/signal-desktop-keyring.gpg] https://updates.signal.org/desktop/apt xenial main' | tee -a /etc/apt/sources.list.d/signal-xenial.list
Then we update APT and install the Signal Desktop application:
# apt update # apt install signal-desktop
Exit the chroot and run Signal Desktop as the regular user:
$ /compat/debian/opt/Signal/signal-desktop --no-sandbox
If you get the error:
ELF interpreter /lib64/ld-linux-x86-64.so.2 not found, error 2
Then fix this by doing the following as root outside the chroot:
# cd /compat/debian/lib64/ # rm ./ld-linux-x86-64.so.2 # ln -s ../lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 ld-linux-x86-64.so.2
Then run Signal again as the regular user:
$ /compat/debian/opt/Signal/signal-desktop --no-sandbox
If the problem with ld-linux-x86-64.so.2
persists, then reboot FreeBSD before you continue.
That's it.
Have a nice one!