davesteele / cloudprint-service

Debian packaging for the Python cloudprint proxy utility
GNU General Public License v3.0
71 stars 4 forks source link

cloudprintd not starting on boot (network readiness problem?) #8

Closed bjohv052 closed 10 years ago

bjohv052 commented 10 years ago

After installing the debs manually on my Sheevaplug I got the following on the serial console after rebooting:

[ ok ] Starting periodic command scheduler: cron. [....] Starting Common Unix Printing System: cupsd[ 19.506233] mv643xx_eth_port mv643xx_eth_port.0: eth0: link up, 1000 Mb/s, full duplex, flow control disabled [ 19.516448] ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready . ok Traceback (most recent call last): File "/usr/bin/cloudprint", line 9, in load_entry_point('cloudprint==0.10', 'console_scripts', 'cloudprint-cmd')() File "/usr/share/cloudprint/cloudprint/cloudprint.py", line 476, in main sync_printers(cups_connection, cpp) File "/usr/share/cloudprint/cloudprint/cloudprint.py", line 301, in sync_printers remote_printers = dict([(p.name, p) for p in cpp.get_printers()]) File "/usr/share/cloudprint/cloudprint/cloudprint.py", line 166, in get_printers { 'X-CloudPrint-Proxy' : 'ArmoooIsAnOEM'}, File "/usr/share/cloudprint/cloudprint/cloudprint.py", line 147, in f r = attr(_arg, *_karg) File "/usr/share/cloudprint/cloudprint/rest.py", line 105, in post return self.rest_call('POST', path, data, content_type, headers, response_type) File "/usr/share/cloudprint/cloudprint/rest.py", line 65, in rest_call self._conn.request(verb, path, data, headers) File "/usr/lib/python2.7/httplib.py", line 962, in request self._send_request(method, url, body, headers) File "/usr/lib/python2.7/httplib.py", line 996, in _send_request self.endheaders(body) File "/usr/lib/python2.7/httplib.py", line 958, in endheaders self._send_output(message_body) File "/usr/lib/python2.7/httplib.py", line 818, in _send_output self.send(msg) File "/usr/lib/python2.7/httplib.py", line 780, in send self.connect() File "/usr/lib/python2.7/httplib.py", line 1161, in connect self.timeout, self.source_address) File "/usr/lib/python2.7/socket.py", line 553, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): socket.gaierror: [Errno -2] Name or service not known [ ok ] Starting system message bus: dbus. [ ok ] Starting MTA: exim4. [ ok ] Starting NTP server: ntpd. [ ok ] Starting OpenBSD Secure Shell server: sshd. [ ok ] Starting bittorrent daemon: transmission-daemon.

I suspected that it had something to to with the network not being quite ready, so as a quick and dirty solution I added ssh under "Required-Start" in /etc/init.d/cloudprintd. After that everything was ok.

Disclaimer: I have used cloudprint from armooo as a service with my own init.d script earlier, but I did my best to clean everything out before installing the debs.

davesteele commented 10 years ago

The last time this came up, it was due to an init.d Required-Start on "$cups" instead of "cups".

My cloudprint.init also has a dependency on "$network". Are you sure you installed cloudprint-service cleanly? Try deleting any old cloudprint inits and re-install.

bjohv052 commented 10 years ago

I have done as you suggested, but it makes no difference. After looking a bit closer at what the $network dependency means I found this: http://refspecs.linuxfoundation.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/facilname.html

Isn't the problem that cloudprint-service assumes that an internet connection is available when it is not? According to the above link, the $network dependency only means that "basic networking" is available and that e.g. a dhcp request has not necessarily finished. Could cloudprint-service handle the situation more gracefully, by trying again in x seconds, instead of just failing to start?

davesteele commented 10 years ago

That's the usual behavior. I'll take a look at it.

davesteele commented 10 years ago

I've added a retry, but the service really should fail eventually in this case. Per the refspec you cited, is your problem fixed if you add $named to the Required-Start list?

bjohv052 commented 10 years ago

Added $named and then "update-rc.d cloudprintd defaults && reboot" but no difference. For now I've resorted to using $all as dependency, which works.

I really appreciate your efforts. As long as I'm the only one with this issue (and I have a workaround) don't bother too much with it.

davesteele commented 10 years ago

Could you leave a directory listing of /etc/init.d?

bjohv052 commented 10 years ago

root@myran /etc/init.d

ls

total 312 -rwxr-xr-x 1 root root 1071 Nov 23 2009 atd -rwxr-xr-x 1 root root 2253 Mar 6 2013 avahi-daemon -rwxr-xr-x 1 root root 2444 Jan 1 2011 bootlogd -rwxr-xr-x 1 root root 1276 Oct 15 2012 bootlogs -rwxr-xr-x 1 root root 1281 Oct 15 2012 bootmisc.sh -rwxr-xr-x 1 root root 3816 Dec 11 2012 checkfs.sh -rwxr-xr-x 1 root root 1099 Dec 11 2012 checkroot-bootclean.sh -rwxr-xr-x 1 root root 9673 Dec 11 2012 checkroot.sh -rwxr-xr-x 1 root root 3325 Dec 29 20:31 cloudprintd -rwxr-xr-x 1 root root 3362 Dec 29 20:22 cloudprintd~ -rwxr-xr-x 1 root root 1379 Dec 9 2011 console-setup -rwxr-xr-x 1 root root 3033 Jul 4 2012 cron -rwxr-xr-x 1 root root 3038 Dec 4 2012 cups -rwxr-xr-x 1 root root 2832 Jul 17 2010 dbus -rwxr-xr-x 1 root root 3684 Mar 28 2010 ddclient -rw-r--r-- 1 root root 2244 Dec 29 20:31 .depend.boot -rw-r--r-- 1 root root 971 Dec 29 20:31 .depend.start -rw-r--r-- 1 root root 831 Dec 29 20:31 .depend.stop -rwxr-xr-x 1 root root 3076 Apr 6 2012 downtimed -rwxr-xr-x 1 root root 6435 Jan 2 2013 exim4 -rwxr-xr-x 1 root root 1523 May 26 2010 fancontrol -rwxr-xr-x 1 root root 1329 Jan 1 2011 halt -rwxr-xr-x 1 root root 1423 Jan 1 2011 hostname.sh -rwxr-xr-x 1 root root 3880 Dec 11 2012 hwclock.sh -rwxr-xr-x 1 root root 7592 Apr 28 2012 kbd -rwxr-xr-x 1 root root 1591 Oct 1 2012 keyboard-setup -rwxr-xr-x 1 root root 1293 Jan 1 2011 killprocs -rwxr-xr-x 1 root root 1990 May 20 2012 kmod -rwxr-xr-x 1 root root 869 May 27 2010 lm-sensors -rwxr-xr-x 1 root root 2528 Feb 17 2012 minissdpd -rwxr-xr-x 1 root root 995 Oct 15 2012 motd -rwxr-xr-x 1 root root 670 Dec 11 2012 mountall-bootclean.sh -rwxr-xr-x 1 root root 2128 Jan 23 2013 mountall.sh -rwxr-xr-x 1 root root 1508 Dec 11 2012 mountdevsubfs.sh -rwxr-xr-x 1 root root 1413 Dec 11 2012 mountkernfs.sh -rwxr-xr-x 1 root root 678 Dec 11 2012 mountnfs-bootclean.sh -rwxr-xr-x 1 root root 2440 Oct 15 2012 mountnfs.sh -rwxr-xr-x 1 root root 1731 Dec 11 2012 mtab.sh -rwxr-xr-x 1 root root 4322 Mar 14 2013 networking -rwxr-xr-x 1 root root 6491 Jul 11 2012 nfs-common -rwxr-xr-x 1 root root 1814 Dec 26 2009 ntp -rwxr-xr-x 1 root root 1346 May 20 2012 procps -rwxr-xr-x 1 root root 6120 Oct 15 2012 rc -rwxr-xr-x 1 root root 782 Oct 15 2012 rc.local -rwxr-xr-x 1 root root 117 Oct 15 2012 rcS -rw-r--r-- 1 root root 2427 Oct 15 2012 README -rwxr-xr-x 1 root root 639 Jan 1 2011 reboot -rwxr-xr-x 1 root root 1074 Jan 1 2011 rmnologin -rwxr-xr-x 1 root root 2344 Jun 15 2012 rpcbind -rwxr-xr-x 1 root root 4395 Dec 2 2012 rsync -rwxr-xr-x 1 root root 3054 Mar 5 2013 rsyslog -rwxr-xr-x 1 root root 2348 Apr 22 2010 saned -rwxr-xr-x 1 root root 1163 Sep 16 2012 screen-cleanup -rwxr-xr-x 1 root root 3200 Oct 15 2012 sendsigs -rwxr-xr-x 1 root root 590 Jan 1 2011 single -rw-r--r-- 1 root root 4290 Oct 15 2012 skeleton -rwxr-xr-x 1 root root 3881 Feb 8 2013 ssh -rwxr-xr-x 1 root root 567 Jan 1 2011 stop-bootlogd -rwxr-xr-x 1 root root 1143 Jan 1 2011 stop-bootlogd-single -rwxr-xr-x 1 root root 1906 May 28 2012 transmission-daemon -rwxr-xr-x 1 root root 8827 Nov 9 2012 udev -rwxr-xr-x 1 root root 1179 Aug 19 2012 udev-mtab -rwxr-xr-x 1 root root 2721 Oct 15 2012 umountfs -rwxr-xr-x 1 root root 2195 Dec 11 2012 umountnfs.sh -rwxr-xr-x 1 root root 1122 Oct 15 2012 umountroot -rwxr-xr-x 1 root root 3111 Oct 15 2012 urandom -rwxr-xr-x 1 root root 2666 Mar 2 2012 x11-common

bjohv052 commented 10 years ago

Works now, I don't know why. The system runs from a usb stick and I recently changed it because the old one was worn out. That's the only change I can think of. Close this issue.

bjohv052 commented 10 years ago

Now on a clean install with a known good usb stick. It works.