Failing to start systemd service - linux

I have written the following systemd service to login at the wireless at boot:
[Unit]
Description=Wireless network connectivity (%i)
Wants=network.target
Before=network.target
BindsTo=sys-subsystem-net-devices-%i-device
After=sys-subsystem-net-devices-%i-device
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/ip link set dev %i up
ExecStart=/usr/bin/wpa_supplicant -B -i %i -c /etc/wpa_supplicant/wpa_supplicant.conf
ExecStart=/usr/bin/dhcpcd %i
ExecStop=/usr/bin/ip link set dev %i down
[Install]
WantedBy=multi-user.target
I then enable it but I get the following error every time I boot my computer:
[abc#arch ~]$ systemctl --failed
UNIT LOAD ACTIVE SUB DESCRIPTION
● network-wireless#wlp3s0.service loaded failed failed Wireless network connectivity (wlp3s0)
However if I manually start this service after boot with:
systemctl start network-wireless#xlp3s0
the service starts as expected.
This is the content of wpa_supplicant.conf
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel
network={
ssid="TeliaGateway30-91-8F-1C-B2-29"
#psk="A80871A90A"
psk=b4d8a1e9ad665eed0178fea6f141134e795e15183a661848b371a41bb73a6844
}
Why is this services starting ok when starting it manually but not at boot and how can I change it to start at boot?
EDIT: Added error output:
This is what error im getting:
[abc#arch ~]$ journalctl -b -u network-wireless#wlp3s0.service
-- Logs begin at Sat 2015-08-22 12:50:42 CEST, end at Sun 2015-08-23 22:15:26 CEST. --
Aug 23 21:23:36 arch systemd[1]: Starting Wireless network connectivity (wlp3s0)...
Aug 23 21:23:36 arch ip[274]: Cannot find device "wlp3s0"
Aug 23 21:23:36 arch systemd[1]: network-wireless#wlp3s0.service: Main process exited, code=exited, status=1/FAILURE
Aug 23 21:23:36 arch systemd[1]: Failed to start Wireless network connectivity (wlp3s0).
Aug 23 21:23:37 arch systemd[1]: network-wireless#wlp3s0.service: Unit entered failed state.
Aug 23 21:23:37 arch systemd[1]: network-wireless#wlp3s0.service: Failed with result 'exit-code'.
Aug 23 21:25:11 arch systemd[1]: Starting Wireless network connectivity (wlp3s0)...
Aug 23 21:25:11 arch dhcpcd[424]: wlp3s0: waiting for carrier
Aug 23 21:25:16 arch dhcpcd[424]: wlp3s0: carrier acquired
Aug 23 21:25:16 arch dhcpcd[424]: DUID 00:01:00:01:1d:6b:6b:e6:10:0d:7f:b7:30:f3
Aug 23 21:25:16 arch dhcpcd[424]: wlp3s0: IAID c1:c4:73:e0
Aug 23 21:25:16 arch dhcpcd[424]: wlp3s0: soliciting an IPv6 router
Aug 23 21:25:16 arch dhcpcd[424]: wlp3s0: rebinding lease of 192.168.1.85
Aug 23 21:25:21 arch dhcpcd[424]: wlp3s0: leased 192.168.1.85 for 3600 seconds
Aug 23 21:25:21 arch dhcpcd[424]: wlp3s0: adding route to 192.168.1.0/24
Aug 23 21:25:21 arch dhcpcd[424]: wlp3s0: adding default route via 192.168.1.1
Aug 23 21:25:21 arch dhcpcd[424]: forked to background, child pid 477
Aug 23 21:25:21 arch dhcpcd[424]: wlp3s0: waiting for carrier
Aug 23 21:25:21 arch dhcpcd[424]: wlp3s0: carrier acquired
Aug 23 21:25:21 arch dhcpcd[424]: DUID 00:01:00:01:1d:6b:6b:e6:10:0d:7f:b7:30:f3
Aug 23 21:25:21 arch dhcpcd[424]: wlp3s0: IAID c1:c4:73:e0
Aug 23 21:25:21 arch dhcpcd[424]: wlp3s0: soliciting an IPv6 router
Aug 23 21:25:21 arch dhcpcd[424]: wlp3s0: rebinding lease of 192.168.1.85
Aug 23 21:25:21 arch dhcpcd[424]: wlp3s0: leased 192.168.1.85 for 3600 seconds
Aug 23 21:25:21 arch dhcpcd[424]: wlp3s0: adding route to 192.168.1.0/24
Aug 23 21:25:21 arch dhcpcd[424]: wlp3s0: adding default route via 192.168.1.1
Aug 23 21:25:21 arch dhcpcd[424]: forked to background, child pid 477
Aug 23 21:25:21 arch systemd[1]: Started Wireless network connectivity (wlp3s0).
Aug 23 21:25:28 arch dhcpcd[477]: wlp3s0: no IPv6 Routers available
Aug 23 22:15:09 arch dhcpcd[477]: wlp3s0: carrier lost
Aug 23 22:15:09 arch dhcpcd[477]: wlp3s0: deleting route to 192.168.1.0/24
Aug 23 22:15:09 arch dhcpcd[477]: wlp3s0: deleting default route via 192.168.1.1
Aug 23 22:15:13 arch dhcpcd[477]: wlp3s0: carrier acquired
Aug 23 22:15:14 arch dhcpcd[477]: wlp3s0: IAID c1:c4:73:e0
Aug 23 22:15:14 arch dhcpcd[477]: wlp3s0: soliciting an IPv6 router
Aug 23 22:15:14 arch dhcpcd[477]: wlp3s0: rebinding lease of 192.168.1.85
Aug 23 22:15:19 arch dhcpcd[477]: wlp3s0: leased 192.168.1.85 for 3600 seconds
Aug 23 22:15:19 arch dhcpcd[477]: wlp3s0: adding route to 192.168.1.0/24
Aug 23 22:15:19 arch dhcpcd[477]: wlp3s0: adding default route via 192.168.1.1
Aug 23 22:15:19 arch dhcpcd[477]: wlp3s0: removing route to 192.168.1.0/24
Aug 23 22:15:26 arch dhcpcd[477]: wlp3s0: no IPv6 Routers available
EDIT:
I have found one potetential error, it seems as if the network interface changes name from wlan0 during boot, however i have tried starting the service with wlan0 but with no change in the result.

The reason the service stops at boot is because the ip command cannot find the interface. According to the man page for systemd services that is enough reason to fail the service.
As you noticed yourself the interface gets renamed or is not ready yet at boot.
You can check if you need to add an After= statement
You can check with the systemd-analyze command if the ordering at boot is correct
You could split up the service and make it more robust. Most daemons can start fine even if the interface is not ready yet.
Personally I would make dhcpd and wpa_supplicant separate services and use systemd's networkd or an udev rule to bring up the interface (if that is even needed). There are a lot examples of unit files for wpa_supplicant and dhcpd online maybe have look at those?

Related

Error in Bluetooth Status - Raspberry Pi - "Failed to set privacy: Rejected (0x0b)"

I'm in the very early stages of doing some Bluetooth Mesh work on my Raspberry Pi 4.
From the instructions I have found that a rebuild of the Kernel is required to enable the Crypto APIs that Mesh requires.
I am starting with
pi#pi-4:~ $ uname -a
Linux pi-4 5.10.63-v7l+ #1459 SMP Wed Oct 6 16:41:57 BST 2021 armv7l GNU/Linux
pi#pi-4:~ $ bluetoothd -v
5.55
And rebuilt the kernel using
git clone --depth=1 https://github.com/raspberrypi/linux
cd linux
KERNEL=kernel7l
make bcm2711_defconfig
vi .config # to customize the local name of the kernel build
make menuconfig
Of note, I have seen varying documents on which kernel options to set so I went with the superset of options. Set via a combination of vi and the UI. The resulting edits were
CONFIG_EXPERT=y
CONFIG_TIMERFD=y
CONFIG_EVENTFD=y
CONFIG_NET=y
CONFIG_BT=y
CONFIG_BT_RFCOMM=y
CONFIG_BT_RFCOMM_TTY=y
CONFIG_BT_BNEP=y
CONFIG_BT_BNEP_MC_FILTER=y
CONFIG_BT_BNEP_PROTO_FILTER=y
CONFIG_BT_HIDP=y
CONFIG_RFKILL=y
CONFIG_CRYPTO_USER=y
CONFIG_CRYPTO_USER_API_HASH=y
CONFIG_CRYPTO_USER_API_SKCIPHER=y
CONFIG_CRYPTO_MD5=y
CONFIG_CRYPTO_SHA1=y
CONFIG_KEY_DH_OPERATIONS=y
CONFIG_CRYPTO_USER_API_AEAD=y
CONFIG_CRYPTO_USER_API_HASH=y
CONFIG_CRYPTO_AES=y
CONFIG_CRYPTO_CCM=y
CONFIG_CRYPTO_AEAD=y
CONFIG_CRYPTO_CMAC=y
I also edited the statup command line option to turn off the SAP plug-in to get rid of that startup error.
KERNEL=kernel7l
make -j4 zImage modules dtbs
sudo make modules_install
sudo cp arch/arm/boot/dts/*.dtb /boot/
sudo cp arch/arm/boot/dts/overlays/*.dtb* /boot/overlays/
sudo cp arch/arm/boot/dts/overlays/README /boot/overlays/
sudo cp arch/arm/boot/zImage /boot/$KERNEL.img
pi#pi-4-x:~/ell-0.9/linux $ sudo reboot now
Connection to pi-4-x closed by remote host.
Connection to pi-4-x closed.
.
. reconnect
.
pi#pi-4:~ $ uname -a
Linux pi-4 5.10.90-v7l-With-BlueZ-Crypto+ #2 SMP Fri Jan 14 16:00:58 EST 2022 armv7l GNU/Linux
Now I am looking at this error when I check the status. This error is the SAME when using the BlueZ shipped with the distribution (5.55) and when rebuilding from source (5.63).
Any ideas?
Failed to set privacy: Rejected (0x0b)
pi#pi-4:~/linux $ sudo service bluetooth status
● bluetooth.service - Bluetooth service
Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2022-01-18 11:32:44 EST; 11min ago
Docs: man:bluetoothd(8)
Main PID: 1726 (bluetoothd)
Status: "Running"
Tasks: 1 (limit: 3715)
CPU: 59ms
CGroup: /system.slice/bluetooth.service
└─1726 /usr/libexec/bluetooth/bluetoothd --noplugin=sap
Jan 18 11:32:44 pi-4 systemd[1]: Starting Bluetooth service...
Jan 18 11:32:44 pi-4 bluetoothd[1726]: Bluetooth daemon 5.55
Jan 18 11:32:44 pi-4 systemd[1]: Started Bluetooth service.
Jan 18 11:32:44 pi-4 bluetoothd[1726]: Starting SDP server
Jan 18 11:32:44 pi-4 bluetoothd[1726]: Excluding (cli) sap
Jan 18 11:32:44 pi-4 bluetoothd[1726]: Bluetooth management interface 1.18 initialized
Jan 18 11:32:44 pi-4 bluetoothd[1726]: Failed to set privacy: Rejected (0x0b)
Jan 18 11:32:44 pi-4 bluetoothd[1726]: Endpoint registered: sender=:1.21 path=/MediaEndpoint/A2DPSink/sbc
Jan 18 11:32:44 pi-4 bluetoothd[1726]: Endpoint registered: sender=:1.21 path=/MediaEndpoint/A2DPSource/sbc

kfd kfd: STONEY not supported in kfd

I been getting this error on my manjaro linux machine, here is some more info:
- Journal begins at Mon 2021-03-08 18:37:49 EET, ends at Tue 2021-03-09 16:21:19 EET. --
Mar 09 11:02:26 manjaro kernel: tpm_crb MSFT0101:00: can't request region for resource [mem 0xcfbb6000-0xcfbb9fff]
Mar 09 11:02:29 manjaro kernel: kfd kfd: STONEY not supported in kfd
Mar 09 11:02:32 manjaro systemd-backlight[1332]: Failed to get backlight or LED device 'backlight:acpi_video0': No such device
Mar 09 11:02:32 manjaro systemd[1]: Failed to start Load/Save Screen Backlight Brightness of backlight:acpi_video0.
Subject: A start job for unit systemd-backlight#backlight:acpi_video0.service has failed
Defined-By: systemd
Support: https://forum.manjaro.org/c/support
A start job for unit systemd-backlight#backlight:acpi_video0.service has finished with a failure.
The job identifier is 1354 and the job result is failed.
Mar 09 11:02:32 manjaro systemd-backlight[1333]: Failed to get backlight or LED device 'backlight:acpi_video1': No such device
Mar 09 11:02:32 manjaro systemd[1]: Failed to start Load/Save Screen Backlight Brightness of backlight:acpi_video1.
Subject: A start job for unit systemd-backlight#backlight:acpi_video1.service has failed
Defined-By: systemd
Support: https://forum.manjaro.org/c/support
A start job for unit systemd-backlight#backlight:acpi_video1.service has finished with a failure.
The job identifier is 1360 and the job result is failed.
I don't know if the kfd error it's happening because of the first error.
I would like to know what it actually means, where is it coming from, and how can I fix it?
And maybe a word on the systemd-backlight#backlight:acpi_video1.service error.
The setup i have:
Cpu:
AMD A9-9420 RADEON R5, 5 COMPUTE CORES 2C+3G, 2586 MHz
GPU:
ATI Stoney [Radeon R2/R3/R4/R5 Graphics]
4GB RAM, 250GB SSD
OS: Linux manjaro 5.9.16-1-MANJARO #1 SMP PREEMPT Mon Dec 21 22:00:46 UTC 2020 x86_64 GNU/Linux

cgconfig service won't start up

I have already referenced this post: Centos cgconfig fails to start
I have a centos 7 machine. I've tried commenting out and leaving in memory in the following /etc/cgconfig.conf file:
mount {
cpuset = /cgroup/cpuset;
cpu = /cgroup/cpu;
cpuacct = /cgroup/cpuacct;
memory = /cgroup/memory;
devices = /cgroup/devices;
freezer = /cgroup/freezer;
net_cls = /cgroup/net_cls;
blkio = /cgroup/blkio;
}
I've also manually created that directory structure. When I run service cgconfig start, systemctl status cgconfig.service gives me this:
cgconfig.service - Control Group configuration service
Loaded: loaded (/usr/lib/systemd/system/cgconfig.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Tue 2017-03-14 20:27:40 EDT; 18s ago
Process: 6713 ExecStart=/usr/sbin/cgconfigparser -l /etc/cgconfig.conf -L /etc/cgconfig.d -s 1664 (code=exited, status=101)
Main PID: 6713 (code=exited, status=101)
Mar 14 20:27:40 localhost.localdomain systemd[1]: Starting Control Group configuration service...
Mar 14 20:27:40 localhost.localdomain cgconfigparser[6713]: /usr/sbin/cgconfigparser; error loading /etc/cgconfig.conf: Cgroup mounting failed
Mar 14 20:27:40 localhost.localdomain cgconfigparser[6713]: Error: cannot mount cpu to /cgroup/cpu: Device or resource busy
Mar 14 20:27:40 localhost.localdomain systemd[1]: cgconfig.service: main process exited, code=exited, status=101/n/a
Mar 14 20:27:40 localhost.localdomain systemd[1]: Failed to start Control Group configuration service.
Mar 14 20:27:40 localhost.localdomain systemd[1]: Unit cgconfig.service entered failed state.
Mar 14 20:27:40 localhost.localdomain systemd[1]: cgconfig.service failed.
I've also tried to look at /proc/mounts to perhaps unmount cpu.
Any help to get the cgconfig service to start would be helpful.
$ lssubsys -a
cpu,cpuacct
If is a cosubsystem like 'cpu,cpuacct', must mount in the same hierachy (for cg).
Running on Ubuntu I could resolve the same issue by installing the libcgmanager which provides the daemon cgmanager.

Bug: Varnish 4 install on CentOS 7 (systemctl)

Installed Varnish from yum; but immediate error when initiating via systemctl.
Jul 28 14:11:54 localhost.localdomain varnishd[6546]: .init_func = VGC_function_vcl_init,
Jul 28 14:11:54 localhost.localdomain varnishd[6546]: .fini_func = VGC_function_vcl_fini,
Jul 28 14:11:54 localhost.localdomain varnishd[6546]: };
Jul 28 14:11:54 localhost.localdomain varnishd[6557]: Assert error in main(), mgt/mgt_main.c line 686:
Jul 28 14:11:54 localhost.localdomain varnishd[6557]: Condition((daemon(1,0)) == 0) not true.
Jul 28 14:11:54 localhost.localdomain varnishd[6557]: errno = 19 (No such device)
Jul 28 14:11:54 localhost.localdomain systemd[1]: Failed to read PID from file /var/run/varnish.pid: Invalid argument
Jul 28 14:11:54 localhost.localdomain systemd[1]: varnish.service never wrote its PID file. Failing.
Jul 28 14:11:54 localhost.localdomain systemd[1]: Failed to start Varnish a high-perfomance HTTP accelerator.
Jul 28 14:11:54 localhost.localdomain systemd[1]: Unit varnish.service entered failed state.
SELinux is disabled; package was installed via root. This is a fresh install.
Looks like you need to reboot. ;)
The message:
Failed to read PID from file /var/run/varnish.pid Invalid argument
is non-critical. It is just systemd trying to read the pidfile too early. You can poll status with:
systemctl status varnish
If its "Main PID" entry is matching the contents of /var/run/varnish.pid(and if varnishd is started via systemd, it always does), you can ignore that message. This is fixed in later versions of systemd.

I want to know if my server was shutdown and time that is shutting down in

i have a server hp with ubuntu server
I want to know if my server was shutdown and time that is shutting down in
there are something to know a logs of my server
You can try the last reboot command to get some basic information about the most recent reboots and the uptime between them.
# last reboot
reboot system boot 2.6.32-431.3.1.e Fri Mar 14 07:02 - 01:51 (8+18:49)
reboot system boot 2.6.32-431.3.1.e Sun Feb 16 02:15 - 06:59 (26+03:44)
reboot system boot 2.6.32-431.3.1.e Sun Jan 26 16:21 - 06:59 (46+13:38)
reboot system boot 2.6.32-358.11.1. Sun Oct 13 18:53 - 16:18 (104+22:25)
reboot system boot 2.6.32-358.11.1. Sun Oct 6 10:10 - 18:50 (7+08:40)
reboot system boot 2.6.32-358.11.1. Sat Jun 29 09:28 - 10:06 (99+00:38)
reboot system boot 2.6.32-358.11.1. Sat Jun 29 09:06 - 09:25 (00:19)
reboot system boot 2.6.32-358.6.2.e Sat Jun 29 08:46 - 09:01 (00:15)

Resources