# Cups , Samba and Windows Printing

## sonix

Hello world,

I've had a problem pop up from no where last week. I can't print to my windows printer anymore. I get the following message in cups

 *Quote:*   

> "Unable to connect to CIFS host, will retry in 60 seconds..."

 

then eventually i get

 *Quote:*   

> "/usr/libexec/cups/backend/smb failed"

 

Thing is, i thought i fixed this problem by setting my samba box here as the domain master in smb.conf. I was then able to view smbtree and I printed a document. Today, i get the same problem and searching around the web didn't get me far.

Here is the error from smbtree

 *Quote:*   

> $ smbtree -U siddig%
> 
> WORKGROUP
> 
>         \\STALIN                        Samba Linux Server 3.0.24
> ...

 

I don't even think my WAN ip address starts with a 66. any tips are appreciated.

----------

## sonix

bump.

still have no solution. anyone please?

 *Quote:*   

> Description: HP Laserjet 1100
> 
> Make and Model: HP LaserJet 1100 Foomatic/ljet4 (recommended)
> 
> Device URI: smb://redblack/laserjet1100

 

----------

## sonix

seems like samba is my problem. i can't locate my windows computers using their name:

 *Quote:*   

> # smbclient -L redblack -N
> 
> timeout connecting to 66.150.2.134:445
> 
> timeout connecting to 66.150.2.134:139
> ...

 

 *Quote:*   

> [global]
> 
> # 1. Server Naming Options:
> 
> # workgroup = NT-Domain-Name or Workgroup-Name
> ...

 

----------

## mallchin

I have a similar issue. It was all working but something (an update?) broke it.

I can connect via smbclient, but I get:

```

Anonymous login successful

Domain=[DPS] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]

        Sharename       Type      Comment

        ---------       ----      -------

cli_rpc_pipe_open: cli_nt_create failed on pipe \srvsvc to machine sergio-pc.  Error was NT_STATUS_ACCESS_DENIED

Error returning browse list: NT_STATUS_ACCESS_DENIED

Anonymous login successful

Domain=[DPS] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]

        Server               Comment

        ---------            -------

        Workgroup            Master

        ---------            -------

```

I've seen this error before. I'm going to Google it now.

----------

## mallchin

It all comes back to me now.

 *Quote:*   

> 
> 
> The problem is in the windows XP setup. For some reason on xp you must go to "add/remove programs" in the control panel and on the left will be a button for Windows components. Click on it and under "other network file and print services" you will find "print services for Unix". Make sure that it is checked and hit ok. When setting up in Mepis, set up as remote lpr/lpd. and give the ip address to the machine. Everything should work well after all that.
> 
> 

 

I decided to use a different printer as I can't access the Windows machine at present.

----------

## sonix

 *mallchin wrote:*   

> It all comes back to me now.
> 
>  *Quote:*   
> 
> The problem is in the windows XP setup. For some reason on xp you must go to "add/remove programs" in the control panel and on the left will be a button for Windows components. Click on it and under "other network file and print services" you will find "print services for Unix". Make sure that it is checked and hit ok. When setting up in Mepis, set up as remote lpr/lpd. and give the ip address to the machine. Everything should work well after all that.
> ...

 

I enabled Unix Print Services but I get the same error "CIFS Host . . . "

Its strange because both of my gentoo boxes got this problem around the same time. I'm surprised this post hasn't attracted attention since it seems to be the only one related to this obscure problem.

----------

## sonix

more strange errors....

 *Quote:*   

> $ smbclient -L redblack
> 
> Error connecting to 8.15.7.117 (Connection refused)
> 
> Connection to redblack failed
> ...

 

ok here's the debug info...

 *Quote:*   

> # smbclient -d 10 -L redblack
> 
> INFO: Current debug levels:
> 
>   all: True/10
> ...

 

error from samba logs

 *Quote:*   

>  [2007/10/22 18:16:29, 0] lib/util_sock.c:read_data(534)
> 
>   read_data: read failure for 4 bytes to client 192.168.0.201. Error = Connection reset by peer

 

----------

## DaggyStyle

try setting smb port = 445 in smb.conf

----------

## mallchin

nmb returns 192.168.0.201 for redblack...

 *sonix wrote:*   

> 
> 
> $ nmblookup redblack
> 
> querying redblack on 192.168.0.255
> ...

 

The (outdated) cache returns 66.150.2.134...

 *sonix wrote:*   

> 
> 
> internal_resolve_name: looking up redblack#20
> 
> Opening cache file at /var/cache/samba/gencache.tdb
> ...

 

And WINS server on localhost returns 8.15.7.117...

 *sonix wrote:*   

> 
> 
> resolve_wins: using WINS server 127.0.0.1 and tag '*'
> 
> bind succeeded on port 0
> ...

 

Try defining redblack in /etc/hosts  :Smile: 

----------

## sonix

what if dhcp decides that the IP address should change today? 

meh, i guess i'll go static.

----------

## darkphader

Make sure your XP system registers itself with your WINS server (TCP/IP properties).

Compile Samba with winbind support (but you wont be running winbindd) and edit the hosts: line in /etc/nsswitch.conf to read

```
hosts:       files dns wins
```

Chris

----------

## sonix

 *darkphader wrote:*   

> Make sure your XP system registers itself with your WINS server (TCP/IP properties).
> 
> Compile Samba with winbind support (but you wont be running winbindd) and edit the hosts: line in /etc/nsswitch.conf to read
> 
> ```
> ...

 

i recompiled samba with winbind support and added winbind to rc-update. are you sure i should remove it? i actually don't remember how i added it. if you could remind me that would be nice.

----------

## Lex_Brugman

Check if /usr/libexec/cups/backend/smb exists, if not: ln -s /usr/bin/smbspool /usr/libexec/cups/backend/smb

----------

## darkphader

 *sonix wrote:*   

> i recompiled samba with winbind support and added winbind to rc-update. are you sure i should remove it? i actually don't remember how i added it. if you could remind me that would be nice.

 

Right. If you don't build with winbind support you don't get the libraries to support hosts lookups via WINS. Basically there are times (such as this one) when you want to compile with winbind support yet not actually run winbind. The way to start winbind in Gentoo (which you don't need to do) is to edit the /etc/conf.d/samba file and add it to the daemon_list.

Chris

----------

## sonix

 *Lex_Brugman wrote:*   

> Check if /usr/libexec/cups/backend/smb exists, if not: ln -s /usr/bin/smbspool /usr/libexec/cups/backend/smb

 

 *Quote:*   

>  # ls -l /usr/libexec/cups/backend/smb 
> 
> lrwxrwxrwx 1 root root 17 2007-10-22 20:53 /usr/libexec/cups/backend/smb -> /usr/bin/smbspool
> 
> # smbtree
> ...

 

----------

## darkphader

 *DaggyStyle wrote:*   

> try setting smb port = 445 in smb.conf

 

Actually the parameter is "smb ports" (not "smb port" - testparm should identify this) and if you want normal NetBIOS browsing, etc. you probably want to leave it at the default (139 445) or, if anything, limit it to port 139 instead:

```
smb ports = 139
```

 or 

```
smb ports = 445 139
```

 which is the same as leaving the line out or commented.

Chris

----------

## darkphader

Recommended changes to your posted smb.conf:

```
hosts allow = 192.168.0. 127.  ;probably not necessary - should certainly be removed for troubleshooting

hosts deny = 0.0.0.0/0 ;remove this line completely

security = share ;needs to be security = user for proper operation, especially in this context

;username map = /etc/samba/smbusers ;uncomment this, you want it
```

The above lines (minus the 2 not needed) should now read:

```
security = user

username map = /etc/samba/smbusers
```

And at the very least the above referenced /etc/samba/smbusers file should contain:

```
nobody = guest
```

Make these changes, stop samba, locate your wins.dat file, delete it, start samba.

Chris

----------

## darkphader

 *Quote:*   

> Domain=[REDBLACK] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager] 

 

Another oddity is that apparently your domain name (redblack) and the system you're trying to connect to (redblack) are the same - this should not be the case. The domain name or workgroup name (if you're not running a domain) must be different. In the case of your samba server you're setting the workgroup/domain name to WORKGROUP, you should do the same on your other systems - or change samba to match - but do not use the same name for a host name.

Chris

----------

## SkyLeach

the mount.cifs stuff was recently broken out of the main samba branch.  I ran into multiple CIFS issues this week and found that all of them were solved by doing the following (note: you might want to specify a version number, I typically use the latest versions with samba and CIFS because 1.) they release good code and 2.) microsoft changes things and pushes them out on msupdate that breaks windows-linux interoperation):

```
emerge --sync

echo "net-fs/mount-cifs ~x86" >> /etc/portage/package.keywords

emerge -uDv --newuse mount-cifs

revdep-rebuild

```

You might be able to get by with just merging mount-cifs, but since it split from samba it's wise to update all of it.

----------

## darkphader

 *SkyLeach wrote:*   

> the mount.cifs stuff was recently broken out of the main samba branch

 

That could be somewhat misleading. It is more accurate to say that the building of mount.cifs  - still a standard part of Samba, has been arbitrarily split by the Gentoo dev team into a separate ebuild in order to allow for its installation w/o installing Samba itself. The kernel module cifs is still usable w/o the mount.cifs helper app, but the helper does add some niceties.

I personally don't like the extra ebuild, and it certainly causes a problem when you're used to a normal Samba install - where mount.cifs gets built and installed by default and now all of sudden you find it missing.

That aside, it has nothing to do with the problem at hand.

Chris

----------

## SkyLeach

 *darkphader wrote:*   

>  *SkyLeach wrote:*   the mount.cifs stuff was recently broken out of the main samba branch 
> 
> That could be somewhat misleading. It is more accurate to say that the building of mount.cifs  - still a standard part of Samba, has been arbitrarily split by the Gentoo dev team into a separate ebuild in order to allow for its installation w/o installing Samba itself. The kernel module cifs is still usable w/o the mount.cifs helper app, but the helper does add some niceties.
> 
> I personally don't like the extra ebuild, and it certainly causes a problem when you're used to a normal Samba install - where mount.cifs gets built and installed by default and now all of sudden you find it missing.
> ...

 

I was unable to mount any windows shares served from AD or NT domains until I merged it, so I thought since he is getting CIFS errors it might be related.

----------

## darkphader

 *SkyLeach wrote:*   

> I was unable to mount any windows shares served from AD or NT domains until I merged it, so I thought since he is getting CIFS errors it might be related.

 

It's not related. It's a helper app that interfaces with the kernels cifs module, which is only used in mounting. I doubt you need mount.cifs at all but the options aren't the same without it. Last I examined it w/o mount.cifs only the IP address was valid, not the NetBIOS name. Other options that mount.cifs provides may be missing or different when dealing with the kernel module more directly. It (mount.cifs) should not be necessary but possibly desirable.

Chris

----------

## Icethepenguin

I know this may have been long figured out, but have this same problem and I figured out the problem.

My computers all went down due to a power outage (get it, I guy with 7 top computers doesn't have a UPS, lol) but what I had to do was just turn my /etc/hosts to point to the correct new 192.168.1.? and it found windows and all was well and printing.

I hope this simple fix works for you like it did for me.

Kevin

----------

