Syncthing – Cloud-synchronisation without cloud

I would never store my important data in the cloud, so please forgive the title, which might be misleading.

Recently, I found this tool. I had heard about it some time ago, but today I decided to give it a try. Earlier, I used tools like bsync, unison, and others. I was never truly satisfied with any of them, and often found myself returning to rsync. However, with Syncthing, I’ve now found a tool that I want to implement across my entire infrastructure.

The tool is available on Linux, Windows, and apparently also on macOS. I couldn’t test the latter two operating systems, but I believe it will work just as well on them.

I use it to synchronize data across different systems. And what can I say, it works wonderfully and very quickly.

In my setup, it was important that no external relay servers are used. This way, I can ensure that synchronization happens autonomously, which in my view also slightly improves security.

Equally important are the exclusions that should be set when certain file types should not be synchronized. In my case, these are output files from various compilers like gcc and g++, which usually generate a lot of object files (*.o)

Fast transfers with dd and loop-devices

I often adjust various hard drive parameters when using dd. Although the setting options may not be very prominent, the transfer speed ultimately depends primarily on the hardware being used.

The following parameters have proven successful for me when working with loopback devices:

dd if=/dev/sdf2 of=/dev/loop0p2 status=progress bs=64K oflag=direct oflag=direct

Emacs: Failed to verify signature archive-contents.sig

Today i got the message

Failed to verify signature archive-contents.sig

from my Emacs after typing package-list-packages. The full error is listed below:

Failed to verify signature archive-contents.sig:
No public key for 645357D2883A0966 created at 2024-04-22T11:05:03+0200 using EDDSA
Command output:
gpg: Signature made Mon Apr 22 11:05:03 2024 CEST
gpg: using EDDSA key 0327BE68D64D9A1A66859F15645357D2883A0966
gpg: Can't check signature: No public key

It seem’s that i wasn’t able to install elpa-packages anymore.

After some research i got the hint to install gnu-elpa-keyring-update with the Emacs-package-manager to solve this problem.

That sounds easy but before installing a package i had to temporary set the following variable to disable the keyring-check:

(setq package-check-signature nil)

After that i call package-list-packages again an installed
gnu-elpa-keyring-update.

To be on the safe side, i restarted Emacs and the error was gone.

Setting static route in Debian-Linux

Simple network routes can be set under Linux using the route command become. Here is a simple example:

route add -net 192.168.20.0 netmask 255.255.255.0 gw 192.168.0.1

In order for this change to be active even after a restart, the file /etc/network/interfaces must be changed.

iface ens192 inet static
address 192.168.0.156/24
up /bin/ip route add 10.25.20.0/24 via 192.168.0.1

How to change the environment of a running (parent) process under Linux?

This is not actually intended and there is no clean way to do it.

However, it is possible to change an environment variable of an existing process using a debugger.

Specifically, this is about the debugger called gdb. This can attach itself to existing processes and carry out various operations. Among other things, changing environment variables.

To connect to a running process you must have gdb installed and know the respective process ID (PID). In the example below, the ID is 2811:

gdb --pid=2811

The debugger then reports with the GDB prompt:

(gdb) call putenv ("MYVAR=1234")

In the upper sample you can also find the command with which the environment variable of the process can be found. In this case, the variable MYVAR is set to the value 1234.

Please note that the respective process is stopped as soon as gdb is started with the parameter --pid. As soon as the variable has been set, the debugger can be ended again with the q and Enter keys – the process then runs again.

But the whole thing is just a dirty hack and should not be used in a productive environment.

apt-file – Find programs inside APT/Debian-repositories

Recently I noticed on a freshly installed server that there was no command called nslookup. Luckily, Debian-like distributions have the apt-file tool.

This makes it possible to search for applications that are not yet installed but are in principle available in the APT repository. The command

apt-file search nslookup

quickly shed light on the matter and delivered the following output:

bash-completion: /usr/share/bash-completion/completions/nslookup
bind9-doc: /usr/share/doc/bind9-doc/arm/man.nslookup.html
dnsutils: /usr/bin/nslookup
dnsutils: /usr/share/man/man1/nslookup.1.gz
exim4-doc-html: /usr/share/doc/exim4-doc-html/spec_html/ch-the_dnslookup_router.html
fpc-source-3.0.4: /usr/share/fpcsrc/3.0.4/packages/fcl-net/examples/cnslookup.pp
libnet-nslookup-perl: /usr/share/doc/libnet-nslookup-perl/changelog.Debian.gz
libnet-nslookup-perl: /usr/share/doc/libnet-nslookup-perl/copyright
libnet-nslookup-perl: /usr/share/lintian/overrides/libnet-nslookup-perl
libxpa-dev: /usr/share/man/man3/xpanslookup.3.gz

So it was clear that the dnsutils package had to be installed
afterwards. Calling

apt-get install dnsutils

was enough and the nslookup tool was already available on my server.

If apt-file itself is not yet installed, it can be installed beforehand using

apt-get install apt-file

It is important that the cache is set up immediately afterwards. This is done using

apt-file update

Transferring files with Netcat/nc

Individual files can also be transferred using netcat. To do this, the
following instructions must be used on the transmitter and receiver:

On the receiver:

nc -l -p 8888 -w 5 > dest < /dev/null

At the sender:

nc servername 8888 < source

Explanation: The recipient starts a server service based on the first parts,
which reacts to requests on TCP port 8888. With the instruction > dest the content of received data is written to a file name dest.

The file transfer is started on the transmitter by entering the second
instruction. Here a connection with the server servername via port 8888 is initiated and the file source is transferred.

The file is transmitted unencrypted and uncompressed. Using tools like gzip and openssl this could be implemented transparently.

Install Steam on Debian without using an installer

Firstly, during the Steam setup, I’m acting as the user tester. Any other user can be used instead of tester, but in that case, all path references in this documentation must be adjusted accordingly.

First, download the official Steam installer from their website. This will place the file steam.deb in the downloads folder.

If you unpack this Debian package, you’ll find the necessary files under the directory =/CONTENTS= (unpacking with Midnight Commander is very simple: select steam.deb and press Enter). The files you should see are:

  • /usr/bin/steam
  • /usr/bin/steamdeps
  • /usr/lib/steam/bootstraplinux_ubuntu12_32.tar.xz

The last file can be named differently under certain circumstances. Below /usr/lib/steam (within steam.deb!) There should be only one file.

All three files are now e.g. copied to /home/tester/steam/bin (This directory must be created beforehand!) Then the following steps are carried out as user root:

sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install libgl1-mesa-dri:i386
sudo apt-get install libgl1-mesa-glx:i386

Now change to the directory /home/tester/steam/bin and call the file steam:

cd /home/tester/steam/bin
./steam

If packages are still missing, they are now displayed in a separate window (missing packages are installed as above, the package names displayed by Steam can be adopted 1: 1) Otherwise, the execution of the Steam application begins, which usually starts with the Update of own binaries begins. Ultimately, the usual Steam window appears where games can be started and installed.

Addendum: The way described above does not create any desktop icons and otherwise Steam is NOT integrated into the existing desktop environment via GUI but has to be started manually as stated above.