1

On a Linux system, I used the following command to mount a Windows Share folder:

mount.cifs -o user=xxxx,pass=xxxx '//host/folder' /mnt 

Above command finished without giving any errors or output at all. I could see files in /mnt, which means the mount was successful. Then I ran command mount, and the 1st line of the output says:

[mntent]: line 14 in /etc/mtab is bad 

And the share folder I just mounted doesn't appear in the output.

Then I checked the content of /etc/mtab and found that there are a whole lot of options for the just mounted share. like this:
enter image description here

While on another Linux Machine running the same OS(SLE 11SP3), I did the exact same thing(but using a different share on a different Windows machine), but the content in /etc/mtab is very simple, like this(and mount shows the mounted share correctly and doesn't say mtab is bad):

//server/folder /mnt cifs rw 0 0 

So the question is, on the 1st machine:
1. why are there so many option for this windows share in /etc/mtab?
2. why does the mount command say "mtab is bad"?

4
  • No idea why the same mount on identical OSs would give different mtab entries, but it looks like in the first case mount is complaining because the blank in the folder name is making it miscount the fields on that line. Commented Apr 27, 2016 at 7:17
  • Thanks for comment. the black in the folder name appears in option unc=\\xxx\xxx. I definitely didn't specify such an option, no idea why it's there. In the 1st field of line 14 of mtab, the blank is replaced by \040. Commented Apr 27, 2016 at 7:21
  • 1
    that image is unreadable due to tiny tiny fonts. please don't post images, copy and paste the text. Commented Apr 27, 2016 at 8:22
  • Is there an entry in /etc/fstab that also mounts /mnt or something under it? Commented Apr 27, 2016 at 17:11

2 Answers 2

0

Someone added a lot of option for that share or that entry was created automatically. It is saying "mtab is bad" because one or some of the options is not correct.
For instance, the option unc=\\...\abc abc contains a space character, you should quote that value. Options are separated by comma, a space in one of the values will end the "options" field.
You can try to replace that line from mtab with just :

//server/folder /mnt cifs rw,user=xxxx,pass=xxxx 0 0 
1
  • Someone added a lot of option for that share., how? mtab in generated by the system on the fly, not sure If it should be manually edited but my guess is NO. Commented Apr 27, 2016 at 7:22
0

why are there so many option for this windows share in /etc/mtab?

The mount.cifs process has negotiated those exact protocol options and documents the negotiation results in /etc/mtab. Or perhaps /etc/mtab on that system is actually linked to /proc/self/mounts, as is the current practice, and the kernel documents the negotiated mount options.

On older systems, /etc/mtab used to be a file maintained by the mount command.

why does the mount command say "mtab is bad"?

mtab is expected to use the same file format as /etc/fstab: one line per filesystem mount point, with exactly six fields separated by whitespace. The unescaped space character in the unc= option introduces an extra space, which breaks the mtab parsing routine of the mount command.

If mtab is a symlink to /proc/self/mounts, this is a kernel bug; otherwise, this is probably a bug in the mount.cifs binary (or whatever does the /etc/mtab updates).

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.