Skip to main content
Topic: Error trying to add chrony as runit service (Read 105 times) previous topic - next topic
0 Members and 4 Guests are viewing this topic.

Error trying to add chrony as runit service

Hi everyone. arch/pacman/runit n00b here, but lots of Linux experience.

Pretty fresh install of Artix, just a lot of package adds so far, so I think I haven't messed anything up... yet.

Here's the error, by itself:
Code: [Select]
sv start chrony
fail: chrony: unable to change to service directory: file does not exist

I hope, some useful context:
Code: [Select]
Artybus-Max:[root]:~# ls /etc/runit/sv
acpid           agetty-tty1  agetty-tty5     agetty-ttyUSB0  connmand  dhcpcd    lightdm  nfs-server  statd
agetty-console  agetty-tty2  agetty-tty6     avahi-daemon    cronie    dmeventd  logind   rpcbind     sulogin
agetty-generic  agetty-tty3  agetty-ttyAMA0  bluetoothd      cupsd     elogind   mdadm    rsyncd      udevd
agetty-serial   agetty-tty4  agetty-ttyS0    chrony          dbus      haveged   metalog  sshd        wpa_supplicant
Artybus-Max:[root]:~# sv start chrony
fail: chrony: unable to change to service directory: file does not exist
Artybus-Max:[root]:~# ls /run/runit/chrony
ls: cannot access '/run/runit/chrony': No such file or directory
Artybus-Max:[root]:~# ls -od /etc/runit/sv/chrony
drwxr-xr-x 2 root 4096 Jan 11 12:21 /etc/runit/sv/chrony
Artybus-Max:[root]:~# ln -s /etc/runit/sv/chrony /run/runit/chrony
Artybus-Max:[root]:~# sv start chrony
fail: chrony: unable to change to service directory: file does not exist
Artybus-Max:[root]:~# ls -o /run/runit
total 0
lrwxrwxrwx 1 root  20 Jan 18 12:15 chrony -> /etc/runit/sv/chrony
---------- 1 root   0 Jan 17 23:04 reboot
lrwxrwxrwx 1 root  27 Jan 17 23:04 service -> /etc/runit/runsvdir/current
---------- 1 root   0 Jan 17 23:04 stopit
drwx------ 2 root 160 Jan 17 23:04 supervise.agetty-tty1
drwx------ 2 root 160 Jan 17 23:04 supervise.agetty-tty2
drwx------ 2 root 160 Jan 17 23:04 supervise.agetty-tty3
drwx------ 2 root 160 Jan 17 23:04 supervise.agetty-tty4
drwx------ 2 root 160 Jan 17 23:04 supervise.agetty-tty5
drwx------ 2 root 160 Jan 17 23:04 supervise.agetty-tty6
Artybus-Max:[root]:~# ls /etc/runit/sv/chrony
run
Artybus-Max:[root]:~# file /etc/runit/sv/chrony/run
/etc/runit/sv/chrony/run: POSIX shell script, ASCII text executable
Artybus-Max:[root]:~# cat /etc/runit/sv/chrony/run
#!/bin/sh
install -d -m750 -o chrony -g chrony /run/chrony
exec chronyd -n -u chrony
Artybus-Max:[root]:~# ls -o /run/chrony/
total 0

But chrony runs OK standalone:
Code: [Select]
Artybus-Max:[root]:~# chronyd -dd -L -1
2025-01-18T19:45:39Z chronyd version 4.6.1 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SIGND +ASYNCDNS +NTS +SECHASH +IPV6 -DEBUG)
2025-01-18T19:45:39Z Using leap second list /usr/share/zoneinfo/leap-seconds.list
2025-01-18T19:45:44Z Selected source 23.150.40.242 (2.arch.pool.ntp.org)
2025-01-18T19:45:44Z System clock TAI offset set to 37 seconds

And I thought maybe once it had run standalone, any needed directories would be created, but even after that:
Code: [Select]
Artybus-Max:[root]:~# sv start chrony
fail: chrony: unable to change to service directory: file does not exist

Here's the run script:
Code: [Select]
Artybus-Max:[root]:~# cat /etc/runit/sv/chrony/run
#!/bin/sh
install -d -m750 -o chrony -g chrony /run/chrony
exec chronyd -n -u chrony

I can run the "install" command in the shell, and it completes without errors. If I run the "exec chronyd...." the shell exits, and there's no chrony process created.

grepping /var/log/everything/current for "chrony" doesn't reveal anything useful.

I don't know what to check next. Any help appreciated.

Re: Error trying to add chrony as runit service

Reply #1
probably your init script is not linked to svdir. read the wiki.

Re: Error trying to add chrony as runit service

Reply #2
I think it is, unless I'm misunderstanding 'svdir'.

I did ln -s /etc/runit/sv/chrony /run/runit/chrony

Which matches the instructions in the wiki, if I'm reading it right.
Quote
By default services provided by Artix packages aren't in the svdir and can't be started or managed by any tool. To do so it is needed to link the service directories into the desired runlevel directory. For example, the following command allows to supervise a service in the current runlevel:

 ln -s /etc/runit/sv/service_name /run/runit/service

And, when I check /run/runit, the link for chrony is there.

Re: Error trying to add chrony as runit service

Reply #3
I see where the confusion came from.
You need to link inside the "/run/runit/service" directory. so the link syntax would be:
Code: [Select]
 ln -s /etc/runit/sv/chrony /run/runit/service

Re: Error trying to add chrony as runit service

Reply #4
Thank you!