Skip to main content

Questions tagged [systemd-unit]

For questions about the design of systemd units, the relationships between units, and writing [Unit] and [Install] sections of systemd unit files. It can also be used for questions about units which do not have their own tag such as systemd targets.

Filter by
Sorted by
Tagged with
0 votes
0 answers
20 views

My nftables fails because it wants a network bridge that does not exist yet during startup

I’m setting up a mini-PC (Unbranded Protectli vault, possibly a Yangling original) to be used as a home router. Everything currently basically work as expected once I manually sort out some startup ...
Bogey Jammer's user avatar
1 vote
0 answers
12 views

What's the point in having after=<passive target> when the passive target is not pulled in?

I have read the systemd documentation about special targets and hopefully have understood the most part of it. But I am struggling with the section "Special Passive System Units". In the ...
Binarus's user avatar
  • 3,490
0 votes
1 answer
32 views

Systemctl unit fails on "Requisite", but still executes "ExecStart" command

I'm trying to create a systemctl unit, that will only start if another one is active. As far as i know, it can be done by specifying a Requisite field. Thus, i've configured my unit like so: [Unit] ...
Guaiacol's user avatar
0 votes
0 answers
45 views

What PrivateUsers= does exactly?

I am having a hard time understanding Manual for PrivateUsers=. It mentions a few caveats for it to fail silently... But I think i'm avoiding them all and still not managing to reach the manual ...
gcb's user avatar
  • 488
0 votes
1 answer
27 views

systemd: PrivateTmp without PrivateMounts?

Problem: I need to do remote file system maintenance (mount, unmount, encrypt, and so on) with Apache. I like PrivateTmp, but PrivateMounts just causes a vast amount of extra work. So: is it possible ...
EML's user avatar
  • 223
0 votes
0 answers
19 views

Systemd MemoryMax not being applied to service unit

I'm trying to limit the memory usage of a systemd service, but the MemoryMax setting doesn't seem to be applied. Here's my situation: In my service file /etc/systemd/system/discordsearch.service, I ...
Chris Stryczynski's user avatar
-1 votes
1 answer
57 views

Is obex a unit of systemd?

I am following https://askubuntu.com/a/842391/ to enable obex service. Is obex a unit of systemd? Why I can't find it by $ systemctl list-units | grep obex ? It doesn't seem to exist, by $ systemctl ...
Tim's user avatar
  • 104k
1 vote
1 answer
37 views

How to wait for USB drive indefinite

I would like to use external USB flash drive to store encryption key. Whenever the drive is attached during boot - it should decrypt Luks container and continue boot If there is not USB drive with ...
onorua's user avatar
  • 121
1 vote
0 answers
17 views

Can you avoid restart propagation on failure to PartOf target with systemd 239

I'm not even sure this is possible with the version that we have available. I have 5 databases that I want to be able to restart at once or individually. I have set up a target for this. I added ...
IncredibleStorm's user avatar
2 votes
0 answers
199 views

systemd: usage of AllowedCPUs vs. CPUAffinity

In Linux systemd, two different properties seem to address the same concern: AllowedCPUs and CPUAffinity. Both seem to restrain a running process to some defined CPUs (you can for instance restrict a ...
Doc Davluz's user avatar
0 votes
1 answer
47 views

Systemd fails to restart a Python script with exit(0)

I have a working python script and systemd service script. But somehow it is not working the way I wanted it. The python script prints time every 5s but stops with exit(0) at first second of a minute. ...
Mainland's user avatar
  • 115
0 votes
1 answer
151 views

Systemd unit file with multiple instance parameters (including user)

If a systemd unit file has a prefix (i.e. without the .service, .timer etc. suffix) followed by @, then the unit can be instantiated – that is, I can enable or start the unit multiple times, each time ...
user149408's user avatar
  • 1,363
3 votes
1 answer
141 views

Managing ordering dependencies between systemd template instances

Abstracted example: I have two recurring tasks A and B that I want to setup as systemd services. As the tasks are quite similar to each other, I am using a template [email protected]; A and B will be ...
bluesheep's user avatar
0 votes
1 answer
43 views

send notification from one systemd unit to another with python?

I have a systemd unit 'my-app' that runs my main python app but I want it to auto-update when there is a new version on a remote server. The detection is watched by another python systemd unit (let's ...
16ar's user avatar
  • 13
1 vote
0 answers
200 views

How do I setup and start a unix socket in Red Hat? [closed]

I couldn't find any specific guides for creating a unix socket in Red Hat Enterprise Linux (RHEL version 9.3) so I used this guide. After creating the gunicorn.socket and gunicorn.service file in /...
siralbert's user avatar
  • 115
5 votes
1 answer
481 views

How to specify dynamic "Environment" variables in a systemd unit file?

This $(ls -d...) does not work in a systemd unit file: [Service] Type=forking Environment="ORACLE_HOME=$(ls -d /usr/lib/oracle/*/client64 | sort -rV | head -n1)" Environment="TNS_ADMIN=$...
Sybil's user avatar
  • 1,913
0 votes
1 answer
57 views

systemd service fails to use `tail` to output to console

I fail to configure my systemd service properly (systemd 249.11-0ubuntu3.12). It should start a tail process which outputs to the console. Ubuntu running as Proxmox VM. When booting, the service is ...
Twonky's user avatar
  • 171
0 votes
1 answer
858 views

What exactly does it mean for a systemd service to be "activating"?

According to various clauses in the docs, the "activating" state is the transition between inactive states and an active state. So far so obvious. But how exactly is it defined? What ...
Atemu's user avatar
  • 697
0 votes
1 answer
97 views

Systemd executable failed to read file from CacheDirectory with Permission Denied

I have a Golang binary that runs every 5 mins. It is supposed to create & update a text file which needs to be write restricted. To run this binary I created a systemd service and a systemd timer ...
Korba's user avatar
  • 103
0 votes
0 answers
16 views

Systemd: temporary read-write folder in read-only file system

I have a system in which a single host can run multiple executions, which are sandboxed using systemd. The execution can specify which folder to be rooted in, e.g. RootDirectory=/var/images/some_root ...
alexlipa's user avatar
  • 101
0 votes
0 answers
50 views

systemd timers with long lived processes, avoiding overlaps

I have script that will scan for tasks, and work on one at a time to completion and then exit. Execution can last 1s (no tasks) to 2hours (heavy task). And subsequent runs should start as soon as ...
gcb's user avatar
  • 488
1 vote
1 answer
49 views

At boot, if X, then mount A, else mount B

Context is as in this other question of mine. TL,DR: most of my home folder is on an external drive that I carry along with me and mount at my various workplaces and at home. Mount is done as unionfs /...
L. Levrel's user avatar
  • 1,503
1 vote
1 answer
96 views

ping output sporadically missing (labeled as wrong unit) in journal of systemd service

I am using ping in a script, which runs in a systemd service unit. The output from ping is sometimes (often) missing in the unit's journal. I.e., it is missing from journalctl --user -u MyUnit. Note ...
dialer's user avatar
  • 143
0 votes
0 answers
38 views

systemd service startup order, but only on bootup

My use case is pretty similar to what is described in this question: Lots of custom services, not dependent on each other. On boot, they all start simultaneously and cause a peak in CPU and RAM load. ...
Attila Csipak's user avatar
0 votes
0 answers
65 views

systemd - Is this how to require a service by an installed program?

The essence: I want the systemd to symlink specific directories to /tmp/some_folder before it starts services from various installed packages and system services (like cups, pacman, etc.), the reason: ...
cnikbesku's user avatar
  • 214
0 votes
0 answers
22 views

A generator-like unit creates another unit, and both should be started during boot; is that possible?

Converting some old-style services using a configuration file to systemd units, I wrote a generator-like (i.e.: not actually a systemd generator) service that creates (depending on the configuration ...
U. Windl's user avatar
  • 1,553
3 votes
1 answer
362 views

Why systemctl status shows a time in the future and the amount of time left?

When we issue "systemctl status", we usually get in the output, a line showing the status and for how long it has been in that status. Like: (I issued that few minutes ago) Active: active (...
Travelling_Bird's user avatar
1 vote
0 answers
92 views

waylock - Trigger screenlocker on suspend, but not on hibernate?

The rationale is the same as in this question - since I'm already typing a disk encryption password on resume, I don't want to have to unlock my screen as well. I want the screen locker to only ...
Inglorion's user avatar
0 votes
1 answer
104 views

systemd: After=<a service that's activated by a systemd path unit>

Context I want A.service to be started only after B.service finishes starting up, and B.service is a unit that's activated by the corresponding systemd path unit: B.path. Relevant code snippets can be ...
David Chen's user avatar
1 vote
0 answers
50 views

How do I make sure that systemd targets start after the last one has completed?

I have t1.target and t2.target. I want to ensure that t2.target is only started after t1.target and all it's dependency services are completed. I have mocked this up for now but it does not seem to ...
user588629's user avatar
0 votes
0 answers
125 views

Systemd service wait wifi adapter to plug in

I have a systemd service that change MAC address every boot to wifi adapter. Systemd service works fine. I want this systemd service not wait 1m 30sec when the wifi adapter is not plug in the usb. I ...
user21379959's user avatar
0 votes
2 answers
213 views

Reorder of launching Systemd services

OS: Debian 11 Bullseye Context: The Zerotier application adds the zerotier-one.service system service and creates a virtual network interface (when it works). The sshd server default listens to all ...
DarekH's user avatar
  • 127
0 votes
2 answers
2k views

Unit templates and non-template destination units

I like to keep my custom unit files in their own directory away from /etc. In 247 this worked well, using something like the following: systemctl enable /path/to/unit.service This also worked with ...
Spammy's user avatar
  • 31
0 votes
1 answer
507 views

Run systemd timer even if process is still running

It has been confirmed that systemd timers won't start the .service if previous run hasn't finished. However, for unknown reason this blocks some Type=oneshot backup processes on my machine (they seem ...
Daniel Krajnik's user avatar
2 votes
1 answer
170 views

Ensure that systemd timer instances of same template are not running in parallel

I have a systemd timer template [email protected] and a corresponding service [email protected]. The job runs daily and has a generous RandomizedDelaySec of 2 hours. The job has many instances. Can I tell systemd ...
sedrubal's user avatar
  • 316
1 vote
1 answer
139 views

Systemd path PathExists= doesn't work if tracked file is deleted inside Unit=?

I have simple systemd.path restart.path: [Unit] Description= [Path] PathExists=/home/ubuntu/restart Unit=restart.service [Install] WantedBy=multi-user.target And the triggered restart.service ...
Azii's user avatar
  • 11
0 votes
2 answers
105 views

systemd unit "Before=" with timer

In my system I have b.service activated by b.timer. I want another service (a.service) that start before b.service. I cant change b.service or b.timer because are not mine. I've putte Before=b.service ...
Andrea Romano's user avatar
0 votes
1 answer
166 views

Bring systemd services up/down along with specific systemd service?

I have systemd: service1.service service2.service service3.service service1.service looks like: [Unit] Wants=service2.service service3.service After=service2.service service3.service [Service] ...
ojacomarket's user avatar
0 votes
3 answers
167 views

systemd.time - OnCalendar= unwanted running after suspend

I wanted a "more stupid" version of crontab: Run only on given times, don't catch up after suspension. I.e. when a service should have been triggered by crontab, but the machine was ...
DomX's user avatar
  • 1
0 votes
0 answers
94 views

systemd to control launch order for services

I have two systemd service files. I want gw_web.service to start after gw_log.service. Here are the two service files: gw_log.service: [Unit] Description=myGarage Log Service After=multi-user.target [...
gldrplt's user avatar
0 votes
3 answers
179 views

Many issues "(servicename) could not be found"

I've got issue in recently installed RHEL9.2. When looking at systemctl status -all I've got no failed units, but i see many red notices about missing services somehow inserted into middle of regular ...
AdamG's user avatar
  • 1
0 votes
1 answer
4k views

Why is systemd stopping my service immediately after start?

I am trying to build a custom service at the system level.  I have a script that runs successfully when run directly from the terminal.  This script activates a specific Conda environment and then ...
user571896's user avatar
0 votes
1 answer
174 views

do not run systemd service when another service ran sucessfully

I have two services for an application: healthcheck- which check the health of a system and attempts restart when the validation fails. rollback- when multiple restart attempts fails to pass the ...
sayan paul's user avatar
0 votes
1 answer
73 views

Start a systemd service after network but before other services

I want my service to start after network service but before all other services (eg. tomcat or mysql). I know about "Before=mysqld.service" option but I do not know all the names of the ...
aaa's user avatar
  • 1
0 votes
1 answer
192 views

Rsync script running manually but not via systemd service/timer

I've got a handful of bash scripts (all essentially clones of each other) which each does an rsync to a different dnf/yum repo to pull that repo down to our local mirror. The scripts all run correctly ...
Dulux-Oz's user avatar
0 votes
0 answers
225 views

Configuring a service unit to launch a bash script. Why is this failing?

I am asking systemd to supervise and control a process but for some reason, it is failing. Check the output at the end of the question I have a bash script in /usr/sbin/ros_diagnostics.sh that ...
UserK's user avatar
  • 2,484
3 votes
1 answer
507 views

Systemd will not enable this unit file, states "Invalid cross-device link" on the same file system

I have a Fedora 37 server I use for running my 3D printer farm. I have multiple instances of Klipper (3D printer firmware) running as individual systemd units along with other supplementary services ...
AtomicPorkchop's user avatar
0 votes
1 answer
173 views

Service ordering with a dependency on a conditional unit

On startup, service process_queue starts if ConditionDirectoryNotEmpty=/unfinished_queue_jobs, clears that directory, then stops. Service accept_new_jobs should start after process_queue completes, or ...
rgov's user avatar
  • 253
0 votes
1 answer
1k views

Make systemd treat unexpected exit as failure

I'm wrapping a 3rd party executable in a systemd service unit to manage it. I can't alter the behavior of this program and I don't really trust its exit codes. I would like to treat any exit that ...
davolfman's user avatar
  • 682
0 votes
0 answers
1k views

Running a simple command at startup in Fedora 37 using Systemd?

I simply want to execute a single command during startup, before any user logs in. (More precisely, I want to run a setkeycodes command to fix a quirk of my laptop's keyboard, so that it works ...
Thomas.M's user avatar
  • 293