You are here

How to start and stop a GNUnet peer

Primary tabs

This section describes how to start a GNUnet peer. It assumes that you have already compiled and installed GNUnet and its' dependencies. Before you start a GNUnet peer, you may want to create a configuration file using gnunet-setup (but you do not have to). Sane defaults should exist in your GNUNET_PREFIX/share/gnunet/config.d/ directory, so in practice you could simply start without any configuration. If you want to configure your peer later, you need to stop it before invoking the gnunet-setup tool to customize further and to test your configuration (gnunet-setup has build-in test functions).

The most important option you might have to still set by hand is in [PATHS]. Here, you use the option "GNUNET_HOME" to specify the path where GNUnet should store its data. It defaults to $HOME/, which again should work for most users. Make sure that the directory specified as GNUNET_HOME is writable to the user that you will use to run GNUnet (note that you can run frontends using other users, GNUNET_HOME must only be accessible to the user used to run the background processes).

You will also need to make one central decision: should all of GNUnet be run under your normal UID, or do you want distinguish between system-wide (user-independent) GNUnet services and personal GNUnet services. The multi-user setup is slightly more complicated, but also more secure and generally recommended.

The Single-User Setup

For the single-user setup, you do not need to do anything special and can just start the GNUnet background processes using gnunet-arm. By default, GNUnet looks in ~/.config/gnunet.conf for a configuration (or $XDG_CONFIG_HOME/gnunet.conf if
$XDG_CONFIG_HOME is defined). If your configuration lives elsewhere, you need to pass the -c FILENAME option to all GNUnet commands.

Assuming the configuration file is called ~/.config/gnunet.conf, you start your peer using the gnunet-arm command (say as user gnunet) using:

gnunet-arm -c ~/.config/gnunet.conf -s

The "-s" option here is for "start". The command should return almost instantly. If you want to stop GNUnet, you can use:

gnunet-arm -c ~/.config/gnunet.conf -e

The "-e" option here is for "end".

Note that this will only start the basic peer, no actual applications will be available. If you want to start the file-sharing service, use (after starting GNUnet):

gnunet-arm -c ~/.config/gnunet.conf -i fs

The "-i fs" option here is for "initialize" the "fs" (file-sharing) application. You can also selectively kill only file-sharing support using

gnunet-arm -c ~/.config/gnunet.conf -k fs

Assuming that you want certain services (like file-sharing) to be always automatically started whenever you start GNUnet, you can activate them by setting "FORCESTART=YES" in the respective section of the configuration file (for example, "[fs]"). Then GNUnet with file-sharing support would be started whenever you

gnunet-arm -c ~/.config/gnunet.conf -s

Alternatively, you can combine the two options:

gnunet-arm -c ~/.config/gnunet.conf -s -i fs

Using gnunet-arm is also the preferred method for initializing GNUnet from init.

Finally, you should edit your crontab (using the crontab command) and insert a line

@reboot gnunet-arm -c ~/.config/gnunet.conf -s

to automatically start your peer whenever your system boots.

The Multi-User Setup

This requires you to create a user gnunet and an additional group gnunetdns, prior to running make install during installation. Then, you create a configuration file /etc/gnunet.conf which should contain the lines:


Then, perform the same steps to run GNUnet as in the per-user configuration, except as user gnunet (including the crontab installation). You may also want to run gnunet-setup to configure your peer (databases, etc.). Make sure to pass -c /etc/gnunet.conf to all commands. If you run gnunet-setup as user gnunet, you might need to change permissions on /etc/gnunet.conf so that the gnunet user can write to the file (during setup).

Afterwards, you need to perform another setup step for each normal user account from which you want to access GNUnet. First, grant the normal user ($USER) permission to the group gnunet:

# adduser $USER gnunet

Then, create a configuration file in ~/.config/gnunet.conf for the $USER with the lines:


This will ensure that gnunet-arm when started by the normal user will only run services that are per-user, and otherwise rely on the system-wide services. Note that the normal user may run gnunet-setup, but the configuration would be ineffective as the system-wide services will use /etc/gnunet.conf and ignore options set by individual users.

Again, each user should then start the peer using gnunet-arm -s --- and strongly consider adding logic to start the peer automatically to their crontab.

Afterwards, you should see two (or more, if you have more than one USER) gnunet-service-arm processes running in your system.

Killing GNUnet services

It is not necessary to stop GNUnet services explicitly when shutting down your computer.

It should be noted that manually killing "most" of the gnunet-service processes is generally not a successful method for stopping a peer (since gnunet-service-arm will instantly restart them). The best way to explicitly stop a peer is using gnunet-arm -e; note that the per-user services may need to be terminated before the system-wide services will terminate normally.