{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreigihppcmnib7qryoybrhcxcldoo7c25zjqa5d4ixclvearxtsvft4",
"uri": "at://did:plc:ogsypfnyf6uzkppsrqgdirne/app.bsky.feed.post/3m5zflxeza5g2"
},
"path": "/_posts/2022-08-21-raspberry-pi-signal-cli/",
"publishedAt": "2026-06-04T08:27:48.848Z",
"site": "https://nickwasused.com",
"tags": [
"DietPi",
"here",
"1-gb-ram",
"https://github.com/AsamK/signal-cli#install-system-wide-on-linux",
"https://github.com/AsamK/signal-cli/wiki/Provide-native-lib-for-libsignal#manual-build",
"https://github.com/signalapp/libsignal",
"https://github.com/MichaIng/DietPi",
"https://github.com/AsamK/signal-cli/releases"
],
"textContent": "# Notice\n\nAs of 31/03/2023, this guide is not working correctly! Because of that reason, the script got renamed to `signal-cli-install-old.sh`.\n\nAt the time of writing this, the signal-cli is at version `0.11.3` with the libsignal-client being at version `0.20.0`.\nThe OS that I use is DietPi.\n\n# Usage\n\nThe signal-cli could be useful for sending automatic messages, e.g. when a service/job fails. For example, when your database backup fails, you can get the notification right into Signal.\n\n# Automatic install\n\nFor an automatic install, I provide the following script:\n\nYou can use it by running:\n`sudo wget https://nickwasused.com/blog/2022-08-21-raspberry-pi-signal-cli/signal-cli-install.sh`\nNotice! Before running scripts from the Internet, check their code.\n`cat ./signal-cli.install.sh`\nNow you can run the script:\n`sudo chmod +x ./signal-cli-install.sh && sudo ./signal-cli.install.sh`\n\n# Manual install\n\n# precautions\n\nYou need to check the size of your `/tmp` directory with the following command:\n`df -h`\n\nThere will be a line that looks like this:\n`tmpfs 1.0G 1.0M 1023M 1% /tmp`\n\nNotice that it reads `1.0G`. This is too small, as the installation requires about 1.25G.\n\nYou can expand the size of your `/tmp` directory with this command:\n`sudo mount -o remount,size=2G /tmp/`\n\n# required tools\n\nFor this guide, `curl` and `zip` are required. Install them with:\n`sudo apt install curl zip`\n\n(If there is an error, try to run `sudo apt update`)\n\n## Basic install\n\nFirst, we need to set the Version of the signal-cli we are installing. You can find the Version code here.\n\nSet the signal-cli version with:\n`export VERSION=0.11.3`.\nAfter that, we download the signal-cli version:\n`curl --proto '=https' --tlsv1.2 -o signal-cli-\"${VERSION}\"-Linux.tar.gz https://github.com/AsamK/signal-cli/releases/download/v\"${VERSION}\"/signal-cli-\"${VERSION}\"-Linux.tar.gz`\nand unpack it to `/opt`:\n`sudo tar xf signal-cli-\"${VERSION}\"-Linux.tar.gz -C /opt`. After extracting the code, remove the file:\n`sudo rm signal-cli-\"${VERSION}\"-Linux.tar.gz`\nFinally, we link it to `/usr/local/bin` so we can use the signal-cli:\n`sudo ln -sf /opt/signal-cli-\"${VERSION}\"/bin/signal-cli /usr/local/bin/`.\n\nAs the last step for the basic install, we install the required Java version:\n`sudo apt install openjdk-17-jdk`\n\n### Info\n\nIf we try to run `signal-cli` now, then it will fail! (But only if your system type is not `x86_64`)\n\n## Building the libsignal_jni.so\n\nTo resolve the problem, we need to build the \"native lib for libsignal\".\n\nNotice! If you have a 1GB Raspberry Pi, then please read #1-gb-ram.\n\n### Dependencies\n\nFirst, we need to install some dependencies:\n\n#### apt\n\n`sudo apt install protobuf-compiler clang libclang-dev cmake make`\n\n#### rust\n\n`sudo curl https://sh.rustup.rs -sSf | sudo sh -s -- --default-toolchain nightly-aarch64-unknown-linux-gnu -y`\n\n### Build libsignal\n\nLet's create a temporary directory to store files:\n`sudo mkdir /tmp/signal-cli-install && cd /tmp/signal-cli-install`\n\nBefore starting to download the libsignal source code, we have to find the matching version code:\n`export LIBVERSION=$(find /opt/signal-cli-\"${VERSION}\"/lib/ -maxdepth 1 -mindepth 1 -name 'libsignal-client-*' | sed -E 's/\\/opt\\/signal-cli-[0-9]{1,}.[0-9]{1,}.[0-9]{1,}\\/lib\\/libsignal-client-*//g' | sed -E 's/.jar//g')`\n\nAfter that, we download the source code:\n`sudo curl --proto '=https' --tlsv1.2 -o /tmp/signal-cli-install/v\"${LIBVERSION}\".tar.gz https://github.com/signalapp/libsignal/archive/refs/tags/v\"${LIBVERSION}\".tar.gz`\n\nAnd now we have to unpack the downloaded code:\n`sudo tar xf /tmp/signal-cli-install/v\"${LIBVERSION}\".tar.gz -C /tmp/signal-cli-install/ && mv libsignal-\"${LIBVERSION}\" libsignal`\n\nAfter extracting the code, remove the archive as it is no longer needed. `sudo rm /tmp/signal-cli-install/v\"${LIBVERSION}\".tar.gz`\n\nChange into the java directory of the downloaded code:\n`cd libsignal/java`\n\nWe disable some Android stuff as we don't want to build for Android:\n`sudo sed -i \"s/include ':android'//\" /tmp/signal-cli-install/libsignal/java/settings.gradle`\n\n#### 1 GB Ram\n\nWhile building libsignal I ran into a problem with the RAM usage on the Raspberry Pi 3b because eventually, the 1 GB of RAM would be full. This would result in a locked-up Pi that I had to hard reset. We can work around this problem by limiting the CPU usage to 1 Core.\n(I don't know if a 2 GB Raspberry Pi 4 can run all 4 Cores.)\n\n`sudo sed -i \"s/cargo build /cargo build -j ${CORE_COUNT} /\" /tmp/signal-cli-install/libsignal/java/build_jni.sh`\n\n##### Update 08.10.2022\n\nI could not get libsignal to compile on a Raspberry Pi with 1GB of RAM.\n\n#### Starting the Build\n\nWe can start the build with: `sudo /tmp/signal-cli-install/libsignal/java/build_jni.sh desktop`\n\nWe need to remove the bundled `libsignal_jni.so` from `/opt/signal-cli-${VERSION}/lib/libsignal-client-*.jar`:\n`sudo zip -d /opt/signal-cli-${VERSION}/lib/libsignal-client-*.jar libsignal_jni.so`\nand add our own:\n`sudo zip /opt/signal-cli-${VERSION}/lib/libsignal-client-*.jar /tmp/signal-cli-install/libsignal/target/release/libsignal_jni.so`\n\nSince Version 0.11.3, the replacement is not working for me; for that reason, we added the `libsignal_jni.so` to the default Java library path.\nFor that, create it if it doesn't exist: `sudo mkdir -p /usr/java/packages/lib`\nand finally copy the file to that folder:\n`sudo cp /tmp/signal-cli-install/libsignal/target/release/libsignal_jni.so /usr/java/packages/lib`\n\nNow we can remove the temporary files:\n`sudo rm -r /tmp/signal-cli-install`\n\nWe should set the permissions for the new files:\n`sudo chown root:root /usr/java/packages/lib/libsignal_jni.so`\n`sudo chmod 755 /usr/java/packages/lib/libsignal_jni.so`\n`sudo chmod 755 -R /opt/signal-cli-${VERSION}`\n`sudo chown root:root -R /opt/signal-cli-${VERSION}`\n\nNow we should be able to use the `signal-cli` command with no problems.\n\nFinally, the signal-cli should report its version with:\n`signal-cli --version`\n\n# Source\n\nhttps://github.com/AsamK/signal-cli#install-system-wide-on-linux https://github.com/AsamK/signal-cli/wiki/Provide-native-lib-for-libsignal#manual-build\nhttps://github.com/signalapp/libsignal\n\n### archive\n\nThe following links are archived versions, as the main ones could break.\n\nhttps://github.com/MichaIng/DietPi\nhttps://github.com/AsamK/signal-cli/releases",
"title": "Installing the signal-cli on the Raspberry Pi.",
"updatedAt": "2022-08-21T00:00:00.000Z"
}