过去 24 小时之内 mirrors 两次宕机,一次天灾,一次人祸。
4 月 2 日晚 23 时左右,清华大规模停电,mirrors 所在机房发生一次闪断,之后服务器启动出错, 宕机约 1 小时。 启动失败的原因是 lvm 不支持 systemd 事件[1],所以 systemd-udev-settle.service 失败。 这个现象很诡异,因为重启之后就消失了。 4 月 3 日下午,我发现 lxc-images 镜像内容空了,这是因为 lxc-images 是使用 lftp 镜像的,而前段时间 [上游](http://images.linuxcontainers.org/) 进行了改版,不再列出下载目录。我又发现镜像必须的 /images 和 /meta 两个目录仍然可以列出,故修改了同步脚本,运行。 几分钟后发现 lxc-images 镜像仍然是空的,于是停止了 lftp,之后 ls 运行不能。这时我知道坏了。 因为 lftp 指定了 `--delete`,所以这之前几秒钟发生了类似于 `rm -rf /` 的事情。 更具体的原因是这个同步脚本少写了一句 `[ ! -d "$repo_dir" ] && mkdir -p "$repo_dir"` [2],所以 镜像目录不存在的情况下,cd 失败,lftp 的 working directory 在 / 上。 这时手头还有 shell, nginx 等服务还在跑,所以还可以抢救一下。 MaskRay 提供了一个救 rm -rf / 的教程 [3],基本思路是用 bash 的 /dev/tcp 方式,搞一个静态链接的 busybox,然后恢复 /lib64/ld-linux-x86-64.so.2 等基础库,之后再 apt-get install --reinstall 坏掉的包。 同时以防万一,huiyiqun 开始着手重建一个虚拟机。 于是「万一」就发生了,apt-get install systemd 的时候,因为 /run 被删掉了,于是系统死掉,从 console 上看到 kernel panic 了。 于是之后用新建的虚拟机挂旧盘的方式才把服务恢复。 以上,请大家批评我 …… T_T [1] https://freedesktop.org/wiki/Software/systemd/Optimizations/ [2] https://github.com/tuna/tunasync/commit/7da4dfc78e7f517dc06a81452ce9767fc27d7b69#commitcomment-16944301 [3] https://lambdaops.com/rm-rf-remains/ -- Justin Wong Blog: https://bigeagle.me/ Fingerprint: 15CC 6A61 738B 1599 0095 E256 CB67 DA7A 865B AC3A -- --- You received this message because you are subscribed to the Google Groups "TUNA 主邮件列表" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. For more options, visit https://groups.google.com/d/optout.
signature.asc
Description: PGP signature
