redhat – Centos 7 autofs mount在重启后无法正常工作

前端之家收集整理的这篇文章主要介绍了redhat – Centos 7 autofs mount在重启后无法正常工作前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我已经在Centos 7上设置了autofs.但是,似乎在重新启动后,安装/ home /目录需要一些时间,即使我已经进入它.它只在3次尝试后成功:
[root@localhost ~] cd /home/<user>
-bash: cd: /home/<user>: No such file or directory

并且,autofs已启用,因此我希望它在重启后启动:

[root@localhost etc]# systemctl status autofs
autofs.service - Automounts filesystems on demand
   Loaded: loaded (/usr/lib/systemd/system/autofs.service; enabled)
   Active: active (running) since Tue 2015-07-21 10:34:38 HKT; 1h 13min ago
  Process: 1379 ExecStart=/usr/sbin/automount $OPTIONS --pid-file /run/autofs.pid (code=exited,status=0/SUCCESS)
 Main PID: 1385 (automount)
   CGroup: /system.slice/autofs.service
           └─1385 /usr/sbin/automount --pid-file /run/autofs.pid

Jul 21 10:34:38 localhost.localdomain systemd[1]: Starting Automounts filesystems on demand...
Jul 21 10:34:38 localhost.localdomain automount[1385]: setautomntent: lookup(sss): setautomntent: No such file or directory
Jul 21 10:34:38 localhost.localdomain systemd[1]: Started Automounts filesystems on demand.

这是/etc/auto.master:

/misc /etc/auto.misc
/net  -hosts
+dir:/etc/auto.master.d
/home /etc/auto.home
/san /etc/auto.san
+auto.master

/etc/auto.master文件

* -fstype=nfs,rw 192.254.100.4:/home_external/user_home_local/&

/etc/auto.san:

MysqL_db 192.254.100.4:/san_external/MysqLdb

我怀疑出于类似的原因,当MysqL在重启后启动时,它有一个错误,说它不能’cd’进入/ san / MysqL_db /.但启动机器后在MysqL上手动重启是有效的.有任何想法吗?谢谢你

解决方法

我经历过类似的事情.

也就是说,具有自动安装的主目录的用户登录在重新启动后立即挂起,直到我用“systemctl start rpcbind”手动启动rpcbind.这是今天所有最新的Cent7更新.

我发现修改autofs单元文件依赖于rpcbind和其他一些服务修复了我的问题.请参阅下面的“After”代码块中的“Requires = network.target rpc-statd.service rpcbind.service”行…

之前:/usr/lib/systemd/system/autofs.service

[Unit]
Description=Automounts filesystems on demand
After=network.target ypbind.service sssd.service

[Service]
Type=forking
PIDFile=/run/autofs.pid
EnvironmentFile=-/etc/sysconfig/autofs
ExecStart=/usr/sbin/automount $OPTIONS --pid-file /run/autofs.pid
ExecReload=/usr/bin/kill -HUP $MAINPID
TimeoutSec=180

[Install]
WantedBy=multi-user.target

之后:/usr/lib/systemd/system/autofs.service

[Unit]
Description=Automounts filesystems on demand
Requires=network.target rpc-statd.service rpcbind.service
After=network.target ypbind.service sssd.service

[Service]
Type=forking
PIDFile=/run/autofs.pid
EnvironmentFile=-/etc/sysconfig/autofs
ExecStart=/usr/sbin/automount $OPTIONS --pid-file /run/autofs.pid
ExecReload=/usr/bin/kill -HUP $MAINPID
TimeoutSec=180

[Install]
WantedBy=multi-user.target

帽子提示https://www.centos.org/forums/viewtopic.php?f=47&t=51789

原文链接:https://www.f2er.com/linux/399031.html

猜你在找的Linux相关文章