After standby over night no connection to NAS

Hello,

I have connected my NAS (Synology DS 220j)) to my Fedora computer (Fedora 36 with Gnome 42.2). To mount that drive I created an entry in fstab. After starting my computer it automatically connects the NAS. But when I move my computer to Standby over night, the NAS is not availiable at the next morning. The error message shows “The resource is currently unavailable” (see screenshot).
But when I type in in terminal sudo mount -a it immediately connects to the NAS.
When the Standby time is only some hours it is also working without problems. Also there is no problem connecting that NAS at the morning via my Android-App.

The fstab line regarding the NAS:
//IP-Adress/gemeinsam /mnt/Gemeinsam-NAS cifs x-systemd.after=network-online.target,_netdev,credentials=/home/aunda/.smbcredentials,user,uid=1000,gid=1000

Is there something to make better in that entry?

Thank you!

(sorry for my english, my native language is German)

I believe that standby is designed to dismount remote file systems while sleeping, thus it is dismounted when the system goes to standby.

The fact that your fstab entry contains the ‘user’ option should allow you to mount and dismount the device as your regular user without requiring sudo to do that.

You should also be able to mount and dismount it from the file manager if you choose.

I do not have an NAS so cannot test this myself.

I have two folders on my NAS. One of them is mounted manually by clicking on the folder in the file manager. After that the folder is availiable.
The other folder is used by me and my girlfried. This is the folder mounted via fstab.

At this morning I first tried to mount the “manually mounted folder”. I wanted to see that the NAS is available after sleep. Everything was fine. The folder was mountet.

But when I click on the folder mounted via fstab after that, that folder is not available.

Waiting some minutes seems to solve the problem. When the computer is awake some minutes (maybe 5 minutes) the fstab-folder is connected.

Today I tried to access the NAS via the internet browser directly after waking up Fedora from standby. Strange, but it work perfect and I can immedently access to the NAS.

After that I opened Gnome files and got this error:

Some minute later I can open the folder as usual. Without doing anything for that.

I see some failures in journal, but cannot unterstand the meaning of it.

Edit: The connection to the NAS is lost after some hours, not just only over night

I don’t know if it could help, but in my experience mounting network resources via fstab has always been unreliable, and still in my experience, systemd automount units are better.
You could try this way:
https://discussion.fedoraproject.org/t/suddenly-user-cifs-mounts-not-supported/22785/11

1 Like

The udev rules tell the system how to do automounts.
If you wish to do automount of the NAS then anticipate a delay in response at all times as it senses the need and then takes action, all before it is available.

Thank you for the suggestion with systemd mount @alciregi

It worked until I turned off the computer to standby. In the morning it shows me the same problem: no connection to NAS for some minutes.

But systemctl status mnt-samba.automount tells me (with green dots):

● mnt-samba.automount - automount my share
     Loaded: loaded (/etc/systemd/system/mnt-samba.automount; enabled; vendor preset: disabled)
     Active: active (waiting) since Sun 2022-07-31 22:55:38 CEST; 8h ago
      Until: Sun 2022-07-31 22:55:38 CEST; 8h ago
   Triggers: ● mnt-samba.mount
      Where: /mnt/samba

This is the content of /etc/systemd/system/mnt-samba.mount:


[Unit]
Description=mount my share

[Mount]
What=//192.168.178.33/gemeinsam
Where=/mnt/samba
Type=cifs
Options=rw,file_mode=0700,dir_mode=0700,uid=1000,user=Nutzer-NAS,password=mypassword
DirectoryMode=0700

[Install]
WantedBy=multi-user.target

And this the content of /etc/systemd/system/mnt-samba.automount:


[Unit]
Description=automount my share

[Automount]
Where=/mnt/samba
TimeoutIdleSec=60

[Install]
WantedBy=multi-user.target

Maybe there is an error with /home/user/xyz in the line Where. I have to read some more about it after my work.

What happens? You list the content of this directory and it is empty?
You could also look in the logs.

No, it´s not empty. It shows me the content of /mnt/samba/ which is the content of the NAS. That works. But not after some hours in Standby.

In the logs I get the same error as I am mounting the NAS via fstab.

Regarding CIFS there were 13 entries with:

CIFS: VFS: \\192.168.178.33 Send error in SessSetup = -5
CIFS: VFS: \\192.168.178.33 Send error in SessSetup = -11

Yes. I mean, when it doesn’t work, the directory is empty or the ls operation stays stuck?

At this morning I waked up my computer and opend the terminal with the ls command:


$ ls /mnt/samba
ls: Zugriff auf '/mnt/samba' nicht möglich: Eingabe-/Ausgabefehler

I tried it some times again.
Some minutes later I got an mail notification in Geary and at the same time the NAS was available:

$ ls /mnt/samba
 Annemarie  'Bilder zu sortieren'   Musik   Otto  '#recycle'   Scanner

So maybe one of the connections to the network wasn’t availiable. The internet browser worked instantly.

The error shown in journal was the same as postet in #4 https://discussion.fedoraproject.org/t/after-standby-over-night-no-connection-to-nas/68580/4?u=on2082

Does this unmount correctly after the idle timeout? (60 seconds)

If you manually unmount the directory from fstab prior to going to standby does it recover?

Thanks

I checked it with mount.
When I access the NAS, the device is listed as last entry. After some minutes not using the NAS it disappears (when I run mount again). So it seems to be unmounted correctly as in mnt-samba.automount defined.

I commented out the line regarding the fstab entry for the NAS to concentrate on using systemd mount. So fstab is not mounting the NAS anymore.

Sorry, I meant unmounting the NAS prior to going into standby.

But it is automatically unmounted after 60 seconds of idle. Or I am wrong?

Tomorrow morning I will first wake up the NAS manually. After that I will wakeup Fedora from standby. Maybe the Fedora computer has some problems to wake up the NAS in the first minutes after wakeup.

Just to know: does the Android app use samba as well?

I don’t know because I cannot find detailed informations about that app.

Today I noticed that directly after wakeup Fedora from standby the NAS seems to be mounted.
mount shows me the NAS in the last line. :heavy_check_mark:

Then I tried

ls /mnt/samba
ls: Zugriff auf '/mnt/samba' nicht möglich: Eingabe-/Ausgabefehler

But as the results says: Cannot access to /mnt/samba"

I tried ls again after two seconds:

ls /mnt/samba
ls: das Verzeichnis '/mnt/samba' wird gelesen: Die Ressource ist zur Zeit nicht verfügbar

Two seconds further on ls shows me the content of the shared folder.

Sadly I forgot this morning to wake up the NAS before starting Fedora. I will repeat it.

My first impression is that the systemd mount seems to be more robust than fstab and a little faster mounting the NAS.

Edit:
At this morning I woke up the NAS device. But the problem still exists. So I think the NAS is not the problem.

Finally I think I have to live with it. Maybe the problem is fixed with kernel 5.19. Waiting some minutes before accessing the NAS solves the problem.

Hello,

just a quick feedback:
In the last time the problem seems to be gone. Don´t know why… Maybe with the latest kernel 5.19.
After standby the connection to the NAS is instantly available now.

Thank you all for helping me! :+1:

3 Likes