AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 707256
Accepted
surfcode
surfcode
Asked: 2015-07-21 20:05:41 +0800 CST2015-07-21 20:05:41 +0800 CST 2015-07-21 20:05:41 +0800 CST

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

  • 772

我已经在 Centos 7 上设置了 autofs。但是,似乎在重新启动后,挂载 /home/ 目录需要一些时间,即使我 'cd' 进入它也是如此。它仅在 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 是可行的。有任何想法吗?谢谢虚拟机

redhat
  • 2 2 个回答
  • 19498 Views

2 个回答

  • Voted
  1. Best Answer
    Matthew Bohnsack
    2015-09-15T07:21:57+08:002015-09-15T07:21:57+08:00

    我经历过类似的事情。

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

    我发现修改 autofs 单元文件以依赖 rpcbind 和其他一些服务解决了我的问题。请参阅下面“之后”代码块中的“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

    • 8
  2. Bram Vandoren
    2016-08-06T02:48:43+08:002016-08-06T02:48:43+08:00

    这是问题的根本原因:

    • systemd 先启动 sssd
    • sssd 配置为 sssd 中的分叉进程。sssd 在完全加载时不会向 systemd 发出信号。启动后 systemd 认为 sssd 已加载并继续启动过程。
    • 在某些情况下,加载 sssd 并开始回答 autofs/passwd/... nss 查询可能需要一段时间。我见过最多需要 5 秒的系统。
    • 如果 autofs 在加载 sssd 之前启动,则 autofs 映射不可用。

    有几种方法可以解决这个问题:

    • 干净的解决方案是 sssd 实现 systemd 信号,因此它可以在 systemd 完全加载时通知它
    • 尝试加快 sssd 加载速度。检查您的 sssd 配置以检查它是否有加载如此缓慢的原因。
    • hacky 解决方案是在 autofs 启动之前人为地添加足够的延迟。(这就是前面的答案的工作原理。它只是在 autofs 之前添加了另一个服务,因此 sssd 会收到更多时间。)在某些情况下,这还不够。在错误https://bugzilla.redhat.com/show_bug.cgi?id=1189767中提出了另一种解决方案。添加

      ExecStartPre=/bin/sleep 10
      

      到你的 sssd.unit

    • 2

相关问题

  • 如何设置 Redhat 对 ActiveDirectory 的用户进行身份验证

  • 如何从 RHEL 5 迁移到 CentOS 5?

  • 我应该将 Rails 应用程序部署到哪个目录?

  • 如何移动 MySQL 的数据目录?

  • RHEL 5.3 上可用的 yum 存储库

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve