Drives listed in fstab will not mount

openSUSE 13.1 - KDE

I have two drives on my network that are mounted on my system at boot time. They are listed in fstab.


/dev/sdb3              /                  ext4   discard,acl,user_xattr  1 1
/dev/sdb4              /home          ext4   discard,acl,user_xattr  1 2
/dev/sdb2              swap            swap defaults                      0 0
/dev/sdb1               /boot/efi       vfat    umask=0002,utf8=true 0 0
//RT-AC66R/root     /mnt/Hardin  cifs    nofail,credentials=/home/bart/.fstab/.creds,_netdev 0 0
//Ls420dc48/share  /mnt/Buffalo cifs    nofail,credentials=/home/bart/.fstab/.creds,_netdev,file_mode=0777,dir_mode=0777,rw 0 0

The device RT-AC66R/root is a hard drive connected via USB port to my router.
The device Ls420dc48/share is a Buffalo file server connected via ethernet to the router.
There is a link called Router in the home directory that points to /mnt/Hardin
There is a link called Server in the home directory that points to /mnt/Buffalo

If I reboot my machine, the two drives appear to be part of my directory tree as they should. I can read and write to either of the drives by using the “folders” in my home directory.

Recently, my wife finally had a belly full of Windows 10 and asked that I change her over to openSUSE (YAHOO! FINALLY!) I installed 13.1 on her machine, using KDE. Same as mine. I added the network drives in fstab on her machine.

/dev/sda3        /        ext4    defaults        1 1
/dev/sda4        /var        ext4    defaults        1 2
/dev/sda5        /tmp        ext4    acl,user_xattr        1 2
/dev/sda6        /home        ext4    acl,user_xattr        1 2
/dev/sda2         swap        swap    defaults        0 0
/dev/sda1        /boot/efi    vfat    umask=0002,utf8=true    0 0
//RT-AC66R/root        /mnt/Hardin    cifs    nofail,credentials=/home/vinetta/.fstab/.creds,_netdev    0 0
//Ls420dc48/share    /mnt/Buffalo    cifs    nofail,credentials=/home/vinetta/.fstab/.creds,_netdev,file_mode=0777,dir_mode=0777,rw    0 0

(Don’t know why I separated /var and /tmp but… oh well, no harm.)

Problem is, her machine does not mount the two devices RT-AC66R and Ls420dc48 at boot. After rebooting, if I open Konsole and do this:

vinetta@linux-eiwq:~> ls -l Server
lrwxrwxrwx 1 vinetta users 13 Oct  7 15:05 Server -> /mnt/Buffalo/
vinetta@linux-eiwq:~> ls -l Router
lrwxrwxrwx 1 vinetta users 11 Oct 11 14:02 Router -> /mnt/Hardin
vinetta@linux-eiwq:~> su -
Password: 
linux-eiwq:~ # mount /mnt/Buffalo
linux-eiwq:~ # exit
logout
vinetta@linux-eiwq:~> ls -l Server
lrwxrwxrwx 1 vinetta users 13 Oct  7 15:05 Server -> /mnt/Buffalo/
vinetta@linux-eiwq:~> 

The first time, Server -> /mnt/Buffalo is shown in dark blue. If I open dolphin and open ~/Server, there is nothing shown
After the mount command, Server -> .mnt/Buffalo is shown in reverse color and dolphin shows the contents of the network drive.

I just know I’m missing something, but I can’t figure it out. Why does one machine mount the drives and the other does not?

Why not try using the Yast Partitioner to choose the mounts (of course, tick “Do Not Format” or untick “Format”, going by memory here) and then tweak your fstab options a bit in there?

Do both use the same network implementation (i.e. both ifup or both NetworkManager)?

I wonder if it does not mount them because it cannot see them. By this I mean is name resolution working on your wife’s machine and can it see shares externally.

You can test both of these facets with this command in a console: smbtree -N

For example I get this:

john@Tumbleweed:~> smbtree -N
SWERDNA
        \\TUMBLEWEED 
                \\TUMBLEWEED\IPC$            IPC Service ()
                \\TUMBLEWEED\LinVid         
                \\TUMBLEWEED\ohlc           
                \\TUMBLEWEED\print$          Printer Drivers
                \\TUMBLEWEED\centroid       
        \\OMAWIN7      
        \\HPWIN10        

See how that lists the workgroup/s, shares on Linux box, and two windows servers.

I know from that that my Linux box can “see” the network.

Please run this command in a console in your wife’s computer and post the results here:

smbtree -N

[and use code braces so we can read OK]

Yes. Both machines use ifup. I meant to mention that but forgot.

Bart

I ran smbtree -N and smbtree -N -S on both machines. Neither of them produced any output, just a several second delay and then the prompt. There are no windows devices on this network so I have not configured samba. I assume that is the smb part of the command.

As near as I can figure out, both these machines are configured the same. Both 13.1, both fstab files match, both are hardwired, both use ifup, both see all the printers. And once my wife’s machine is up, I can issue a mount command, referencing the fstab listed device, and it connects and works correctly. It just won’t mount at startup!

Bart

Do both use the same init (sysvinit vs. systemd)?

I would say yes as both respond the same when I query the status of the mount:

My machine:


bart@UNIVAC:~> systemctl status mnt-Buffalo.mount
mnt-Buffalo.mount - /mnt/Buffalo
   Loaded: loaded (/etc/fstab)
   Active: active (mounted) since Tue 2015-09-29 02:31:49 MDT; 3 weeks 6 days ago
    Where: /mnt/Buffalo
     What: //Ls420dc48/share

bart@UNIVAC:~> 

My wife’s machine:


vinetta@linux-eiwq:~> systemctl status mnt-Buffalo.mount
mnt-Buffalo.mount - /mnt/Buffalo
   Loaded: loaded (/etc/fstab)
   Active: failed (Result: exit-code) since Mon 2015-10-26 10:16:28 MDT; 1min 51s ago
    Where: /mnt/Buffalo
     What: //Ls420dc48/share
  Process: 4096 ExecMount=/bin/mount //Ls420dc48/share /mnt/Buffalo -t cifs -o nofail,credentials=/home/vinetta/.fstab/.creds,_netdev,file_mode=0777,dir_mode=0777,rw (code=exited, status=1/FAILURE)

This is in her /var/log/boot.log file:


[1;31mFAILED[0m] Failed to mount /mnt/Buffalo.
See 'systemctl status mnt-Buffalo.mount' for details.
[1;31mFAILED[0m] Failed to mount /mnt/Hardin.
See 'systemctl status mnt-Hardin.mount' for details.

I know using a cred file isn’t the most secure system, but no one ever uses her machine except her, and pretty much the same for mine.

The only suggestion I can make, at this moment, is that perhaps the network is not fully up on her machine at the moment the mount is attempted.

???

Just a potential clue???:question:

Could you show “systemctl status network-online.target” from both systems?

This was clear from the very beginning. The question is, why it is not up on one system. Something is different, and we need to understand what.

Here is the results from my system:

bart@UNIVAC:~> systemctl status network-online.target
network-online.target - Network is Online
   Loaded: loaded (/usr/lib/systemd/system/network-online.target; static)
   Active: active since Tue 2015-09-29 02:31:43 MDT; 4 weeks 0 days ago
     Docs: man:systemd.special(7)
           http://www.freedesktop.org/wiki/Software/systemd/NetworkTarget

bart@UNIVAC:~> 

And my wife’s:

vinetta@linux-eiwq:~> systemctl status network-online.target
network-online.target - Network is Online
   Loaded: loaded (/usr/lib/systemd/system/network-online.target; static)
   Active: active since Tue 2015-10-27 11:11:51 MDT; 1min 33s ago
     Docs: man:systemd.special(7)
           http://www.freedesktop.org/wiki/Software/systemd/NetworkTarget

vinetta@linux-eiwq:~> 

This was clear from the very beginning. The question is, why it is not up on one system. Something is different, and we need to understand what.

I did find a difference in the two machines. Looking at the boot log on my machine, I see that the firewall is started phase one, then a few lines, and then firewall phase two is started. Only then are the network drives mounted. (relevant lines):


[32m  OK  [0m] Started System Logging Service.
[32m  OK  [0m] Started Authorization Manager.
[32m  OK  [0m] Started Modem Manager.
**[32m  OK  [0m] Started SuSEfirewall2 phase 1.**
         Starting LSB: Configure network interfaces and set up routing...
[32m  OK  [0m] Created slice system-network.slice.
         Starting ifup managed network interface enp8s0...
[32m  OK  [0m] Started ifup managed network interface enp8s0.
[32m  OK  [0m] Started LSB: Configure network interfaces and set up routing.
[32m  OK  [0m] Reached target Network.
         Starting Command Scheduler...
[32m  OK  [0m] Started Command Scheduler.
**         Starting SuSEfirewall2 phase 2...**
         Starting /etc/init.d/boot.local Compatibility...
         Mounting /mnt/Buffalo...
         Mounting /mnt/Hardin...
[32m  OK  [0m] Reached target Host and Network Name Lookups.
         Starting LSB: Network time protocol daemon (ntpd)...

And my wife’s machine:

         Starting Hostname Service...
[32m  OK  [0m] Started Hostname Service.
[32m  OK  [0m] Started Restore Sound Card State.
**[32m  OK  [0m] Started SuSEfirewall2 phase 1.**
         Starting LSB: Configure network interfaces and set up routing...
[32m  OK  [0m] Created slice system-network.slice.
         Starting ifup managed network interface enp5s0...
[32m  OK  [0m] Started ifup managed network interface enp5s0.
[32m  OK  [0m] Started LSB: Configure network interfaces and set up routing.
[32m  OK  [0m] Reached target Network.
         Mounting /mnt/Buffalo...
         Mounting /mnt/Hardin...
**         Starting SuSEfirewall2 phase 2...**
[32m  OK  [0m] Reached target Host and Network Name Lookups.
         Starting LSB: Network time protocol daemon (ntpd)...

I get the feeling that the firewall is preventing the mount command from executing. Is there a way to change the order of the boot processes? Then again, that could open a huge can of worms!

Looking at this further, I may have set this up wrong. Instead of having the network connections made during boot, using the credentials of the person most likely to be using it, perhaps I should pull the network drives out of the fstab file and put a script in the startup folder that would automagically mount the drives using the credentials of the person logging in. Is that the correct way?

Bart

If the resource is being mounted for a specific user, then generally – yes – it is better to mount it at login. That is a much better security method, as well. However, since it is a one-person machine, you could get by doing what you are doing.

If it was me, though, I would mount it at login, or I would mount it "on demand".

Originally, mine was the only Linux machine that connected to these drives. Since my wife decided to leave Windows, I lazily set her new Linux system up the same as mine. That said, I should change it to mount at login. I cannot however, figure out how to get the mount command to work without having to enter the root password. I went down quite a few paths only to get into such a complex situation it seems like not the way to go. I “think” a script in the /usr/share/autostart directory would work if I could figure out how to get the mount command to work.

I’d welcome any help even if it’s telling me the answer. I’d learn from that!

Bart

I figured that part out. :slight_smile:

I “think” a script in the /usr/share/autostart directory would work if I could figure out how to get the mount command to work.

It seems that the options have to be in the fstab file as I get a “user not allowed to use options” when I try to mount it as myself. In the fstab file, it will not recognize $USER in the path to the creds file.

I’d welcome any help even if it’s telling me the answer. I’d learn from that!

Bart

Well, I got it! I created a script that runs at login and mounts the drives where each individual user wants them. Much better than what I was using but certainly not something I’d put in a corporate environment. Works for me!

Bart

Hey, Bart:

Way to go.

A suggestion: Perhaps for newcomers or others who might have a similar problem, could you post your solution/script in this thread? That would complete the process, IMHO.

Oh, yes … and it probably would be better “SOLVED” than “SOVLED”? (sorry, could not resist … I tried. Honest. Cross my heart.)rotfl!

To recap: I have a home network consisting of two desktop computers, two laptops, three printers, and two network drives. One is simply a SSD plugged into the USB port of my router, the other is a Buffalo file server. Only one of the laptops are running Windows, (7) and is very rarely started. The other computers are running openSUSE 13.1. The two network drives are set up to require a username and password for access. I wanted to be able to have the computer login to the drives when a user loged in to the system without having to set up a complex domain system. Here is what I came up with:

First: Change the line in fstab for the network drives to include noauto and user(s) and to point to the credentials file in /tmp/ . I decided to call the file .cred I chose /tmp/ as users have the ability to write to that directory so I didn’t have to make any unnecessary changes to the file structure.

Here’s an example:

//RT-AC66R/root    /mnt/Hardin  cifs  noauto,nofail,users,credentials=/tmp/.cred,_netdev 0 0
//Ls420dc48/share /mnt/Buffalo cifs  noauto,nofail,users,credentials=/tmp/.cred,_netdev,file_mode=0777,dir_mode=0777,rw 0 0

(For some reason, The Buffalo drive would not recognize the rw option, therefore the file_mode and dir_mode parameters.)

Next, I created a .desktop file and placed it in /usr/share/autostart/ I named it makecred.desktop. The contents are as follows:

[Desktop Entry]
Type=Application
Exec=makecred.sh  
Terminal=false
Name=makecred
X-KDE-autostart-after=plasma

The final step was to create a script that would create (overwrite) the credentials file in /tmp/. I writes two lines to this file, the username of the user logging in, and the password associated with that user for access to the drives. It then changes the permissions of the file so it can be overwritten by the next user, and finally calls the mount command. I named it makecred.sh and it resides in /usr/bin so it will be in the path. Here is the contents of the script, with the passwords changed of course…

#! /bin/bash

# This script will write a credentials file to the /usr/bin/ directory that will be used to log into the network drives.

# we will mount the drives only for certain users.
declare -i CALLMOUNT=0

#set the username and password for each user.
if test "$USER" = "bart" ; then
  printf "username=bart
password=<bart's password>
" > /tmp/.cred
  elif test "$USER" = "vinetta" ; then
  printf "username=vinetta
password=<vinetta's password>
" > /tmp/.cred
  elif test "$USER" = "jake" ; then
  printf "username=jake
password=<jake's password>
" > /tmp/.cred
  else
  printf "username=nonvalid
password=nonvalid
" > /tmp/.cred
  CALLMOUNT=1
  fi
  
# If a user has logged on who is allowed access, set the permissions of the file and then mount the drives.
if test "$CALLMOUNT" == 0 ; then
  # we need to change the permissions so the next user can overwrite the file.
  chmod 0666 /tmp/.cred  
  mount /mnt/Buffalo
  mount /mnt/Hardin
  fi

Obviously, the password is in plain text in the script, and in the .cred file. But then, .cred has only the password of the used loggin in, so it’s not a problem. And frankly, my wife would not go poking around looking for my passwords. So, this system works for me, I hope it works for someone else.

Bart

Great work, Bart!

And, I imagine since one person (you) has found it a usefull solution, I would bet there are going to be at least 2 or 3 others. I am sure they will appreciate your instructions.:slight_smile:

After all the help I have received on this forum, it would be really great if I could help someone else.

Bart

You already do.

If you think about it, every time you (or anyone) asks a question and others give the solution or help lead the thread to a solution, several other users get help from that thread.

Thus, questions are actually as helpfull – sometimes more so – as solutions.:wink: