Centos7—glibc 升级失败、意外删除、故意删除后的处理方法

由于升级glibc不成功,将老版本的glibc删除,导致系统大部分下令都不能使用,系统不能正常启动。

方式一:

  1. 准备一个U盘启动盘

  2. 按住电源键重启

BIOS选择U盘启动

进入拯救模式 (Troubleshooting –> Rescue a CentOS system)

  1. 提示:

Rescue

  The rescue environment will not attempt to find your Linux installation and

  mount it under the directory : /mnt/sysimage . You can then make any changes

  required to your system. Choice '1' to proceed with this step.

  You can choose to mount your file systems read-only instead of read-write by

  choosing '2' .

  If for some reason this process does not work choose '3' to skip directly to a

  shell.

  1)Continue

Read-only mount

Skip to shell

Quit(Reboot)

Please make a selection from the above :

  选择1 回车
  1. 镜像包里什么包都全的话,直接装就好了

sh-4.2# mkdir /mnt/cdrom //千万不要挂载到 /mnt 下 你还挂着个系统呢!

sh-4.2# blkid //查看U盘是哪个

sh-4.2# mount /dev/sda1 /mnt/cdrom //挂载U盘,我的U盘是/dev/sda1

sh-4.2# rpm -ivh /mnt/cdrom/Packages/glibc* --nodeps --root /mnt/sysimage --force //一定要指定root,因为你目前的根目录是U盘的

sh-4.2# reboot //第一次重启时间会比较久,耐心点

方式二:

用光盘或者u盘,重启进入rescue模式,rescue模式下会把原系统的根目录挂到/mnt/sysp_w_picpath下,所以利用rescue模式把/mnt/sysp_w_picpath目录下缺的文件恢复就行了。

进入rescue模式后:

进入rpm包目录,命令:

cd /run/install/repo/Package

安装glibc包,命令:

rpm -ivh ./glibc*.rpm --root /mnt/sysp_w_picpath --nodeps –force

再次安装glibc包,命令:

rpm -ivh ./glibc*.rpm --root /mnt/sysp_w_picpath --nodeps --force

此时会报libc.so,libpthread.so这两个包找不到,无法执行安装

把这两个包从/mnt/sysp_w_picpath/lib64拷贝到/lib64下:

cp /mnt/sysp_w_picpath/lib64/libc.so /lib64

cp /mnt/sysp_w_picpath/lib64/ libpthread.so /lib64

安装glibc包

rpm -ivh ./glibc*.rpm --root /mnt/sysp_w_picpath --nodeps –force

完成 重启

© 版权声明
THE END
喜欢就支持一下吧
点赞10 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容