studying my hobby


Remote printing: Debian and Google Cloud Print

(8 votes, average: 4.75 out of 5)

Have you ever heard of google cloud print? It allows you to add your printers to the cloud and share them. You can print on them from any device supporting this service, even if you are on another network. This sounds pretty cool, I gave it a try and I am really amazed.

None of my printers doesn't support cloud print directly, so I need a google chrome installation to share the printer. But I don't want to have my computer to run when printing remotely. There is a project called Google CloudPrint on Linux which allows you to use this nice service from the command line. At this point the dockstar or the linkstation joines the game.

To use your debian server as a printserver for cloud print, you need to configure your printer correctly. You will need cups. Here you can find everything needed to set it up: Debian as Printserver and Scanserver with HPLIP, CUPS, SANE

Now lets install cloudprint:

To manage startup, create the init-script /etc/init.d/cloudprint with following contents:
Make sure to set USER to the user you want cloudprint is ran as.

Make it executable, create the path for the pidfile and start it on startup:

You now should be able to run a test:

Enter the username and password of the google account you want to use when prompted. If everything is done you should see the printer at
If you now hit CTRL+P in chrome and select cloud print, a print job should be created and your printer will start printing.

Check this for other clients to print in a cloud:
I have tested the android app Cloud Print BETA and my job has been printed flawlessly!

  • curti

    Thank you for this post. I have successfully set it up. It took some time due to driver issues but everything is working now.

    I also had issues with the script above. I’m not too familiar with Linux and made a slight change to the script above. I received a script error (I don’t remember the exact details but it had to do with the line(s) that included sudo) and changed sudo to su and it seemed to work.

    I look forward to more posts about the Dockstar.

    P.S. I’d also like to thank you for your HowTo post to install Debian Squeeze which I found browsing Jeff’s forum.

  • Love this! I also made a few tweaks to it. I removed the sudo portion and allow it to run as root be default. I also changed the name of the script to cloudprintd. The reason for this is, since the init script carries the same name as the executable, the killall command terminates the script that called it as well and so the restart command never gets executed. I chose the above method, but one could also merely change line 29 to read:

    kill cat $PIDFILE

    This would target the actual cloudprint process by PID.


    • I also changed


      since the folder gets wiped out at reboot and

      # Required-Start: $cups $network $local_fs $syslog
      # Required-Start: cups $network $local_fs $syslog

      since $cups is incorrect.

      • shyd

        Thanks, nice to know!

  • Andy

    I’ve been trying to get this to work on a raspberry pi, but keep getting “daemon module required for -d” when I run the script, but the daemon is definitely installed. Any ideas?

    • shyd

      Hm I am sorry, but I don’t know, maybe it’s an issue with wheezy?
      I guess your rpi is running wheezy?

      • David

        I have the same issue with my pi running wheezy. The printers are recognized in CloudPrint but the daemon module can’t be found as described above.
        Maybe someone has an idea to solve this problem?

        • markus

          pip install python-daemon

          • rob

            pip uninstall daemon
            apt-get install python-daemon
            worked for me

    • Bosn

      same error here
      re-installing the daemon does not help
      any ideas?

  • sam

    Hi thx for the tutorial, but i have a problem.

    I wirte: sudo insserv cloudprint

    Outputtext is: “insserv: script pyload: service pyload already provided!”

    What can i do now?

    thx sam

    • shyd

      Ew that’s weird. Stupid question, but are you sure you pasted the correct content into your file?
      Check if there is another executable script with pyload in it in /etc/init.d/. insserv checks through all executables when ran.

      • sam

        So this probrem is solved. I had 2 Script for pyload in the init.d -.-

        But now ich hab a new problem with the deamon.

        first he sayed after “cloudprint start” i need the deamon.
        then i installed it with pip install python-deamon.

        So, and now i have this exception, after “cloudprint start”:

        pi@raspberrypi /usr/local/bin $ /etc/init.d/cloudprint start
        Starting Google Cloud Print: pi@raspberrypi /usr/local/bin $ Traceback (most recent call last):
        File “/usr/local/bin/cloudprint”, line 9, in
        load_entry_point(‘cloudprint==0.7’, ‘console_scripts’, ‘cloudprint’)()
        File “/usr/local/lib/python2.7/dist-packages/cloudprint/”, line 475, in main
        File “/usr/local/lib/python2.7/dist-packages/daemon/”, line 189, in do_action
        File “/usr/local/lib/python2.7/dist-packages/daemon/”, line 124, in _start
        File “/usr/local/lib/python2.7/dist-packages/daemon/”, line 346, in open
        File “/usr/local/lib/python2.7/dist-packages/lockfile/”, line 226, in __enter__
        File “/usr/local/lib/python2.7/dist-packages/daemon/”, line 42, in acquire
        super(TimeoutPIDLockFile, self).acquire(timeout, *args, **kwargs)
        File “/usr/local/lib/python2.7/dist-packages/lockfile/”, line 90, in acquire
        raise LockFailed

        And now i dont know, what i should do.

  • smagee

    Reboot the RPi and the “daemon module required” message goes away. At least that worked for me.

  • ev23

    Things are working fine on Raspbian on a manual start “cloudprint start” but it doesn’t start on boot (made the insserv command) ….. any advice ?

    • I too had massive problems getting this to work. Well, actually, the script itself worked flawlessly when run as root and had me surprised at how easy it was to get it going. I spent hours trying to get it to work at boot time though. Nothing worked – manually adding to /etc/rc.local, specifying authentication with -a, hard-coding my details. The two problems seemed to be: (a) it was still prompting for details (despite me having typed them in from the command line once and it not prompting when I ran it manually) and (b) with the details hard-coded it would give an error about the service not being found. -a doesn’t seem to work at all, it wipes the auth file and then gives an authentication error, so I gave up with that.

      Eventually I figured out that the problem was my wireless hadn’t come up by the time cloudprint was run.

      1. Hard-code the logon details in the script (details in the link in the original post, although the line is more like 440 rather than 40)
      2. Create a script /etc/network/if-up.d/zcloudprintd which is simply (your init.d script name may vary; I changed mine):
      /etc/init.d/cloudprintd start


  • David Steele

    Debian packages for Cloud Print, with an init.d service:

    Install, then run “service cloudprintd login” as root.

    • Stuart

      this worked a treat, thanks David

  • Jason

    Thanks for sharing but it doesn’t seem to work with GAPPs accounts (ie.

    • I can’t test right now. But I set this up with my GAPPs account when I wrote this article.

  • Nick Sillito

    I’ve just tries setting this up on my system — running Ubuntu 10.04 LTS (64 bit), with a Canon PIXMA printer. This all works fine, and I can see the printer ok on the Google cloud print home page.

    However, when I try to print from my ‘phone — a Google Nexus 5 — as soon as I select this printer, I get the message “the print spooler has crashed, do you want to send an error report”

    I have some other printers set up on my account, and they work fine.

    Any ideas?

  • Thierry CHARLES

    fully reviewed service script for debian :

    # /etc/rc.d/cloudprint
    # Description: Starts the Google Cloud Print script on startup
    # —————-
    # Provides: Cloud-Print
    # Required-Start: cups $network $local_fs $syslog
    # Required-Stop: $local_fs $syslog
    # Default-Start: 2 3 4 5
    # Default-Stop: 0 1 6
    # Description: Start Google Cloud Print


    . /lib/lsb/init-functions

    function start() {
    log_begin_msg “Starting Google Cloud Print”
    if [ -f $PIDFILE ]
    log_end_msg 1
    return 1

    su – $USER -c “cloudprint -d -p $TMPPID”
    while [ $WAIT -gt 0 -a “!” -f $TMPPID ]
    sleep 1
    WAIT=$(( $WAIT – 1 ))

    if [ -f $TMPPID ]
    log_end_msg 0
    return 0
    log_end_msg 1
    return 1

    function stop() {
    log_begin_msg “Stopping Google Cloud Print”
    if [ “!” -f $PIDFILE ]
    log_end_msg 1
    return 1

    kill -9 cat $PIDFILE
    rm $PIDFILE
    log_end_msg 0
    return 0

    case $1 in
    sleep 1
    echo “Usage: cloudprint {start|stop|restart}”

    exit $RT

  • Ecclesia

    When I try to set up for insserv I am getting this error: insserv: script lpd: service cups already provided!

    Does anyone know how to set this up so that I can allow the script to start at boot. Obviously, it depends on cups – so if I remove this from init.d the script will run, but it won’t connect to cups and thus fails.