USB printer on LS Pro V2 with 1.15 firmware

From NAS-Central Buffalo - The Linkstation Wiki
Revision as of 14:20, 15 June 2009 by Aplesch (Talk | contribs)

Jump to: navigation, search

Step by Step:

I tried to explain each step so these instruction became pretty long. The actual setup actually does not take very long.

1) update linkstation to stock 1.15 firmware from Buffalo:

direct link:

Use Buffalo instructions to update. I did not have problem using my wireless connections, recommended is a wired connection.

The firmware adds timers to the web interface (sleep at night), and is maybe faster (?). Probably a good idea anyways to update to the latest product firmware.

2) use acp_commander to reset root password

Follow instructions here:


use firmware 1.11-1a instructions.

The instructions are very detailed and therefore long. The process itself is quick and fun because you gain a lot of power.

I installed the addons with acp_commander. The included wget does not work for me on the LS. Not a problem, since I use my laptop to download anyways. Then just move files to the LS samba share "share" which is /mnt/disk1/share on the LS. I actually made a new directory /mnt/disk1/operator as a place to put files (It was then picked up automatically by samba or some daemon and made available as a share via samba).

3) telnet in and enable sshd:

actually part of instructions above. I use the much recommended putty as a telnet and ssh client:

Reboot to make sure that ssh and/or telnet works.

4) replace stock kernel with kernel to get usb printing

This is more exciting since now you are about to leave the coziness of the company approved environment somewhat. The kernel available at

is still compiled from the Buffalo LS kernel sources, so is still a 2.6.16 kernel. It has a lot more functionality enabled including a lot of kernel modules such as usblp.ko and enabled usb printing. The thread at

discusses recompilation efforts,

is where this recommended kernel appears in the discussion.

discusses it among other kernels as well, specifically at

Installation boils to downloading the package, moving it over to the LS, to say /mnt/disk1/operator/kernel1, then unpacking it:

root@LS-GLE1D:/mnt/disk1/operator/kernel1# tar xzvf kernel-

This produces a boot directory which has the kernel and a lib/modules directory which has the kernel modules.

Then one needs to replace the kernel by copying the new kernel to /boot, moving the original kernel out of the way, and symlinking uImage.buffalo to the new kernel:

root@LS-GLE1D:/mnt/disk1/operator/kernel1# cp boot/uImage- /boot/
root@LS-GLE1D:/mnt/disk1/operator/kernel1# cd /boot
root@LS-GLE1D:/boot# mv uImage.buffalo uImage.buffalo.fw115
root@LS-GLE1D:/boot# ln -s uImage- uImage.buffalo

Double check to make you did not mistype something, otherwise the new kernel will not be found at boot time, and the machine cannot boot.

By symlinking the new kernel it is easy to go back to the original kernel when necessary.

Finally one needs to also copy over the modules

root@LS-GLE1D:/boot# cd /mnt/disk1/operator/kernel1
root@LS-GLE1D:/mnt/disk1/operator/kernel1# cp -pr lib/ /

The -p flag is for preserving permission (and dates) based on the assumptions that the permissions were done correctly in the download package. (The -r flag stands for recursive and is necessary in order to copy whole directories).

5) reboot: the moment of truth

You can just type reboot at the prompt. You machine will go through its stop scripts (eg. you loose the connection) and reboot.

The machine should come back up and beep. It takes maybe a minute.

6) modprobe usblp

Now you have a usb printing enabled kernel. To actually enable usb printing one must load the usblp kernel module with modprobe:

root@LS-GLE1D:~# modprobe usblp

Check that it loaded with lsmod:

root@LS-GLE1D:~# lsmod
Module                  Size  Used by
*usblp                  12160  0
appletalk              32464  20
psnap                   3268  1 appletalk
llc                     6132  1 psnap

(* added for emphasis)

Connecting a USB printer and loading the module creates a device at /dev/usb/lp0 .

Test by:

root@LS-GLE1D:~# cat /dev/usb/lp0
cat: /dev/usb/lp0: No such device

If this error message appears you do not have the device and you cannot print. Either there is no usb printer connected or the module is not loaded. Instead, there should be no error message. For me the command clears the screen because the printer sends some control character.

Now you could start sending data to printer directly. Eg. you could print to a file with the windows printer driver, move the file to the LS, and cat it to the device to check if it does something, possibly print.

root@LS-GLE1D:~# cat printed.prn > /dev/usb/lp0

(I sent a wrong file to the printer and it started to spit out empty pages ..)

7) install lprng (from .tgz but just lprng not web stuff)

Let's not use samba printing because samba uses lpr anyways and windows actually includes a good lpr for printing to a lpd. This way we remove a layer which make it less complex and therefore easier to understand. Also, it works well. The idea is to pass through without filters (which otherwise are a convenience feature for unix printing) data from the windows printer driver to the USB printer via lpd. lpd listens on port 515 for data requesting print jobs and then jumps into action. It forwards data to the printer and also does accounting which I do not really need.

Get the package from

Put it on the LS, say on /mnt/disk1/operator and unpack it.

root@LS-GLE1D:/mnt/disk1/operator# mkdir lprng-withweb
root@LS-GLE1D:/mnt/disk1/operator# mv lprng-withweb_2.04.tgz.gz lprng-withweb/
root@LS-GLE1D:/mnt/disk1/operator# cd lprng-withweb/
root@LS-GLE1D:/mnt/disk1/operator/lprng-withweb# tar xzvf lprng-withweb_2.04.tgz.gz

The instructions on


unpack right in the system root /. Let's do it more carefully. I will leave out the included web interface because it does not work for firmware 1.15 and is not really useful to me. The printer should just work when I connect it to the LS.

a) install binaries by copying them over to standard directories.

root@LS-GLE1D:/mnt/disk1/operator/lprng-withweb# cp -ipr usr /

The usr directories have all the executables and libraries and we can just copy them over. The -i flag makes sure we do not accidentally overwrite system files., and -p preserves permission (and symlinks).

b) install config files by copying them over to standard directories.

I did not want to overwrite the default samba init script, so let's rename first the provided and then copy.

root@LS-GLE1D:/mnt/disk1/operator/lprng-withweb# mv etc/init.d/ etc/init.d/
root@LS-GLE1D:/mnt/disk1/operator/lprng-withweb# cp -ipr etc /

Again, we do not need a modified but let's have the provided one there in case we want it later.

We could also copy over the man pages but since man is not included in stock it does not make a lot sense. One can always use google to read man pages.

c) setup directories

We could use the included script to set up directories but let's do it step by step. The script first sets up the device directory but it should be already there by default:

root@LS-GLE1D:/mnt/disk1/operator/lprng-withweb# ls -la /dev/usb/lp*
crwxrwxrwx    1 root     root     180,   0 Dec  8  2006 /dev/usb/lp0
crwxrwxrwx    1 root     root     180,   1 Dec  8  2006 /dev/usb/lp1
crwxrwxrwx    1 root     root     180,   2 Dec  8  2006 /dev/usb/lp2

Then the scripts creates spool directories for lpd, so let's do that:

root@LS-GLE1D:/mnt/disk1/operator/lprng-withweb# mkdir /var/spool/win /var/spool/tmp /var/spool/samba

/var/spool/tmp and /var/spool/samba are for samba printing which we will not use but let's create the directories anyways for future use.

Then the script opens up wide the spool directories and /dev/null, so let's do that, too:

root@LS-GLE1D:/mnt/disk1/operator/lprng-withweb# chmod 777 /var/spool/* 
root@LS-GLE1D:/mnt/disk1/operator/lprng-withweb# chmod 666 /dev/null

I am not sure if that 777 on the spool directories is necessary and checkpc does complain:

root@LS-GLE1D:/mnt/disk1/operator/lprng-withweb# checkpc
Warning - owner/group of '/var/spool/win' are 0/0, not 2/2
Warning - permissions of '/var/spool/win' are 0777, not 0700
Warning - lp-ps: CATASTROPHIC ERROR! queue 'lp' also has spool directory '/var/spool/win'

This also shows that the included printcap file is not valid. It will still work but one should remove the second queue (lp-ps) or point it to another spool directory.

If you run "checkpc -f" checkpc will attempt to fix problems. Here, it will change the owner of the spool directories to daemon:daemon which is (presumably) preferable to root.

d) edit init scripts a bit

The only change I made to the provided /etc/init.d/ script is to add a line to modprobe usblp. This way we do not need to modprobe manually each time after a reboot. I did not find another obvious place in the firmware where modules are loaded on boot. I put the line in the start section where to me it makes the most sense. One could also remove it again in the stop section but removing it does not gain anything except for a bit of memory. Modprobing after it is already loaded does not seem to hurt.


        #Let's check about melco
        if [ $printer = off ] ; then
            /usr/bin/logger -t ${tag} -p ${facility} 'Not started lpd'
            exit 0

        # Start daemons.
        echo -n "Starting lpd: "


        #Let's check about melco
        if [ $printer = off ] ; then
            /usr/bin/logger -t ${tag} -p ${facility} 'Not started lpd'
            exit 0
        #AP: load module here because nowhere else is obvious
        modprobe usblp
        # Start daemons.
        echo -n "Starting lpd: "

Use vi to edit. (In vi use the arrow keys to navigate, press "i" to insert text or delete text with backspace, press "ESC" to get out of edit mode, and press ":wq" to write the file and quit.)

Going through the script now again, I found that the stop script does not work with the default busybox ps. Edit the script so it reads PSHOWALL="".

To automatically start the script at boot also edit /etc/init.d/rcS and add to the scripts in section 3:


echo "** step3 **"
for cmd in


echo "** step3 **"
for cmd in

e) edit configs

The scipts are setup to look into /etc/melco/printer to check if printing is switched on. I guess that is how the web interface can control the setup. Let's just edit the file by hand, with vi, or with sed:


root@LS-GLE1D:~# more /etc/melco/printer


root@LS-GLE1D:~# more /etc/melco/printer

In my case I cannot see a situation where I would want printer=off.

I also edited /etc/lpd/lpd.conf to keep spool directory from growing:


 # Purpose: keep the last NN done jobs for status purposes
#   default done_jobs= 1  (INTEGER)
# Purpose: keep done jobs for at most max age seconds
#   default done_jobs_max_age= 0  (INTEGER)


 # Purpose: keep the last NN done jobs for status purposes
#   default done_jobs= 1  (INTEGER)
# AP: repeat to make sure it is set
# Purpose: keep done jobs for at most max age seconds
#   default done_jobs_max_age= 0  (INTEGER)
#AP: to make sure that things get removed
done_jobs_max_age= 7200

The lpd.conf edits are optional and there many more settings which might be useful.

8) start up lpd with init script

After installation we can now start lpd:

root@LS-GLE1D:~# /etc/init.d/ start
Starting lpd:

check with ps if lpd is running:

root@LS-GLE1D:~# ps
15592 daemon      444 S   lpd Waiting

9) set up windows printers (clients): XP: print service for UNIX; Vista: LPR and LPD options

Now, the last step is to set up new windows printers. In windows language these will not be network printers but local printers with a special port. For some reason a standard tcp/ip port in lpr mode (port 515) does not work. One needs to use special LPR ports. In Vista and XP these need to be enabled first. In Vista this option is very hidden:

control Panel - programs and features - turn windows features on and off - print services: LPD print service and LPR port monitor on

In XP the equivalent is here:

control panel - network connections - advanced - optional networking components - other network file and print services - print services for unix

After enabling one now has the option to connect a new local printer to a new LPR port. The IP adress of the LPR port is the IP address of the LS in your network, and the queue name is "lp" (as defined in /etc/printcap)

Use the default windows printer driver for your printer. Some printer apparently need special advanced settings such as "start printing after last page is spooled" and "enable bidirectional support". For my Brother HL 2040 the defaults worked.

This is now a not so rough guide with pretty detailed instructions. It looks long but the explanations take up most of the space.