Skip to content

Commit 5e4119a

Browse files
committed
contrib/systemd/labgrid-exporter, doc: document DynamicUser and helpers
The helpers with sudo on exporters cannot be used together with systemd's DynamicUser. This directive enforces the NoNewPrivileges directive, which leads to the following error: sudo: The "no new privileges" flag is set, which prevents sudo from running as root. sudo: If sudo is running in a container, you may need to adjust the container configuration to disable the flag. Since DynamicUser introduced in 0a2deef ("contrib/systemd/labgrid-exporter: improve service") is a useful feature, switch to User and Group only when using helpers. Signed-off-by: Tomas Novotny <tomas@novotny.cz>
1 parent 872fffb commit 5e4119a

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

contrib/systemd/labgrid-exporter.service

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ EnvironmentFile=-/etc/environment
1111
ExecStart=/path/to/labgrid/venv/bin/labgrid-exporter /etc/labgrid/exporter.yaml
1212
Restart=always
1313
RestartSec=30
14+
# Replace 'DynamicUser=yes' with 'User=labgrid' and 'Group=labgrid' when using labgrid helpers with sudo.
1415
DynamicUser=yes
1516
# Adjust to your distribution (most often "dialout" or "tty")
1617
SupplementaryGroups=dialout plugdev

doc/getting_started.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,15 @@ Follow these instructions to install the systemd files on your machine(s):
379379
installation paths of your distribution.
380380
#. Adapt the ``ExecStart`` paths of the service files to the respective Python
381381
virtual environments of the coordinator and exporter.
382+
#. If you use labgrid helpers (see :file:`helpers/`) with sudo on exporter,
383+
replace ``DynamicUser`` with ``User`` and ``Group`` in the
384+
:file:`labgrid-exporter.service`:
385+
386+
.. code-block::
387+
388+
User=labgrid
389+
Group=labgrid
390+
382391
#. Adjust the ``SupplementaryGroups`` option in the
383392
:file:`labgrid-exporter.service` file to your distribution so that the
384393
exporter gains read and write access on TTY devices (for ``ser2net``); most

0 commit comments

Comments
 (0)