#StackBounty: #18.04 #systemd #stdout systemd service output to terminal/pty

Bounty: 50

I am not able to figure out what option to pass in StandardOutput= for a
unit file (.service), where I want to show some messages on the connected terminal
from where the service is started! (console/tty doesn’t seem to be what I want)

Maybe /etc/systemd/system.conf‘s global default DefaultStandardOutput=journal can be changed, but I don’t want to do that!
I am only interested in showing some progress/startup messages from my unit file
(like systemd-run -P)

I am on Ubuntu 18.04.2

# systemd --version
systemd 237


Get this bounty!!!

#StackBounty: #systemd #namespace Extra mount points for systemd service

Bounty: 50

I am trying to set up a systemd service which needs to have access to a filesystem I don’t normally want mounted (in case it’s relevant, I want to set up Snapper on btrfs, but want to use a flat subvolume layout as described in various places eg. here, and want .snapshots directories to be unmounted for everything else).

I know it’s possible to give the service its own private mount namespace, but most of the documentation talks about restricting access to data that’s usually available, not granting access to something that usually isn’t. How can I ensure that Snapper will have mounts that the rest of the system will not?

Edit: Of course I can replace the Exec= value with a script that mounts the filesystem and then does runs the main thing, but that’s inelegant in various ways (for one thing, the example above isn’t the only time I want to do this, and the other time I don’t want the main service to run as root and I’d need to manually change that too instead of just using User=). If I do go that route, though, would I need the script to also unmount the filesystem, or would systemd clean that up automatically?


Get this bounty!!!

#StackBounty: #server #systemd #systemd-journald Avoid systemd unit (service) to be logged in journal

Bounty: 50

To produce metrics on some disks I have setup a systemd.timer + systemd.service

That timer spins up every 10 seconds, and I would like to avoid my journal be spammed every time this small script get spawned and then succedes.

Journal writes multiple lines like that

Jan 04 17:21:31 hostname systemd[1]: personal.service: Succeeded.
-- Subject: Unit succeeded
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- The unit personal.service has successfully entered the 'dead' state.

Moreover there is an audit on every service start

Jan 04 17:22:31 hostname audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=personal comm="systemd" exe="/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Jan 04 17:22:31 hostname kernel: audit: type=1131 audit(1578158551.035:11612): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=personal comm="systemd" exe="/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'


Get this bounty!!!

#StackBounty: #networking #systemd #routing #systemd-networkd #metric Set routing metrics for static IPs with systemd-networkd?

Bounty: 50

I recently set up a server with its network managed directly by systemd-networkd (nuked netplan.io and Network Manager) and gave it static IPs like this:

/etc/systemd/network/10-ethernet.network

[Match]
Name=eno1

[Network]
Address=192.168.1.2/24
Gateway=192.168.1.1
DNS=192.168.1.1

After restarting systemd-networkd.service, default routes look like this:

default via 192.168.1.1 dev eno1 proto static
default via 172.16.0.1 dev eno2 proto static
default via 172.31.255.1 dev eno3 proto static
                                               ^^^

Because there are multiple NICs and I want to make eno1 the preferred one, I want the routes laid out like this:

default via 192.168.1.1 dev eno1 proto static metric 100
default via 172.16.0.1 dev eno2 proto static metric 300
default via 172.31.255.1 dev eno3 proto static metric 500
                                               ^^^^^^^^^^

Without the metric value, it default to 0, meaning all routes have the same priority (highest), which I want to avoid.

I’ve tried this setting:

[Route]
Gateway=192.168.1.1
Metric=100

But it only generates an extra route with the desired metric while the original ones (missing metric) still remaining.

I’m running on Systemd 240. How should I achieve this?


Get this bounty!!!

#StackBounty: #linux #systemd #autossh Autossh fails on startup

Bounty: 100

I am trying to make autossh set up a reverse tunnel to a server I have at home automatically with systemd. I set up a unit in /etc/systemd/system called autossh.service

It all works fine if I start the service once I am connected to the Internet. However, that is not the case on startup. It fails saying “Could not resolve hostname” since it is not connected to the Internet.

In /etc/systemd/system/autossh.service I have the line

After=network-online.target

which should in theory take care of this problem but it doesn’t. The command fails on startup (it is not online yet so it says it could not resolve the hostname) and it does not try again.

How can I solve this?


Get this bounty!!!

#StackBounty: #systemd #boot How to make network loads after (or parallel to) graphics on boot

Bounty: 50

I want to speed up my boot. I checked systemd-analyze critical-chain output:

graphical.target @13.691s
└─multi-user.target @13.691s
  └─cups-browsed.service @13.690s
    └─org.cups.cupsd.service @13.419s +269ms
      └─network.target @13.412s
        └─dhcpcd@enp6s0.service @5.850s +7.561s
          └─basic.target @5.838s
            └─sockets.target @5.838s
              └─avahi-daemon.socket @5.838s
                └─sysinit.target @5.837s
                  └─systemd-update-done.service @5.828s +8ms
                    └─ldconfig.service @5.183s +643ms
                      └─local-fs.target @5.180s
                        └─run-mount-extra.mount @3.333s +1.846s
                          └─systemd-fsck@dev-disk-byx2duuid-abd2e996x2db30bx2d4e55x2db52ex2dccd74242221a.service @1.650s +1.680s
                            └─local-fs-pre.target @1.649s
                              └─lvm2-monitor.service @216ms +1.432s
                                └─lvm2-lvmetad.service @235ms
                                  └─systemd-journald.socket @207ms
                                    └─-.mount @181ms
                                      └─systemd-journald.socket @207ms
                                        └─...

dhcpcd@enp6s0.service takes 7 seconds. But I don’t really need network on the first seconds of my boot and can wait for a few seconds after WM start. What should I change to make it possible?


Get this bounty!!!

#StackBounty: #debian #systemd #services #systemctl systemd: Can't unmask root mount (-.mount)

Bounty: 50

(Dist: Debian 10)

I have a reoccurring error message that mainly pops up when using systemctl (also when installing a package, and occasionally in a few other places that escape me),

Unit -.mount is masked.

Sometimes (depending on what command called the error message) it is more verbose, such as

Error: GDBus.Error:org.freedesktop.systemd1.UnitMasked: Unit -.mount is masked.

This error doesn’t impede installing packages or any systemd services which are enabled already (and as such are loaded at boot), but using systemctl or service to restart, start or stop a service fails. This means I have to reboot the whole server to restart a service, which can be a little annoying.

Trying to unmask the root mount with systemctl unmask -- -.mount appears to work (nothing is returned), but systemctl status -- -.mount still outputs the following after:

● -.mount - Root Mount
   Loaded: masked (Reason: Unit -.mount is masked.)
   Active: active (mounted) since Mon 2019-08-05 15:03:38 AEST; 4h 8min ago
    Where: /
     What: /dev/sde1
    Tasks: 0 (limit: 4915)
   Memory: 0B
   CGroup: /system.slice/-.mount

Any ideas? I’m don’t want to start from a fresh install for this server, so either I find a fix or just deal with having to restart if I need to reload a service.


Get this bounty!!!

#StackBounty: #debian #systemd #services #systemctl systemd: Can't unmask root mount (-.mount)

Bounty: 50

(Dist: Debian 10)

I have a reoccurring error message that mainly pops up when using systemctl (also when installing a package, and occasionally in a few other places that escape me),

Unit -.mount is masked.

Sometimes (depending on what command called the error message) it is more verbose, such as

Error: GDBus.Error:org.freedesktop.systemd1.UnitMasked: Unit -.mount is masked.

This error doesn’t impede installing packages or any systemd services which are enabled already (and as such are loaded at boot), but using systemctl or service to restart, start or stop a service fails. This means I have to reboot the whole server to restart a service, which can be a little annoying.

Trying to unmask the root mount with systemctl unmask -- -.mount appears to work (nothing is returned), but systemctl status -- -.mount still outputs the following after:

● -.mount - Root Mount
   Loaded: masked (Reason: Unit -.mount is masked.)
   Active: active (mounted) since Mon 2019-08-05 15:03:38 AEST; 4h 8min ago
    Where: /
     What: /dev/sde1
    Tasks: 0 (limit: 4915)
   Memory: 0B
   CGroup: /system.slice/-.mount

Any ideas? I’m don’t want to start from a fresh install for this server, so either I find a fix or just deal with having to restart if I need to reload a service.


Get this bounty!!!

#StackBounty: #debian #systemd #services #systemctl systemd: Can't unmask root mount (-.mount)

Bounty: 50

(Dist: Debian 10)

I have a reoccurring error message that mainly pops up when using systemctl (also when installing a package, and occasionally in a few other places that escape me),

Unit -.mount is masked.

Sometimes (depending on what command called the error message) it is more verbose, such as

Error: GDBus.Error:org.freedesktop.systemd1.UnitMasked: Unit -.mount is masked.

This error doesn’t impede installing packages or any systemd services which are enabled already (and as such are loaded at boot), but using systemctl or service to restart, start or stop a service fails. This means I have to reboot the whole server to restart a service, which can be a little annoying.

Trying to unmask the root mount with systemctl unmask -- -.mount appears to work (nothing is returned), but systemctl status -- -.mount still outputs the following after:

● -.mount - Root Mount
   Loaded: masked (Reason: Unit -.mount is masked.)
   Active: active (mounted) since Mon 2019-08-05 15:03:38 AEST; 4h 8min ago
    Where: /
     What: /dev/sde1
    Tasks: 0 (limit: 4915)
   Memory: 0B
   CGroup: /system.slice/-.mount

Any ideas? I’m don’t want to start from a fresh install for this server, so either I find a fix or just deal with having to restart if I need to reload a service.


Get this bounty!!!