1

I'm trying to share an NTFS drive, or a directory on the drive, via samba, and I have found several tutorials that show it being done in just a few minutes (minus the updates and package installs). I'm about 3 weeks in and I can't get it working. Currently, other machines on the network cannot resolve the hostname, and I believe that's the root cause of error 0x80070035.

If I use the IP address like so: \\192.168.1.xx\, I can see the share "shares" and get prompted for a username/password. However, after putting in a username and password, I get Error code: 0x80070035 The network path was not found (pics on the SuperUser question). I've started this question over at SuperUser and it's stalled out, so I figure I'd come over here and ask what can be done about all this.


Tutorials I Used

Tutorial 1 - Raspberry Pi NAS: Build a Raspberry Pi Samba Server

Tutorial 2 - How to Turn a Raspberry Pi into a Low-Power Network Storage Device

Tutorial 3 / Youtube DIY - Raspberry Pi as a NAS with Samba - How To


Questions and Research

How does a n00b begin to troubleshoot samba? Is there a tutorial that will help me get this working?

I've already burned a new raspbian image and started from scratch and that didn't help. I shouldn't need avahi/Bonjour since I'm using samba/netbios, and I don't want to use HOSTS file modifications since I have several machines I want to use this with. Given the fact that there are packages and tutorials, I am confused why I can't get this up and running and why I am having such difficulty. Especially given the homogenity of the instructions.

nsswitch.conf

# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.

passwd:         compat
group:          compat
shadow:         compat

hosts:          files mdns4_minimal dns mdns4 wins [NOTFOUND=return]
networks:       files

protocols:      db files
services:       db files
ethers:         db files
rpc:            db files

netgroup:       nis

ping from the raspberry pi:

$ ping -c3 raspberrypi
PING raspberrypi (127.0.1.1) 56(84) bytes of data.
64 bytes from raspberrypi (127.0.1.1): icmp_req=1 ttl=64 time=0.208 ms
64 bytes from raspberrypi (127.0.1.1): icmp_req=2 ttl=64 time=0.200 ms
64 bytes from raspberrypi (127.0.1.1): icmp_req=3 ttl=64 time=0.240 ms
--- raspberrypi ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 0.200/0.216/0.240/0.017 ms

smb.conf

[global]
   workgroup = WORKGROUP
#   NetBIOS name = raspberrypi
   server string = %h server
   dns proxy = no
   log file = /var/log/samba/log.%m
   max log size = 1000
   syslog = 0
   panic action = /usr/share/samba/panic-action %d
   security = user
   encrypt passwords = true
   passdb backend = tdbsam
   obey pam restrictions = yes
   unix password sync = yes
   passwd program = /usr/bin/passwd %u
   passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n$
   pam password change = yes
   map to guest = bad user
   usershare allow guests = yes
[homes]
   comment = Home Directories
   browseable = no
   read only = yes
   create mask = 0700
   directory mask = 0700
   valid users = %S
[printers]
   comment = All Printers
   browseable = no
   path = /var/spool/samba
   printable = yes
   guest ok = no
   read only = yes
   create mask = 0700
[print$]
   comment = Printer Drivers
   path = /var/lib/samba/printers
   browseable = yes
   read only = yes
   guest ok = no
[Shares]
   comment = Shares Folder
   path = '/media/80Gigger/shares'
   browsable = yes
   read only = no

fstab

proc            /proc           proc    defaults          0       0
/dev/mmcblk0p1  /boot           vfat    defaults          0       2
/dev/mmcblk0p2  /               ext4    defaults,noatime  0       1
#/dev/sda1      /media/USB              auto    gid=1002,uid=1001       0       0
# a swapfile is not a swap partition, so no using swapon|off from here on, use  dphys-swapfile swap[o$

Update 1

etc\hosts

127.0.0.1       localhost
::1             localhost ip6-localhost ip6-loopback
fe00::0         ip6-localnet
ff00::0         ip6-mcastprefix
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters

127.0.1.1       raspberrypi

Update 2

The Windows machine is not joined to a domain. The pi has the default hostname and hosts file. When you say "fiddle with", what should I change?

$ hostname
raspberrypi

$ nmblookup raspberrypi
querying raspberrypi on 192.168.1.255
192.168.1.14 raspberrypi<00>

$ nmblookup -M -- -
querying __MSBROWSE__ on 192.168.1.255
192.168.1.14 __MSBROWSE__<01>

$ smbclient -L 192.168.1.14
Enter pi's password:
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.6.6]

        Sharename       Type      Comment
        ---------       ----      -------
        print$          Disk      Printer Drivers
        Shares          Disk      Shares Folder
        IPC$            IPC       IPC Service (raspberrypi server)
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.6.6]

        Server               Comment
        ---------            -------
        D-WHALEY2
        LAPTOP
        RASPBERRYPI          raspberrypi server

        Workgroup            Master
        ---------            -------
        WORKGROUP            RASPBERRYPI

Update 3

I uncommented the NetBios field in the raspberry pi and am now getting a different error in Windows explorer; error 0x80004005. I get this error if I try to navigate to \raspberrypi\ . I found this question that describes many facets of the error. I only found 1 Microsoft 6to4 adapter though. Deleting it and restarting had no effect.

I still get error 0x80070035 if I navigate to \192.168.1.14\ and enter in the appropriate credentials.

I do have ipv6 disabled on the Windows 7 laptop. I don't think that would have any bearing on this phenomenon though.

On the raspberry pi, I cannot ping the name of the Windows machine, nor can I seem to access the samba share on the Windows 7 machine. I'm not sure if PCMANFM can even do this, but it's certainly not working.

Update 4

I now have samba working and letting me see files in the share, though I still don't have name resolution working. Progress! Thanks for everyone's help so far!

It seems like I'm fighting more than 1 problem, and I just solved the accessing the share problem. The drive needed a permanent mount point to be read/write for samba, so I had to modify the fstab file. Also, it seemed that when I removed the space in the volume name, I had left the single quotes around the oath int he smb.conf file, and looking in the samba log, that was causing problems, so I had to edit that too.

I still can't resolve the pi's name to IP by pinging it, though I'm going to try to decipher the answer below that looks like it will help.

I re-did the smbpasswd for the account I'm using, just in case I had forgotten to do this previously:

sudo smbpasswd -a backups

this is my new hosts file:

127.0.0.1       raspberrypi localhost
::1             raspberrypi localhost ip6-localhost ip6-loopback
fe00::0         ip6-localnet
ff00::0         ip6-mcastprefix
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters

#127.0.0.1      raspberrypi
#127.0.1.1      raspberrypi

This is my fstab file:

proc            /proc           proc    defaults          0       0
/dev/mmcblk0p1  /boot           vfat    defaults          0       2
/dev/mmcblk0p2  /               ext4    defaults,noatime  0       1
/dev/sda1       /media/80Gigger         auto    gid=1002,uid=1001       0      $
# a swapfile is not a swap partition, so no using swapon|off from here on, use $

This is my new smb.conf:

[global]
   workgroup = WORKGROUP
   #netbios name = raspberrypi
   server string = %h server
   dns proxy = no
   log file = /var/log/samba/log.%m
   max log size = 1000
   syslog = 0
   panic action = /usr/share/samba/panic-action %d
   security = user
   encrypt passwords = true
   passdb backend = tdbsam
   obey pam restrictions = yes
   unix password sync = yes
   passwd program = /usr/bin/passwd %u
   passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n$
   pam password change = yes
   map to guest = bad user
   usershare allow guests = yes
[homes]
   comment = Home Directories
   browseable = no
   read only = yes
   create mask = 0700
   directory mask = 0700
   valid users = %S
[printers]
   comment = All Printers
   browseable = no
   path = /var/spool/samba
   printable = yes
   guest ok = no
   read only = yes
   create mask = 0700
[print$]
   comment = Printer Drivers
   path = /var/lib/samba/printers
   browseable = yes
   read only = yes
   guest ok = no
[Shares]
   comment = Shares Folder
   path = /media/80Gigger/shares
   browsable = yes
  • I can see what you are trying to do. However I can not see clearly where you are getting stuck. Can you make this more clear. – ctrl-alt-delor Jul 25 '15 at 21:05
  • And although posting the same question in multiple exchanges is discouraged, I'll clean this up just a bit for you... – eyoung100 Jul 25 '15 at 21:38
  • A few things I noticed after editing your post: 1.) Your Samba Share should be on your local network. With an IP Address of 127.0.1.1, the Samba Share Cannot be seen. Were you meaning to ping localhost at 127.0.0.1, which will always succeed? 2.) The NetBIOS Name of raspberrypi legal but it's commented out. – eyoung100 Jul 25 '15 at 22:08
  • Having that line commented or uncommented had no effect. By default, there wasn't even a netbios variable, so that came into being while troubleshooting. Today I was backpedaling and commented that out. On the Pi, I pinged it's own hostname and it resolved to a localhost of some flavor, so that tells me that the pi is able to resolve its own name... I think. I'm not sure what to expect from Linux in that context. – YetAnotherRandomUser Jul 25 '15 at 22:16
4

If you say "ping raspberrypi", it does not use the same way to do a name lookup as do your windows machines... probably. That is, the SMB/CIFS protocols have three ways of doing name lookups, but the other two are really only used if you configure a domain, which you're not doing.

That means you need to do name lookups though the NMB protocol. Samba will default to using the hostname of the local machine (the output of the hostname command) as the NMB name. Try running that, and verify that it is the hostname you were expecting. If it doesn't, fiddle with /etc/hosts until it does. You may also have to fix /etc/hostname (but note that changes in the latter file aren't live unitil you run the hostname init script, or reboot).

The samba tool to do NMB lookups is called, unsurprisingly, nmblookup. Run that on the raspberry pi with the output of hostname as its argument, and verify that it matches the ip address of the raspberry pi. If it doesn't, post the output. If it does but the ip address is preceded by a hex number between angle brackets (<>), that's fine (the hex number is the type of the result; there are many possible result types).

The NMB protocol is pretty horrible, partially because it wants to elect a 'master browser' host, which doesn't always work right. Try running nmblookup -M -- - (that is, nmblookup dash-capital m-space-dash-dash-space-dash. Yes, that's ugly). This will do a lookup for the master browser. Note the IP adress you get back. Run smbclient -L ip, where ip is that ip address. Verify that your raspberry pi is listed. If it isn't, you can try giving the raspberry pi a better chance of winning a master browser election by specifying preferred master = yes in your smb.conf. If you are running a domain however, don't (the domain master needs to be master browser, otherwise domain logins will fail).

If you are running Windows 7 or above joined to a domain, then by default Windows won't do NMB lookups anymore. In that case, you may need to set some registry keys to change those defaults (these keys can be found on the samba wiki). Alternatively, you can join the raspberry pi to the windows domain, which will remove the need for NMB.

  • I ran those commands and put the results in Update 2. – YetAnotherRandomUser Jul 26 '15 at 19:23
1

This might point you in right direction, but might not resolve the problem. DHCP and DNS demons on routers might mess things up. In my case I was having the same issue with opensuse and raspberypi. Here are all the steps I did:

  1. Edited hostname file /etc/hostname mymacnine tried alsoe mycmachine.domain Neither worked.
  2. Messed with resolv.conf Worked until something got updated or deleted in Windows machine
  3. Found that my WRT1900ac has place where you ender domain name and did it, works every time.

Somebody pointed your NetBIOS name is commented out.

1

Solution

I can't provide this in a comment, but I want you to see a working hosts file (From my working Gentoo installation):

# /etc/hosts: Local Host Database
#
# This file describes a number of aliases-to-address mappings for the for 
# local hosts that share this file.
#
# In the presence of the domain name service or NIS, this file may not be 
# consulted at all; see /etc/host.conf for the resolution order.
#

# IPv4 and IPv6 localhost aliases
127.0.0.1       bedroom-gentoo.myISP.net     bedroom-gentoo  localhost
::1             bedroom-gentoo.myISP.net     bedroom-gentoo  localhost


#
# Imaginary network.
#10.0.0.2               myname
#10.0.0.3               myfriend
#
# According to RFC 1918, you can use the following IP networks for private 
# nets which will never be connected to the Internet:
#
#       10.0.0.0        -   10.255.255.255
#       172.16.0.0      -   172.31.255.255
#       192.168.0.0     -   192.168.255.255
#
# In case you want to be able to connect directly to the Internet (i.e. not 
# behind a NAT, ADSL router, etc...), you need real official assigned 
# numbers.  Do not try to invent your own network numbers but instead get one 
# from your network provider (if any) or from your regional registry (ARIN, 
# APNIC, LACNIC, RIPE NCC, or AfriNIC.)
#

Notice that the localhost address of 127.0.0.1 can resolve to multiple names.

  1. The FQDN (2nd Column), in case apps require it. (This is explained in the links the OP provided).
  2. My MachineName (3rd Column).
  3. The localhost (4th Column).

Also, note that I do not differentiate between IPv4 and IPv6


This format removes the need for the workaround for 127.0.1.1. Since I don't want my machine to be seen by others on my network, I left the imaginary network section Commented, but if I wanted to do this I would add (assuming I had your Devices):

#
# Real Network
192.168.1.14            raspberrypi.myISP.net    raspberrypi
192.168.1.x             D-WHALEY2.myISP.net      D-WHALEY2
192.168.1.xx            LAPTOP.myISP.net         LAPTOP

# Imaginary Network
#10.0.0.2               myname
#10.0.0.3               myfriend
#

To make this work every time, I must log into my Router and assign by MAC Filtering, and remove 127.0.1.1 from the Raspian hosts file . This only needs to be done once: (MAC Address resolves to Static IP Address)

  1. MAC Address of Pi --> 192.168.1.14
  2. MAC Address of D-WHALEY2 --> 192.168.1.x
  3. MAC Address of LAPTOP --> 192.168.1.xx

Doing this ensures that the each time a device on the network is started, it's assigned the address matching your hosts file. It also removes the need for the Windows Computers to resolve internal addresses.


Problem

Windows is having trouble resolving the Address for your Pi for 2 Reasons:

  1. 127.0.1.1 is not a valid internal address, according to RFC 1918, superseded by RFC 6761. See also comments in hosts file.
  2. Because Windows has a hosts file that doesn't contain the 127.0.1.1 address, it is treating it as another localhost address (See Who picked 127.0.0.1 to be localhost and why? What meaning does it have?), for why. This behavior leads to the errors the OP described.

In short, this is a problem with Windows, and a "feature" of Debian based distributions. Removing the "feature," and configuring the router to "fix" the problem in Windows should allow Samba to connect

  • It sounds like you're giving me background info on why 127.0.1.1 is a PITA and then telling me to punt by putting names and IPs into the HOSTS files of all machines and set up DNS/DHCP reservations in my router. I should not have to do all that since I'm running samba. Samba and/or NetBIOS is supposed to handle the name resolution. – YetAnotherRandomUser Jul 27 '15 at 1:44
  • Not in all machines, only the raspian, and then setup the router... the problem exists in the name resolution not in Samba or NetBIOS. Samba and NetBIOS are both services which rely on name resolution, and as long as that's malfunctioning, nothing will work. – eyoung100 Jul 27 '15 at 1:50
  • So you're telling me that no Linux machine's IP address ever in the whole universe can be resolved on a wireless network (I point out wireless because a machine might move wireless networks) because it has to have its HOSTS file modified and the network has to have certain modifications made to support name resolution? I know that "all Linux" != raspbian, but the sheer amount of people with this problem and the only solution I've ever seen offered is to fiddle with HOSTS files. that makes no sense! – YetAnotherRandomUser Jul 27 '15 at 1:55
  • That screams overtinkering rather than fixing the actual problem. If there's a problem with samba or NetBIOS, isn't there another .conf file to look at? – YetAnotherRandomUser Jul 27 '15 at 1:56
  • The problem exists in all Debian variants, using 127.0.1.1 to resolve a FQDN, was a "fiddle" in the first place Removing the "fiddle" and realizing that /etc/hosts is for local name resolution makes sense to me, since we are discussing your "local" network. Re: Overtinkering is like saying the busses tires are flat when it's actually the road that contains the nails... As long as the highway samba rides on is broken, samba will be broken – eyoung100 Jul 27 '15 at 2:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.