OpenPrinting / cups-snap

Complete CUPS printing stack in a snap
25 stars 14 forks source link

Unable to read "/var/snap/cups/common/etc/cups/cupsd.conf" due to errors. #19

Open archenroot opened 11 months ago

archenroot commented 11 months ago

I am running on the Ubuntu system and suddenly service snap.cups.cupsd.service started failing to start.

System details:

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.3 LTS"
KERNEL="6.2.0-37-generic"

I have used journalctl -u snap.cups.cupsd.service -f which provided following output:`

pro 12 21:13:59 X10SRA systemd[1]: Started Service for snap application cups.cupsd.
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + mkdir -p /var/snap/cups/980/var/spool/tmp
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + mkdir -p /var/snap/cups/980/var/run/certs
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + mkdir -p /var/snap/cups/980/var/log
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + mkdir -p /var/snap/cups/980/var/cache/fontconfig
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + mkdir -p /var/snap/cups/common/etc/cups/ppd
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + mkdir -p /var/snap/cups/common/etc/cups/ssl
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + mkdir -p /var/snap/cups/common/run
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + mkdir -m 0755 -p /run/cups
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + export LC_ALL=C.UTF-8
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + export LANG=C.UTF-8
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + export TMPDIR=/var/snap/cups/980/tmp
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + mkdir -p /var/snap/cups/980/tmp
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + CUPSTMPDIR=/var/snap/cups/980/var/spool/tmp
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + [ -d /var/snap/cups/980/tmp ]
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + chown -R root.root /var/snap/cups/980/tmp
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + chmod -R u+rwX /var/snap/cups/980/tmp
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + rm -rf /var/snap/cups/980/tmp
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + [ -d /var/snap/cups/980/tmp ]
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + [ -d /var/snap/cups/980/var/spool/tmp ]
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + chown -R root.root /var/snap/cups/980/var/spool/tmp
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + chmod -R u+rwX /var/snap/cups/980/var/spool/tmp
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + rm -rf /var/snap/cups/980/var/spool/tmp
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + [ -d /var/snap/cups/980/var/spool/tmp ]
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + mkdir -p /var/snap/cups/980/tmp
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + chown -R root.root /var/snap/cups/980/tmp
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + chmod -R 1777 /var/snap/cups/980/tmp
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + mkdir -p /var/snap/cups/980/var/spool/tmp
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + chown -R root.snap_daemon /var/snap/cups/980/var/spool/tmp
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + chmod -R 1770 /var/snap/cups/980/var/spool/tmp
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + CUPSUSER=snap_daemon
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + ALTCUPSUSER=root
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + CUPSGROUP=snap_daemon
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + ALTCUPSGROUP=root
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + CUPSSYSTEMGROUP=lpadmin
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + ALTCUPSSYSTEMGROUP=adm
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + TESTFILE=/var/snap/cups/980/tmp/testfile
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + touch /var/snap/cups/980/tmp/testfile
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + chown snap_daemon /var/snap/cups/980/tmp/testfile
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + chgrp snap_daemon /var/snap/cups/980/tmp/testfile
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + rm -f /var/snap/cups/980/tmp/testfile
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + getent group lpadmin
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + [ ! -f /var/snap/cups/common/etc/cups/cups-files.conf ]
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + perl -p -i -e s:^(\s*\#)?\s*User\s+\S+\s*$:User snap_daemon\n:; -e s:^(\s*\#)?\s*Group\s+.*$:Group snap_daemon:; -e s:^(\s*\#)?\s*SystemGroup\s+.*$:SystemGroup lpadmin root:; -e s:^(\s*\#)?\s*AccessLog\s+.*$:AccessLog /var/snap/cups/980/var/log/access_log:; -e s:^(\s*\#)?\s*CacheDir\s+.*$:CacheDir /var/snap/cups/980/var/cache:; -e s:^(\s*\#)?\s*DataDir\s+.*$:DataDir /snap/cups/980/share/cups:; -e s:^(\s*\#)?\s*DocumentRoot\s+.*$:DocumentRoot /snap/cups/980/share/cups/doc:; -e s:^(\s*\#)?\s*ErrorLog\s+.*$:ErrorLog /var/snap/cups/980/var/log/error_log:; -e s:^(\s*\#)?\s*FontPath\s+.*$:\#FontPath (NOT SUPPORTED ANY MORE):; -e s:^(\s*\#)?\s*PageLog\s+.*$:PageLog /var/snap/cups/980/var/log/page_log:; -e s:^(\s*\#)?\s*Printcap\s+.*$:Printcap /var/snap/cups/common/etc/printcap:; -e s:^(\s*\#)?\s*RequestRoot\s+.*$:RequestRoot /var/snap/cups/980/var/spool:; -e s:^(\s*\#)?\s*ServerBin\s+.*$:ServerBin /snap/cups/980/lib/cups:; -e s:^(\s*\#)?\s*ServerRoot\s+.*$:ServerRoot /var/snap/cups/common/etc/cups:; -e s:^(\s*\#)?\s*StateDir\s+.*$:StateDir /var/snap/cups/980/var/run:; -e s:^(\s*\#)?\s*TempDir\s+.*$:TempDir /var/snap/cups/980/var/spool/tmp:; /var/snap/cups/common/etc/cups/cups-files.conf
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + PROXY_MODE=NO
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + SYSTEM_CUPS_SERVER=
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + rm -f /var/snap/cups/980/var/run/proxy-mode
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + [ ! -f /var/snap/cups/common/no-proxy ]
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + [ -r /etc/cups/cupsd.conf ]
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + touch /var/snap/cups/980/var/run/proxy-mode
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + PROXY_MODE=YES
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + SYSTEM_CUPS_SERVER=localhost:631
pro 12 21:13:59 X10SRA cups.cupsd[26521]: + grep -E ^[ \t]*Listen[ \t]+/ /etc/cups/cupsd.conf
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + LINE=Listen /run/cups/cups.sock
pro 12 21:13:59 X10SRA cups.cupsd[26523]: + echo Listen /run/cups/cups.sock
pro 12 21:13:59 X10SRA cups.cupsd[26524]: + head -1
pro 12 21:13:59 X10SRA cups.cupsd[26525]: + perl -p -e s:^\s*Listen\s+(\S+)\s*$:\1:
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + SYSTEM_CUPS_SERVER=/run/cups/cups.sock
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + PORT=631
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + ALTPORT=10631
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + DOMAINSOCKET=/run/cups/cups.sock
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + [ ! -d /run/cups ]
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + ALTDOMAINSOCKET=/var/snap/cups/common/run/cups.sock
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + [ YES = YES ]
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + PORT=
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + DOMAINSOCKET=/var/snap/cups/common/run/cups.sock
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + [ ! -f /var/snap/cups/common/etc/cups/cupsd.conf ]
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + [ YES = YES ]
pro 12 21:13:59 X10SRA cups.cupsd[26527]: + cat /var/snap/cups/common/etc/cups/cupsd.conf
pro 12 21:13:59 X10SRA cups.cupsd[26528]: + grep -v Listen
pro 12 21:13:59 X10SRA cups.cupsd[26529]: + grep -v Port
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + mv /var/snap/cups/common/etc/cups/cupsd.conf.new /var/snap/cups/common/etc/cups/cupsd.conf
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + LISTENLINES=
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + [ /var/snap/cups/common/run/cups.sock = /var/snap/cups/common/run/cups.sock ]
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + LISTENLINES=Listen /var/snap/cups/common/run/cups.sock
pro 12 21:13:59 X10SRA cups.cupsd[26532]: + cat /var/snap/cups/common/etc/cups/cupsd.conf
pro 12 21:13:59 X10SRA cups.cupsd[26533]: + grep -v Listen
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + echo Listen /var/snap/cups/common/run/cups.sock
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + cat /var/snap/cups/common/etc/cups/cupsd.conf.new
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + rm -f /var/snap/cups/common/etc/cups/cupsd.conf.new
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + touch /var/snap/cups/common/etc/cups/client.conf
pro 12 21:13:59 X10SRA cups.cupsd[26538]: + cat /var/snap/cups/common/etc/cups/client.conf
pro 12 21:13:59 X10SRA cups.cupsd[26539]: + grep -v ServerName
pro 12 21:13:59 X10SRA cups.cupsd[26537]: + true
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + echo ServerName /var/snap/cups/common/run/cups.sock
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + cat /var/snap/cups/common/etc/cups/client.conf.new
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + rm -f /var/snap/cups/common/etc/cups/client.conf.new
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + [ ! -f /var/snap/cups/common/etc/cups/snmp.conf ]
pro 12 21:13:59 X10SRA cups.cupsd[26542]: + yes n
pro 12 21:13:59 X10SRA cups.cupsd[26543]: + cp -ri /snap/cups/980/etc/cups/ppd /var/snap/cups/common/etc/cups/
pro 12 21:13:59 X10SRA cups.cupsd[26544]: + yes n
pro 12 21:13:59 X10SRA cups.cupsd[26545]: + cp -ri /snap/cups/980/etc/cups/ssl /var/snap/cups/common/etc/cups/
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + SCHEDULER=cupsd
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + CUPS_PID=26546
pro 12 21:13:59 X10SRA cups.cupsd[26546]: + exec cupsd -f -s /var/snap/cups/common/etc/cups/cups-files.conf -c /var/snap/cups/common/etc/cups/cupsd.conf
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + echo 26546
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + [ YES = YES ]
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + PROXY_DAEMON=cups-proxyd
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + PROXYD_PID=26547
pro 12 21:13:59 X10SRA cups.cupsd[26466]: +
pro 12 21:13:59 X10SRA cups.cupsd[26547]: +
pro 12 21:13:59 X10SRA cups.cupsd[26466]: echo 26547
pro 12 21:13:59 X10SRA cups.cupsd[26547]: exec cups-proxyd /var/snap/cups/common/run/cups.sock /run/cups/cups.sock -l --logdir /var/snap/cups/980/var/log
pro 12 21:13:59 X10SRA cups.cupsd[26466]: + wait 26546
pro 12 21:13:59 X10SRA cupsd[26546]: Unable to read "/var/snap/cups/common/etc/cups/cupsd.conf" due to errors.
pro 12 21:13:59 X10SRA systemd[1]: snap.cups.cupsd.service: Main process exited, code=exited, status=1/FAILURE
pro 12 21:13:59 X10SRA systemd[1]: snap.cups.cupsd.service: Failed with result 'exit-code'.
pro 12 21:13:59 X10SRA systemd[1]: snap.cups.cupsd.service: Scheduled restart job, restart counter is at 5.
pro 12 21:13:59 X10SRA systemd[1]: Stopped Service for snap application cups.cupsd.
pro 12 21:13:59 X10SRA systemd[1]: snap.cups.cupsd.service: Start request repeated too quickly.
pro 12 21:13:59 X10SRA systemd[1]: snap.cups.cupsd.service: Failed with result 'exit-code'.
pro 12 21:13:59 X10SRA systemd[1]: Failed to start Service for snap application cups.cupsd.

The error was this line: Unable to read "/var/snap/cups/common/etc/cups/cupsd.conf" due to errors.

I have located all cupsd.conf files:

 zangetsu  X10SRA  /etc  locate cupsd.conf
/etc/cups/cupsd.conf
/snap/cups/980/etc/cups/cupsd.conf
/snap/cups/980/etc/cups/cupsd.conf.default
/snap/cups/980/share/cups/doc/help/man-cupsd.conf.html
/usr/share/cups/cupsd.conf.default
/usr/share/cups/doc-root/help/man-cupsd.conf.html
/usr/share/man/de/man5/cupsd.conf.5.gz
/usr/share/man/fr/man5/cupsd.conf.5.gz
/usr/share/man/man5/cupsd.conf.5.gz
/var/snap/cups/common/etc/cups/cupsd.conf

I attach the failing file conf: cupsd-failing.conf.txt and the working file from /etc/cups folder. I used this file to overwrite the failing one: cupsd-working-from-etc.conf.txt

One operation which I was doing on system level was that I changed the hostname. But I did notice the failing service much later, so not sure if it is/was related to that error.