Problem with starting p910nd process not as root

Hello All,

I'm having strange issue. I cannot start p910nd process via init.d scrtipt. I.e. below you can see it says it is running but there's now process running in fact:

root@OpenWRT:~# /etc/init.d/p910nd start

root@OpenWRT:~# /etc/init.d/p910nd status
running

root@OpenWRT:~# ps | grep -i p91
  702 root      1560 S    grep -i p91

Here is my /etc/config/p910nd which I have defaulted back:

root@OpenWRT:~# cat /etc/config/p910nd
config p910nd
	option device        /dev/usb/lp0
	# Actual TCP port is 9100 plus this value
	# Valid values are 0,1,2
	option port          0
	option bidirectional 1
	option enabled       1
	# Override running as user p910nd, group lp
	option runas_root    0

	# mDNS support - see Bonjour Printing Specification for details concerning the values
	# Be aware that you can only advertise one printer on this host via mDNS
	# Set to 1 to enable
	option mdns          0
	# Human-readable printer make and model
	option mdns_ty       'My Printer Manufacturer/Model'
	# Human-readable location
	option mdns_note     'Basement'
	# Post-Script product string, including parenthesis
	option mdns_product  ''
	# IEEE-1284 Device ID MANUFACTURER/MFG string
	option mdns_mfg      ''
	# IEEE-1284 Device ID MODEL/MDL string
	option mdns_mdl      ''
	# IEEE-1284 Device ID COMMAND SET/CMD string
	option mdns_cmd      ''

I have noticed that when I change "option runas_root" from 0 (which is default) to 1 then p910nd process is starting, as below:

root@OpenWRT:~# /etc/init.d/p910nd start

root@OpenWRT:~# /etc/init.d/p910nd status
running

root@OpenWRT:~# ps | grep -i p91
 1053 root      1004 S    {p910nd} /usr/sbin/p9100d -d -b -f /dev/usb/lp0 0
 1113 root      1560 S    grep -i p91

I don't know since when it stopped working, it could be since some release or since I've installed some additional package maybe grep/sed or other replacement of busybox.

Please help, cause since OpenWRT is getting more complicated regarding init.d script I cannot debug the issue. There is nothing special in log except this

root@OpenWRT:~# logread | grep -i p91
[DATE_AND_TIME_OF_LOG_ENTRY] daemon.info procd: Instance p910nd::p9100d s in a crash loop 6 crashes, 0 seconds since last crash

I've tried on other OpenWRT box with very similar listing of packages and I have same issue, so this is rather platform independent.
Here is list of installed packages:

root@OpenWRT:~# opkg list-installed
base-files - 1498-r20028-43d71ad93e
busybox - 1.35.0-5
ca-bundle - 20230311-1
cgi-io - 2022-08-10-901b0f04-21
curl - 8.2.1-1
ddns-scripts - 2.8.2-25
ddns-scripts-services - 2.8.2-25
dnsmasq - 2.86-16
dropbear - 2022.82-2
ethtool - 5.16-1
firewall4 - 2022-10-18-7ae5e14b-1
fstools - 2022-06-02-93369be0-2
fwtool - 2019-11-12-8f7fe925-1
getrandom - 2021-08-03-205defb5-2
grep - 3.7-2
haveged - 1.9.18-1
hostapd-common - 2022-01-16-cff80b4f-16.2
https-dns-proxy - 2023-05-25-4
iftop - 2018-10-03-77901c8c-2
iw - 5.16-1
iwinfo - 2022-12-15-8d158096-1
jansson4 - 2.13.1-2
jshn - 2022-05-15-d2223ef9-1
jsonfilter - 2018-02-04-c7e938d6-1
kernel - 5.10.161-1-2974fbe1fa59be88f13eb8abeac8c10b
kmod-cfg80211 - 5.10.161+5.15.81-1-1
kmod-crypto-aead - 5.10.161-1
kmod-crypto-ccm - 5.10.161-1
kmod-crypto-cmac - 5.10.161-1
kmod-crypto-crc32c - 5.10.161-1
kmod-crypto-ctr - 5.10.161-1
kmod-crypto-gcm - 5.10.161-1
kmod-crypto-gf128 - 5.10.161-1
kmod-crypto-ghash - 5.10.161-1
kmod-crypto-hash - 5.10.161-1
kmod-crypto-hmac - 5.10.161-1
kmod-crypto-kpp - 5.10.161-1
kmod-crypto-lib-chacha20 - 5.10.161-1
kmod-crypto-lib-chacha20poly1305 - 5.10.161-1
kmod-crypto-lib-curve25519 - 5.10.161-1
kmod-crypto-lib-poly1305 - 5.10.161-1
kmod-crypto-manager - 5.10.161-1
kmod-crypto-null - 5.10.161-1
kmod-crypto-rng - 5.10.161-1
kmod-crypto-seqiv - 5.10.161-1
kmod-crypto-sha256 - 5.10.161-1
kmod-gpio-button-hotplug - 5.10.161-3
kmod-hwmon-core - 5.10.161-1
kmod-leds-gpio - 5.10.161-1
kmod-lib-crc-ccitt - 5.10.161-1
kmod-lib-crc32c - 5.10.161-1
kmod-mac80211 - 5.10.161+5.15.81-1-1
kmod-mt76-connac - 5.10.161+2022-09-06-d7054646-5
kmod-mt76-core - 5.10.161+2022-09-06-d7054646-5
kmod-mt7615-common - 5.10.161+2022-09-06-d7054646-5
kmod-mt7615-firmware - 5.10.161+2022-09-06-d7054646-5
kmod-mt7615e - 5.10.161+2022-09-06-d7054646-5
kmod-nf-conntrack - 5.10.161-1
kmod-nf-conntrack6 - 5.10.161-1
kmod-nf-flow - 5.10.161-1
kmod-nf-log - 5.10.161-1
kmod-nf-log6 - 5.10.161-1
kmod-nf-nat - 5.10.161-1
kmod-nf-reject - 5.10.161-1
kmod-nf-reject6 - 5.10.161-1
kmod-nfnetlink - 5.10.161-1
kmod-nft-core - 5.10.161-1
kmod-nft-fib - 5.10.161-1
kmod-nft-nat - 5.10.161-1
kmod-nft-offload - 5.10.161-1
kmod-nls-base - 5.10.161-1
kmod-ppp - 5.10.161-1
kmod-pppoe - 5.10.161-1
kmod-pppox - 5.10.161-1
kmod-slhc - 5.10.161-1
kmod-udptunnel4 - 5.10.161-1
kmod-udptunnel6 - 5.10.161-1
kmod-usb-core - 5.10.161-1
kmod-usb-ledtrig-usbport - 5.10.161-1
kmod-usb-printer - 5.10.161-1
kmod-usb-xhci-hcd - 5.10.161-1
kmod-usb-xhci-mtk - 5.10.161-1
kmod-usb3 - 5.10.161-1
kmod-wireguard - 5.10.161-1
libblobmsg-json20220515 - 2022-05-15-d2223ef9-1
libc - 1.2.3-4
libcares - 1.19.1-1
libcurl4 - 8.2.1-1
libev - 4.33-1
libgcc1 - 11.2.0-4
libhavege - 1.9.18-1
libiwinfo-data - 2022-12-15-8d158096-1
libiwinfo-lua - 2022-12-15-8d158096-1
libiwinfo20210430 - 2022-12-15-8d158096-1
libjson-c5 - 0.15-2
libjson-script20220515 - 2022-05-15-d2223ef9-1
liblua5.1.5 - 5.1.5-10
liblucihttp-lua - 2023-03-15-9b5b683f-1
liblucihttp0 - 2023-03-15-9b5b683f-1
libmbedtls12 - 2.28.4-1
libmnl0 - 1.0.5-1
libncurses6 - 6.3-2
libnftnl11 - 1.2.1-2
libnghttp2-14 - 1.44.0-1
libnl-tiny1 - 2021-11-21-8e0555fb-1
libpcap1 - 1.10.1-3
libpcre - 8.45-3
libpthread - 1.2.3-4
libubox20220515 - 2022-05-15-d2223ef9-1
libubus-lua - 2022-06-01-2bebf93c-1
libubus20220601 - 2022-06-01-2bebf93c-1
libuci-lua - 2021-10-22-f84f49f0-6
libuci20130104 - 2021-10-22-f84f49f0-6
libuclient20201210 - 2023-04-13-007d9454-1
libucode20220812 - 2022-12-02-46d93c9c-1
libustream-wolfssl20201210 - 2022-12-08-9217ab46-2
libwolfssl5.5.4.ee39414e - 5.5.4-stable-1
logd - 2021-08-03-205defb5-2
lua - 5.1.5-10
luci - git-23.093.42303-d58cd69
luci-app-ddns - git-23.118.79498-4390b4d
luci-app-firewall - git-23.093.42704-1c01c64
luci-app-https-dns-proxy - 2023-05-25-4
luci-app-ledtrig-rssi - git-20.125.36159-be640ce
luci-app-ledtrig-switch - git-20.125.36161-a6fa3ce
luci-app-ledtrig-usbport - git-21.300.30579-af7b965
luci-app-opkg - git-23.093.42303-e16f620
luci-app-p910nd - git-20.108.38431-8f34e10
luci-app-simple-adblock - 1.9.5-3
luci-app-wireguard - git-23.018.72712-6d712c3
luci-base - git-23.119.80898-65ef406
luci-compat - git-23.093.42303-ef4cd04
luci-lib-base - git-20.232.39649-1f6dc29
luci-lib-ip - git-20.250.76529-62505bd
luci-lib-jsonc - git-22.097.61921-7513345
luci-lib-nixio - git-20.234.06894-c4a4e43
luci-mod-admin-full - git-19.253.48496-3f93650
luci-mod-network - git-23.170.81153-99d3815
luci-mod-status - git-23.158.78816-1c26abc
luci-mod-system - git-23.118.78821-0c02883
luci-proto-ipv6 - git-21.148.48881-79947af
luci-proto-ppp - git-21.158.38888-88b9d84
luci-proto-wireguard - git-23.093.40597-18a1842
luci-ssl - git-20.244.36115-e10f954
luci-theme-bootstrap - git-23.093.42704-b47268a
mtd - 26
netcat - 0.7.1-2
netifd - 2022-08-25-76d2d41b-1
nftables-json - 1.0.2-2.1
odhcp6c - 2022-08-05-7d21e8d8-18
odhcpd-ipv6only - 2023-01-02-4a673e1c-2
openwrt-keyring - 2022-03-25-62471e69-3
opkg - 2022-02-24-d038e5b6-1
p910nd - 0.97-9
ppp - 2.4.9.git-2021-01-04-3
ppp-mod-pppoe - 2.4.9.git-2021-01-04-3
procd - 2022-06-01-7a009685-2
procd-seccomp - 2022-06-01-7a009685-2
procd-ujail - 2022-06-01-7a009685-2
procps-ng - 3.3.16-3
procps-ng-top - 3.3.16-3
procps-ng-watch - 3.3.16-3
px5g-wolfssl - 6.2
rpcd - 2022-12-15-7de4820c-1
rpcd-mod-file - 2022-12-15-7de4820c-1
rpcd-mod-iwinfo - 2022-12-15-7de4820c-1
rpcd-mod-luci - 20210614
rpcd-mod-rrdns - 20170710
rssileds - 3
screen - 4.8.0-2
sed - 4.8-3
simple-adblock - 1.9.5-5
tcpdump - 4.9.3-4
terminfo - 6.3-2
ubi-utils - 2.1.4-1
uboot-envtools - 2022.01-36
ubox - 2021-08-03-205defb5-2
ubus - 2022-06-01-2bebf93c-1
ubusd - 2022-06-01-2bebf93c-1
uci - 2021-10-22-f84f49f0-6
uclient-fetch - 2023-04-13-007d9454-1
ucode - 2022-12-02-46d93c9c-1
ucode-mod-fs - 2022-12-02-46d93c9c-1
ucode-mod-ubus - 2022-12-02-46d93c9c-1
ucode-mod-uci - 2022-12-02-46d93c9c-1
uhttpd - 2023-06-25-34a8a74d-1
uhttpd-mod-ubus - 2023-06-25-34a8a74d-1
urandom-seed - 3
urngd - 2023-07-25-7aefb47b-1
usign - 2020-05-23-f1f65026-1
wireguard-tools - 1.0.20210424-3
wireless-regdb - 2023.05.03-1
wpad-basic-wolfssl - 2022-01-16-cff80b4f-16.2

I don't want to run p910nd from root account if I don't have to. So I appreciate every idea of what and where to check or how to debug those starting scripts.

Can you check if you have both, a user account p910nd and a group lp? Check in /etc/passwd and in /etc/group:

grep p910nd /etc/passwd
grep lp /etc/group

User and group should have been added by the package during install.

Please also check the permissions of /dev/usb/lp0 by running:

ls -l /dev/usb/lp0
1 Like

Hi,

Thank you for your interest in the topic. Here is the output:

root@OpenWRT:~# grep p910nd /etc/passwd
p910nd:x:393:7:p910nd:/var/run/p910nd:/bin/false

root@OpenWRT:~# grep lp /etc/group
lp:x:7:p910nd

root@OpenWRT:~# ls -l /dev/usb/lp0
ls: /dev/usb/lp0: No such file or directory

root@OpenWRT:~# ls -l /dev/usb/lp0
crw-rw----    1 root     lp        180,   0 Sep 14 13:55 /dev/usb/lp0

BTW: /dev/usb/lp0 appears only when I connect and/or turn a printer on. But I'm pretty sure earlier p910nd started even there was no printer device in /dev/...
Now I have a situation that p910nd doesn't want to start with "option runas_root 0" in config of p910nd, when it is set to "option runas_root 1" it runs fine. I don't know how to debug starting script or execute a /usr/sbin/p910nd as p910nd user without su command to see error messages on output.

the usb device will only appear when the printer's connected.

I remember an old thread where the issue was the path for the printer device, I think they've been moved from /dev/ to /dev/usb/, check the p910nd settings.

it could also be a jail issue, if the daemon's using it.

Hi frollic,

Thanks for contribution. I've checked that even the printer path doesn't exist (like there was no printer connected) p910nd should start. But in my case it doesn't want to start. It starts only when "option runas_root 1" is set. But I don't want to run as root.
I thought someone on forum here could tell me how to debug starting script? Like how to get more verbose output from it? Or how to start the process like init script is doing?

Thanks in advance

OK. I have checked configs, permissions and cleaned up router from some json and lock files regarding p910 and I have rebooted router and somehow it started to work.
I don't know what was it, but rather not the configs. Looks more like the reboot has helped 0_o.