network mount at bootup experience

hi,

I got myself a small NAS and wanted my opensuse 12.3 to mount one of the filesystem as CIFS, I know this can be easily done in KDE’s Dolphin but that “mount” is not really available to other application, so I wanted it more like a real mount and thus tried the following steps:

1- using an fstab entry: //192.168.2.200/test /home/test/test cifs username=test,password=test

of course this did not work since networkmanager was not up yet and thus the server could not be found as systemd said with error -101

2- I added the _netdev option, in the hopes it would help but that made no difference at all

3- searching the web I finally found why we have a cifs daemon in opensuse, so removed the line from fstab and added it to /etc/samba/cifstab, new reboot but nope even the cifs daemon started to early, maybe this works okay if not using networkmanager, not sure, but with networkmanager it does not.

4- more searching led me from fuse options (did not really find a good one) to autofs which I did not really investigate since I at the same moment I found x-systemd.automount for systemd, this looked promising so back I went from cifstab to fstab and added x-systemd.automount as option: //192.168.2.200/test /home/test/test cifs x-systemd.automount,username=test,password=test

Now this sort of work, the networkfs was mounted once I reached the desktop but sadly whatever I tried it was always mounted as root:root on /home/akm/test, also umount was not really working as it got auto-mounted right away which made me wonder how shutdown would go…

5- so a few more searches I came across /etc/NetworkManager/dispatcher.d/, there I created a file called cifs, chmod 775 and placed in it: mount -t cifs //192.168.2.200/test /home/test/test -o username=test,password=test, rebooted and it works like a charm.

I am not sure this is the perfect way to do it, but from all the options I tried it seems to be the best one so far, hope it helps those looking for a similar solution or if you know a better one I gladly hear about it :slight_smile:

-Xil

On 2013-10-26 20:46, Xilanaz wrote:
> of course this did not work since networkmanager was not up yet and thus
> the server could not be found as systemd said with error -101

You have to make the network entry available to other users.


Cheers / Saludos,

Carlos E. R.
(from 12.3 x86_64 “Dartmouth” at Telcontar)

Yes, and that’s called “System connection” in KDE. And make sure that “Automatically connect” is enabled as well.

Or just switch to “Traditional method with ifup” in YaST->Network->Network Settings->Global Options.
But if you use a wireless connection, it’s not that easy to setup in YaST than it is with NetworkManager (but it _is_possible… :wink: ). Wired should work out-of-the-box though.

On 2013-10-26 21:26, wolfi323 wrote:

> But if you use a wireless connection, it’s not that easy to setup in
> YaST than it is with NetworkManager (but it _is_possible… :wink: ).

It is very easy, I use it :slight_smile:
What is not easy is to adapt to different sites if you move the laptop.

The old method was to use “profiles” and switch them, with “scpm”, if I
recall the name correctly. You could define different profiles for home,
work, visit, whatever, and the entire system config (network, postfix,
ifup/nm) was stored and changed as appropriate. The last release I have
seen that working was on 11.4.


Cheers / Saludos,

Carlos E. R.
(from 12.3 x86_64 “Dartmouth” at Telcontar)

On 10/26/2013 1:46 PM, Xilanaz wrote:
> 5- so a few more searches I came across
> /etc/NetworkManager/dispatcher.d/, there I created a file called cifs,
> chmod 775 and placed in it: mount -t cifs //192.168.2.200/test
> /home/test/test -o username=test,password=test, rebooted and it works
> like a charm.
>
> I am not sure this is the perfect way to do it, but from all the options
> I tried it seems to be the best one so far, hope it helps those looking
> for a similar solution or if you know a better one I gladly hear about
> it:)
>
> -Xil
Xilanaz;

To specify which user and group will own the files on Linux, your mount.cifs command needs to specify the options:


uid=<username>
and
gid=<group>

Here will be the name/id of the Linux owner and the group name/id of the owning group. If not
specified these default to root. For example:


mount -t cifs //192.168.2.200/test /home/test/test -o username=test,password=test,uid=xil,gid=users

mount.cifs is meant for Windows file systems that have no idea of Linux permissions and hence you need to specify the
owning user and group for Linux.

See: man mount.cifs for details and additional information.


P.V.
“We’re all in this together, I’m pulling for you” Red Green

thanks alot Venzkep, will add those.

no sorry wolfi323, fstab is executed way way before networkmanager and wont wait.

OK, I thought that might be the case.
But that’s why I also suggested to switch to ifup. :wink:

On 2013-10-27 08:36, Xilanaz wrote:
> no sorry wolfi323, fstab is executed way way before networkmanager and
> wont wait.

Network shares in fstab go through a second round after network is up.
Do you think devs are that daft? :slight_smile:


Cheers / Saludos,

Carlos E. R.
(from 12.3 x86_64 “Dartmouth” at Telcontar)