Hot answers tagged

4

The answer is in the first sentence you quoted. "systemd will dynamically create device units". It says "create", not just "start". Through integration with the udev daemon, once the kernel tells udev about a new device, a .device unit will be synthesized on the fly. (And similarly, if a device disappears, the .device unit will be destroyed as well.) It is ...


4

The "auto" part in automount does not refer to the boot process: automount units define mount points that are mounted on-demand, i.e. only when they are accessed. automount units are optional; but, when they exist, corresponding mount units must also exist. The former are meant to add functionalities to existing instances of the latter. From man systemd....


3

By default, systemd will use service file from /usr/lib/systemd/system/daemon.service. However, if it finds the service unit in the /etc/systemd/system/daemon.service, it automatically uses this unit and ignores the default one. So basically cp /usr/lib/systemd/system/daemon.service /etc/systemd/system/daemon.service and make whatever changes you need in ...


3

You've made an Accept=No socket, where the service is passed the listening socket file descriptor and is expected to do the accepting of connections, and stay running. The giveaway should be that you didn't make a template service unit, as would have been needed for an Accept=Yes socket where the service is passed the connected socket file descriptor. ...


3

[Unit] ... [Service] Type=exec # or any other type you want, apart from "oneshot" ExecStart=/usr/bin/your_program ExecStopPost=/bin/sh -c \ 'if [ "$SERVICE_RESULT" = "success" ]; then systemctl poweroff; fi' RestartSec=5 Restart=on-failure If your service is written using Type=oneshot, you will need the pattern in Oxyd's answer instead. Using ...


3

/etc/systemd/system/my_unit.service: [Unit] ... ... [Service] Type=oneshot ExecStart=/usr/bin/your_program ExecStartPost=/usr/bin/systemctl poweroff RestartSec=5 Restart=on-failure [Install] ... ... It's simple. Another interesting parameters see in man systemd.service and man systemd.unit.


2

RIP systemd. Use service instead. type in # service --status-all and see if it is functional. Then do all of your above commands using service syntax and you should be functional. Once you are running normally, take some time and dig into why systemd is not functioning properly.


2

On CentOS 7 network filesystem mounts depend on network-online.target. The network-online.target is reached once an interface is up and an ip has been set. This presumes the first ip on the first interface to get up is enough for the hostname to be resoved. This is however doesn't have to be the case. We can write systemd services to test if network is ...


2

As hinted at by @JdeBP wrong SELinux file labels are the reason for the behavior. The . character in the output of ls indicates that there is a security context set for the file. So be attentive to the . in the ls output! cd /etc/systemd/system && ls -lhZ some-other-service.service anfragen-3dkonfig-mapper.service prints -rw-r--r--. 1 root root ...


2

The message means that the app your .service file started with ExecStart= exited and set the return code to 10 when it did so. There is no single uniform standard (although there are several partial standards and conventions) on result codes, so the only way to find out what the code 10 means is reading the documentation of that specific app... or its ...


2

You can use systemctl show for this: systemctl show -pUser,UID nginx If User shows nothing, and UID is [not set], the service is running as root, or the owning user in the case of a user service.


1

It appears that you have been operating under the assumption that whenever you called source /home/user/venv/activate, the python3 command (and the pip3 command) would subsequently call the relevant executable from /home/user/venv/bin. However, the clarification you added in the comments indicates that assumption was incorrect. You hadn't been calling the ...


1

According to the systemd documentation, the logs kept by journald default to a size limit of 15% of disk capacity or 4GB, whichever is smaller. If /var is not mounted, not writable, or /var/log/journal does not exist, journald logs will only be stored in volatile memory (/run/log/journal.) If your service creates log files of its own outside the systemd ...


1

You can use a template unit file: systemd.unit For OpenVPN as an example: You can create a unit file with a name openvpn@.service in /etc/systemd/system with a following content: [Unit] Description=OpenVPN connection to %i After=network-online.target Wants=network-online.target [Service] Type=forking ExecStart=/usr/sbin/openvpn --config /etc/openvpn/%i....


1

10 is the return value of the main process. By convention every non-zero exit code is considered a failure, where the number should ideally indicate what went wrong. n/a stands for not applicable or available (Cf. https://en.wikipedia.org/wiki/N/a) and it means there is no symbolic name for the exit code 10 defined, so it does not indicate what went wrong. ...


1

Later versions of systemd may have changed this, but in 237 or so you are not allowed $ or % in the program, which also has to be an absolute path. You can get round this by, for example, ExecStart=/usr/bin/bash -c 'exec $HOME/.local/bin/cprev-agent' Here the $HOME is expanded by the shell. systemd only expands such variables if they are a single word. You ...


1

This may not be something that you can do w/o bios clock. I am not familiar with ODROID-C2 but have worked on some other embedded devices. Since the system will start logging as soon as the kernel comes up journalctl output will have date stamps from whatever it gets from the system hardware clock until it can correct time. Since your device does not ...


1

-rw-r--r--. SELinux restrictions are making life complex for you.


1

First they are not sigterm. Next you pass a signal, not an argument. To send signals we use kill. See man kill. You have to specify the process. systemd will always be run as process 1, the init process. Therefore to send SIGRTMIN+15, do sudo kill -SIGRTMIN+15 1. However it will be better to use the command shutdown --poweroff, or shutdown --reboot.


1

Strange way for controlling VM. Good way -- use systemd for automatic start and stop VM. For example: /etc/systemd/system/qemu@.service [Unit] Description=QEMU virtual machine [Service] Environment="type=system-x86_64" "haltcmd=kill -INT $MAINPID" EnvironmentFile=/etc/conf.d/qemu.d/%i ExecStart=/usr/bin/qemu-${type} -name %i -nographic $args ExecStop=/bin/...


1

In systemd units, lists can typically be reset in overrides by assigning an empty value. This works for conditions too: If any of these options is assigned the empty string, the list of conditions is reset completely, all previous condition settings (of any kind) will have no effect. In your override, use this: ConditionPathExists= ConditionPathExists=|!...


1

Can you not just replace the .service file with a symlink to /etc/systemd/system/keygen.service and put the contents of your preferred .service in there?


1

I think you need to use a .target file for ansiblePB, not a service. This is what the question you linked to uses.


1

Systemd brings down Network Manager first Even after correcting the error message by not disconnecting USB bus during suspend the issues remain you cannot send a WiFi command during suspend. Network Manager is the first service that is brought down during suspend / hibernate and shutdown. If you want to send a WiFi radio signal to a device during those ...


1

I found the using the systemctl edit command was tricky (using Ubuntu 18.04), so I did this: sudo mkdir /etc/systemd/system/docker.service.d sudo vi /etc/systemd/system/docker.service.d/override.conf then added the lines I required, in your case: (and yes, the apparently empty first ExecStart= line is not a mistake) [Service] ExecStart= ExecStart=/usr/bin/...


Only top voted, non community-wiki answers of a minimum length are eligible