Skip to content

subprocess.CalledProcessError: Command '['sudo sv status /var/service/*']' returned non-zero exit status 2.

ketika menjalankan pyrunit -l muncul error

$ pyrunit -l                                                                                                                                                                        Password: 
Traceback (most recent call last):
  File "/home/redinetyas/.local/bin/pyrunit", line 8, in <module>
    sys.exit(pyRunit())
  File "/home/redinetyas/.local/lib/python3.10/site-packages/pyrunit/__init__.py", line 6, in pyRunit
    Runit.pyrunit()
  File "/home/redinetyas/.local/lib/python3.10/site-packages/pyrunit/pyrunit.py", line 99, in pyrunit
    self.serviceActive()
  File "/home/redinetyas/.local/lib/python3.10/site-packages/pyrunit/pyrunit.py", line 41, in serviceActive
    status_all = sub.check_output(["sudo sv status /var/service/*"], shell=True, text=True).strip().split("\n")
  File "/usr/lib/python3.10/subprocess.py", line 420, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.10/subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['sudo sv status /var/service/*']' returned non-zero exit status 2.

error dikarenakan ada layanan yang fail

# sv status /var/service/*
fail: /var/service/_pipewire: unable to change to service directory: file does not exist
run: /var/service/acpid: (pid 797) 39631s
run: /var/service/adb: (pid 796) 39631s
run: /var/service/agetty-tty1: (pid 852) 39631s
run: /var/service/agetty-tty2: (pid 853) 39631s
run: /var/service/agetty-tty3: (pid 858) 39631s
run: /var/service/agetty-tty4: (pid 854) 39631s
run: /var/service/agetty-tty5: (pid 838) 39631s
run: /var/service/agetty-tty6: (pid 847) 39631s
run: /var/service/backlight: (pid 801) 39631s
run: /var/service/bluetoothd: (pid 811) 39631s; run: log: (pid 810) 39631s
run: /var/service/bluez-alsa: (pid 1052) 39630s
run: /var/service/colord: (pid 1057) 39630s
run: /var/service/cupsd: (pid 831) 39631s
run: /var/service/dbus: (pid 842) 39631s
run: /var/service/earlyoom: (pid 857) 39631s; run: log: (pid 856) 39631s
run: /var/service/hddtemp: (pid 825) 39631s
run: /var/service/libvirtd: (pid 861) 39631s; run: log: (pid 860) 39631s
run: /var/service/NetworkManager: (pid 1025) 39630s
run: /var/service/ntpd: (pid 826) 39631s
fail: /var/service/openntpd: unable to change to service directory: file does not exist
run: /var/service/sddm: (pid 1021) 39630s
run: /var/service/smbd: (pid 883) 39631s; run: log: (pid 882) 39631s
run: /var/service/udevd: (pid 850) 39631s
run: /var/service/ufw: (pid 829) 39631s
run: /var/service/usbmuxd: (pid 855) 39631s
run: /var/service/uuidd: (pid 840) 39631s
run: /var/service/virtlockd: (pid 872) 39631s; run: log: (pid 871) 39631s
run: /var/service/virtlogd: (pid 868) 39631s; run: log: (pid 867) 39631s
down: /var/service/waydroid-container: 39631s
run: /var/service/zramen: (pid 839) 39631s

solved setelah menghapus layanan yang failed # rm /var/service/_pipewire ; rm /var/service/openntpd

~►pyrunit -l                                                                                                                                                                        0.356s 18:37
========================
Service         | Status       
========================
NetworkManager  | run            
acpid           | run            
adb             | run            
agetty-tty1     | run            
agetty-tty2     | run            
agetty-tty3     | run            
agetty-tty4     | run            
agetty-tty5     | run            
agetty-tty6     | run            
backlight       | run            
bluetoothd      | run            
bluez-alsa      | run            
colord          | run            
cupsd           | run            
dbus            | run            
earlyoom        | run            
hddtemp         | run            
libvirtd        | run            
ntpd            | run            
sddm            | run            
smbd            | run            
udevd           | run            
ufw             | run            
usbmuxd         | run            
uuidd           | run            
virtlockd       | run            
virtlogd        | run            
waydroid-container | down           
zramen          | run            
========================

lebih baik jika ada layanan yang fail diberi keterangan fail agar memudahkan pengguna mengecek layanan yang berjalan