Announcement

Collapse
No announcement yet.

Entry in fstab did not get mounted at boot time

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Entry in fstab did not get mounted at boot time

    I have the following entriy in /etc/fstab

    Code:
    192.168.1.125:/volume1/homes /mnt/MyNAS1 nfs defaults 0 0
    But the directory will not get mounted at starup. I need to execute
    Code:
    sudo mount -a
    to get the directory mounted after system startup.

    I also tried
    Code:
    192.168.1.125:/volume1/homes /mnt/MyNAS1 nfs defaults,_netdev 0 0
    but the result is the same.

    I am running Kubuntu 22.04 with latest updates. My NAS is a Synology NAS.

    #2
    if the line in fstab mounts when using mount -a, there is probably nothing wrong with the fstab entry itself. You could consider a cron entry @ reboot for the root user to issue mount -a at startup as a workaround. Maybe the fstab entry is trying to load before the necessary network services (nfs) are loaded.

    Comment


      #3
      Someone may have a better idea than this. I am just suggesting it as a troubleshooting step to see if having the system wait and then issue the mount -a command automatically allows the share to be mounted correctly. If you already have experience with cron great, if not it is really not that difficult.
      You would have to research and learn how to edit cron jobs, there are various ways of doing it. You can even put the cron job in a text file and load it with cron command on command line or use crontab -e with sudo or as root to edit the crontab file. This is the general steps involved, but like I said this is not a tutorial, just to give a general idea of some of the steps involved if you don't already know how it would be done. There are plenty of tutorials out there online. Some are good, some are ambiguous and some are wrong, so read several until you get the idea. If you have any questions someone will help you here.

      If cron is not already installed:
      Code:
      sudo apt install cron
      Then make sure cron service is enabled:
      Code:
       sudo systemctl enable cron
      Edit the crontab entry to run as privileged user:
      Code:
      sudo crontab -e
      have cronjob sleep first to allow for network services to come up, then execute command as follows:
      Code:
      @reboot sleep15;mount -a
      There are probably other ways of troubleshooting this but it was my first thought.

      Comment


        #4
        Sorry - I deleted my answer.
        I thought I had a solution, but it was a different use-case from work, where every user had to authenticate for a Samba-mount…
        Last edited by Schwarzer Kater; Jun 15, 2022, 02:07 PM. Reason: wrote rubbish
        Debian KDE & LXQt • Kubuntu & Lubuntu • openSUSE KDE • Windows • macOS X
        Desktop: Lenovo ThinkCentre M75s • Laptop: Apple MacBook Pro 13" • and others

        get rid of Snap script (20.04 +)reinstall Snap for release-upgrade script (20.04 +)
        install traditional Firefox script (22.04 +)​ • install traditional Thunderbird script (24.04)

        Comment


          #5
          Use KSystemLog or use dmesg to view and search the logs for mount actions, or the device/partition, to see if it didn't mount because the network wasn't up at the time, which seems extremely likely.

          There are numerous ways to do this, using the _netdev option in the fstab is one, but there are others.

          However (due to me having a brane cramp lol):
          IF you are using WiFi to connect to your network, a quick thing that may fix this all by itself, is to set that connection to be available to all users , which makes it available during boot, as opposed to after login.
          This might or might not work, depending on how long it takes to connect, and you might still need the _netdev option in the fstab.
          If you are connection via Ethernet cable, double check that this setting is enable there, though it normally should be.


          Click image for larger version  Name:	image_9464.png Views:	3 Size:	51.0 KB ID:	663769

          Last edited by claydoh; Jun 15, 2022, 02:32 PM.

          Comment


            #6
            Thanks for all of your info. After some trials. I found out that if I connect my laptop to the network using ethernet cable. The mount will occur at boot time. Even when the _netdev is not present.

            The mount will not occur at boot time only when I use a wifi connection. Even if I have the _netdev option infstab and set the connection to all user.

            For now I will just connect my laptop to the network using the ethernet cable.

            Comment


              #7
              For now I will just connect my laptop to the network using the ethernet cable.
              You could also look here in the meantime to see if any of the posted solutions work for you:
              https://askubuntu.com/questions/3996...unting-at-boot
              The one that looks interesting and hopefully might have some effect to date:
              If _netdev doesn't work, try this option instead:

              x-systemd.automount
              It works by mounting the drive at first access.
              And one user suggested all three of the following:
              • noauto will stop the no-brainer actions like forcibly mounting whatsoever at booting regardless if the network is up or not.
              • x-systemd.automount is the smart daemon that knows when to mount.
              • The _netdev tag will also identify that it uses network devices, thus it will wait until the network is up.
              His fstab had this inline:
              noauto,x-systemd.automount,_netdev
              Last edited by rab0171610; Jun 15, 2022, 09:02 PM.

              Comment


                #8
                I am able to connect my laptop to the network using both ethernet cable and wifi and mount at boot time. The following is the entry in fstab.

                Code:
                192.168.1.125:/volume1/homes /mnt/MyNAS1 nfs defaults,x-systemd.automount 0 0
                I also need to set "All users may connect to this network" for wifi connection. Otherwise the laptop take a long time to start.

                The following is the web page that teach me to connect a Synology NAS to the network.

                https://kb.synology.com/en-ca/DSM/tu...al_network_NFS

                Does anyone know how to mark this post as RESOLVED?
                Last edited by fckwan; Jun 16, 2022, 01:06 PM.

                Comment

                Working...
                X