I wonder why my Ubuntu Server 14.04 LTS has problems resolving a hostname from fstab. I tried to mount the following entry:

//NAS-5h2-20/backuppc/  /mnt/backuppc   cifs   auto,user=THEUSER,password=THEPASSWORD,cifsacl,uid=109      0       0

the mount fails with the error

mount: wrong fs type, bad option, bad superblock on //NAS-5h1-15/backuppc,
   missing codepage or helper program, or other error
   (for several filesystems (e.g. nfs, cifs) you might
   need a /sbin/mount.<type> helper program)
   In some cases useful info is found in syslog - try
   dmesg | tail  or so

and the Syslog entry:

Unable to determine destination address.

HOWEVER, this works like a charm if I exchange the hostname NAS-5h2-20 for its IP However, for portability reasons, I'd like to map the mount by hostname within the fstab.

Contents of /etc/hosts is (among other lines):    NAS-5h1-15    NAS-5h2-20    NAS-6h1-04

These Hostnames are not registered with the local DNS-Server. And it's intended do be in some cases able to use different IPs (servercluster/workstation) for DNS and server-internal usage, so I can't register them to the DNS.

It's also no Problem to

ping NAS-5h2-20


Thus I'm sure, it's a resolver problem. However, I can't figure out, where. I look at nsswitch.conf, nothing special there:

passwd:         compat
group:          compat
shadow:         compat
hosts:          files dns
networks:       files
protocols:      db files
services:       db files
ethers:         db files
rpc:            db files
netgroup:       nis

And /etc/resolv.conf also looks OK:

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
search ourdomain.local

So, questions: - why does the resolver fail to read OR ignores the hosts file in this special case?
- is DNS/WINS/ some other resolving method hardcoded into mount.cifs?


By default, the samba (cifs) package on some distributions doesn't use the hosts file to resolve the name. Instead, it uses the NetBIOS name to resolve to the IP. There are two ways to go about this:

  • Set samba to use the hosts file for resolution.

In your smb.conf file, find and modify or create the following line:

    name resolve order =  host lmhosts wins bcast

and restart samba. This will set samba to a use a standard host name to IP address resolution, using the system /etc/hosts, NIS, or DNS lookups, to resolve the server name. Additionally, added machine-name.domainname as an alias in your hosts file:    machine-name    machine-name.domainname
  • Set the NetBIOS name of the machines you are trying to connect to.

On the machines you're trying to connect to set the following in the smb.conf file:

    netbios name = MachineName

and restart samba.

Ideally, you want to do both of these things, however just setting samba to use the hosts file should work.

References: https://www.samba.org/samba/docs/using_samba/ch07.html

  • Tiksi, do you have any ideas how to change this setting without installing the samba package on the machine? Currently speaking, only cifs-utils is installed and would like to avoid installing additional packages only to be able to resolve DNS addresses. Thank you!
    – David
    Mar 31 at 2:00

I was trying to get this to work with auto.misc, but something was missing.

Installing cifs-utils package and then restarting autofs fixed it.

More details (as requested)...

I use autofs to mount external (network) resources as required.

So, I install autofs, together with samba.

Then I have an entry like this in /etc/auto.misc:

REMFOLDER -fstype=cifs,ro,username=user,password=PW ://windowsbox.my.local.domain/SHAREDFOLDER

That means I can access the SHAREDFOLDER on the windowsbox as /misc/REMFOLDER.

This has worked well for years.

However, on a new installation of Pop OS (based on Ubuntu) and version 21.04, this was not working.

I could use smbclient with the username and password to access the SHAREDFOLDER, but the auto.misc entry was not working.

The message indicated (sorry, didn't note it down) that the username/password was incorrect.

A search led me to here, and the solution that worked was to install the cifs-util package.

  • Please provide additional details in your answer. As it's currently written, it's hard to understand your solution.
    – Community Bot
    Sep 2 at 17:09
  • Thanks for the feedback. I've updated. Is that enough information?
    – russellr
    Sep 3 at 21:35

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.