低版本Ubuntu升级为高版本libc6

20220304更新

最近因git lfs需要更新libc6版本到2.32以上,遇到了一些问题,在此更新记录
总结经验就是:安装libc6需要找与系统相对接近的版本去更新,否则会出现系统异常。

从libc6的版本看,20.04的版本对应的libc6版本最高也是libc6_2.31-0ubuntu9.7_amd64
如果要安装2.32以上,能看到的也就是 libc6_2.33-0ubuntu5_amd64或者 libc6_2.34-0ubuntu3_amd64(和更高)
而据悉,Ubuntu20.10的包就是libc6_2.34-0ubuntu3_amd64

ubuntu 16.04
Ubuntu16.04的libc6是libc6_2.23-0ubuntu3_amd64,这个一下子升级到libc6_2.34-0ubuntu3_amd64,也是可以。
后果就是连sudo都不能用了。系统还能开机,但是login都直接失败了。
我尝试使用U盘系统启动,进入/lib/x86_64-linux-gnu目录使用sudo ln -snf 修改libc6的so链接,将安装后的指向2.34版本修改为指向原来的2.23版本
重启直接报kernel异常了。
最后还是备份数据重装系统了。这次如愿了,直接安装了想要的20.04版本

ubuntu 20.04
Ubuntu20.04的libc6也并非就顺利的是2.32以上了,而是libc6_2.31-0ubuntu9_amd64
直接安装libc6_2.34-0ubuntu3_amd64也是可以的,跟Ubuntu16.04一样有一个auto config的提示,所以安装命令如下:
sudo dpkg --auto-deconfigure -i libc6_2.34-0ubuntu3_amd64.deb
安装是有个restart service的提示(图不是重点,不要装这个版本)
在这里插入图片描述
之后再安装git lfs也是ok的了,没有再提示需要2.32版本以上了。
但是这样安装libc6_2.34-0ubuntu3_amd64有一些其他库不完整,导致apt-get install时一直提示异常。
因此我又降版本安装了libc6_2.33-0ubuntu5_amd64系列库文件,安装2.33就不需要加–auto-deconfigure,也没有界面提示了。一切看似顺利,git lfs也成功安装运行了,apt-get install运行也正常了。

此问题本该到此结束,但因为我系统安装其他如g++时提示了libc-dev等版本不匹配。所以我把git lfs卸载了,把libc6又降到libc6_2.31-0ubuntu9.7_amd64,把一些编译所需的工具安装完成,编译正常了。

所以后续在把整个系统升级到21.04以上之前,我只能按需切换libc6的版本了。

20210721 记录

GLIBCXX_3.4.20 not found
GXXABI_1.3.9 not found
GLIBCXX_3.4.21 not found

ldd --version 查看当前版本
ldd (Ubuntu GLIBC 2.23-0ubuntu10) 2.23
Copyright © 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.

系统14.04系统,默认的是2.19版本,查看16.04的是2.23版本,可以编译pass
ldd (Ubuntu EGLIBC 2.19-0ubuntu6.11) 2.19
Copyright © 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

中间过程有点不确定,建议直接看最后方法,如果最后方法还是不行,请按前面再试。

于是,需要升级14.04默认版本
使用sudo apt-get install libc6-dev
虽然默认还是安装2.19版本,但是可以看到,需要的包有如下:
在这里插入图片描述
重点是这几个:
libc-dev-bin libc-dev-bin_2.23-0ubuntu3_amd64.deb
libc6 libc6_2.23-0ubuntu3_amd64.deb
libc6:i386 libc6_2.23-0ubuntu3_i386.deb
libc6-dev libc6-dev_2.23-0ubuntu3_amd64.deb
libc6-dev:i386 libc6-dev_2.23-0ubuntu3_i386.deb
libc6-dev-i386 libc6-dev-i386_2.23-0ubuntu3_amd64.deb
libc6-dev-x32 libc6-dev-x32_2.23-0ubuntu3_amd64.deb
libc6-i386 libc6-i386_2.23-0ubuntu3_amd64.deb
libc6-x32 libc6-x32_2.23-0ubuntu3_amd64.deb

sudo dpkg -i --auto-deconfigure libc6_2.23-0ubuntu3_i386.deb libc6_2.23-0ubuntu3_amd64.deb libc6-dev_2.23-0ubuntu3_amd64.deb lib
c6-dev_2.23-0ubuntu3_i386.deb libc6-dev-i386_2.23-0ubuntu3_amd64.deb libc6-dev-x32_2.23-0ubuntu3_amd64.deb libc6-i386_2.23-0ubuntu3_amd64.deb libc6-x32_2.23-0ubuntu3_amd64.deb libc-dev-bin_2.23-0ubuntu3_amd64.deb

在这里插入图片描述

dpkg: error processing package libc6-i386 (–install):
dependency problems - leaving unconfigured
Processing triggers for libc-bin (2.19-0ubuntu6.11) …

dpkg: error processing package libc-bin (–install):
dependency problems - leaving unconfigured
Processing triggers for man-db (2.6.7.1-1ubuntu1) …

(Reading database … 116015 files and directories currently installed.)
Preparing to unpack man-db_2.7.5-1_amd64.deb …
Unpacking man-db (2.7.5-1) over (2.6.7.1-1ubuntu1) …
dpkg: dependency problems prevent configuration of man-db:
man-db depends on libpipeline1 (>= 1.4.0); however:
Version of libpipeline1:amd64 on system is 1.3.0-1.

sudo dpkg -i libpipeline1_1.4.1-2_amd64.deb
(Reading database … 116088 files and directories currently installed.)
Preparing to unpack libpipeline1_1.4.1-2_amd64.deb …
Unpacking libpipeline1:amd64 (1.4.1-2) over (1.3.0-1) …
Setting up libpipeline1:amd64 (1.4.1-2) …

顺序:
libpipeline1_1.4.1-2_amd64.deb
#libpipeline-dev_1.4.1-2_amd64.deb
man-db_2.7.5-1_amd64.deb
libc-bin_2.23-0ubuntu3_amd64.deb
libc6-i386_2.23-0ubuntu3_amd64.deb
libc6_2.23-0ubuntu3_i386.deb
libc6_2.23-0ubuntu3_amd64.deb

没有全部安装成功,但是ldd --version看到已经是2.23版本。

strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX
还是没有更新到3.4.21
在这里插入图片描述

其实查看到libstdc++.so.6链接到了libstdc++.so.6.0.19版本,所以GLIBCXX还是旧的。
在这里插入图片描述
于是,从其他地方拷贝一个libstdc++.so.6.0.21
修改链接
sudo ln -snf libstdc++.so.6.0.21 libstdc++.so.6
在这里插入图片描述
再次查看就有3.4.21了
在这里插入图片描述
编译也都正常了。

  • 5
    点赞
  • 24
    收藏
    觉得还不错? 一键收藏
  • 8
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值