Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
How to make fstab work on Debian 10?
How to make fstab work on Debian 10?
On all the Linuxes that I've tried before, whenever one puts something in /etc/fstab it gets automatically mounted when the machine is restarted, however after installing Debian 10, the same mechanism doesn't seem to work on it.
After restart, the mount folder is empty and is not listed in the mounts.
I had to add "sudo mount -a" to crontab @restart to get them to show up, but is there a more "proper" way for Debian 10 to recognize fstab the way other Debians do?
After restart, the mount folder is empty and is not listed in the mounts.
I had to add "sudo mount -a" to crontab @restart to get them to show up, but is there a more "proper" way for Debian 10 to recognize fstab the way other Debians do?
- wizard10000
- Global Moderator
- Posts: 595
- Joined: 2019-04-16 23:15
- Location: southeastern us
- Has thanked: 78 times
- Been thanked: 89 times
Re: How to make fstab work on Debian 10?
fstab works just fine in Debian 10. Think you could share your fstab so we can have a look?
we see things not as they are, but as we are.
-- anais nin
-- anais nin
Re: How to make fstab work on Debian 10?
//hostname/Share /Share cifs _netdev,dir_mode=0777,file_mode=0777,username=<NAME>,password=<PASSWORD>,rw,uid=1000,gid=1000 0 0
Like, I said, it works fine when I do "sudo mount -a" so the settings seem to be fine, but upon restart it's just not there.
Like, I said, it works fine when I do "sudo mount -a" so the settings seem to be fine, but upon restart it's just not there.
Re: How to make fstab work on Debian 10?
You can try to add this as mount options:
Code: Select all
noauto,x-systemd.automount
Re: How to make fstab work on Debian 10?
That looks like it worked, but why do i need to add "noauto"?
Re: How to make fstab work on Debian 10?
noauto: to make it clear that auto mounting process will be managed by x-systemd.automount, and nothing else.
You can try to remove noauto, it may works. If not .. just keep it !
man systemd.mount
noauto, auto
With noauto, the mount unit will not be added as a dependency for local-fs.target or remote-fs.target.
This means that it will not be mounted automatically during boot, unless it is pulled in by some other unit.
The auto option has the opposite meaning and is the default.
Note that the noauto option has an effect on the mount unit itself only — if x-systemd.automount is used (see above), then the matching automount unit will still be pulled in by these targets.
You can try to remove noauto, it may works. If not .. just keep it !
man systemd.mount
noauto, auto
With noauto, the mount unit will not be added as a dependency for local-fs.target or remote-fs.target.
This means that it will not be mounted automatically during boot, unless it is pulled in by some other unit.
The auto option has the opposite meaning and is the default.
Note that the noauto option has an effect on the mount unit itself only — if x-systemd.automount is used (see above), then the matching automount unit will still be pulled in by these targets.
Re: How to make fstab work on Debian 10?
Interesting, I'm going to have to read up on that a bit more, thanks for your help, the mount is working for now
-
- Posts: 13
- Joined: 2014-05-11 15:52
- Has thanked: 7 times
Re: How to make fstab work on Debian 10? [solved, sort of, Debian 11]
My Thinkpad T450s under Debian 11 Bullseye does not automount network shares in my /etc/fstab on boot, but only because the internal WiFi is so slow at connecting to my network. Like others, worked after boot, so the fstab entries are OK, even without any special options. Here is what I have:
The solution for me: plug in an Ethernet cable, the shares automount on boot, even with the above. Under WiFi only, none of the options to wait for network etc helped, although they caused no harm either: 'sudo mount -a' continued to mount all my shares after boot even when I tried them.
I may replace my Intel AC 7265 card, itself not original, with an Intel AC 8265, said to work better under Linux with this machine, to see if it helps. I will probably use some of the options recommended then.
It seems these tradtional fstab entries like mine are read by some systemd magic and turned into a systemd service. When I was having failures (when I used WiFi only), here is what I got from a status check. You can see the error on boot when the 'Network is unreachable'. Restarting the service, as shown in the last line here, nicely mounted the drives too:
A word of warning!: if you discover it, don't try and simply 'enable' systemd-networkd-wait-online.service because it has no timeout and your boot will hang at the point of waiting for the Network, which apparently never happens. It was originally disabled on my system. If you know what you are doing (which I do not), you can probably set a timeout when you enable it. My fix at this point was to plug in the Ethernet, and the boot rapidly recovered--and mounted my network shares!
Instructions for disabling systemd-networkd-wait-online.service which restored my machine to normal boot: https://wiki.debian.org/systemd/howtos/WaitOnline
Code: Select all
sudo mount -a
Code: Select all
//192.168.1.220/backups/ /media/Backups cifs credentials=/home/myusername/.smb-freenas,uid=1000,iocharset=utf8,noperm
I may replace my Intel AC 7265 card, itself not original, with an Intel AC 8265, said to work better under Linux with this machine, to see if it helps. I will probably use some of the options recommended then.
It seems these tradtional fstab entries like mine are read by some systemd magic and turned into a systemd service. When I was having failures (when I used WiFi only), here is what I got from a status check. You can see the error on boot when the 'Network is unreachable'. Restarting the service, as shown in the last line here, nicely mounted the drives too:
Code: Select all
user@thinkdeb:~$ systemctl status media-Backups.mount
● media-Backups.mount - /media/Backups
Loaded: loaded (/etc/fstab; generated)
Active: failed (Result: exit-code) since Sun 2021-08-08 15:34:25 EDT; 54s ago
Where: /media/Backups
What: //192.168.1.220/backups/
Docs: man:fstab(5)
man:systemd-fstab-generator(8)
CPU: 13ms
Aug 08 15:34:25 thinkdeb systemd[1]: Mounting /media/Backups...
Aug 08 15:34:25 thinkdeb mount[1672]: mount error(101): Network is unreachable
Aug 08 15:34:25 thinkdeb mount[1672]: Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messa>
Aug 08 15:34:25 thinkdeb systemd[1]: media-Backups.mount: Mount process exited, code=exited, status=32/n/a
Aug 08 15:34:25 thinkdeb systemd[1]: media-Backups.mount: Failed with result 'exit-code'.
Aug 08 15:34:25 thinkdeb systemd[1]: Failed to mount /media/Backups.
user@thinkdeb:~$ systemctl restart media-Backups.mount
user@thinkdeb:~$
Instructions for disabling systemd-networkd-wait-online.service which restored my machine to normal boot: https://wiki.debian.org/systemd/howtos/WaitOnline
Operating System: Debian GNU/Linux 12
KDE Plasma Version: 5.26.90
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8
Kernel Version: 6.1.0-3-amd64 (64-bit)
...
KDE Plasma Version: 5.26.90
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8
Kernel Version: 6.1.0-3-amd64 (64-bit)
...
-
- Posts: 13
- Joined: 2014-05-11 15:52
- Has thanked: 7 times
Re: How to make fstab work on Debian 10?
The new card (Intel 8265) did not fix the issue. For me, the problem of fstab share mounting over WiFi alone was finally solved by two further changes, both necessary:
When set to 'available to all users', WiFi connects during boot, and before any individual user logs in, so the fstab entries process in time. Similarly, Ethernet is available to all users by default, so Ethernet always makes an early connection letting fstab connect and automount the Shares.
When WiFi is not made available to all users, and there is no alternative wired Ethernet, the machine does not connect to the network until an individual user (me) logs in--too late for the fstab entries to take effect.
So, all-user-WiFi, and the way it forces early connection, is definitely necessary, but the historic fstab entries still did not work with WiFi alone.
Again, the historic fstab entry I had used was:
For some reason, `x-systemd.automount` option is also necessary. Perhaps it adds some extra degree of waiting for the WiFi connection during boot, sufficient for the fstab entries to process successfully. Here is how I added that to the above:
So, a little confusing (to me), but both changes were needed, at least using WiFi without Ethernet. I believe I am by now on the release version of Debian 11 Bullseye so I hope this can help other users in future.
Edit: I tried this with the 'noauto' option added to the fstab entry too, but it seemed to make no difference so I have omitted it for now.
- enabling 'Make available to other users' in the settings for the WiFi access point AND
- adding `x-systemd.automount` to each fstab entry.
When set to 'available to all users', WiFi connects during boot, and before any individual user logs in, so the fstab entries process in time. Similarly, Ethernet is available to all users by default, so Ethernet always makes an early connection letting fstab connect and automount the Shares.
When WiFi is not made available to all users, and there is no alternative wired Ethernet, the machine does not connect to the network until an individual user (me) logs in--too late for the fstab entries to take effect.
So, all-user-WiFi, and the way it forces early connection, is definitely necessary, but the historic fstab entries still did not work with WiFi alone.
Again, the historic fstab entry I had used was:
Code: Select all
//192.168.1.220/backups/ /media/Backups cifs credentials=/home/myusername/.smb-freenas,uid=1000,iocharset=utf8,noperm
Code: Select all
//192.168.1.220/backups/ /media/Backups cifs x-systemd.automount,credentials=/home/michael/.smb-freenas,uid=1000,iocharset=utf8,noperm 0 0
Edit: I tried this with the 'noauto' option added to the fstab entry too, but it seemed to make no difference so I have omitted it for now.
Operating System: Debian GNU/Linux 12
KDE Plasma Version: 5.26.90
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8
Kernel Version: 6.1.0-3-amd64 (64-bit)
...
KDE Plasma Version: 5.26.90
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8
Kernel Version: 6.1.0-3-amd64 (64-bit)
...