New answers tagged

1 vote

Service timer file not working with systemd

When you use OnUnitActiveSecs, that means: Defines a timer relative to when the unit the timer unit is activating was last activated Because the timer is relative to when the unit...was last ...
user avatar
  • 25.7k
0 votes

Permission denied (publickey,password) on SSH connection when run as a service

I don't have an answer to fix your specific problem, but you can add verbose output to the ssh command to debug more relating to its use of ssh keys: rsync -avzh \ -e "ssh -vvv -i /home/...
user avatar
0 votes

How to determine the active systemd-resolved link number using a script?

resolvectl status | grep -PB1 'Current Scopes.*\bDNS\b' | head -n 1 is the best way to do it!
user avatar
0 votes

How to display echo messages from a systemd-timer script in journalctl?

I found how to have the lines appear, but do not fully understand the difference: root@srv ~ [SIGINT]# journalctl -u borg -f Aug 08 18:34:59 srv borg.sh[2652992]: All archives: 1.10 TB ...
user avatar
  • 1,298
1 vote

Is the systemd dbus service under org.freedesktop.systemd1 able to manage unit templates?

The systemd service on dbus is as well fully capable of managing the services started off a template unit file. So given you have a template unit file foo@.service and an instance with concrete name ...
user avatar
0 votes

Rocky Linux container with systemd on MacOS

Here is an example of someone who got systemd working in a docker container on MacOS, using a docker-compose.yml file to mount the /sys/fs/cgroup volume and the necessary tmpfs directories: https://...
user avatar
1 vote
Accepted

journalctl set default datetime format

The -o option allows the timestamp formatting to be chosen among a few options, including ISO format (e.g. 2022-08-04T17:45:08+0200) with journalctl -o short-iso or journalctl -o short-iso-precise ...
user avatar
0 votes

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

systemd cannot take shell command lines directly. So you can pass a shell implementation of some sort to source a file. In your case, you can try to modify your unit like this: ExecStart=/bin/sh -c '. ...
user avatar
0 votes
Accepted

Systemd services spontaneously restart every 30 minutes

It seems like it's related to packagekit. The restart of nexus is about 5 seconds after the start of packagekit. I wonder if you can figure out what this PID is: Aug 2 11:54:48 beta-nexus dbus-daemon[...
user avatar
1 vote

How to keep systemd journal for one year?

The systemd-journald options are fully documented at Freedesktop.org In this case the options you are looking for are: SystemMaxUse, SystemKeepFree, SystemMaxFileSize, and SystemMaxFiles. You've set ...
user avatar
  • 393
0 votes
Accepted

systemd-resolved as mDNS responder

I don't know why it was so hard to reach this page, but on https://www.freedesktop.org/software/systemd/man/systemd.dnssd.html it's documented how to configure Services files to be announces on DNS-SD/...
user avatar
  • 101
1 vote
Accepted

nodejs server running from service giving error "Failed to execute command: Exec format error"

Solution was to adjust permissions on the myservice.service file, and then to add a WorkingDirectory value to the location the node application needed to be run from.
user avatar
0 votes

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

If PartOf is part of the service [Unit] then the target shouldn't need Wants; systemd will automatically know what templates have been enabled for the target. systemctl enable myapp@Chicago (etc) ...
user avatar
0 votes

How to use Systemd user services without Desktop session[No D-Bus]

It will work with just two commands. cat << 'EOF' >> ~USERNAME/.profile export XDG_RUNTIME_DIR=/run/user/$(id -u) EOF loginctl enable-linger $USERNAME
user avatar
  • 76
-1 votes

How to keep systemd journal for one year?

No idea how the 491.5M limit was decided. I changed the below setting and restarted the system AND: By default my system had about ~500MB max size which had about 1 month of logs. AND: Now the max ...
user avatar
-1 votes

How to keep systemd journal for one year?

set up a cronjob to run on a periodic basis, e.g for your use case, run this daily: $ journalctl --vacuum-time=1y refs: https://www.freedesktop.org/software/systemd/man/journalctl.html#--vacuum-size=...
user avatar
  • 57
0 votes

Systemd service - custom operation

I know it has been 3 years since this question was asked but I had the same question and I think I have an answer. You could create a systemd service and call it "foo-start-dump.service" ...
user avatar
  • 2,113
1 vote

Why is /etc/fstab preferred over systemd unit files?

In my case with CIFS using Kerberos security (sec=krb5) won't work via fstab for RHEL 7. x due to the cifs.upcall on CIFS-Utils version 6.2 (standard for RHEL 7. x). CIFS-Utils version 6.2 only allows ...
user avatar
0 votes

How to keep systemd journal for one year?

There is the exactly desired option in the journald.conf file. From the man page [1]: MaxFileSec= The maximum time to store entries in a single journal file before rotating to the next one. ...
user avatar
  • 2,600
1 vote

systemd-ask-password prompt not displayed for vpn

After experimenting, it seems like systemctl will not prompt if the service is considered started just after the command, as is the case when Type=simple. It worked when I used Type=notify and used ...
user avatar
  • 238
2 votes
Accepted

How To Change DNS Server?

You can of course tell NetworkManager not to write /etc/resolv.conf and do it yourself. However, usually the DNS server depends on the network to which you are connecting, and isn't that static. Which ...
user avatar
  • 1,286
1 vote

How To Change DNS Server?

The following method is from the RedHat documentation, but also works for me on Debian. It probably works the same or similarly for Arch Linux using systemd and NetworkManager. As the root user, ...
user avatar
  • 2,216
1 vote
Accepted

systemd: Failed to parse calendar specification, ignoring: 5m

5m is a time-span. OnCalendar= expects a time-stamp. According to systemd.time(7), a time-stamp is a unique point in time, while a time-span is a duration. If you want to keep OnCalendar=, then use a ...
user avatar
  • 9,540
0 votes

Creating a systemd service in ubuntu that can be started/stopped

My executable started another process that was not killed in every exit event, so I created a new .service file and recompiled by executable. It now works perfectly.
user avatar
  • 13
1 vote
Accepted

Creating a systemd service in ubuntu that can be started/stopped

Here's an answer for the simplest case. All you need to do is create /etc/systemd/system/myservice.service. This is an INI file with a [Service] section. A very simple service looks like this: [...
user avatar
  • 9,540
0 votes

How can I use a USB keyboard or mouse to wake from suspend?

One solution is to use a udev rule to enable wakeup based on USB vendor and product ID, e.g. add a /etc/udev/rules.d/usb-wake.rules file containing something like: ACTION=="add", ATTR{...
user avatar
  • 11
1 vote

Can't reboot with systemctl

You can use one of the following. Solution for Ubuntu Pull Image command: docker run -d --name Linuxamination --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro jrei/systemd-ubuntu:20.04 Log into the ...
user avatar
0 votes

Run systemd service before unmount

Try adding DefaultDependencies=no to the Unit section of the service file. systemd.service manpage says: The following dependencies are added unless DefaultDependencies=no is set: • Service units ...
user avatar
1 vote
Accepted

Correct usage/location of tmpfs for a service in Raspberry Pi?

For a service, create another user to run it. Then use /dev/shm, or /tmp, for temporary storage.
user avatar
8 votes

Start different sysyemd services depending on the selected grub option

If you have multiple desktop environments installed, gdm should already provide a way to select one of them for your session at login time. If there is a gear icon near the bottom right corner of the ...
user avatar
  • 70.6k
0 votes

How to force load kernel module (modprobe -f) on startup?

You should follow the steps: Add module_name.conf to /etc/modules-load.d/. The module_name.conf file should simply contain a list of kernel module names to load,separated by newlines. Add another ...
user avatar
0 votes

Managing systemd services on read-only filesystem

Not a full answer, but too much detail for a comment. To make a change, you need write access to that filesystem. I'm guessing you have write-access now, but you want to lock-it-down read-only while ...
user avatar
  • 9,540
1 vote

Not able to run chromium as service

This is running on systemd's --system bus. We know that because your service file is in /etc/systemd/system. The problem is that root usually doesn't have a desktop session. Even if root had one (...
user avatar
  • 9,540
1 vote
Accepted

systemd-networkd-wait-online.service consistently overwritten by updates

Combining the two ideas from How to override systemd unit file settings?, I would suggest overriding the ExecStart directive by calling systemctl edit systemd-networkd-wait-online.service, which will ...
user avatar
  • 63.8k
0 votes

systemd-networkd won't configure a static IP

I'm trying to switch to a static IP address, but systemd keeps using DHCP Yes! Exactly that. There was a file in /lib/systemd/network that was setting DHCP for ALL wired networks. Great idea. Thanks! ...
user avatar
  • 3,998
0 votes

Remove a DNS server from systemd-resolved?

I second Ian D. Allen comment : 1- the resolvectl revert command does not remove DNS from Global section 2- one cannot obviously revert an interface, tun0 which is actually down So the question ...
user avatar
1 vote

systemd stops writing to StandardOutput file

I am experiencing the same issue in Ubuntu 20.04, but the content is actually being written in the begging of the file which makes it invisible to the tail command. This behavior is expected and ...
user avatar
  • 878
0 votes

remove on stale pid file after power failure to allow software startup via systemd service

As you have discovered a PID file that is still present at system start-up cannot correctly represent the new state of the system. A lingering PID file will mislead the initialisation process and ...
user avatar
  • 105
0 votes

systemd not playing a sound

Running Debian 11 in a Raspberry Pi, it was enough for me to add this to the service unit file: Environment="PULSE_RUNTIME_PATH=/run/user/1000/pulse/" Keep in mind here 1000 is the user id ...
user avatar
-1 votes

systemd-networkd-wait-online.service consistently overwritten by updates

I think you can create a .sh. file that runs a command and associate it with a service. So, and this is just a patch, you should be able to put that ExecStart=/usr/lib/systemd/systemd-networkd-wait-...
user avatar
0 votes

is there a proper way to shut down from single user mode

For newer Linux systems, this command should work: systemctl poweroff --force --force
user avatar
1 vote
Accepted

Diffence between `systemd-sysctl` and `sysctl`

sysctl is an administrative tool which provides access to values in the /proc/sys virtual file system (see also How to set and understand fs.notify.max_user_watches). You can use it to see the current ...
user avatar
0 votes

recompiling linux kernel always ending with desktop manager not working

The fix was to just uninstall nvidia-dkms and install it once the kernel is installed into the system.
user avatar
1 vote
Accepted

Prevent subsequent systemd units to start

It's more of a hack than a real solution, you can try to just put a sleep after the reboot into A: sleep 60 If the service continues running while the system is rebooting, the others shouldn't start, ...
user avatar
0 votes

systemd: failed to mount NFS share: mount.nfs: Network is unreachable until later in boot process

The approach that I've found to work is to create a dedicated systemd service for the job of mounting the disks, and ignore the mount functionality of systemd. The basics of this approach are: NFS ...
user avatar

Top 50 recent answers are included