Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: cups broken on runit spin (Read 80 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

cups broken on runit spin

I may just be a noob, feel free to call me out.  ???

I'm using runit spin with kde5 and installed cups, but the daemon is not installed in /etc/runit/sv

Code: [Select]
# sv status cupsd
fail: cupsd: unable to change to service directory: file does not exist

Code: [Select]
# ls /etc/runit/sv
NetworkManager  agetty-console  agetty-serial  agetty-tty2  agetty-tty4  agetty-tty6     agetty-ttyS0    alsa          bluetoothd  dbus    dmeventd  haveged  mdadm       ntpd     rsyncd  sshd   sulogin    wpa_supplicant
acpid           agetty-generic  agetty-tty1    agetty-tty3  agetty-tty5  agetty-ttyAMA0  agetty-ttyUSB0  avahi-daemon  cronie      dhcpcd  elogind   lvmetad  nfs-server  rpcbind  sddm    statd  syslog-ng

Code: [Select]
# lpstat -t
scheduler is not running
no system default destination
lpstat: Bad file descriptor
lpstat: Bad file descriptor
lpstat: Bad file descriptor
lpstat: Bad file descriptor
lpstat: Bad file descriptor

Printing module in kde5 gives the message "Print service unavailable: Bad file descriptor." Opening localhost:631 results in a refused connection.

I am assuming that the lack of cupsd is the issue, but I could be wrong. Any help would be appreciated.


Re: cups broken on runit spin

Reply #1
Have you installed cups-runit?

Re: cups broken on runit spin

Reply #2
Have you installed cups-runit?

Aha, I have now! It was not included as a dependency for some reason. Thank you for the pointer.

So now cupsd is present in /etc/runit/sv:
Code: [Select]
# ls /etc/runit/sv
NetworkManager  agetty-console  agetty-serial  agetty-tty2  agetty-tty4  agetty-tty6     agetty-ttyS0    alsa          bluetoothd  cupsd  dhcpcd    elogind  lvmetad  nfs-server  rpcbind  sddm  statd    syslog-ng
acpid           agetty-generic  agetty-tty1    agetty-tty3  agetty-tty5  agetty-ttyAMA0  agetty-ttyUSB0  avahi-daemon  cronie      dbus   dmeventd  haveged  mdadm    ntpd        rsyncd   sshd  sulogin  wpa_supplicant

However, it fails to start:
Code: [Select]
# sv start cupsd
fail: cupsd: unable to change to service directory: file does not exist

So I went looking and found that the service directory that sv calls for is actually in /run/runit/service:

Code: [Select]
# ls /run/runit/service
NetworkManager  acpid  agetty-tty1  agetty-tty2  agetty-tty3  agetty-tty4  agetty-tty5  agetty-tty6  cronie  dbus  elogind  sddm  syslog-ng

Code: [Select]
# sv status elogind
run: elogind: (pid 1414) 2273s

So any daemons that are installed into /etc/runit/sv are not seen by sv.

Code: [Select]
# sv status ntpd
fail: ntpd: unable to change to service directory: file does not exist

So I moved the cupsd directory into /run/runit/service and voila:

Code: [Select]
# mv /etc/runit/sv/cupsd /run/runit/service/
# sv up cupsd
# sv status cupsd
run: cupsd: (pid 3748) 8s

Code: [Select]
# lpstat -t
scheduler is running
no system default destination
device for Brother_HL-2240_series: usb://Brother/HL-2240%20series?serial=H2N870642
Brother_HL-2240_series accepting requests since Tue 06 Nov 2018 04:07:09 PM EST
printer Brother_HL-2240_series is idle.  enabled since Tue 06 Nov 2018 04:07:09 PM EST

kde5 printing module picks up the printer and localhost:631 is able to connect. Everything works fine! Hopefully this will help anyone else facing printing troubles with runit.

The only question remaining is why daemons are installed to /etc/runit/sv if sv points to /run/runit/service? It seems there are duplicate services in both directories, but sv only sees the /service directory and can only control services from there unless it can be redirected.


Re: cups broken on runit spin

Reply #4
@zhaich Consult the wiki on how Runit services work, especially how to enable them, as installing a service package does not have to enable the service automatically.

Re: cups broken on runit spin

Reply #5
Since I don't use my printer daily, instead of having cupsd running all the time I've made 2 scripts and placed them in /usr/local/bin and given them user +x rights.   A command printon links/enables cupsd, printoff, removes the link and kills cupsd.