Skip to main content

New answers tagged

0 votes

Systemd-user-service to enable keyboard gives no error but doesn't work

Note: This answer assumes that the DISPLAY and XAUTHORITY environment variable would be imported to the systemd user manager by your desktop environment, and that you always log in with the same user ...
Tom Yan's user avatar
  • 971
0 votes

Systemd-user-service to enable keyboard gives no error but doesn't work

You are right, xinput produces no output. I've tested this.System Service units run outside of the scope/environment of Xorg. You have to put your unit in /usr/lib/systemd/user/myservice.service, then ...
Schmaehgrunza's user avatar
0 votes

How to show logs when running systemd service interactively?

While I see the utility of such a command, I don't think that exists. But maybe (sleep 1; systemctl start foobar)& journalctl --follow --end --unit foobar.service is enough to scratch that itch?
Marcus Müller's user avatar
0 votes

How to view the systemd-xdg-autostart-generator generated files?

The file is automatically created by systemd-xdg-autostart-generator.  It looks at the .desktop files in these two locations and then creates a .service file used by systemd.  You would want to edit ...
Juts's user avatar
  • 13
0 votes

Execute a script when powering off, but not when rebooting (using systemd)

After some deep research on how to execute a script using a service/unit but only when the system is being powered off, I managed to find a conditional execution that determines if this is a power ...
Marcelo's user avatar
  • 3,631
0 votes

How can I list all of the systemd targets?

if you actually check, you will see that only this really shows you. systemctl list-unit-files | grep target doing it via --type=target --all does not list many of them, for example: poweroff.target ...
ron's user avatar
  • 7,264
0 votes

Execute a script when powering off, but not when rebooting (using systemd)

few notes on the service and the script: after placing your something.service file under the desired systemd folder location, do a systemctl daemon-reload for it to be recognized when doing a ...
ron's user avatar
  • 7,264
1 vote

Execute a script when powering off, but not when rebooting (using systemd)

I tried to start a script, when powering off and it worked. Made a service unit called myservice.service [Unit] Description=Run mycommand at shutdown DefaultDependencies=no Before=poweroff.target [...
Schmaehgrunza's user avatar
0 votes

What are MODERN uses for halt (non-power off) vs shutdown (power-off)?

I have one: My BIOS allows me to provide a power-on behavior. I can set it to always on. But it will only do so, if I did not gracefully shut down the PC previously. In other words: If I power off on ...
pdx9k9e9's user avatar
0 votes

Restart=always not working

Whenever I see this question, the answer is usually related to: RestartSec= (default 100ms), StartLimitIntervalSec= (default 10s), or StartLimitBurst= (default 5 times) If you start the unit (...
Stewart's user avatar
  • 14.2k
0 votes

How does gunicorn knows how to connect to systemd socket?

I've had the same question after stumbling upon a socket-activated Gunicorn that seemed to work "by magic" without being passed the socket path explicitly. How it works is that when systemd ...
André Borie's user avatar
0 votes
Accepted

drmModePageFlip() is failing when process started by systemd service

The problem is previous page flip not completed successfully. I removed break; in user interrupted case, so until page flip completes it will wait and next page flip will be queued without any issues.
Yugandhar Babu's user avatar
0 votes

journalctl: how to prevent text from truncating in terminal

The problem arises because journalctl's default for $SYSTEMD_LESS is "FRSXMK" (from the manpage), and less's -S "Causes lines longer than the screen width to be chopped (truncated) ...
jcomeau_ictx's user avatar
0 votes

print statement in python scripts invoked through systemd .service

The suggestion to use the /dev/tty9 method seems to work perfectly for me. To return back to the GUI I did CTRL+Alt+F7. Thanks. Incidentally the idea to use mate-terminal did not work for me but this ...
xuraax's user avatar
  • 3
2 votes
Accepted

print statement in python scripts invoked through systemd .service

So your Blink.py apparently prints the characters to its standard output. By default, the standard output of any processes started as services usually goes to the systemd journal. When a program is ...
telcoM's user avatar
  • 101k
1 vote

Battery notification script works on its own but does not work when triggered by a systemd-service

The D-Bus session bus works similarly to the X server – there can be more than one per system, so clients must know the socket address to connect to, i.e. they need DBUS_SESSION_BUS_ADDRESS= which is ...
u1686_grawity's user avatar
2 votes
Accepted

Can I make a script that Reboots and continues after?

@larsks already provided the definitive answer here as a comment - but just for the lafs.... #!/bin/bash STATE="/tmp/$( basename "$BASHSOURCE" )" REPEAT=10 function install() { ...
symcbean's user avatar
  • 5,831
0 votes

Can I make a script that Reboots and continues after?

First at all, you need some file to remember the reboot times: $ echo 1 > xx $ read x 9 ## key in by keyboard $ echo ${x} 9 ## Check the value of {x} $ read x < xx ## Read the ...
James's user avatar
  • 49
0 votes

Enable systemd services without systemctl

To enable a service without using systemctl, systemd-nspawn, or anything else that requires SystemD running, you can manually add a symlink for your service in your desired target's wants directory (i....
Tenders McChiken's user avatar
1 vote

Can I make a script that Reboots and continues after?

I don't think it'll work for your particular case but the approach can be used in similar situations and it's too long for a comment On Linux it could be achieved by enabling hibernation and doing ...
Arkadiusz Drabczyk's user avatar
0 votes
Accepted

How to wait for USB drive indefinite

Created file dev-disk-by\x2dlabel-KEY.device and it is working as expected: [Unit] Description=Wait for USB Drive with label KEY DefaultDependencies=no Conflicts=shutdown.target Before=local-fs-pre....
onorua's user avatar
  • 111
2 votes

Is obex a unit of systemd?

It's not a system service, but a per-user service (= part of the user's login session, has the same file access rights as the user), so try systemctl --user list-units and systemctl --user status obex....
telcoM's user avatar
  • 101k
2 votes
Accepted

How to force `systemctl show --all *` to list all units and instances?

Your shell is expanding *, so systemctl is given a list of the files in the current directory. You need to escape it: systemctl show --all '*'
Stephen Kitt's user avatar
1 vote

systemctl daemon-reload: show diff between running config and current file

So in kind of a crisis, I spend 4 hours making a python script without dependencies so I can more easily compare running config with usual config for systemctl unit files. Script is not perfect and ...
Kiwy's user avatar
  • 9,764
0 votes

How to disable rfkill after it has been uninstalled from Raspbian

Even it's a old question, here is my dirty solution for Pi Zero 2W & 2024-03-12-raspios-bullseye-armhf-lite: Mount somewhere the SD /rootfs partition, I use Paragon to mount it on Windows but I ...
yo3hcv's user avatar
  • 101
0 votes

Enabled systemd user service doesn't start at login

I had a similar issue as the OP with not having my user systemd service working with an initial [Install] config that was something other than WantedBy=default.target. In my case, I initially had a ...
Antony Nguyen's user avatar
1 vote
Accepted

systemctl daemon-reload: show diff between running config and current file

Your suspicion is correct: systemctl cat always shows the contents of the relevant unit files as they currently are on disk, not as they are currently in systemd’s view of the system. You can see the ...
Stephen Kitt's user avatar
0 votes

Can I hook into a systemd event for enabling or disabling a service?

If I understand correctly... yes... I do a generalized /etc/systemd/system/administration.service which has an After = default.target to simply run commands I want to happen after system boot. It has ...
ron's user avatar
  • 7,264
0 votes

Periodically restart systemd service

Not enough reputation to comment, but the systemd manual suggests that you could also set WatchdogSignal to something that you can handle as well.
user22476690's user avatar
0 votes

Periodically restart systemd service

Use cron: 5 5 * * * systemctl try-restart your-own.service I would use Restart=on-failure in the unit file. This prevents unwanted restarts if the service is not running for some other ...
Walf's user avatar
  • 1,394
1 vote

Why do some of the directories in `/run/systemd/` have permissions 600?

If I understand correctly, the purpose of /run/systemd/propagate/* directories is to act as mount points for dynamic bind mounts, for services running in their own mount namespaces. This explains why ...
telcoM's user avatar
  • 101k
0 votes

Need kernel version string in ConditionPathExists of systemd unit file

I think there are probably several ways to do what you want. Use a dependency instead of condition First, you could replace your ConditionPathExists with a dependency on another service. If we create ...
larsks's user avatar
  • 36k
1 vote
Accepted

systemd CPU usage meaning

Question 1 It's almost certainly going to be the value of the kernel's runtime counter, which gets updated every context switch. So, yes, that's pretty much what you describe. However, we can be sure. ...
Marcus Müller's user avatar

Top 50 recent answers are included