Edw*_*lds 6 boot fstab mount samba systemd
I am following MountWindowsSharesPermanently to mount a samba share on boot
As said in wiki, I added these lines to /etc/fstab:
# auto-mounting the samba share 'Seagates' on raspberry pi
//192.168.2.2/Seagates /home/edward/samba/raspberry cifs uid=1000,gid=1000,credentials=/home/edward/.smbcredentials,iocharset=utf8,sec=ntlm 0 0
Run Code Online (Sandbox Code Playgroud)
and after that, since it is a password protected share, I added login credentials in ~/.smbcredentials and rebooted
The mount is failing with these errors, taken from journalctl | grep samba:
Nov 10 22:39:27 flippingbits systemd[1]: Mounting /home/edward/samba/raspberry...
Nov 10 22:39:33 flippingbits systemd[1]: home-edward-samba-raspberry.mount: Mount process exited, code=exited status=32
Nov 10 22:39:33 flippingbits systemd[1]: Failed to mount /home/edward/samba/raspberry.
Nov 10 22:39:33 flippingbits systemd[1]: home-edward-samba-raspberry.mount: Unit entered failed state.
Nov 10 22:39:58 flippingbits smbd[2613]: pam_unix(samba:session): session closed for user nobody
Run Code Online (Sandbox Code Playgroud)
However if I mount using sudo mount -a after boot, it works.
NOTE: On the same page (here) they have showed a work around to add username=guest to solve this problem. But I cant do it because I am mounting it as another user which is written in ~/.smbcredentials
I am on Ubuntu 15.10
我提到的 Ubuntu Wiki 有点过时,并且无法正常使用systemd. systemd 最初是在 Ubuntu 15.04 中引入的
。问题可能是任何问题,在/etc/fstab读取时网络无法启动或在/etc/fstab读取时samba服务未准备好或它可以是任何东西,我没有阅读太多日志。
但基本上维基中显示的方法不起作用。
在网上漫游后,我终于找到了解决方案,它是x-systemd.automount,x-systemd.device-timeout=3,在fstab文件中的其余选项之前添加
这个:
//192.168.2.2/Seagates /home/edward/samba/raspberry cifs uid=1000,gid=1000,credentials=/home/edward/.smbcredentials,iocharset=utf8,sec=ntlm 0 0
Run Code Online (Sandbox Code Playgroud)
会变成
//192.168.2.2/Seagates /home/edward/samba/raspberry cifs x-systemd.automount,x-systemd.device-timeout=3,uid=1000,gid=1000,credentials=/home/edward/.smbcredentials,iocharset=utf8,sec=ntlm 0 0
Run Code Online (Sandbox Code Playgroud)
如果第一次尝试未挂载驱动器,systemd 将等待,然后放弃尝试自动挂载。这也不会影响/增加引导时间,因为 systemd 不会等待它完成并继续加载系统的其余部分。