错误提示:

Give root password for maintenance

(or type Control-D to continue):

服务器重启后报错如上,面向百度来讲,这个错误大部分原因都是挂载问题,解决方式:

  1. 输入root用户密码,进入系统.
  2. 执行命令:
vim /etc/fstab
|# 打开以后,示例:
# /etc/fstab
# Created by anaconda on Mon Jun  1 13:49:02 2020
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/centos-root /                       ext4    defaults        1 1
UUID=218c68fc-215e-47bc-a07a-60a4d7d53601 /boot                   xfs     defaults        0 0
/dev/mapper/centos-home /data                   ext4    defaults        1 2
/dev/mapper/centos-swap swap                    swap    defaults        0 0
  1. 首先检查挂载选项,如果发现有问题的就注释掉,重启

当然,我是没有发现有什么问题,如上,我有一个挂载在 /data 下的分区,同时也是数据存储分区,其他两个一个是swap分区无所谓,另一个是系统所需的挂载在根分区下的

  1. 如果找不到或者不知道那个有问题,可以先把所有挂载都注释掉(处根目录 外),此处注释掉了 挂载到data目录的.

将所有涉及这几个挂载目录的服务全部取消开机自启动,然后重启.
启动成功后手动挂载(路径直接复制)

我的docker服务是没有取消,这个坑是踩过之后再知道的.
当我重启成功后再手动挂载上,我的docker服务已经开机自启动了.
我执行了 docker ps -a,发现几十个容器全部都没了,一片空白.

[root@localhost docker]# docker ps -a 
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

当时有点懵,重启了下并没什么软用.
然后我想重新启动rancher,因为数据都是存储在本地的,没丢,只要启动起来容器还会回来.

[root@localhost mysql]# docker run -d -p 8080:8080 --restart=always -v /data/rancher/db:/var/lib/mysql --name rancher-server registry.cn-hangzhou.aliyuncs.com/sinobasedm/rancher-server:1.6.14
Unable to find image 'registry.cn-hangzhou.aliyuncs.com/sinobasedm/rancher-server:1.6.14' locally
1.6.14: Pulling from sinobasedm/rancher-server
Digest: sha256:1189591225794e9eed212fa21cb4120d36a0d3821d0ecff2637e71713432a219
Status: Downloaded newer image for registry.cn-hangzhou.aliyuncs.com/sinobasedm/rancher-server:1.6.14
docker: Error response from daemon: layer does not exist.
See 'docker run --help'.

是的,启动失败了.
然后我贼心不死,重启了下docker

[root@localhost docker]# systemctl restart docker
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
[root@localhost docker]# cd /data/docker/
[root@localhost docker]# ls
builder  containerd  containers  image  network  overlay2  plugins  runtimes  swarm  tmp  trust  volumes

然后docker就起不来了…
我的docker数据是放在/data下的,然后我跑去检查了下,数据目录都还在.
按照他给我的提示执行了

[root@localhost mysql]# systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: failed (Result: start-limit) since Wed 2020-07-01 11:32:22 CST; 9s ago
     Docs: https://docs.docker.com
  Process: 11644 ExecStart=/usr/bin/dockerd --insecure-registry 124.239.180.93:5000 --insecure-registry 124.239.180.93:5000 --insecure-registry 124.239.180.93:5000 --insecure-registry 124.239.180.93:5000 (code=exited, status=1/FAILURE)
 Main PID: 11644 (code=exited, status=1/FAILURE)

Jul 01 11:32:22 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
Jul 01 11:32:22 localhost.localdomain systemd[1]: Unit docker.service entered failed state.
Jul 01 11:32:22 localhost.localdomain systemd[1]: docker.service failed.
Jul 01 11:32:22 localhost.localdomain systemd[1]: docker.service holdoff time over, scheduling restart.
Jul 01 11:32:22 localhost.localdomain systemd[1]: start request repeated too quickly for docker.service
Jul 01 11:32:22 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
Jul 01 11:32:22 localhost.localdomain systemd[1]: Unit docker.service entered failed state.
Jul 01 11:32:22 localhost.localdomain systemd[1]: docker.service failed.

我就去百度了下这个错误,好像是搜索的
Failed to start Docker Application Container Engine.
这么一段来着.

百度没有用不说还误人,大部分(99.9%)都是说/etc/docker/daemon.json 文件不对,甚至没人知道 “/usr/lib/systemd/system/docker.service” 这个文件不对也会报相同错误(我吃过亏) ,看样子靠百度救不了服务器.

我回想了一下我的操作步骤决定还原一下.

先是直接在宿主机给这台机子打了快照,然后将/etc/fstab 目录取消开机自动挂载data ,将docker取消了开机自动,停掉了服务器.

然后我再次开机,启动,远程连接,挂载目录 最后确定无误后 启动了docker.

再次执行docker ps -a,服务都回来了.docker也没了问题.