模拟环境
[root@centos8 /]# mv /lib64/libc.so.6 /opt/
[root@centos8 /]# ls
ls: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
[root@centos8 /]# mv
mv: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
[root@centos8 /]# cp
cp: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
虚拟机光盘救援模式
右键虚拟机的标签 点击设置 确保光盘已经挂载并连接
右下角有光盘图标状态可以看到
点击重置或者重启虚拟机都可以
出现此启动界面快速按下esc键,只有0.5秒的窗口期
如果一次没按到的话,可以按下CTRL+alt+insert键继续重启,
选择光盘启动
选择Troubleshooting
选择救援模式
稍等一下 选择1 继续
此处的提示是硬盘中的根目录被挂载在/mnt/sysroot 这个目录下
回车即可 此时进入的根目录是光盘下的根目录
这里是模拟,所以是mv到原目录中
mv /mnt/sysroot/opt/libc.so.6 /mnt/sysroot/lib64/
如果是删除了,拷贝光盘中的文件到磁盘中即可
cp /lib64/libc.so.6 /mnt/sysroot/lib64/
按下ctrl+alt+insert键重启即可
[root@centos8 ~]# cp
cp: missing file operand
Try 'cp --help' for more information.
命令使用正常