Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

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
1 answer
27 views

How to inherit XDG_SESSION_TYPE in systemd units?

My current desktop environment: Plasma Wayland. Many GUI applications can't be launched from within Emacs daemon (started by e systemd unit) unless XDG_SESSION_TYPE is set to "wayland". It's ...
user avatar
0 votes
0 answers
12 views

Systemd.service LOAD STATE SUB Meanings

I'm trying to better understand the state of units in my system. I've read the systemd and systemctl man pages, and I understand that systemd has three high level state components for a unit - LOAD, ...
user avatar
0 votes
1 answer
18 views

Systemd Bash script daemon causes timeout and fails

I have a service file: Memory.service [Unit] Description=Memory Service [Service] ExecStart=%h/opt/bin/Memory --quiet SyslogIdentifier=MemoryService [Install] WantedBy=default.target It starts a ...
user avatar
  • 1,374
0 votes
1 answer
57 views

Installing a systemd user service for all users

Goal: install a systemd service, which any user should be able to start. The problem is to enable a user service (no sudo), as a step of installing it (with sudo). I put a service file in /etc/systemd/...
user avatar
  • 820
1 vote
0 answers
72 views

RemainAfterExit not working

I have a systemd service unit, for which I want to enable RemainAfterExit. This runs in a custom intrd. Here is my unit: [Unit] Description=Ask for network config Conflicts=initrd-switch-root.target ...
user avatar
0 votes
1 answer
52 views

How Yocto embeds systemd in end project?

How can I customize systemd source code? When I do bitbake, systemd appears in my end project, but I cannot find any source files of it in my local directories. I want to track down unit files ...
user avatar
  • 21
1 vote
1 answer
47 views

systemd debug (embedded case)

How to trace systemd unit files, to be specific, device unit files? I use 3.18 version of linux kernel. On my board after systemd has started, (mypartition).device runs and, I suppose, remounts the ...
user avatar
  • 21
0 votes
1 answer
20 views

Systemd mount unit configuration *.img file on centos

It is necessary to create a virtual file samba.img that will be a device and automatically mount it when the system starts. creating a virtual disk from a file fallocate -l 2G /root/img/samba.img mkfs....
user avatar
0 votes
1 answer
28 views

Redirect logs from file to Systemd journal

I have a program which is started by systemd service myprogram.service. Problem is that it is writing its logs directly to the log file /opt/myprogram/logs.txt. I want to redirect its logs into ...
user avatar
  • 3,872
0 votes
1 answer
63 views

automatically activate service after RPM was installed

OS - Red Hat Enterprise Linux 8 I've created a .spec file to build and package my application. My rpm also includes my_app.service file for systemd to start it. However, by default one has to enable ...
user avatar
  • 1,419
0 votes
1 answer
37 views

After= directive of systemd unit not working as expected

So, I started breaking up my system init and creating some service files for things I want to be loaded after I login. It's the usual stuff like polybar, dunst and the rest of the things. Things do ...
user avatar
0 votes
0 answers
20 views

systemd: define a network interface configuration in unit file

Is it possible to replace an /etc/sysconfig/network-scripts/ifcfg-* file with systemd unit file and define interface configuration in there? The reason I'm asking is that I'd like to create a bridge ...
user avatar
  • 1,419
1 vote
1 answer
44 views

How to create an ephemeral user-level systemd timer on the commandline without unit/timer files?

Suppose I want to run the command notify-send "invoked" "$(date)" every 5 seconds using systemd timers. I know how to create a corresponding unit file and a timer file, then enable ...
user avatar
1 vote
0 answers
18 views

Systemd Automount Failing on Program Execution

I set up a systemd automount for an external drive by UUID. I basically just wanted the drive to mount whenever it's accessed. It was working fine but I noticed some issues when loading Evince first, ...
user avatar
0 votes
1 answer
70 views

systemd start stop enable and disable multiple services with one target unit

I have created a target file /etc/systemd/system/watch-for-sync-need-all.target [Unit] Description=systemd target to group services for all folders that create a sync need by changes After=multi-user....
user avatar
  • 145
0 votes
1 answer
30 views

Systemd: Start service if a path is found but only between 9AM and 6PM

I wonder if there's some way to have both the functionality of a Path unit and a Timer. The idea is to start a specific service if a path on the system is found but only between 9AM and 6PM. Currently ...
user avatar
  • 711
1 vote
0 answers
24 views

Use an environment variable in SyslogIdentifier in service file

I'm working on a system running RHEL 7.9 and we're trying to use an environment variable to alter the SyslogIdentifier for the service. We've tried a number of options, but they all output exactly ...
user avatar
1 vote
0 answers
162 views

systemd: Where is the `enabled-runtime` symlink?

miranda:~# systemctl is-enabled --full postfix@- enabled-runtime miranda:~# systemctl is-enabled --full tinydns enabled /etc/systemd/system/multi-user.target.wants/tinydns.service miranda:~# ls -la /...
user avatar
0 votes
0 answers
11 views

With systemd, how to recursively start Wants= relationships from a “root” target?

I just enabled mpop.timer, which is now wanted by timers.target. It is still deactivated. siemer@miranda:~$ systemctl --user list-dependencies default.target default.target ● ├─pipewire.service ● └─...
user avatar
0 votes
0 answers
18 views

systemd execute scripts after success or failed starts

I am starting a service whose configuration file has hardcoded passwords. the purpose is to generate the file with the passwords before the start of the service and remove it after. so i have this ...
user avatar
  • 61
2 votes
1 answer
112 views

What is the default value of `ExecSearchPath=` in a systemd unit file?

man systemd.exec says concerning ExecSearchPath=: Takes a colon separated list of absolute paths relative to which the executable used by the Exec*= (e.g. ExecStart=, ExecStop=, etc.) properties can ...
user avatar
  • 24.6k
1 vote
1 answer
71 views

systemd nightmare - ordering my service so it starts at boot and restarts when needed

I can't wrap my head around systemd unit files. Here's my scenario, I have a service called: my.service my.service needs to start sometime after boot, whenever everything else is ready, no rush. my....
user avatar
  • 13
0 votes
1 answer
60 views

How to deal with blocking commands in systemd service ExecStartPre lines?

Before my backup program (btrbk) can send its backup to my server, I need to open a VPN connection. Opening up the VPN connection by hand works perfectly fine, by invoking openvpn --config VPNConfig....
user avatar
0 votes
1 answer
75 views

Failure to change key mapping with loadkeys in systemd service

My Packard-Bell laptop keyboard has 2 non-standard keys grouped with the navigation arrows making a 2-rows x 3-columns sub-block instead of the traditional inverted-T. Of course, these keys are not ...
user avatar
  • 165
1 vote
0 answers
38 views

systemd unit how to clear OnFailure setting

I had a target t1.target which i cannot modify directly but can only modify through drop-in conf file. This target has: [Unit] OnFailure=s1.service On my drop-in conf file I write: [Unit] OnFailure= ...
user avatar
  • 11
0 votes
2 answers
618 views

Why ssh.service doesn’t start automatically during boot despite being enabled by systemd?

I’m using Debian 11 on a Raspberry Pi 4 (image found here). sshd is properly configured (I only edited /etc/ssh/sshd_config, the rest is completely fresh from system installation) and works correctly ...
user avatar
0 votes
0 answers
38 views

Create new systemd service inside a service and inject the dependency

I want to create a new systemd service inside an existing service and update the dependency chan. Originally there are service A and service B. A is a one-time service for some initial setup, B is the ...
user avatar
0 votes
0 answers
18 views

journalctl display template suffix

I have multiple Services running with a template service file like described her https://serverfault.com/a/730339/544615 When I execute journalctl -f I see only the process name and the PID but not ...
user avatar
1 vote
1 answer
520 views

Why ssh.socket is set to conflict with ssh.service (Ubuntu 18.04.3)?

Description of condition I ran into a strange condition with systemd and ssh on Ubuntu 18.04.3 LTS I checked the status of the ssh.socket unit: $ systemctl status ssh.socket ● ssh.socket - OpenBSD ...
user avatar
  • 257
0 votes
0 answers
91 views

How to dynamically create a list of units for a `systemd` target?

Newbie systemd user here; my apologies if the question seems 'too basic' and would be better asked elsewhere on the StackOverflow ecosystem... I'm in the process of converting some of my ancient init ...
user avatar
0 votes
1 answer
23 views

Changing Unit Configuration to restart httpd every 3s

I tried to add the following with systemctl edit httpd.service and this created /etc/systemd/system/httpd.service.d/override.confcontaining : [Unit] Restart=always RestartSec=3 now after systemctl ...
user avatar
0 votes
0 answers
206 views

How to run source and export inside a systemd unit file to start the service

I have been trying to get a service file setup for our software so that it can be started and stopped. When I manually run the commands, the server starts normal. I next took this an implemented this ...
user avatar
  • 103
0 votes
0 answers
155 views

Systemd Unit file not working even though systemd-analyze verify says its good

I created a unit file for the application I want to run as a daemon. For that I created a very simple unit file which, when fed into systemd-analyze verify shows no errors. The file is located in /usr/...
user avatar
3 votes
2 answers
235 views

gpg-agent hanging when trying to access private keys

I'm having trouble using gpg (actually, the gpg-agent) on my Debian Bullseye (Stable) system. More precisely, I use the following: gpg --version | head -n2 gpg (GnuPG) 2.2.27 libgcrypt 1.8.8 uname -...
user avatar
  • 198
0 votes
1 answer
730 views

Systemd service does not start (WantedBy=multi-user.target)

OS: Ubuntu 20.04.3 $ \cat /home/nikhil/.config/systemd/user/Festival.service [Unit] Description=Festival Service [Service] ExecStart=/usr/bin/festival --server Restart=on-failure RestartSec=10 ...
user avatar
  • 1,374
1 vote
1 answer
113 views

How to check if a file has proper permissions / ownership from SystemD Unit File?

Basically title. Is there a way? Or a hacky way, whatever. There's no "ConditionPermissions=", "ConditionOwnership=" or something like that, as far as I can see.
user avatar
0 votes
0 answers
77 views

How to make a systemd unit run as root when user logs in?

I want to have a systemd unit running as root when a specific user logs in. I've already tried creating a local systemd unit for the user (placing it in its home directory at ~/.local/share/systemd/...
user avatar
  • 148
4 votes
1 answer
501 views

Create a new systemd unit/service/timer/sockets with systemctl from the command line?

Given the CLI tool systemctl edit can be used to edit existing systemd units such as services, timers, sockets, devices, mounts, automounts, targets, swap, path, slice, scope or nspawn files and you ...
user avatar
  • 2,136
0 votes
0 answers
44 views

starting wsgi as a service fails on startup

I am trying to deploy a flask application inside my WSGI container. I have tried to deploy it by symply executing the same commands within [Service] tags in the unit declaration; this means that I ...
user avatar
0 votes
1 answer
346 views

Multiple Instances of Unit= in Path or Timer Unit?

Can multiple instances of Unit= exist in a systemd.path or systemd.timer unit? Or, must one instead specify multiple instances of the path or timer unit, each with a single instance of Unit=? I ...
user avatar
  • 51
0 votes
2 answers
304 views

Java systemd service without specifying java -jar

I'm struggling to make a SpringBootApp to run as a service at the moment. The biggest issue is that Devops doesn't allow us to make changes on the Ansible scripts that deploys the artifact and creates ...
user avatar
  • 103
1 vote
0 answers
19 views

Does systemd "After=" check if services in it are started without failures before starting the service?

example: bar.service: [Unit] After=foo.service if foo.service isn't started correctly, will bar.service start? and what about if foo.service isn't a dependency of anything and will never start?
user avatar
  • 11
1 vote
1 answer
2k views

Docker-compose as Systemd unit

I have a systemd unit, that uses the command docker-compose to start and stop a given set of containers. It looks like this: [Unit] Description=... [Service] WorkingDirectory=/opt/tsc-docker ...
user avatar
0 votes
1 answer
376 views

Enable service for specific user Only (UBUNTU)

Currently writing a service unit file in Ubuntu, i want the service to be enabled for one user UserA only. The service will run automatically when UserA login but not for other users. How can I do ...
user avatar
0 votes
1 answer
788 views

How can I define the output directory a bundled .NET Core SingleFile published app will be deployed to?

I am deploying a .NET Core Worker Service app in linux, as a systemd daemon/service, as recommended. The .NET Core app is published using the SingleFile property, which generates an all-in-one exe ...
user avatar
  • 298
0 votes
0 answers
101 views

Stop systemd from running user unit for user jenkins

I just installed jenkins on my pop-os following the instruction and install several plugins in jenkins when I found that several gnome user unit is started for user jenkins I tried restarting my ...
user avatar
  • 188
0 votes
1 answer
63 views

Issue with creating an ubuntu service unit file for a program with a GUI

I am trying to write a unit service file for a program that has a GUI. I have an ubuntu server from DigitalOcean and I connect to it with TightVNC to display:2. The GUI requires a username and ...
user avatar
  • 497
0 votes
1 answer
2k views

systemd: Unknown key name 'ConditionEnvironment' in section 'Unit'

I'm using systemd version 246: $ systemctl --version systemd 246 (246.2-1-arch) +PAM +AUDIT -SELINUX -IMA -APPARMOR +SMACK -SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +...
user avatar
  • 125
0 votes
1 answer
86 views

ConditionPathIsEncrypted not supported?

I've created a unit file to mount the /srv partition automatically. It will check first if /dev/mapper/srv exists and then start it. I'd like to take it one step further and only let it be able to ...
user avatar
  • 553
24 votes
4 answers
4k views

Why do some unit filenames end with @?

Some applications, like ssh have a unit file that ends with @, like ssh.service and ssh@.service. They contain different contents, but I cannot understand what exactly is the difference in ...
user avatar
  • 553