14.1.10

WD MyBook Hacks - Print Server

There are a plenty of tutorials on web on this topic, yet none of them worked for me out of the box, so I put   together this guide with steps that worked for me (mostly based on this and this tutorial).

The printer was a HP Laserjet 2300L equipped with USB connection only. Upon connecting the printer to the storage I encountered the first issue:

~#: lsusb

had no output at all. However

~#: cat /sys/bus/usb/devices/1-1/product
hp Laserjet 2300L

revealed that the printer is indeed there so that there is no hardware problem.
What we need first of all is the following:
 ~#: mount -t usbfs none /proc/bus/usb   
so that lsusb will be able to list devices. CUPS is ready to roll now:
~#: ipkg install cups cups-doc cups-driver-gutenprint cups-pdf hpijs

will install CUPS version 1.4.2 and HP printer device drivers.

Contrary to earlier versions in the package repository,  this one works well so no recompile is necessary (so the presence of gcc is not required). The web interface of CUPS will be available at http://IP_of_NAS:631. Since for /admin https is required (and is a good practice anyhow), we still need to create the proper ssl certificate since this automatism fails for some reason:

~#: openssl req -new -x509 -keyout /opt/etc/cups/ssl/server.key -out
/opt/etc/cups/ssl/server.crt -days 365 -nodes -config /opt/share/openssl/openssl.cnf


and then:
~#: cupsd
starts the daemon itself. We still lack the USB printing support which should be available as a kernel modul. This I found here (great thanks for Bertram Winter!). This should be put to the following directory:
/lib/modules/2.6.24.4/kernel/drivers/usb/class/. This can be easily achieved by issuing:

~#: mkdir /lib/modules/2.6.24.4/kernel/drivers/usb/class/
~#: wget http://members.aon.at/berwinter/mbwe/usblp.ko.whitelight -O /lib/modules/2.6.24.4/kernel/drivers/usb/class/usblp.ko

Don't forget to create the corresponding node!

~#: mknod /dev/lp0 c 180 0

So the modul is ready to be loaded:

~#: insmod /lib/modules/2.6.24.4/kernel/drivers/usb/class/usblp.ko
It worth a note that even though /dev/usb/lp0 exists, still /dev/lp0 has to be used.
So now we have three USB related moduls:
~#: lsmod | grep usb
usblp                  12064  0
usb_storage            35936  0
usbcore               120212  4 usblp,ehci_hcd,usb_storage

We can also test whether CUPS also sees what needs to be seen:
#:/opt/lib/cups/backend/usb 
DEBUG: list_devices
DEBUG: usb_find_busses=1
DEBUG: usb_find_devices=2

Now we can add the printer on the web interface: https://IP_of_NAS:631/admin
Login/pass are the root credentials. The printer should be visible after choosing "Find New Printer". The rest is quite self-explaining, I chose the corresponding HP Laserjet 2300 PS driver. Note: the "Share Printer" checkbox should be checked! Most of the default options are OK, only paper size has to be changed to A4 (at least in Europe ;)). Some fine tuning includes reduce of maximum amount of jobs and clients as this one is anyhow an embedded system. For this, refer to the following screenshot:




Now the printer should be visible if pressing "Manage Printers":



For the clients the printer will be available as: https://IP_of_NAS/printers/name_of_printer. In Windows one simply has to press Add Printer, choose Network Printer and provide the above address. As for printer driver, Generic -> MS Publisher Imagesetter works well:



It worth a note that here we chose to use the specific driver in CUPS, and issued the client to use a generic (postscript) driver. It can be done in the other way around as well: in that case Raw driver has to be chosen when adding the printer on the server and the specific driver has to be installed on the client.

At this point the only remaining task is to have all of these persistent, so have the CUPS daemon started when the device boots up. For this I made the following script based on this one:

#!/bin/sh

MODULE=/lib/modules/2.6.24.4/kernel/drivers/usb/class/usblp.ko
LPNODE=/dev/lp0
CUPSD=/opt/sbin/cupsd
SETUP=/opt/sbin/lpadmin
PRINTER="LaserJet_2300L"

case "$1" in
        start)
                if ( [ ! -c /dev/lp0 ] ) then
                        mknod $LPNODE c 180 0
                fi
                #/bin/chown sys:lp /dev/lp0

                if ( !(lsmod | grep "^usblp" -q) ); then
                         insmod $MODULE
                fi

                if [ -n "`pidof cupsd`" ]; then
                        /usr/bin/killall cupsd 2>/dev/null
                fi
        $CUPSD
        $SETUP -p $PRINTER -E
        ;;
        stop)
                if [ -n "`pidof cupsd`" ]; then
                        /usr/bin/killall cupsd 2>/dev/null
                fi
        ;;
        *)
                echo "Usage: (start|stop)"
                exit 1
esac


The script first makes sure that the device node exists and the module is loaded (the rest of the usb modules are anyhow loaded on startup). Then kills all instances of the daemon before starting the new process. Note that the printer has to be specifically enabled by lpadmin -p "printer name" -E which is done just after the daemon started.

80 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Thanks for a great tutorial!
    I noticed that you have a later kernel (2.6.24.4) than I have on my fw2.0.19 (2.6.17.14).
    Could this be the reason for me getting:
    # cupsd
    cupsd: can't resolve symbol 'stdout'
    ?
    How did you install the new kernel?

    ReplyDelete
  3. Hi,
    I made an update through the web interface before installing custom stuff. Note that doing in the other way around might overwrite custom modifications to the system config, although I haven't checked it.
    Anyhow, give it a try with a newer kernel, also issuing an "ipkg --update" and "ipkg --upgrade" might do the trick as well.

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. Hi,
    I made all these steps above, but CUPS can't find my printer. It's a HP Deskjet F2420.
    I installed the hplip and hpijs.

    # /opt/lib/cups/backend/usb
    DEBUG: list_devices
    DEBUG: usb_find_busses=1
    DEBUG: usb_find_devices=2

    lsusb
    Bus 001 Device 003: ID 03f0:7611 Hewlett-Packard
    Bus 001 Device 001: ID 0000:0000

    # cat /sys/bus/usb/devices/1-1/product
    Deskjet F2400 series


    Any ideas what I could do?!?

    ReplyDelete
  6. Hi,
    If it is already missing when you try to add it on the web interface then it is not a driver issue.
    Is usblp module loaded into the kernel?
    Also make sure that /dev/lp0 node is created.
    These are my first and trivial shoots.

    Regarding to the driver issue google found the following page:
    https://answers.launchpad.net/hplip/+question/87325
    "HP Deskjet F2420 is supported by HPLIP 3.9.10 which is due to be released soon, however we can't give the exact time line as to when it will be released and the release might get delayed if there are some unavoidable circumstances.
    So you can find the HPLIP release 3.9.10 from http://hplipopensource.com/hplip-web/index.html"

    Good news is that 3.10.5 is already available, bad news is that it is still not ported to mybook:
    ~#: ipkg update
    ~#: ipkg list | grep hplip
    hplip - 2.8.12-1 - HP Linux Imaging and Printing

    Sorry for that, maybe you should give some generic HP driver a try, if available (I cannot check it now).

    ReplyDelete
  7. Hi,

    Well the usblp module is loaded with the command in your tutorial, the same with de dev/lp0 node.

    After I rebooted my Mybook, I had to run this command, mount -t usbfs none /proc/bus/usb, again to see the usb devices.

    I got my MyBook with fw-version 01.01.18
    could this be the problem?!?

    ReplyDelete
  8. just tested it...has nothing to do with 01.01.18...damnit I've no clue...

    ReplyDelete
  9. Let me understand: if you try "Find new printers" your Deskjet doesn't show up. What if you simply add it manually using the button Add new printer?
    I have to admit that I didn't test this, nor can I try it right now.

    ReplyDelete
  10. well...tested this too...I can connect to the printer via Win7...but in cups it says "Paused Permission denied" :(

    ReplyDelete
  11. How did u solved the problem of permissions?
    Paused - "Unable to open device file "/dev/lp0": Permission denied"
    Thks

    ReplyDelete
  12. I solved temporarily with "chown sys /dev/lp0"

    ReplyDelete
  13. Hi,
    Mine says:
    # ls -l /dev | grep lp0
    crw-rw-rw- 1 root root 180, 0 Jan 4 2010 lp0

    ReplyDelete
  14. Hello Attila,
    at first I have to say - really nice tutorial. I already found & read a lot of tutorials regarding hacking WD Mybook, but this one is the best.
    I try to print on the printer connected to MyBook, but - printer is installed, I see printer in cups admin interface, but I cannot load modul usnlp.ko to the kernel, so when I try print test page for example - nothings happend - printer do nothing, is still in idle mode and print job is "done"..

    This is my configuration:
    My Book World Edition (white light) - fw.:01.02.06
    Printer: HP Deskjet F2420
    cups: 1.4.6-1
    hpijs: 2.1.4-1

    I made everything step by step by your tutorial:

    [root@MyBookWorld ~]# mount -t usbfs none /proc/bus/usb

    [root@MyBookWorld ~]# lsusb
    Bus 001 Device 002: ID 03f0:7611 Hewlett-Packard
    Bus 001 Device 001: ID 0000:0000

    [root@MyBookWorld ~]# cat /sys/bus/usb/devices/1-1/product
    Deskjet F2400 series

    installing cups, making ssl certificate until this:

    [root@MyBookWorld ~]# insmod /lib/modules/2.6.24.4/kernel/drivers/usb/class/usblp.ko
    insmod: cannot insert `/lib/modules/2.6.24.4/kernel/drivers/usb/class/usblp.ko': Invalid module format (-1): Exec format error

    so when I try

    [root@MyBookWorld ~]# lsmod | grep usb
    usb_storage 35936 0
    usbcore 120212 3 ehci_hcd,usb_storage

    As I checked on http://members.aon.at/berwinter/mbwe/mbwe_en.html kernel module was tested with firmware 01.00.16, 01.00.18 and 01.01.16 - but I don't wanna downgrade...Any advice for me? Many thanx.

    ReplyDelete
  15. Hi,
    One post should be enough :)
    Is the usblp.ko the one downloaded from
    http://members.aon.at/berwinter/mbwe/usblp.ko.whitelight ?
    If so, what kernel version reports uname -a ?
    If it is different from 2.6.24.4, then either the module has to be recompiled for your actual version, or you have to downgrade.

    ReplyDelete
  16. Hi Attila,
    you right - one post is more than enought..:) - I'm so sorry, I cannot post it properly first time.
    Actually, my problem with printing on WD Mybook is resolved. Like usually, problem was somewhere between the chair and the keyboard..:) As I wrote to you - I do everything step by step like in your tutorial, until loading the kernel module usblp.ko.
    I was thinking - that's the problem why I cannot print - but that's no true - not really.
    So, I'm install and configure Cups. After that, when I try to print out testing page from Cups Administration page - nothings happend. Why? Simply, I found answer in one forum - I'm not sure, but the true is - it's works for me. Because when we setup printer in Cups, we select Raw option in model and driver selection. It means, there is no "regular" driver for the printer, cups just forwards incoming raw data to the printer. So, when I try to print test page from Cups web-GUI - it looks like job is done, in the log file is no error messages and the printer do nothing. Of course, because Cups without driver cannot make any regular raw data.
    But, when I install this printer like network printer (http://NAS_IP_ADDRESS:631/printers/PRINTER_NAME), everything works perfectly.
    I'm just edit your starting script like:

    #!/bin/sh

    CUPSD=/opt/sbin/cupsd

    case "$1" in
    start)
    mount -t usbfs none /proc/bus/usb

    if [ -n "`pidof cupsd`" ]; then
    /usr/bin/killall cupsd 2>/dev/null
    fi
    $CUPSD
    ;;
    stop)
    if [ -n "`pidof cupsd`" ]; then
    /usr/bin/killall cupsd 2>/dev/null
    fi
    ;;
    *)
    echo "Usage: (start|stop)"
    exit 1
    esac


    Anyway, now everything works, but just for interest, I wanna know what's wrong with the kernel module usblp.ko and why I cannot load it:

    [root@MyBookWorld ~]# insmod /lib/modules/2.6.24.4/kernel/drivers/usb/class/usblp.ko
    insmod: cannot insert `/lib/modules/2.6.24.4/kernel/drivers/usb/class/usblp.ko': Invalid module format (-1): Exec format error

    [root@MyBookWorld ~]# echo hello>/dev/lp0
    -bash: /dev/lp0: No such device

    [root@MyBookWorld ~]# lsmod | grep usb
    usb_storage 35936 0
    usbcore 120212 3 ehci_hcd,usb_storage

    Of course, I downloaded usblp.ko from http://members.aon.at/berwinter/mbwe/usblp.ko.whitelight and I use right kernel version:

    [root@MyBookWorld ~]# uname -a
    Linux MyBookWorld 2.6.24.4 #1 Thu Apr 1 16:43:58 CST 2010 armv5tejl unknown

    ReplyDelete
  17. Hi, ive connected a Canon IP5000,

    cat /sys/bus/usb/devices/1-1/product
    shows iP5000
    GUI only shows "looking for printers"

    any ideas?

    thanks

    ReplyDelete
  18. Hi, I have installed as given in the guide and everything went well without any errors.

    But now when I am trying to open the URL: http://:631/ I am not getting anything and browser is not able to load the page. I tried with https too but without any luck.

    I went to the document root of the cups-doc, i.e. /opt/share/doc/cups, I do not see any cgi scripts or anything.

    Am I missing something here?

    thanks

    ReplyDelete
  19. Hi,
    cat /sys/bus/usb/devices/1-1/product

    return

    "USB2.0 Printer (Hi-speed)"

    my epson stylus photo r285 is not compatibile with cups?

    ReplyDelete
  20. I have been reading your posts regularly. I need to say that you are doing a fantastic job. Please keep up the great work.


    123 HP Oj7612 Printer Support

    ReplyDelete
  21. Great blog! I really love how it is easy on my eyes and the information are well written.

    123HPEnvy OfficeJet3834 Install

    ReplyDelete

  22. I actually enjoyed reading through this posting.Many thanks.
    123 HP Officejet Printer Models

    ReplyDelete
  23. Thank u for the wonderful post !!


    123 HP Setup

    ReplyDelete
  24. A very interesting article. The insights are really helpful and informative. Thanks for posting.

    123 HP Officejet 7612 Printer Setup

    ReplyDelete

  25. Thanks for sharing your info. I really appreciate your efforts and I will be waiting for your further write.I like the post

    123 HP OJ5743 Setup

    ReplyDelete
  26. Nice post. I was checking continuously this blog and I am impressed! Very helpful information specially the last part :) I care for such info a lot. I was looking for this certain info for a long time. Thank you

    123.hp.com/envy4520

    ReplyDelete
  27. Very nice blog...... Hot Tot Hair Products seems to be very useful.... I would like to try them if i could buy them in Australia.... Nice work, keep it up.

    123 hp setup envy 4520

    ReplyDelete
  28. Great post.I'm glad to see people are still interested of Article.Thank you for an interesting read........


    hp envy 5055 manual

    ReplyDelete
  29. Thank you for your post. This is excellent information. It is amazing and wonderful to visit
    your site.
    123 HP Envy 4520 Setup

    ReplyDelete
  30. This is really an awesome article. Thank you for sharing this.It is worth reading for everyone.



    officejet pro 6968 install

    ReplyDelete
  31. It's an interesting article..!! Thanks for sharing. For Router Queries, Check in to our site..!!

    123.hp.com/setup
    123.hp.com
    Epson Printer Support
    Router Support

    ReplyDelete
  32. Excellent information on your Article, thank you for taking the time to share with us such a nice article. Also, check our sites.

    123.hp.com||123.hp.com/setup||123 HP Setup||hp.com/setup||hp.com/123||123.hp.com setup||123 HP Printer Setup||123 HP Printer Support||123 HP Setup and Install||123hpcom

    ReplyDelete
  33. Nice Content ,Want to setup HP OfficeJet Pro 8600 Driver in windows? IT provides you with various different features. You can use your HP OfficeJet 8600 printer to print, scan, copy, and fax. Furthermore, it has an ADF that you can use for quick scanning and copying.Any Queries Visit 123hp.com setup to get more details.

    ReplyDelete
  34. Great Content here some tips regarding HP Printer, Want to Troubleshoot HP ENVY 5055,It is very simple Uninstall the existing driver and update the matching version. It’s important to cross-check and ensure that the drivers are compatible to use with your model After that, all you have to do is navigate to 123.hp.com/setup 5055 and download the Drivers.

    ReplyDelete
  35. The activation of Roku is quite simple. All you need is a Roku streaming device, a high-speed internet connection, cables to set up and connect the devices. To start with, you need a Roku account for linking the device with your account. After performing the hardware setup login to your Roku account. If you are a new user then create a Roku account. The existing users can log in directly with their login credentials. Follow the instructions step-by-step carefully that is given on the official Roku website and complete the process. After you finish, an activation code will appear on the TV screen. Now visit Roku.com/link and enter the code. For further inquiries and clarification on the Roku.com/link , visit our website.

    ReplyDelete
  36. Nice Blog Post Thanks for sharing this.

    MagicJack uses the internet connection for allowing you to make calls on this device. The best part of this device is that you can get customer support service on phone.

    How to activate magicjack.com
    How To Set Up magicJack Go
    How to install Magicjack Go
    www magicjack tech helpline number
    magicjackcom support phone number
    Magicjackcare.com phone number


    ReplyDelete
  37. Nice post and please provide more information. Thanks for sharing.
    123hpcom envy4512

    ReplyDelete
  38. If you need to use any type of model of HP printer for your printing needs, you can set up your suggested model number of HP printer using printer setup. This website assists you to set up the suggested model number of your HP printer in the suitable ways. First of all, you want to open this link in your suggested browser and download the application step by step. After that, you want to perform shown steps in the direct ways. If you get jammed in the procedure, you can take the good technician from an online technical specialist.

    ReplyDelete
  39. It is a valid link to activate www.amazon.com/mytv or primevideo.com/mytv in your device. You can watch Amazon prime video on amazon mytv, just you need to enter a 6 digit amazon registration code on your device.

    ReplyDelete
  40. Am I a small business owner and having the essentials of a printer. So as per my needs, I suggest HP printer. HP printer is totally an easy printing machine for users. This printing device has the advance and amazing features, so I suggest this brand most. I look furthur to using the HP printer via 123.hp.com/setup , but I don’t have enough skill to complete the setup process. rapidly, I look for the technician assists to help me for the HP printer setup procedure. So please someone can refer me to the proper instructions to set up an HP printer.
    123.hp.com/ojpro8035
    123.hp.com/ojpro9025

    ReplyDelete
  41. This is one step goal to find all the documents and driver applications related to all the HP printer models. Along with this, we have indicated here a good and easy process for 123 HP Deskjet 3630 Printer Setup. So for what reason would you say you are stopping? Hit the connection and appreciate top tier printing results.

    ReplyDelete
  42. I want a 123 Hp Envy 7800 Printer Setup for printing help. I trust in using HP products for my wireless printer function. HP printer is an excellent printing system, so legion users choose it for their printing needs. I want to set up an HP printer with the assist of 123.hp.com/setup. First of all, I have opened this link in my suggested browser. Then, I entered the model number of my 123 Hp Envy 7800 Printer Setup in the shown box. I am finishing this step to introduce a printer driver or apply HP direction for the HP printer setup procedure. After this step, I am getting stuck to finish the HP printer using 123 hp envy 7800 printer setup. I am facing technical issues to complete the HP printer setup procedure. So anyone can share the easy ways to set up anless printer with the assist of 123.hp.com/setup.

    ReplyDelete
  43. Watch FuboTv on your device to sign in or create a new Fubo account using email and password. FuboTv is a premium online streaming services used at fubotv Connect.It gives users access to a wide range of services like live broadcasting, watches unlimited videos online, select more then 150 channels. Viewers can watch live sports for 7 days free trail membership. fubo.tv/Connect

    ReplyDelete
  44. In the initial step, you want to open your web page in the chosen browser. Next step, you want to type the model number of your 123.hp.com/ojp8710 printer in the shown box. Following, you want to complete the instructions shown for setting up the HP printer.

    ReplyDelete
  45. Wow,amazing blog structure! How long have you been running a blog for you make running a blog look easy. The total look of your website is wonderful, as smartly as the content! simply couldn’t leave your web site before suggesting that I actually loved the standard information an individual provides to your guests? I am gonna be frequenting in order to check out new posts.

    A better quality printer supports high-speed printing and works on quality performance. If you have any question please our website - http//ij.start.canon

    ReplyDelete
  46. You write this article is amazing and informative. You easily explained every topic in article. I am impressed your writing style. Thank you for sharing the information. It is a very helpful for me.

    So we are also providing the printer http //ij.start.canon setup repairing service online. You can repair your printer remotely. If you have any query so visit our website - canon.com/ijsetup

    ReplyDelete
  47. lovely blog with full of information. This article is so interesting that caught my attention. And I simply could not resist to leave a comment. Definitely I will be following your blog for more knowledge and information.And I simply could not resist to leave a comment. read more

    ReplyDelete
  48. This comment has been removed by the author.

    ReplyDelete
  49. Great post on hacking the WD MyBook as a print server! The steps and insights are really valuable for tech enthusiasts. On a different note, if anyone is experiencing issues with their HP Envy 5530 printer, I found some excellent troubleshooting tips that could be really helpful. You can check them out here. Thanks for sharing this informative guide!
    Visit to know more in detail =https://l4rgdigitalplus.com/tech-support-services

    ReplyDelete