首先感谢falconindy提供的几个note, 这是我的解决思路的基础:
A few things to note...
1) If you find yourself in a position to recreate the symlink yourself, the link target is [b]usr/lib[/b] and not [b]/usr/lib[/b]. This is an important difference that's only evident in a chroot situation.
2) The linker is an interpreter, just like /bin/bash. If it exists on the system but the /lib symlink is missing/fubar, you can run ELF binaries directly via the linker, e.g. /usr/lib/ld-2.16.so /bin/ln -s ....
我遇到了和litemotiv一样的问题:
清理过/lib, 保证里面的文件都属于 glibc 后再次尝试升级:
(1/2) upgrading glibc [########################################################] 100%
error: extract: not overwriting dir with file lib
error: problem occurred while upgrading glibc
call to execv failed (No such file or directory)
error: command failed to execute correctly
error: could not commit transaction
error: failed to commit transaction (transaction aborted)
Errors occurred, no packages were upgraded.
我的问题的特殊点是: 我没有打开一个root权限的命令行, root密码登陆被禁用(所以我无法使用su root), 而且我无法使用上面说的ld-2.16.so去加载sudo(由于sudo本身的安全规则).
于是我琢磨出了下面的方法去修复这个已经挂掉的系统, 希望能帮到遇到类似问题的盆友:
- 重启, 编辑grub里linux(或kernel)开头的那行, 在尾部添加:
init=/usr/lib/ld-2.16.so /bin/sh
- remount文件系统使其可写:
/usr/lib/ld-2.16.so /bin/mount -o remount,rw /
- 移除空的(上面的错误会使它是空的) /lib 目录:
/usr/lib/ld-2.16.so /bin/rmdir /lib
- 手动修复链接:
/usr/lib/ld-2.16.so /bin/ln -s usr/lib /lib
- 按 ctrl-alt-del 重启电脑, 然后用pacman重新安装一次glibc
然后各种东西都恢复正常了, 不需要使用恢复光盘之类的东西 🙂
参考: https://bbs.archlinux.org/viewtopic.php?pid=1126667#p1126667