# mounting nas at boot? (SOLVED)

## Spanik

I added a NAS (Qnap TS-453 Pro) to my system. The intention is to use it as a "fileserver". It sits on a fixed IP adress

I followed the NFS wiki:

- nfs was already in the kernel as I intended to use the nas last kernel update

- emerged nfs-utils

- added nfsclient to runlevel default

- made a mount point /mnt/nas

After a reboot I could mount the NAS as root with "mount W.X.Y.Z:/Public /mnt/nas" and see the content. I changed ownership of /mnt/nas to my user/group and then I could also write files to it.

I then added the nas to fstab:

```
W.X.Y.Z:/Public            /mnt/nas   nfs     noatime,rw,exec,suid,_netdev    0 0
```

When I boot the pc now and I go to /mnt/nas I get an empty folder. In dmesg I find the following:

```
[    0.627827] NET: Registered PF_INET protocol family

[    0.628100] IP idents hash table entries: 262144 (order: 9, 2097152 bytes, vmalloc)

[    0.630132] tcp_listen_portaddr_hash hash table entries: 32768 (order: 7, 524288 bytes, vmalloc)

[    0.630292] TCP established hash table entries: 524288 (order: 10, 4194304 bytes, vmalloc)

[    0.630930] TCP bind hash table entries: 65536 (order: 8, 1048576 bytes, vmalloc)

[    0.631047] TCP: Hash tables configured (established 524288 bind 65536)

[    0.631162] UDP hash table entries: 32768 (order: 8, 1048576 bytes, vmalloc)

[    0.631308] UDP-Lite hash table entries: 32768 (order: 8, 1048576 bytes, vmalloc)

[    0.631533] NET: Registered PF_UNIX/PF_LOCAL protocol family

[    0.631800] RPC: Registered named UNIX socket transport module.

[    0.631803] RPC: Registered udp transport module.

[    0.631806] RPC: Registered tcp transport module.

[    0.631807] RPC: Registered tcp NFSv4.1 backchannel transport module.

.....

[    0.745660] NFS: Registering the id_resolver key type

[    0.745676] Key type id_resolver registered

[    0.745678] Key type id_legacy registered
```

If I mount the nas as root all is OK. I can read and write to the nas. So something must be wrong with the fstab or the config of the nas.

Another thing I do not understand is that to mount the nas I have to be root. But root (as defined on the pc) is not known on the nas. How can the nas then verify the right user is connecting?

----------

## Hu

 *Spanik wrote:*   

> If I mount the nas as root all is OK. I can read and write to the nas. So something must be wrong with the fstab or the config of the nas.

 Is your system configured to mount network filesystems at boot?  For openrc, I think this would be through the netmount init script. *Spanik wrote:*   

> Another thing I do not understand is that to mount the nas I have to be root. But root (as defined on the pc) is not known on the nas. How can the nas then verify the right user is connecting?

 The NAS does not care who mounts it.  The local kernel cares that you do not have arbitrary users mounting filesystems, neither local nor remote, without permission from the local root user.  root obviously has permission from itself to mount filesystems.  It can delegate that to other users with an fstab entry marking the filesystem as safe for users to mount.

----------

## Spanik

[quote="Hu"]Is your system configured to mount network filesystems at boot?  For openrc, I think this would be through the netmount init script.

To be honest, I have no idea. I followed the wiki. And from what I understand of what I found on the net, then adding "_netdev" in the fstab should make that this nfs drive is only mounted after the network has started. Everywhere I read it says this should do it. But it obviously does not mount the nas at boot. I looked at that script but I don't understand a single thing about it. Do I have to change it?

Could it be that the nas has gone to sleep and that it takes too long to wake? If so, then how can you tell fstab to wait x time?

 *Hu wrote:*   

> The NAS does not care who mounts it.  The local kernel cares that you do not have arbitrary users mounting filesystems, neither local nor remote, without permission from the local root user.  root obviously has permission from itself to mount filesystems.  It can delegate that to other users with an fstab entry marking the filesystem as safe for users to mount.

 

Ok. But I assumed that fstab would run with the root privileges. Otherwise it would not be able to mount anything. Or am I seeing that wrongly?

But I really would like this to be mounted at boot, not requiring any extra intervention from the user (me in this case).

----------

## Hu

What Wiki did you follow?  Neither of your posts in this thread links to a Wiki page, so I cannot readily follow along to see what you did.

I asked if you have netmount enabled.  If you don't know, you should check.  That could be the explanation.  On OpenRC systems, the netmount init script is responsible for mounting filesystems marked as _netdev in /etc/fstab.  If you have not enabled that init script, then nothing will attempt to mount these for you.

If the NAS were asleep, but the system were attempting to mount the filesystem, you should get an error message when the mount times out.  Do you?

fstab is a configuration file, so it never runs at all.  Many tools that change system state based on what they find in /etc/fstab are run with root privilege, but those tools typically only act if authorized by root, either directly by having been started with a real uid of root, or indirectly by finding an annotation in fstab, such as users, that says root intends for unprivileged users to be able to act.

----------

## alamahant

Try enabling nfsclient and network

```

rc-update add net.<> default

rc-update add nfsclient default

```

from your dmesg

```

 RPC: Registered tcp NFSv4.1 backchannel transport module

```

it seems it is trying to mount the share as nfs vers4.1.

For that you need rpc.idmapd.

Edit

/etc/conf.d/nfsclient

like

```

c_need="!rpc.statd rpc.idmapd"

```

and /etc/idmapd.conf like

```

[Mapping]

Nobody-User = nobody

Nobody-Group = nobody

```

----------

## Spanik

 *Hu wrote:*   

> What Wiki did you follow?  Neither of your posts in this thread links to a Wiki page, so I cannot readily follow along to see what you did.

 

This is what I followed: https://wiki.gentoo.org/wiki/Nfs-utils I do not have systemd or Kerberos.

 *Hu wrote:*   

> I asked if you have netmount enabled.  If you don't know, you should check.  That could be the explanation.  On OpenRC systems, the netmount init script is responsible for mounting filesystems marked as _netdev in /etc/fstab.  If you have not enabled that init script, then nothing will attempt to mount these for you.

 

I see these services:

```
rc-service --list

agetty

binfmt

bootlogd

bootmisc

cgroups

consolefont

cronie

cups-browsed

cupsd

dbus

devfs

device-mapper

dhcpcd

display-manager

display-manager-setup

dmcrypt

dmesg

dmeventd

elogind

fancontrol

fsck

fuse

gpm

gpsd

hostname

hwclock

ip6tables

iptables

keymaps

killprocs

kmod-static-nodes

lm_sensors

local

localmount

loopback

lvm

lvm-monitoring

lvmetad

lvmpolld

mit-krb5kadmind

mit-krb5kdc

mit-krb5kpropd

modules

motion

mount-ro

mtab

net-online

net.eno1

net.eno2

net.lo

netmount

nfs

nfsclient

nfsmount

ntp-client

ntpd

nullmailer

numlock

osclock

pciparm

procfs

pydoc-3.10

pydoc-3.9

root

rpc.idmapd

rpc.pipefs

rpc.statd

rpcbind

rsyncd

runsvdir

s6-svscan

samba

save-keymaps

save-termencoding

savecache

serial

smartd

sntp

sshd

stmpfiles-dev

stmpfiles-setup

swap

swclock

sysctl

sysfs

sysklogd

termencoding

udev

udev-settle

udev-trigger

urandom

virtualbox-guest-additions

xdm

```

and

```
rc-update

               binfmt | boot                                   

             bootmisc | boot                                   

              cgroups |                                 sysinit

               cronie |      default                           

                 dbus |      default                           

                devfs |                                 sysinit

               dhcpcd |      default                           

                dmesg |                                 sysinit

                 fsck | boot                                   

             hostname | boot                                   

              hwclock | boot                                   

              keymaps | boot                                   

            killprocs |                        shutdown        

    kmod-static-nodes |                                 sysinit

                local |      default nonetwork                 

           localmount | boot                                   

             loopback | boot                                   

              modules | boot                                   

             mount-ro |                        shutdown        

                 mtab | boot                                   

             net.eno1 |      default                           

             net.eno2 |      default                           

             netmount |      default                           

                  nfs |      default                           

            nfsclient |      default                           

           ntp-client |      default                           

               procfs | boot                                   

                 root | boot                                   

         save-keymaps | boot                                   

    save-termencoding | boot                                   

            savecache |                        shutdown        

                 sshd |      default                           

        stmpfiles-dev |                                 sysinit

      stmpfiles-setup | boot                                   

                 swap | boot                                   

               sysctl | boot                                   

                sysfs |                                 sysinit

             sysklogd |      default                           

         termencoding | boot                                   

                 udev |                                 sysinit

         udev-trigger |                                 sysinit

              urandom | boot                                   

 virtualbox-guest-additions |      default 
```

 So I think netmount is running.

 *Quote:*   

> If the NAS were asleep, but the system were attempting to mount the filesystem, you should get an error message when the mount times out.  Do you?

 

I see an error before logging in but I cannot find it back in any log. There is nothing in dmesg except that nfs has registered the key. I took a literate screenshot:https://quirinus.one/gentoo/screenshot_nfs.jpg When I want to access /mnt/log with Dolphin I get:

```
An error occurred while accessing '/mnt/nas', the system responded: mount.nfs: failed to prepare mount: Operation not permitted
```

 *Quote:*   

> fstab is a configuration file, so it never runs at all.  Many tools that change system state based on what they find in /etc/fstab are run with root privilege, but those tools typically only act if authorized by root, either directly by having been started with a real uid of root, or indirectly by finding an annotation in fstab, such as users, that says root intends for unprivileged users to be able to act.

 

Ok.

----------

## Spanik

This came while typing the previous reply.

 *alamahant wrote:*   

> Try enabling nfsclient and network
> 
> ```
> 
> rc-update add net.<> default
> ...

 

As above, they are running. At least that is how I read what I get back from rc-update.

 *alamahant wrote:*   

> try modifying fstab to
> 
> ```
> 
> W.X.Y.Z:/Public            /mnt/nas   nfs     uid=1000,gid=1000,noatime,rw,exec,suid,_netdev    0 0
> ...

 

Now how do I know if I have to use nfsv4.1? When I go into the config of the NAS I only have an entry to "enable nfs", not choosing what version to use. and /etc/conf.d/nfsclient says to leave it alone if you do not know what version to use. Can't nfs_client work out itself what version to use?

----------

## alamahant

 *Quote:*   

> 
> 
> Now how do I know if I have to use nfsv4.1? When I go into the config of the NAS I only have an entry to "enable nfs", not choosing what version to use
> 
> 

 

Yes you are right.

Also the uid=1000,gid=1000 options dont seem to be available anymore.

Sorry for any confusion.

You can try nfsstat to deduce server nfs protocol

```

nfsstat --server <ip-of-nas>

```

Plz see this

https://www.qnap.com/en-us/how-to/knowledge-base/article/how-to-enable-and-setup-host-access-for-nfs-connection

use your nas control panel to set nfs version and perms.

----------

## Spanik

 *alamahant wrote:*   

> 
> 
> You can try nfsstat to deduce server nfs protocol
> 
> ```
> ...

 

I'll try tomorrow. Probably I'll have to check if I need an update to the nas for those settings. I do not have the choice between versions, only an "enable".

Thanks so far to you all for the suggestions.

----------

## Spanik

 *alamahant wrote:*   

> You can try nfsstat to deduce server nfs protocol
> 
> ```
> 
> nfsstat --server <ip-of-nas>
> ...

 

Ok, I had to update the nas to get V4 working. It is now set. I also checked the access richts of the /Public and those are ok.

```
# nfsstat --server 192.168.2.6

Error: No Server Stats (/proc/net/rpc/nfsd: No such file or directory).
```

And it doesn't work at boot either. I I try to mount it as root I get:

```
# mount /mnt/nas

mount.nfs: an incorrect mount option was specified

# mount -t nfs 192.168.2.6:/Public /mnt/nas 
```

So it looks as if one of the options I have in fstab isn't ok for mount.nfs

----------

## alamahant

Plz remove from fstab nfs mount

```

uid=65534,gid=65534,

or

uid=1000,gid=1000,

```

If you have them.

I had mentioned above adding these was my mistake as they are non existent mount options(any more?)

----------

## Spanik

 *alamahant wrote:*   

> Plz remove from fstab nfs mount
> 
> ```
> 
> uid=65534,gid=65534,
> ...

 

They are removed so it isn't that.

I was looking now at what is shown when booting. Sadly I cannot find it in a log so I'm typing it over from a photo:

```
* Starting NFS sm-notify ...

* Mounting network filesystems ...

mount.nfs: Network is unreachable

* Could not mount all network filesystems

* Starting NFS mountd ...

* Starting NFS daemon ...

rpc.nfsd: Unable to access /proc/fs/nfsd errno 2 (No such file or directory).

Please try, as root, 'mount -t nfsd nfsd /proc/fs/nfsd' and then restart.nfsd to correct the problem

* Starting NFS smnotify ...

* ERROR: nfs failed to start

* Starting sshd ...
```

So I'm now going to try what is says in that line "Please try, as root....". I'll come back then.

EDIT:

```
# mount -t nfsd nfsd /proc/fs/nfsd

mount: /proc/fs/nfsd: unknown filesystem type 'nfsd'.
```

So this doesn't help either.

----------

## alamahant

```

* Starting NFS sm-notify ...

* Mounting network filesystems ...

mount.nfs: Network is unreachable

* Could not mount all network filesystems

* Starting NFS mountd ...

* Starting NFS daemon ...

rpc.nfsd: Unable to access /proc/fs/nfsd errno 2 (No such file or directory).

Please try, as root, 'mount -t nfsd nfsd /proc/fs/nfsd' and then restart.nfsd to correct the problem

* Starting NFS smnotify ...

* ERROR: nfs failed to start

* Starting sshd ...

```

you are in your client so you shouldnt normally need nfsd.

Plz run

```

rc-update delete nfs default

rc-update add nfsclient default

rc-update add net.<your iface> default

```

It complains

```

mount.nfs: Network is unreachable

```

----------

## Spanik

I removed nfs from level default and the error about rpc.nfsd is now gone. But still the error about mounting the nas.

Both network interfaces and dhcpcd are up right after entering runlevel 3, before the system tries to mount the nas. See screenphoto:

https://quirinus.one/gentoo/screenshot_nfs_2.jpg

You can see that interface eno1 has received an IP address.

----------

## alamahant

This is the problem in fstab

```

W.X.Y.Z:/Public            /mnt/nas   nfs     noatime,rw,exec,suid,_netdev    0 0

```

plz change it to

```

W.X.Y.Z:/Public            /mnt/nas   nfs     rw,defaults    0 0

or

W.X.Y.Z:/Public            /mnt/nas   nfs     rw,suid,_netdev    0 0

```

----------

## Spanik

 *alamahant wrote:*   

> 
> 
> plz change it to
> 
> ```
> ...

 

I tried both version but it continues to complain about "network unreachable".

----------

## alamahant

You get in your rc.log a

failure of name resolution.

What is the contents of

/etc/resolv.conf?

This should not matter as in fstab you used an ip for your nas server no?

Like

```

192.168.2.6:/Public /mnt/nas   nfs     rw,defaults    0 0

```

----------

## Spanik

 *alamahant wrote:*   

> You get in your rc.log a
> 
> failure of name resolution.
> 
> What is the contents of
> ...

 

resolv.conf

```
# Generated by dhcpcd from eno1.dhcp, eno1.dhcp6, eno1.ra

# /etc/resolv.conf.head can replace this line

domain lan

nameserver 192.168.2.1

nameserver fd10:3da9:ee3::1

# /etc/resolv.conf.tail can replace this line
```

ipv6 is enable in the nas as well and the switch in between supports it.

Yes, I use an IP address in fstab

```
# /etc/fstab: static file system information.

#

# noatime turns off atimes for increased performance (atimes normally aren't 

# needed); notail increases performance of ReiserFS (at the expense of storage 

# efficiency).  It's safe to drop the noatime options if you want and to 

# switch between notail / tail freely.

#

# The root filesystem should have a pass number of either 0 or 1.

# All other filesystems should have a pass number of 0 or greater than 1.

#

# See the manpage fstab(5) for more information.

#

# <fs>         <mountpoint>   <type>      <opts>      <dump/pass>

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.

#

# NOTE: Even though we list ext4 as the type here, it will work with ext2/ext3

#       filesystems.  This just tells the kernel to use the ext4 driver.

#

# NOTE: You can use full paths to devices like /dev/sda3, but it is often

#       more reliable to use filesystem labels or UUIDs. See your filesystem

#       documentation for details on setting a label. To obtain the UUID, use

#       the blkid(8) command.

#LABEL=boot      /boot      ext4      noauto,noatime   1 2

#UUID=58e72203-57d1-4497-81ad-97655bd56494      /      ext4      noatime      0 1

#LABEL=swap      none      swap      sw      0 0

#/dev/cdrom      /mnt/cdrom   auto      noauto,ro   0 0

PARTUUID=4d06bb89-cbf7-d84c-9ee1-fa1ce078ee01   /boot      vfat   noauto,noatime      1 2

UUID=076be15c-015b-4bd6-8c2a-a8a9ecd5ddca   none      swap   sw         0 0

UUID=96d663c8-081a-4834-8766-1acca3cde0a2   /      xfs   noatime         0 1

UUID=5961004a-94f5-4c20-9746-7c721d22e6ec   /mnt/main_data   xfs   noatime,rw,exec,suid   0 1

UUID=94063aea-cfd4-4f05-9228-f10ba1c08ae2   /mnt/rommel   xfs   noatime,rw,exec,suid   0 1

UUID=cf9c0169-59c9-4c28-9d8c-d7a77b3897ca   /mnt/mail   xfs   noatime,rw,exec,suid   0 1

UUID=377e334b-7a76-43f2-b5a9-587cd1caabed   /mnt/virt_xp    xfs noatime,rw,exec,suid    0 1

192.168.2.6:/Public                         /mnt/nas        nfs rw,defaults    0 0
```

----------

## alamahant

Is this a VirtualBox VM?

If yes what kind of net adapter have you assigned to it?

NAT or bridged?

----------

## alamahant

OK you have 2 ifaces eno1 and eno2.

Both get ip and default gateway and dns indo from dhcp.

This is the problem.

Just remove one of the two.

You can not have two ifaces in the same LAN being asigned a default gateway.

It will block the network.

So either remove one of them or configure it to not get default gateway assigned.

----------

## Spanik

 *alamahant wrote:*   

> Is this a VirtualBox VM?
> 
> If yes what kind of net adapter have you assigned to it?
> 
> NAT or bridged?

 

I do not follow this. the Gentoo is the only OS on the pc. There are VM's, but those are not running (and are not intended to be connected to the nas).

 *alamahant wrote:*   

> OK you have 2 ifaces eno1 and eno2.
> 
> Both get ip and default gateway and dns indo from dhcp.
> 
> This is the problem.
> ...

 

Both interfaces are physical interfaces on the motherboard. At this moment, only eno1 is connected to the switch. So I do not understand why it is listed as "received address". If I run ifconfig

```
ifconfig

bond0: flags=5123<UP,BROADCAST,MASTER,MULTICAST>  mtu 1500

        ether 6a:13:f3:25:4b:f8  txqueuelen 1000  (Ethernet)

        RX packets 0  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes 0 (0.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 192.168.2.11  netmask 255.255.255.0  broadcast 192.168.2.255

        inet6 fe80::899b:f866:bf0d:8c8a  prefixlen 64  scopeid 0x20<link>

        inet6 fd10:3da9:ee3:0:4cd3:388:7e82:4881  prefixlen 64  scopeid 0x0<global>

        inet6 2a02:a03f:610b:1300:a9ce:3fd5:6c09:1931  prefixlen 64  scopeid 0x0<global>

        ether ac:1f:6b:ad:42:d2  txqueuelen 1000  (Ethernet)

        RX packets 84943  bytes 98916117 (94.3 MiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 41969  bytes 8414356 (8.0 MiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

        device memory 0xef800000-ef87ffff  

eno2: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500

        ether ac:1f:6b:ad:42:d3  txqueuelen 1000  (Ethernet)

        RX packets 0  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes 0 (0.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

        device memory 0xef700000-ef77ffff  

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536

        inet 127.0.0.1  netmask 255.0.0.0

        inet6 ::1  prefixlen 128  scopeid 0x10<host>

        loop  txqueuelen 1000  (Local Loopback)

        RX packets 14  bytes 1116 (1.0 KiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 14  bytes 1116 (1.0 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

```

I'm a bit confused about the "bond0" entry. The idea was to connect both interfaces to the switch as a bonded interface. Likewise the nas and the switch can be set for bonding as well. But I never did this because I never started the nas (it sat for years unused under my desk).

I'll remove net.eno2 from default and see what that gives.

----------

## alamahant

 *Quote:*   

> 
> 
> alamahant wrote:
> 
> Is this a VirtualBox VM?
> ...

 

Then why do you have virtualbox-guest additions failing to initialize in your rc.log?

They are meant for the guest NOT the host.

----------

## Spanik

 *alamahant wrote:*   

>  *Quote:*   
> 
> alamahant wrote:
> 
> Is this a VirtualBox VM?
> ...

 

Yes, I never get to understanding the wiki on installing it. Sorry. There is other stuff likewise, like nfsd...

----------

## NeddySeagoon

Spanik,

I use

```
# DVD Collection Read Only 

192.168.100.55:/mnt/mediatomb                  /mnt/media              nfs             sync,hard,intr,ro,nolock,vers=3         0 0
```

I could not get nfs version 4 to work ro,nolock are safe together. If you want a rw mount, you must have locking.

Your bond0 and an interface with an IP address makes me raise an eyebrow.

To make a bond work, you donate interfaces to the bond before they are configured, then the bond gets configured as if it were a physical interface.

I don't think any of this will fix your network error though.

What do you have in /etc/rc.conf for

```
# Do we allow any started service in the runlevel to satisfy the dependency

# or do we want all of them regardless of state? For example, if net.eth0

# and net.eth1 are in the default runlevel then with rc_depend_strict="NO"

# both will be started, but services that depend on 'net' will work if either

# one comes up. With rc_depend_strict="YES" we would require them both to

# come up.

#rc_depend_strict="YES"
```

Its worth a try with 

```
rc_depend_strict="NO"[
```

With your rc.conf 

```
net.eno1

net.eno2

net.lo 
```

the default is to require all three interfaces to be up before the network is considered up.

With eno2 not connected, that's not going to happen.

----------

## Spanik

I started with this one

 *Quote:*   

> 
> 
> ```
> net.eno1
> 
> ...

 

I removed net.eno2 from the default startup but no difference. The reason both interfaces start are because this board has 2 ethernet interfaces and when installing from the live cd it names the interfaces differently. So I start both of them.

 *NeddySeagoon wrote:*   

> I use
> 
> ```
> # DVD Collection Read Only 
> 
> ...

 

It makes no difference with those settings. Tried with the _netdev as well but again, the same error.

 *Quote:*   

> Your bond0 and an interface with an IP address makes me raise an eyebrow.
> 
> To make a bond work, you donate interfaces to the bond before they are configured, then the bond gets configured as if it were a physical interface.
> 
> I don't think any of this will fix your network error though.

 

I have no idea where that bond comes from. As I wrote, it was my intention to use that when I installed the pc. So I probably activated something in the kernel for it. But there it stopped.

 *Quote:*   

> What do you have in /etc/rc.conf for
> 
> ```
> # Do we allow any started service in the runlevel to satisfy the dependency
> 
> ...

 

It was with 

```
#rc_depend_strict="YES"
```

I changed it to "NO" and removed the # but again, no change.

----------

## Spanik

 *NeddySeagoon wrote:*   

> Your bond0 and an interface with an IP address makes me raise an eyebrow.
> 
> To make a bond work, you donate interfaces to the bond before they are configured, then the bond gets configured as if it were a physical interface.

 

I checked my kernel config and I indeed have the network bonding driver in the kernel and not as a module. I removed it and it is compiling right now.

----------

## alamahant

If you wish to bond the two ifaces together your /etc/conf.d/net

should contain

```

config_eno1="null"

config_eno2="null"

slaves_bond0="eno1 eno2"

config_bond0="dhcp"

```

Plz have net.eno1 net.eno2 and net.bond0 enabled @default (### corrected it from @boot)

Disable dhcpcd.

And let netifrc use it when it deems necessary.

----------

## Spanik

I removed the bond driver from my kernel. Next I also removed net.eno2 from the default level, removed /etc/init.d/net.eno2 and removed eno2 from /etc/conf.d/net. I doesn't figure anymore during the boot messages. But it still starts eno2...

```
$ ifconfig

eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 192.168.2.11  netmask 255.255.255.0  broadcast 192.168.2.255

        inet6 fe80::899b:f866:bf0d:8c8a  prefixlen 64  scopeid 0x20<link>

        inet6 fd10:3da9:ee3:0:4cd3:388:7e82:4881  prefixlen 64  scopeid 0x0<global>

        inet6 2a02:a03f:610b:1300:a9ce:3fd5:6c09:1931  prefixlen 64  scopeid 0x0<global>

        ether ac:1f:6b:ad:42:d2  txqueuelen 1000  (Ethernet)

        RX packets 216  bytes 200479 (195.7 KiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 107  bytes 8716 (8.5 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

        device memory 0xef800000-ef87ffff  

eno2: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500

        ether ac:1f:6b:ad:42:d3  txqueuelen 1000  (Ethernet)

        RX packets 0  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes 0 (0.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

        device memory 0xef700000-ef77ffff  

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536

        inet 127.0.0.1  netmask 255.0.0.0

        inet6 ::1  prefixlen 128  scopeid 0x10<host>

        loop  txqueuelen 1000  (Local Loopback)

        RX packets 14  bytes 1116 (1.0 KiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 14  bytes 1116 (1.0 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
```

 *alamahant wrote:*   

> If you wish to bond the two ifaces together your /etc/conf.d/net
> 
> should contain
> 
> ```
> ...

 

Thanks, I will file this for reference later. But first I'd like to get this nas mounted at boot before getting deeper into that.

----------

## Spanik

 *alamahant wrote:*   

> Plz have net.eno1 net.eno2 and net.bond0 enabled @boot.

 

Just a tought, should net.eno1 be at runlevel "boot" instead of "default"?

----------

## alamahant

Yes my mistake.

Plz have them all enabled @default.

----------

## Spanik

I'm lost with this network stuff. Somehow I cannot make it so eno2 does not start. And _netdev that should make mount wait untill network is started does not seem to have any influence.

Is there a way to have this nfs mounted automatically after login? Without having to become root etc.

----------

## alamahant

Your network is a bit of a mess.

I suppose your are not using net.<ifname> files.

But dhcpcd.

So somewhere in dhcpcd conf file you have assigned eno2 to be handled by dhcpcd.

My advice is disable dhcpcd.

And use netifrc.

```

cd /etc/init.d

ln -s net.lo net.eno1

ln -s net.lo net.eno2

rc-update add net.eno1 default

rc-update delete dhcpcd default

### do not enable net.eno2

```

Then

in /etc/conf.d/net

```

config_eno1="dhcp"

```

If this a desktop used only at home then I strongly advice you to use static ip.

in /etc/conf.d/net

```

#config_eno1="dhcp"

config_eno1="192.168.2.3/24"

routes_eno1="default via 192.168.2.1" ### router-ip

dns_servers_eno1="192.168.2.1 1.1.1.1 8.8.8.8" ###etc

```

for example.

Plz make sure dhcpcd is DISABLED.

Netifrc will use it if it deems necessary.

Then plz reboot

 *Quote:*   

> 
> 
> s there a way to have this nfs mounted automatically after login? Without having to become root etc.
> 
> 

 

Yes plz use autofs

https://wiki.gentoo.org/wiki/AutoFS

The nfs share will be mounted when you try to access it.

----------

## Spanik

 *alamahant wrote:*   

> Your network is a bit of a mess.
> 
> I suppose your are not using net.<ifname> files.
> 
> But dhcpcd.
> ...

 

I do have dhcpcd. But do have the network configured as you give in your example with /etc/init.d/net.eno1 as a link and /etc/conf.d/net as follows:

```
dns_domain_lo="home"

config_eno1="dhcp"
```

I removed the /etc/init.d/net.eno2 link and also removed it from level default. However after a reboot I still see eno2 when I run ifconfig.

What if I remove dhcpcd? Can I still use dhcp?

 *Quote:*   

> 
> 
> s there a way to have this nfs mounted automatically after login? Without having to become root etc.
> 
> 

 

Yes plz use autofs

https://wiki.gentoo.org/wiki/AutoFS

The nfs share will be mounted when you try to access it.[/quote]

I'll check that out. Thanks.

----------

## Spanik

Ok, so I removed dhcpcd from level default and now after a reboot I only have eno1 when I do ifconfig.

Time to go back to start for this nfs.

----------

## Spanik

Ok, so after removing dhcpcd from runlevel default and a reboot the only connected network interface came up and only that one.

I added the line in fstab again.

```
192.168.2.6:/Public                         /mnt/nas    nfs     rw,suid,_netdev         0 0
```

And now it is mounted at boot. What I see now in the messages that come during boot before logging in is that the interface is started and then dhcpcd is called. There are a lot more lines there now with info. And it takes a bit longer to boot.

Thanks to all of you!

----------

## alamahant

Good news.

If you decide to go with autofs then in fstab nfs share line delete "_netdev" and add "noauto"

Or comment out the whole line.

Then configure autofs and it will be nice and cool.

 *Quote:*   

> 
> 
> There are a lot more lines there now with info. And it takes a bit longer to boot.
> 
> 

 

That is why i suggested static ip.It will be blazing fast during boot.

If it is a desktop it is what you should do really.

----------

## Spanik

 *alamahant wrote:*   

> Good news.
> 
> If you decide to go with autofs then in fstab nfs share line delete "_netdev" and add "noauto"
> 
> Or comment out the whole line.
> ...

 

This motherboard is not "blazing fast to boot". It takes quite some time before it goes through all the screens. So those few extra seconds make not much difference. I'm going to stay with dhcp however. That way the laptop and desktop are similar. It is easier if they are similar (for me to remember how to do things). But this means I'll have to disable dhcpcd in runlevel default on the laptop as well.

This autofs however is something I'm going to check out. It would be good to have the backup USB-disks mountable that way. And for the laptop to connect to the nas. No need that the laptop tries to mount the nas if not on the home network.

Next on the list will be that bonding of the interfaces. But I'll have to re-read the manual of the switch first so I can configure that one as well.

----------

