Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

New answers tagged

0

This line RemainAfterExit=yes mean service showed as active when script in ExecStart ends with success exit code. This line Restart=always mean restart on each of next events: Clean exit code or signal Unclean exit code Unclean signal Timeout Watchdog If you need to not restart service on some exit codes, check this option: RestartPreventExitStatus= ...


0

I've had the same issue on Fedora 29. Replace: After=network.target With: Requires=network.target It is incredibly frustrating because the file is clearly there but nothing seems to want to see it. There is no failure from the systemd analyze either. It just shows as 'bad' under systemctl --list-unit-files.


0

I was using Notepad++ on Windows so I had to run sed -i -e 's/\r$//' /etc/start.sh to replace the Windows line endings. The ^M is a carriage return character. Linux uses the line feed character to mark the end of a line, whereas Windows uses the two-character sequence CR LF. Your file has Windows line endings, which is confusing Linux. Answer-...


1

If we include Restart=always in the .service file, does this mean that it again executes ExecStart after the script finishes and hence keeps executing the script in a loop? The Restart option is only invoked if the started process exits; with always, according to the systemd.service documentation, the service will be restarted if the process exits due to: ...


3

The Restart setting doesn’t work like that; quoting the manual, When the death of the process is a result of systemd operation (e.g. service stop or restart), the service will not be restarted. systemctl allows you to specify the state you want a service to be in: systemctl start specifies that it should be running, systemctl stop specifies that it ...


0

Stopping systemd-logind fixed it for me: sudo systemctl stop systemd-logind This is suggested as a workaround in this github issue on the nvidia-xrun github page: Good news guys, systemd-logind is the culprit here. The current workaround is to run the following command after logging out from the "nvidia-xrun" session sudo systemctl stop systemd-...


0

This is the service unit configuration file I have that runs after the docker.service is up, and is also re-run whenever docker.service is restarted: [Unit] Description=Floating IP After=docker.service BindsTo=docker.service ReloadPropagatedFrom=docker.service [Service] Type=oneshot ExecStart=/usr/local/bin/floating-ip.sh ExecReload=/usr/local/bin/floating-...


0

CUDA Installation 1) Download the latest CUDA Toolkit 2) Switch to tty3 by pressing Ctl+Alt+F3 3) Unload nvidia-drm before proceeding. 3a) Isolate multi-user.target sudo systemctl isolate multi-user.target 3b) Note that nvidia-drm is currently in use. lsmod | grep nvidia.drm 3c) Unload nvidia-drm sudo modprobe -r nvidia-drm 4d) Note that nvidia-drm ...


2

The above worked for me (systemd version 231) by also adding StandardInput=tty as otherwise top refused to run with error failed tty get.


0

With sudo, you're running systemctl --user as root... but if root is not logged in at the time, there is no active per-user D-Bus instance for root. Only actual logged-in users have a user-specific D-Bus instance running. Using su or sudo may not necessarily be fully equivalent to a real login in this particular sense. If your Linux distribution has the ...


0

This suggests the unit file that starts Xorg has insufficient dependencies, and so systemd ends up running it too early. At least in Debian, local filesystem mounts automatically have ordering dependency Before=local-fs.target, and the local-fs.target is wanted by sysinit.target which is responsible for early system initialization, so all the local ...


0

what worked for me was to change system to start in text more systemctl set-default runlevel3.target then restart and install nvidia cuda driver once finished you may want to change system to start in graphics mode again systemctl set-default runlevel5.target


0

Aknowledgment: Thanks a lot to clever for all the explainations! Do do that, let's first write the configuration file in myconfiguration.nix: {config, pkgs, ... }: { # You can actually remove the user, and still use it # as a user if you link it in ~/.config/systemd/user/ # (do not forget to remove the `user` it in anything.nix # as well) ...


0

https://access.redhat.com/solutions/1293513, after discussing --user, says RH doesn't generally support the ability of regular users to stop and start system daemons; it then goes on to show how to set up sudo to allow those users to become admin to start a given daemon (like a log daemon which runs as root). But the article misses the crux of OP's ...


0

I assume that you are using Ubuntu or another distro in Debian. timesyncd is a small client-only NTP implementation bundled with systemd releases. Unfortunately, systemd-timesyncd does no clock discipline, so it could definitely cause problems for distributed systems that want greater time precision. However, based on your purpose, you also can use ...


0

No, systemd won't stop the service when the connection is closed. The reason that is not possible is that, once systemd has accepted a new connection to the socket it's listening on, it will pass that socket to the service started to handle the connection and it will no longer keep any reference to that connection. In order to detect when the connection ...


6

The convention is that /usr/lib is for files installed by the system, and /etc is for local configuration.


1

The following offered to provide clarity on what /etc/environment is/does, when its' consulted and what package provides it: whereis /etc/environment environment: /usr/lib/environment.d /etc/environment Feeding the results of whereis above, we confirm /etc/environment is a SystemD file: sudo dpkg -S /usr/lib/environment.d systemd, snapd: /usr/lib/...


1

it's not possible. This feature was implemented for the .rules-variant only https://github.com/systemd/systemd/pull/1159


0

Pulseaudio default configuration can reset levels to 100% using Pulseaudio option 'flat volumes = yes' to change this option: echo 'flat-volumes = 0' >> ~/.config/pulse/daemon.conf then re-start pulseaudio: systemctl --user restart pulseaudio for further information on this see man pulse-daemon.conf


1

You’re running the service from your user manager (--user), and apparently your logind doesn’t have lingering enabled for you. As a result, your session (including any services started inside it) is closed down whenever you log out. To change this behaviour, you need to enable lingering: sudo loginctl enable-linger $USER This will start a user manager for ...


0

This answer explain what can be done with systemd when network changes... There are many alternative solution, but a direct simple solution only with systemd is not implemented as of 06/2019


0

This answer explain how to use the power target You can add a service that will trigger a command on power-off event, something like [Unit] Description=My command on power event Before=shutdown.target DefaultDependencies=no [Service] ExecStart=/some/thing/to/execute Type=oneshot RemainAfterExit=yes [Install] WantedBy=shutdown.target


0

Target If the HandleLidSwitch is set to sleep, you can create a new systemd service with sleep target, and thus your service will be executed when the sleep is called (lid closed) here is an example with power target.. update that to sleep. Command on lock This question explain how to run a command when the lock screen is enabled Screen saver You can ...


1

The Packages list for Ubuntu 18.04 LTS shows, in the admin section, that systemd is used, not upstart. Ubuntu even provides a comparison. *.wants directories hook units into the start-up of other units, without having to modify their unit files. Units are 'plain text ini-style file that encodes information about a service, a socket, a device, a mount ...


0

I faced this problem as well and I worked around it by disabling the networking service and starting it manually after login. Cable not being plugged in would cause a significant increase in boot up time


0

Another option: Have a secondary unit that runs before this one and creates an EnvironmentFile it can use: https://stackoverflow.com/a/42841480/32453 The secondary unit can use bash for instance. Seems to be the systemd way for importing env. :|


1

service is an "high-level" command used for start, restart, stop and status services in different Unixes and Linuxes. Depending on the "lower-level" service manager, service redirects on different binaries. For example, on CentOS 7 it redirects to systemctl, while on CentOS 6 it directly called the relative /etc/init.d script. On the ...


0

I followed the advice from someone in the kernel bug page : I just had to power off the computer by pressing the power button of the laptop. I have no idea why it worked, I just remember that I had to force the shutdown using the button sometime ago, just like the guy said in his comment, and his solution worked for me too. I hope it will for you too.


1

Why: This error is being caused by a combination of things: 1) The command th-cmd --socket /var/run/thd.socket --passfd --udev produces a segfault. This seems to be because triggerhappy hasn't been patched to address a number of issues reported over the last 4 years... https://github.com/wertarbyte/triggerhappy/issues 2) Unfortunately, the error will ...


0

You can change logind configuration: /etc/systemd/logind.conf [Login] … KillUserProcesses=no … This also changes behavior for other services and background processes (like screen, tmux). See issue #3483; Run systemctl restart systemd-logind after that.


0

No. The search path for unit files is documented in man systemd.unit. For user units you could customize $XDG_RUNTIME_DIR, but for system units the paths are fixed.


0

So you can put logic based on below scenarios: [1] Check pid if exists, if not restart application. [2] Check log if not produced for some time(check what threshold you want to put), restart service. journalctl <your application binary> [3] If your application support endpoints for health check, you can write on top of it. Actually we need to ...


0

Can you reach the VM from the host before the external IP address is passed through to it? If so, then you can use the remote functionality of systemctl to check the status of a VM's boot. This requires that the VM be accessible using an ssh key from the host. On the host you would run: systemctl -H <vm name or ip> --quiet is-active multi-user....


0

There is a mechanism called "polkit" that is used to (among other things) allow the user logged into the machine locally to perform certain tasks that on a traditional unix system would require root, such as shutting the machine down, connecting to networks etc. There is a more in-depth answer at How does gnome reboot without root privileges? , ignore the ...


1

After trials and errors, this is the solution I implemented. I attached my script to a systemd service: [Unit] Description=Make VMs reachable from the internet Wants=network-online.target After=network-online.target [Service] Type=oneshot ExecStart=/home/…/virbr0-enable.sh [Install] Alias=makeVMvisible.service WantedBy=multi-user.target I made it wait ...


1

A way to go about this would be by using a socket. Of course, this implies that you need to use network socket libraries in your processes, but this is the most common way of allowing two processes to communicate. Since the two processes are on the same machine, I suggest you configure a systemd unix socket. Then, Process A can connect to the socket to ...


0

Reboot On the setting panel (KDE/GNOME) there is a startup section where application can be added to startup session, xmodmap can be added there Resume Xmodmap does not keep the changes after sleep/resume, here is how to set xmodmap on system resume with systemd: (non systemd user can use this) Create xkeyboard resume script: touch /usr/lib/systemd/...


0

I tried adding a CPUWeight=80 directive to my template service but it seems to make little difference. What did work was creating a big-restartall.servicecalls a simple bash script which contains logic for a simple, rolling restart. In my case, I found a one second pause between each service was sufficient to avoid the stampede affect, keeping start times ...


0

It's ugly and not quite what you asked for, nor does it allow for autostart, but for followers it is possible to do something using the systemctl environment: $ sudo systemctl set-environment USE_GPU=4 # add it to the env. variables for future services $ sudo systemctl start gpu_service@4:2.service Just trying to list all the ways possible :)


1

It turns it on for sibling cgroups, as well as it's parent cgroup (and their siblings, but not their children). This is because with cgroups, all cgroups on a level must have accounting enabled if a single cgroup has it enabled. For example, if you turn on cgroups accounting in a example.service, it'll enable accounting for the parent system.service and the ...


0

Add this to your install script: sudo mkdir /opt/xauthorityfix sudo chmod 777 /opt/xauthorityfix echo "#!/bin/sh" > /opt/xauthorityfix/setxauthority.sh echo "export XAUTHORITY=$XAUTHORITY" >> /opt/xauthorityfix/setxauthority.sh sudo chmod 755 /opt/xauthorityfix After that, wrap your python script in this shell script: #!/bin/sh source /opt/...


3

When systemd starts up, or when systemctl daemon-reload is run, systemd runs a systemd-sysv-generator program, which will make a list of /etc/init.d scripts and generate corresponding .service units for them unless a systemd-native .service unit already exists for them. The generator will interpret any LSB header blocks in init.d scripts. They look like ...


0

WantedBy does not influence the order in which services are started. As stated in systemd unit manual, in the WantedBy and RequiredBy description: This has the effect that a dependency of type Wants= or Requires= is added from the listed unit to the current unit. Then in the Wants description it states that it is a weaker version of Requires where it ...


1

Requirement for pam auto-keyring unlock. Check that user password is the same as the keyring password Pam module does not distinguish default keyring from other or renamed/additional keyring Open seahorse and make sure the default keyring is named "default" and is set to default Also you should have a login keyring named Login containing Unlock ...


1

It indeed looked like this bug which affects the initial release of systemd 242: https://bugs.gentoo.org/685002 (upstream: https://github.com/systemd/systemd/issues/12335). And, in fact, the change from 242 to 242r1 (in gentoo's versioning) was to apply this patch: https://gitweb.gentoo.org/repo/gentoo.git/commit/sys-apps/systemd?id=...


0

What about this solution: systemctl set-environment LD_LIBRARY_PATH=/usr/local/lib ?


0

Keep Type=forking and give a pid file location if start service/app is maintaining any pid. [Unit] Description="Run app on boot" After=network.target syslog.target auditd.service [Service] Type=forking PIDFile=/var/run/apache2/apache2.pid ExecStart=/etc/init.d/apache2 start ExecStop=/etc/init.d/apache2 stop StandardOutput=syslog StandardError=syslog ...


0

In the packages by the upstream Tor project, tor.service is a dummy service that only executes /bin/true – that’s why it says “exited”. The real Tor service is tor@default.service and possibly other instances of the tor@.service template, and tor.service only serves to group them together, so that administrators can still use systemctl restart tor instead of ...


0

I'm not sure why, but the problem is trying to both remove and add the module when returning from hibernation. Solution 1 I ran into the same problem as you, and your script fix-touchpad.sh didn't work until I tried removing the module before hibernation, and adding it back after. Based in this answer at Fedora Forum, it could be something like : $ cat /...


Top 50 recent answers are included