Questions tagged as ['systemd']

systemd is a modern replacement for the traditional Linux init. Its main features include the ability to express dependencies between services and aggressive parallelization of service startup.
Score: 1
giomanda avatar
stop kernel audit messages logged in syslog without disabling auditing
us flag

OS: CentOS 7

I am trying to figure out how audit (kaudit) events are logged in /var/log/messages.

I have enabled audit=1 in grub which means when the server boots, kernel auditing is enabled. This is the desired state for the particular system and disabling audit is out of the equation. My audit configuration is as follows

  #  auditctl -s
enabled 1
failure 1
pid 0
rate_limit 0
backlog_limit 64
lost 74 ...
Score: 0
Find out if journald has a key configured and uses forward secure sealing (FSS)?
gb flag

Calling journalctl --setup-keys creates a new key pair for Forward Secure Sealing (FSS). How can I check if this was done on a system without generating those keys if it has not happened yet?

Alternatively, since this process creates the key in file fss in the journal directory, how can I find this directory, since it contains some "arbitrary" hash, e.g. /var/log/journal/3c726bc3b46e1333bb57fa1857efcf35

Score: 0
Nico Gatti avatar
Correct way to modify systemd timer
th flag

I want to know the correct way to modify a timer.

It happened to me that I have timer X configured to run at 8 PM daily, modified the job to run at 1 AM, also daily. When executed the daemon-reload the service that it points to was executed even the timer doesn't shows that it was triggered.

Is there a possibility that when reloading the timer the service got executed by default?

Score: 0
How to stop annoying systemd log message: Starting Poll for Ubuntu Pro licenses
tl flag

How to stop this annoying message?

Nov 23 08:44:48 hostname systemd[1]: Started Poll for Ubuntu Pro licenses (Only enabled on GCP LTS non-pro).
Nov 23 08:47:48 hostname systemd[1]: Starting Poll for Ubuntu Pro licenses (Only enabled on GCP LTS non-pro)..

On Ubuntu 18.04.6 LTS

systemd current version is: systemd-237-3ubuntu10.52

Score: 0
steiny avatar
Listing btrfs subvolumes not allowed in container
id flag

I try to run a btrbk server within a systemd container. Unfortunately, I cannot get btrbk running since the command btrfs subvolume list /srv/backup fails to run from within the container with "Operation not permitted".

I already tried adding "user_subvol_rm_allowed" to the mount options, as suggested in a lxc issue, however without luck. While btrfs subvolume delete /srv/backup/foobar works now, I still  ...

Score: 1
Is there a better way to override all instances of a templated systemd unit?
in flag

I ran into an issue with vncserver needing to wait for my autofs-managed home directory. I have multiple users that will need VNC access. The vnc server is started by systemd.

I'm aware that I could do:

systemd edit vncserver@:1.service
systemd edit vncserver@:2.service
systemd edit vncserver@:3.service

etc and add:

[Unit]
After=autofs.service

to each, but I'd rather not be repeating myself when they a ...

Score: 0
How to bind CPUAffinity dynamically for systemd sub-services
cn flag

I have a systemd bob.target as follows:

Requires=bob@0.service bob@1.service, bob@2.service

I want to set a two-cpu CPUAffinity for each of the bob@ services as follows:

CPUAffinity=0,4 # bob@0
CPUAffinity=1,5 # bob@1
CPUAffinity=2,6 # bob@2

My ideal goal would be to set two CPUS as follows:

CPUAffinity=%i %i+1

When I try the following to dynamically set one of the CPUS I get a parse error:

CPUAffinity ...
Score: 2
Timer not started by userdata command after reboot
co flag

Issue description:

On bootup we trigger the service initialization script that is shown below. The script is a part of Instance User Data.

This script copies the necessary service/timer things to systemd folder and starts a timer.

From time to time after reboot our timers are not working and stays in N/A.

The sudo systemctl restart cleanup.timer command does not help.

Only sudo systemctl stop cleanup.ti ...

Score: 1
reload systemd-networkd without a reboot?
sd flag
gcb

Is it possible to reload changes in /etc/systemd/network/* in a live system?

already tried systemctl daemon-reload, systemctl restart systemd-networkd.service, networkctl... nothing seems to avoid a full reboot.

Score: 0
systemd, journal receiving raw log
sd flag
gcb

one common paradigm on all other syslog implementations (rsyslog, syslog-ng, readlog, etc) is to exchange log entries via UDP514 in plain text format.

How do I enable systemd-journal-remote to receive logs in such format?

(I know there are plugins to more complex log providers to emulate the new https format used by default by systemd-journal-remote, but i'm dealing with dumb appliances that can onl ...

Score: 0
callegar avatar
Is compiling/testing/using a systemd-resolved not aligned with the version of the rest of systemd present on the system supported?
in flag

Is it possible to compile only systemd-resolved from the large systemd sources (without all the rest of systemd) to attempt identify a fix to backport? Can a new systemd-resolved coexist with the rest of a system that is based on an oldish systemd?

Score: 1
Sidney avatar
My systemd service with type as notify doesn't start when the server goes to stand by starts up again
in flag

The first time I set up my systemd service, it works fine.

However, when I restart the server, the systemd service doesn't start, but it remains on activating.

Could someone give any tip of why this is happening?

Unit file:

[Unit]
Description=My App
After=network.service
StopWhenUnneeded=yes

[Service]
Type=notify
NotifyAccess=all
User=ubuntu
Group=ubuntu

WorkingDirectory=/opt/app
KillMode=process
PIDFi ...
Score: 0
leo avatar
How can I find out which program is executed through a PID which is ended
ru flag
leo

I found there is a program that killed my Apache regularly, according to the log information, I understand there is a program using "/etc/init.d/apache2 stop" to stop apache, since this process is gone, how can I find out this PID belongs to which program?

journalctl -o verbose _PID=16630
-- Logs begin at Thu 2021-10-28 ... 
    [s=b8b9ba8c0b3a434ab134b8e39ad9a421;...]
    SYSLOG_FACILITY=3
    PRI ...
Score: 0
DizzyNYC avatar
Is there a way to update a SystemD configuration so that it will not start if its name equals "golang_shared_environment""?
cn flag

I currently have a systemd file called golang@.service that is used for all of my go services.

[Install]
WantedBy=multi-user.target

[Service]
EnvironmentFile=/etc/sysconfig/golang_shared_environment
EnvironmentFile=-/etc/sysconfig/golang_%i
ExecStart=/bin/sh -c /local/%i/%i
Restart=on-failure
RestartSec=2
SyslogIdentifier=golang_%i
User=go_%i

[Unit]
After=network-online.target consul.service
Desc ...
Score: -1
Georgi Koemdzhiev avatar
systemd script do not set correct file permissions at boot time
cn flag

I have written a simple service that calls a bash script that should change file permissions at boot time. The issue is that it seems that the service is not working as the permissions are not changed by the time the user logs in.

However, when I run the service manually - sudo systemctl start setpermissions.service it works and the file permissions are set correctly.

This are the file permission ...

Score: 0
Joel avatar
Systemd: How to automatically start instantiated services after reboot?
sb flag

I have a systemd service file my_service@.service like the following:

[Unit]
Description=...
After=network.target

[Service]
User=...
Group=www-data
WorkingDirectory=/home/...
ExecStart=...
Restart=always
RestartSec=1s

[Install]
WantedBy=multi-user.target

I start then multiple instances like this:

sudo systemctl start my_service@a
sudo systemctl start my_service@b
sudo systemctl start my_service@c
Score: 0
How to ensure output from "tee" is shown when used in a script run under systemd
vn flag

I have a script that I'm running under systemd which has some debug logs that I'd like to send to both stdout (which should end up in the system journal, viewable with journalctl) as well as to a log file on my filesystem.

Typically I'd reach for tee to accomplish this (write to stdout and files), and it works fine when I run the script on its own (I see all my logs on my console as well as in my  ...

Score: 1
Leon avatar
Prevent OpenVPN systemd service from starting at home
gd flag

Within my laptop PC, I set a systemd service that make a OpenVPN connection to my home, and let it automatically start on boot, so that I can access my home server anywhere.

The trouble is that when I'm home already, it still connects to VPN, and confuse the route table of the laptop, therefore I can't access the server when I'm at home.

Is there a way, I can let a systemd service start conditionall ...

Score: 0
`findmnt` and `ls` still see a physically disconnected external storage drive
in flag

Here is an /etc/fstab record example of one of the mounts as per x-systemd.automount and other goodies:

UUID=XXXX-XXXX /media/XXXX-XXXX auto noauto,nofail,nouser,uid=root,gid=users,umask=007,X-mount.mkdir,x-systemd.automount,x-systemd.device-timeout=1,x-systemd.idle-timeout=60 0 2

Currently this external exFAT-formatted drive is physically disconnected from the PC, but I still get the following  ...

Score: 1
ljrk avatar
How to send pending shutdown message to systemd services
za flag

I'm using Fedora CoreOS with the automatic updater enabled, which is great for my use case. Already, when logged in interactively, the system warns about an imminent shutdown/restart via the console, with the same mechanisms described in the answers like Sending shutdown messages to all clients from server

However, the "actual" users of this server aren't Linux users with SSH access but access s ...

Score: 3
Paul avatar
Why does my systemd timer only trigger once when the unit is a target?
jp flag

I have a couple of services (static site generators) that I want to trigger on a regular basis from the same systemd timer. I found this question/answer, which covers exactly what I want to do, and describes a setup whereby a .target file that Wants= multiple services is triggered by a corresponding timer. This sounds great, but I'm finding that when I actually set this up, it only ever triggers

Score: 0
RemainAfterExit in Upstart
bd flag

Is there an Upstart equivalent to systemd's RemainAfterExit?

I have an upstart task that exec's a script that completes quickly when the task is started. However, I would still like that task to report as active so that I can subsequently 'stop' the task and have it execute a cleanup script.

In systemd, I would do the following:

[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/usr/local/bin/my_scri ...
Score: 0
systemd: limit the number of times a service can restart
in flag

I'd like to limit the number of times my service can restart, ever. There are burst limits

StartLimitIntervalSec=60
StartLimitBurst=5

But they limit how many times a service can restart within the specified interval. Is there any way to specify how many times can a service restart in general? As if the interval was set to infinity.

systemd 245 (245.4-4ubuntu3.2)
Score: 0
strange messages in the systemd journal
in flag

I'm running systemd version:

systemd 245 (245.4-4ubuntu3.2)
+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=hybrid

on 5.8.0-54-lowlatency #61~20.04.3

For some reason my services started spamming the system log with these messages:

Oct 02 19:46:08 avionics-fchil2-sim.int.archer.com  ...
Score: 0
DevOpsSauce avatar
Why does a systemd script stop writing to a log after restarting the service?
jp flag

I have a systemd unit file. It starts a php script. There was a network blip, which made me have to reboot after nothing else worked. I noticed that the script was no longer writing to the specified log file, until I manually forced rotation.

[Unit]
Description=Custom Service
Wants=network-online.target
After=network-online.target

[Service]
ExecStart=/usr/bin/php -f /path/to/php/script.php
ExecSto ...
Score: 0
Dave_G avatar
systemd service reports "unknown port"
fr flag

On a CentOS 7 server,I'm creating a new systemd service from scratch for a new service, prometheus-slurm-exporter. (It's an application that exports data from the SLURM scheduler on an HPC cluster.) By default it uses Port 8080, but since that port is already in use by another service, I've set it use Port 9090 instead. Run from the command line, the command looks like this:

/opt/prometheus-slurm-e ...
Score: 0
Jeriko avatar
Delaying my own process to automount an external storage which start at boot
cn flag

I would like to implement my own process into a CentOS7 operating system which automount an external storage (AVID ISIS for this example) at boot through systemd.

To do that, I scripted the mount procedure (because I cannot use fstab in this particular case, the avidfos command provided by AVID is needed) but I have noticed that my process failed at boot. When I run it just after the boot process ...

Score: 2
David Moran avatar
How do I create a python 3 service that uses socket with systemd?
us flag

I am trying to create a service with systemd, where I use python3 to create a simple socket and leave it as a daemon, but I have made several attempts but in both cases without any success. For today systemd has beaten me, but tomorrow is another day to try.

Server

import socket 
host = '127.0.0.1'
port = 9999
BUFFER_SIZE = 1024 

with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as socket_tc ...
Score: 5
How to rename a systemd service without affecting the process (no stop/restart)
eg flag

There are multiple reasons to have to rename a systemd service in production. For example:

  • to better differentiate it from a new one
  • because your boss ordered it
  • because of legacy scripts
  • ...

Assuming a new generic service created in /etc/systemd/system/foo.service and enabled and started as follow: [1]

systemctl daemon-reload
systemctl enable --now foo

Then, you may want to rename it from foo.serv ...

Score: 0
John Smith avatar
How to run service after kernel module is loaded
in flag

I have been breaking my head over this the last few hours. On one of my machines the intel-rapl-msr driver is buggy and reloading it fixes the issue. I thought I could trivially create a service that does this on boot. But I can't get the service to load after the driver has loaded.

[Unit]
Description=Reload intel-rapl-msr
Requires=systemd-modules-load.target
WantedBy=multi-user.target

ExecStart=/nix/sto ...