Koozali.org: home of the SME Server

Getting CUPS/Samba to Store Printer Drivers

Offline arnoldob

  • *
  • 183
  • +0/-0
Getting CUPS/Samba to Store Printer Drivers
« on: April 20, 2005, 07:32:31 PM »
Can anyone point me the right way to get CUPS/Samba 2.2.8a to store the client drivers on my SME 6.0.1 server? I did some research and found the samba "use client driver = no" setting and added it to:

/etc/e-smith/templates-custom/etc/smb.conf/50printers
and
/etc/e-smith/templates-custom/etc/smb.conf/61printerdriversshare

Ran this:
/sbin/e-smith/expand-template /etc/smb.conf
service smb restart

But when I tried to get a Win2K client to upload additional drivers the Win2K choice is already selected and can't be changed. I did this logged on the client as admin since that's in the "printer admin" setting. The clients still get a message that the driver is not on the server.  I also tried to use the advanced workgroups 0.3-4 add-on, with the no effect. I also tried manually placing the required driver files into:
/home/e-smith/files/samba/printers/W32X86
But I got the same result.

Is there some other secret handshake I'm missing here?


Here the globals and the two printer sections from the smb.conf file:
[global]
add user script = /sbin/e-smith/signal-event machine-account-create '%u'
bind interfaces only = no
case sensitive = no
character set = ISO8859-1
client code page = 850
deadtime = 10080
dns proxy = no
domain admin group = adult
domain logons = no
domain master = no
encrypt passwords = yes
guest account = public
guest ok = no
hosts allow = 127.0.0.1 192.168.1.0/255.255.255.0
interfaces = 127.0.0.1 192.168.1.1/255.255.255.0
kernel oplocks = true
level2 oplocks = true
log file = /var/log/samba/log.%m
map to guest = never
max log size = 50
name resolve order = wins lmhosts bcast
netbios name = server
oplocks = true
pid directory = /var/run
preserve case = yes
printer admin = admin arnoldo carmen sonnyb9
security = user
server string = SME Samba ver. %v
short preserve case = yes
smb passwd file = /etc/samba/smbpasswd
socket options = TCP_NODELAY
strict locking = no
unix password sync = Yes
pam password change = Yes
wins support = no
workgroup = home
load printers = yes
printing = cups

[printers]
comment = All Printers
path = /var/spool/samba
browseable = no
guest ok = yes
public = yes
writable = no
printable = yes
use client driver = no

[print$]
comment = Printer drivers
path = /home/e-smith/files/samba/printers
guest ok = yes
browsable = yes
writable = yes
use client driver = no
Tampa, FL USA

Offline arnoldob

  • *
  • 183
  • +0/-0
Getting CUPS/Samba to Store Printer Drivers
« Reply #1 on: April 20, 2005, 10:50:31 PM »
I found an explanation of sorts here:
http://us3.samba.org/samba/docs/man/Samba-HOWTO-Collection/printing.html#id2574373

Quote
The initial listing of printers in the Samba host's Printers folder accessed from a client's Explorer will have no real printer driver assigned to them. By default this driver name is set to a null string. This must be changed now. The local Add Printer Wizard (APW), run from NT/2000/XP clients, will help us in this task.

Installation of a valid printer driver is not straightforward. You must attempt to view the printer properties for the printer to which you want the driver assigned. Open the Windows Explorer, open Network Neighborhood, browse to the Samba host, open Samba's Printers folder, right-click on the printer icon and select Properties.... You are now trying to view printer and driver properties for a queue that has this default NULL driver assigned. This will result in the following error message:

Device settings cannot be displayed. The driver for the specified printer is not installed, only spooler properties will be displayed. Do you want to install the driver now?

Do not click on Yes! Instead, click on No in the error dialog. Only now you will be presented with the printer properties window. From here, the way to assign a driver to a printer is open to us. You now have the choice of:

    *Select a driver from the pop-up list of installed drivers. Initially this list will be empty.

    *Click on New Driver to install a new printer driver (which will start up the APW).

Once the APW is started, the procedure is exactly the same as the one you are familiar with in Windows (we assume here that you are familiar with the printer driver installations procedure on Windows NT). Make sure your connection is, in fact, setup as a user with printer admin privileges (if in doubt, use smbstatus to check for this). If you wish to install printer drivers for client operating systems other than Windows NT x86, you will need to use the Sharing tab of the printer properties dialog.


That got the drivers to the print$ share in the W32X86/3/ directory. Also when you right click a blank spot in the SME server printer folder it shows the installed driver there.

I was ready to declare victory and call it a day, but the clients still won't load the drivers from the server. When they say "Installation of a valid printer driver is not straightforward." they are not kidding. Any ideas?
Tampa, FL USA

Offline arnoldob

  • *
  • 183
  • +0/-0
Getting CUPS/Samba to Store Printer Drivers
« Reply #2 on: April 24, 2005, 12:14:36 AM »
I created a filtering queue and used the cupsaddsmb utility to export  the postscript drivers as described in the howto for cups filtering queues. That went well and I was able to point click and get the drivers on a client. But now it won't print at all via the filtering queue.

After trading e-mails with the SME CUPS add-on author (Thanks Robert) and looking through the documentation here:
http://us3.samba.org/samba/docs/man/Samba-HOWTO-Collection/CUPS-printing.html
I was able to determine a method for SME 6.0. My intent is a set-up where clients can get drivers on the fly and print by simply clicking on the printer share:

1. Set-up a filtering queue in the CUPS web interface. For instructions see the SME CUPS docs:
http://mirror.contribs.org/smeserver/contribs/rvandenaker/beta/e-smith-cups/documentation/howtos/cups-add-printer.html

I have a usb printer, which linux detected and was displayed with the usb port in the list of devices. Select whatever device your printer is connected to, this may require further configuration, see the docs. I don't know if other devices make it as easy.

I used "postscript" for the printer make, then "generic postscript" for the model, even though I use a non-postscript printer. I did this because I can't find a PPD file for my printer.

2. Use cupsaddsmb utility. Install this optional package if you didn't already:
http://mirror.contribs.org/smeserver/contribs/rvandenaker/beta/e-smith-cups/SME_6.0/optional/cups-samba-1.1.19-1rvda.noarch.rpm
 to move the postscript drivers installed with CUPS to the print$ share and register the driver with samba. You can't just move files to the /home/e-smith/files/samba/printers directory, it won't work, I tried :)
Code: [Select]

cupsaddsmb -U admin -v -a

Don't forget to "Synchronize" the printer list from the server-manger "Printers" link.

3. Create directories and copy some template fragments to support filtering queues on non-Postscript printers:
Code: [Select]

mkdir -p /etc/e-smith/templates-custom/etc/cups/mime.types/

cp /etc/e-smith/templates/etc/cups/mime.types/50RawTypes /etc/e-smith/templates-custom/etc/cups/mime.types/50RawTypes

and also this one:
Code: [Select]

mkdir -p /etc/e-smith/templates-custom/etc/cups/mime.convs/

cp /etc/e-smith/templates/etc/cups/mime.convs/30RasterFilters /etc/e-smith/templates-custom/etc/cups/mime.convs/30RasterFilters


4. Edit the template-custom fragements:
Code: [Select]

pico /etc/e-smith/templates-custom/etc/cups/mime.types/50RawTypes

add this line to the end of the file:
Code: [Select]

application/vnd.cups-raw


Code: [Select]

pico /etc/e-smith/templates-custom/etc/cups/mime.convs/30RasterFilters

add this line to the end of the file:
Code: [Select]

application/octet-stream   application/vnd.cups-raw   0   -

5. Expand the templates and tell CUPS to re-read the configuration:
Code: [Select]

/sbin/e-smith/expand-template /etc/cups/mime.convs

/sbin/e-smith/expand-template /etc/cups/mime.types

/sbin/e-smith/signal-event cups-reconfigure

To revert back to the orginal setup, delete the templates-custom fragments you copied in step 3 and run the commands in step 5 again.

I intend to test and update this post with the results as time permits.
Tampa, FL USA

Robert

Getting CUPS/Samba to Store Printer Drivers
« Reply #3 on: April 24, 2005, 12:15:35 PM »
There are some points here that need correcting. Apologies to Arnoldo that I didn't make myself clear in my emails.
Quote from: "arnoldob"
I used "postscript" for the printer make, then "generic postscript" for the model, even though I use a non-postscript printer. I did this because I can't find a PPD file for my printer.

That won't work. CUPS will send PostScript to your printer and if it 's not a PostScript printer, it will choke on it. What may be confusing is statements that you sometimes read that in CUPS every printer is effectively a PostScript printer. What that means is that if you have a filtering queue, you can feed it PostScript regardless of what language(s) the printer natively supports. That's because CUPS translates the PostScript to the printer's native language.

If you want to use a filtering queue with your printer, you will need a matching PPD (and filter). You should look up your printer in the database on http://www.linuxprinting.org; if your printer is supported in Linux, the database will list the appropriate PPD/filter. What's the make and model?

Quote from: "arnoldob"
3. Create directories and copy some template fragments to support filtering queues on non-Postscript printers: [...snip]

That's not exactly what that does. These template fragments are not for supporting filtering queues on non-postscript printers, but rather to allow raw file types to pass through filtering queues unfiltered. This means you can use the vendor-supplied Windows driver for your non-postscript printer and use it to print to a filtering queue controlling that printer. Normally you need to use a PostScript driver to print to a filtering queue and you need a raw queue if you want to use the vendor-supplied Windows printer drivers. That is still the preferred method. Remember that you can use any number of queues in front of any one physical printer, so you're free to use both methods at the same time.
Quote from: "arnoldob"
Code: [Select]

mkdir -p /etc/e-smith/templates-custom/etc/cups/mime.types/

cp /etc/e-smith/templates/etc/cups/mime.types/50RawTypes /etc/e-smith/templates-custom/etc/cups/mime.types/50RawTypes

and also this one:
Code: [Select]

mkdir -p /etc/e-smith/templates-custom/etc/cups/mime.convs/

cp /etc/e-smith/templates/etc/cups/mime.convs/30RasterFilters /etc/e-smith/templates-custom/etc/cups/mime.convs/30RasterFilters


4. Edit the template-custom fragements:
Code: [Select]

pico /etc/e-smith/templates-custom/etc/cups/mime.types/50RawTypes

add this line to the end of the file:
Code: [Select]

application/vnd.cups-raw


Code: [Select]

pico /etc/e-smith/templates-custom/etc/cups/mime.convs/30RasterFilters

add this line to the end of the file:
Code: [Select]

application/octet-stream   application/vnd.cups-raw   0   -

5. Expand the templates and tell CUPS to re-read the configuration:
Code: [Select]

/sbin/e-smith/expand-template /etc/cups/mime.convs

/sbin/e-smith/expand-template /etc/cups/mime.types

/sbin/e-smith/signal-event cups-reconfigure

To revert back to the orginal setup, delete the templates-custom fragments you copied in step 3 and run the commands in step 5 again.

I intend to test and update this post with the results as time permits.

Offline arnoldob

  • *
  • 183
  • +0/-0
Getting CUPS/Samba to Store Printer Drivers
« Reply #4 on: April 24, 2005, 05:14:01 PM »
I'm using a Lexmark Z25. I checked the linuxprinting.org a few days ago and saw no mention of that particular model. But much to my suprise Lexmark does have drivers for various flavors of linux, including 2 drivers that specifically mention redhat and CUPS. I'm not sure if that means there will be PPD files, but I'll download them and see what they do have.

This is turning into one of those situations where I'm learning more about it than I ever intended to :)

Thanks for the input Robert.
Tampa, FL USA

Offline arnoldob

  • *
  • 183
  • +0/-0
Getting CUPS/Samba to Store Printer Drivers
« Reply #5 on: April 25, 2005, 12:36:43 AM »
This site has some info about how to configure smb.conf allow clients grab drivers from the server on the fly.

http://www.cups.org/man/cupsaddsmb.html
Tampa, FL USA

cydonia

Getting CUPS/Samba to Store Printer Drivers
« Reply #6 on: September 01, 2005, 04:43:22 PM »
Eek.  This is confusing...

The CUPS part was great.  Thanks to Robert for the contrib!  Worked perfectly, and Brother even have a PPD file for the HL-2040 which is good.

Test page from the CUPS admin comes up perfectly, but getting windows to play along is another matter.

Hopefully when I have more time I will be able to sort this out...

Offline bubbers214

  • *
  • 32
  • +0/-0
Getting CUPS/Samba to Store Printer Drivers
« Reply #7 on: September 01, 2005, 10:43:57 PM »
Quote from: "cydonia"

Test page from the CUPS admin comes up perfectly, but getting windows to play along is another matter.


When printing from windows you should use a raw queue.  At least that is what I have all my printers setup with and they work perfectly with windows, as well as having the drivers stored on the server.

cydonia

Getting CUPS/Samba to Store Printer Drivers
« Reply #8 on: September 02, 2005, 12:37:45 PM »
Quote from: "bubbers214"


When printing from windows you should use a raw queue.  At least that is what I have all my printers setup with and they work perfectly with windows, as well as having the drivers stored on the server.


I have tried to do this, but it always comes up with the message: "this device cannot be found on the network".
I set up a new printer tcp/ip port and designate it:  "IP_192.168.10.1", my server IP of course.  

Is this how you do it?  Or am I missing something here?

Thanks

cydonia

Getting CUPS/Samba to Store Printer Drivers
« Reply #9 on: September 02, 2005, 01:30:25 PM »
Quote from: "cydonia"

I have tried to do this, but it always comes up with the message: "this device cannot be found on the network".
I set up a new printer tcp/ip port and designate it:  "IP_192.168.10.1", my server IP of course.  

Is this how you do it?  Or am I missing something here?

Thanks


Ahh.  Silly me... Of course TCP/IP wont work since its a USB printer :P.  Put that one down to being up late...

Actually, an interesting thing, I had to print something, so I installed the brother HL-2040 on my laptop via usb.  
Tonight, I have plugged it back into the server to try and get network printing happening.  Now when I click on the printer in the network share for the server, it opens up the print queue.  Also, in the list of printer ports, there is one called "USB001 Virtual printer port for USB".

Will keep looking around.

cydonia

Getting CUPS/Samba to Store Printer Drivers
« Reply #10 on: September 02, 2005, 03:16:11 PM »
Well, I think I've made some progress.

I realised that when I had the line "printcap name = cups" in the [general] area of smb.conf, the printer wouldn't actually be visible in the network.  Although the install CD for the printer still wouldn't see the printer in the workgroup, it saw a port there for it (an IPP thing i think), and I selected that.

So, now jobs are sending to the server, but are being cancelled and i'm getting this message which i believe is the culprit:

"Unable to convert file 0 to printable format for job 4!"


Linuxprinting.org claims that this error msg is cause by the following:

    This is caused by not having the pstoraster filter included in ESP GhostScript, or not having applied the GhostScript patches in the pstoraster directory of the GNU GhostScript sources. You need to install ESP GhostScript or the patch starting with CUPS 1.1.15.

    It may also be necessary to compile ESP GhostScript against your current version of CUPS.


Any ideas?

Robert

Getting CUPS/Samba to Store Printer Drivers
« Reply #11 on: September 03, 2005, 01:50:03 PM »
Quote from: "cydonia"
I realised that when I had the line "printcap name = cups" in the [general] area of smb.conf, the printer wouldn't actually be visible in the network.

[edit]Though I haven't tested it and haven't looked at the samba source to confirm, adding the line "printcap name = cups" will probably not work if samba was configured and built --without-cups. This is probably true for samba 2 and samba 3 alike.

Normally you don't need to specify a printcap name in smb.conf and the only parameter you need is "printing = cups", which should work whether samba was configured and built --with-cups or --without-cups. However, in samba 3 "printing = cups" does not work correctly if samba was configured and built --without-cups.

The next two paragraphs are obsolete. I didn't read cydonia's post closely enough.[/edit]

[obsolete]If you use samba 3 this is a known issue, which I've asked the person who found the issue to report to the samba team. I can only assume that's been done and that the issue is being worked on by the samba team. For a discussion of the bug and a workaround, see http://forums.contribs.org/index.php?topic=25574.0

If you don't use samba 3, you found an unknown issue and I'd like to know more about it.[/obsolete]
Quote from: "cydonia"
So, now jobs are sending to the server, but are being cancelled and i'm getting this message which i believe is the culprit:

"Unable to convert file 0 to printable format for job 4!"


Linuxprinting.org claims that this error msg is cause by the following:

    This is caused by not having the pstoraster filter included in ESP GhostScript, or not having applied the GhostScript patches in the pstoraster directory of the GNU GhostScript sources. You need to install ESP GhostScript or the patch starting with CUPS 1.1.15.

    It may also be necessary to compile ESP GhostScript against your current version of CUPS.


Any ideas?

Assuming you have the ghostscript rpm from the same directory as my cups contrib installed, there shouldn't be any problem with the pstoraster filter as suggested by the linuxprinting.org article you linked to.

Instead, the problem is most likely that you're sending print jobs with a file type for which CUPS has no conversion rules to a filtering queue. Such print jobs are produced, for instance, by Windows printer drivers for just about any non-PostScript printer on the market. Those jobs will be MIME-typed by CUPS as application/octet-stream or application/vnd.hpgl-raw (off the top of my head; I don't remember what I called it) according to the typing rules in /etc/cups/mime.types. These MIME types do not have any corresponding conversion rules in /etc/cups/mime.convs (because there aren't any filters that can convert these files) and that causes CUPS to log the warning you saw.

The solution is to either change the driver on the Windows side to one that produces print jobs that the CUPS filters can deal with, most logically a PostScript driver, or on the server side to add a raw queue to CUPS. Print jobs sent to a raw queue will still be checked against /etc/cups/mime.types to see if they're of an allowed MIME type, but they will not be checked against /etc/cups/mime.convs and effectively bypass the filtering chain.

Instructions for setting up a PostScript printer in Windows and/or a raw queue in CUPS are in the documentation for the e-smith-cups contrib.

Good luck,
Robert

cydonia

Getting CUPS/Samba to Store Printer Drivers
« Reply #12 on: September 03, 2005, 04:24:33 PM »
Quote from: "Robert"

If you don't use samba 3, you found an unknown issue and I'd like to know more about it.
Quote from: "cydonia"
So, now jobs are sending to the server, but are being cancelled and i'm getting this message which i believe is the culprit:


How do I check my version again?  I think i ran SMEPLUS which updates samba, but I may have edited out that section, I can't remember.

Quote from: "Robert"

The solution is to either change the driver on the Windows side to one that produces print jobs that the CUPS filters can deal with, most logically a PostScript driver, or on the server side to add a raw queue to CUPS. Print jobs sent to a raw queue will still be checked against /etc/cups/mime.types to see if they're of an allowed MIME type, but they will not be checked against /etc/cups/mime.convs and effectively bypass the filtering chain.


Thanks Robert.  I got it working using the native drivers on windows, but using a raw queue in CUPS as you suggested.  Incidentally, I tried using the adobe postscript drivers to send to it, but that didn't work and seemed to run very slowly on the windows machine.  Native drivers + raw seems to work very well.

For future reference incase someone is in a similar position, here are the three basic steps needed here:


1:  Setup printer as Raw queue in CUPS.
2:  Installed the network drivers on my computer using the Brother CD (at least I think they were the network drivers as I tried so many things for this :P).
3:  Go to "Add printer", select "Network attached printer", then select "Connect to a printer on the internet...", then enter the direct URL to the CUPS printer.  In my case this was: "http://192.168.10.1/printers/HL2040".

Only concern with the above is that the url requires authentication, and i used admin for that.  Probably should setup a printer account especially for that for security reasons.  Unless others think this is ok?


Thanks again to everyone for their help.  I was beginning to think I would have to buy a commercial print server for this.  I love OS :D.

Robert

Getting CUPS/Samba to Store Printer Drivers
« Reply #13 on: September 03, 2005, 05:16:29 PM »
Quote from: "cydonia"
Quote from: "Robert"

If you don't use samba 3, you found an unknown issue and I'd like to know more about it.
Quote from: "cydonia"
So, now jobs are sending to the server, but are being cancelled and i'm getting this message which i believe is the culprit:


How do I check my version again?  I think i ran SMEPLUS which updates samba, but I may have edited out that section, I can't remember.


I've edited my previous reply. I hadn't read your message correctly. Sorry about that. BTW, if you use samba 3, the thread I linked to in my previous reply may still be of interest. One way to check your samba version is with "rpm -q samba".

Quote from: "cydonia"
Quote from: "Robert"

The solution is to either change the driver on the Windows side to one that produces print jobs that the CUPS filters can deal with, most logically a PostScript driver, or on the server side to add a raw queue to CUPS. Print jobs sent to a raw queue will still be checked against /etc/cups/mime.types to see if they're of an allowed MIME type, but they will not be checked against /etc/cups/mime.convs and effectively bypass the filtering chain.


Thanks Robert.  I got it working using the native drivers on windows, but using a raw queue in CUPS as you suggested.  Incidentally, I tried using the adobe postscript drivers to send to it, but that didn't work and seemed to run very slowly on the windows machine.  Native drivers + raw seems to work very well.

For future reference incase someone is in a similar position, here are the three basic steps needed here:


1:  Setup printer as Raw queue in CUPS.
2:  Installed the network drivers on my computer using the Brother CD (at least I think they were the network drivers as I tried so many things for this :P).
3:  Go to "Add printer", select "Network attached printer", then select "Connect to a printer on the internet...", then enter the direct URL to the CUPS printer.  In my case this was: "http://192.168.10.1/printers/HL2040".

Only concern with the above is that the url requires authentication, and i used admin for that.  Probably should setup a printer account especially for that for security reasons.  Unless others think this is ok?


Thanks again to everyone for their help.  I was beginning to think I would have to buy a commercial print server for this.  I love OS :D.

Now you're using IPP to connect to the print queue. There's nothing wrong with that, but you can also use samba and use the standard samba login service for connecting to the print queue.

cydonia

Getting CUPS/Samba to Store Printer Drivers
« Reply #14 on: September 04, 2005, 12:16:11 AM »
Quote from: "Robert"

I've edited my previous reply. I hadn't read your message correctly. Sorry about that. BTW, if you use samba 3, the thread I linked to in my previous reply may still be of interest. One way to check your samba version is with "rpm -q samba".


Thanks.  Looks like i've got 2.2.8 here...

Quote from: "Robert"

Now you're using IPP to connect to the print queue. There's nothing wrong with that, but you can also use samba and use the standard samba login service for connecting to the print queue.


Yeh, I thought of that after setting up the printer on another computer.  Actually, when I try to use samba, it says in the printers page for windows:
"Access denied, unable to connect".

So I guess I have to tweek smb.conf and get it working for non-root users.