ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

Give root password for maintenance (Or press Control-D to continue)

2021-09-18 10:02:11  阅读:375  来源: 互联网

标签:Control systemd Give -- data02 failed continue root Unit


virtualBox 升级的时候,以前的许多虚拟机来回折腾,有的恢复了,有的干脆删除了!

  1. 有一个虚拟 CentOS 7 密码不记得了 centos7系统忘记root密码

  2. 有一个虚拟 Ubuntu Server 18.04,启动后总是出现以下错误
    Give root password for maintenance
    (Or press Control-D to continue)

    昨天恢复了CentOS 的 root 密码,重设了 ubuntu 18.04 的 root 密码(因为 之前ubuntu 18.04 root 密码是随机的)Ubuntu忘记密码后强制修改密码

  3. 今天来对付这个错误!
    在这里插入图片描述

  4. 输入 root 密码后,启动进入 root 登录
    在这里插入图片描述

    查看网卡地址 192.168.1.193 , ping 网关也通!但是 ssh 连不上!

  5. 先开启sshd 服务
    #service sshd restart

  6. 打开Terminale ,ssh 登录

    $ ssh user@192.168.1.193

     "System is booting up. See pam_nologin(8)"
     Connection closed by 192.168.1.193 port 22
    

    一直使用的 user 不能 ssh ,尝试修改 sudoers 和 允许 sshd 登录账户,好像不管用!

    $ ssh root@192.168.1.193

    这个是可以的,但是需要输入密码

    如果禁止过 root 的 ssh 远程登录,先修改 sshd_config

    之前系统是设置了公钥的,因为 root 用户没有用过,自然也就没有在 root 用户的 home 目录(/root)中保存公钥

  7. 查看系统日志
    #journalctl -xb

    耐心翻阅,找到错误的地方(我这里Terminal 会红色标注出来)
    在这里插入图片描述

    文字内容如下

     ...
     -- Unit systemd-journal-flush.service has finished starting up.
     -- 
     -- The start-up result is RESULT.
     Sep 18 08:43:10 ubuntu1804193 systemd[1]: dev-disk-by\x2duuid-c8330235\x2d7b61\x2d4b0a\x2d8d0f\x2d7988a8bba2ad.device: Job dev-dis
     Sep 18 08:43:10 ubuntu1804193 systemd[1]: Timed out waiting for device dev-disk-by\x2duuid-c8330235\x2d7b61\x2d4b0a\x2d8d0f\x2d798
     -- Subject: Unit dev-disk-by\x2duuid-c8330235\x2d7b61\x2d4b0a\x2d8d0f\x2d7988a8bba2ad.device has failed
     -- Defined-By: systemd
     -- Support: http://www.ubuntu.com/support
     -- 
     -- Unit dev-disk-by\x2duuid-c8330235\x2d7b61\x2d4b0a\x2d8d0f\x2d7988a8bba2ad.device has failed.
     -- 
     -- The result is RESULT.
     Sep 18 08:43:10 ubuntu1804193 systemd[1]: Dependency failed for /data02.
     -- Subject: Unit data02.mount has failed
     -- Defined-By: systemd
     -- Support: http://www.ubuntu.com/support
     -- 
     -- Unit data02.mount has failed.
     -- 
     -- The result is RESULT.
     Sep 18 08:43:10 ubuntu1804193 systemd[1]: Dependency failed for Local File Systems.
     -- Subject: Unit local-fs.target has failed
     -- Defined-By: systemd
     -- Support: http://www.ubuntu.com/support
     -- 
     -- Unit local-fs.target has failed.
     ...
    

    原来问题出在 Unit data02.mount 失败!

  8. 修改文件配置
    #vim /etc/fstab

     UUID=c9db3d96-f9f2-11e8-b72e-0800274e1103 / ext4 defaults 0 0
     # add by wzh 20200119 
     # must mkdir data02 first
     # wzh 20210918 Unit data02.mount has failed.
     # UUID=c8330235-7b61-4b0a-8d0f-7988a8bba2ad /data02 ext4 defaults 0 0
     /swap.img       none    swap    sw      0       0
    

    看到一年前的注解 must mkdir data02 first ,我也忘记了当时是为什么加了这个 data02 ,也不记得他是个什么东西了,可能当时想使用 U 盘启动 ?

    既然 data02 出错,那么,就注释掉,保存退出!

  9. reboot

    现在恢复正常了!之前使用的 user 也可以 公钥方式ssh 登录

    $ ssh user@192.168.1.193

  10. 解决过程参考了以下几个博客

    http://www.qzhuji.com/problem/571.html
    https://www.cnblogs.com/s-sx/p/11818532.html
    https://blog.csdn.net/weixin_45492179/article/details/102709752

标签:Control,systemd,Give,--,data02,failed,continue,root,Unit
来源: https://blog.csdn.net/u010953609/article/details/120360747

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有