Why some systemd service on ArchLinux does not work

  |   Source

List failed services

sudo systemctl --failed

I can also use `sudo journalctl -b` to get the log message when booting all the services. But not very useful.

Find the root cause of failed service

sudo systemctl status service-name

Why my /usr/lib/systemd/system/network-wifi.service does not work

Here is the content of my wifi service

[Unit]
Description=Wireless networkd connectivity (wlan0)
Wants=network.target
Before=network.target
BindsTo=sys-subsystem-net-devices-wlan0.device
After=sys-subsystem-net-devices-wlan0.device

[Service]
Type=oneshot
RemainAfterExit=yes
#EnvironmentFile=/etc/conf.d/network-wireless@wlan0

ExecStart=/usr/bin/ip link set wlan0 up
ExecStart=/usr/bin/wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/yang.conf
ExecStart=/usr/bin/dhcpcd wlan0

ExecStop=/usr/bin/ip addr flush dev wlan0
ExecStop=/usr/bin/ip link set dev wlan0 down

[Install]
WantedBy=multi-user.target

It's because netcfg.service blocks my network-wifi.service.

Solutin is simple:

sudo systemctl disable netcfg

How to start a service as specific user (mpd, for example)

This is the content of /usr/lib/systemd/system/mpd.service:

[Unit]
Description=Music Player Daemon
After=network.target sound.target

[Service]
ExecStart=/usr/bin/mpd --no-daemon /home/cb/.mpd/config
User=cb

[Install]
WantedBy=multi-user.target
Comments powered by Disqus