4

如何将 OpenVZ 6 的 VPS 上的 Ubuntu 16.04 升级到 Ubuntu 18.04

 2 years ago
source link: https://blog.251.sh/upgrade-ubuntu-xenial-to-ubuntu-bionic-on-openvz-6-vps
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

如何将 OpenVZ 6 的 VPS 上的 Ubuntu 16.04 升级到 Ubuntu 18.04

January 10, 2022

注意:操作之后引发的任何问题请自行解决。

2022 年了,为什么还在用基于 OpenVZ 虚拟化的 VPS?当然是便宜啊!

不过,我购买的这个商家提供的是 OpenVZ 6,意味着内核是 Linux 2.26.32。虽然目前还在处于长期支持阶段,但是已经接收不到任何的功能更新了。

然而,当你在 OpenVZ 的机器上尝试将 16.04 升级到 18.04 时,你会遇到这个错误:

This version of libc requires kernel version 3.2 or later. Plase upgrade your kernel before installing glibc.

那么怎么办呢?在互联网上进行了一番搜寻之后,我发现一名用户 wpyoga@LowEndTalk 通过给 glibc 打 patch 使得 glibc 认为自己处于 Linux 内核 3.2 版本,这样就可以升级了!

这里或者这里下载到压缩包并解压。

压缩包里写的很清楚要做什么了,所以我在这里就说我踩到的坑吧。

因为压缩包内没有自带源,所以需要先去 launchpad 下载源。将三个文件下载之后直接运行脚本即可。

我缺少了这些依赖:

$ sudo apt install libselinux1-dev bison systemtap-sdt-dev rdfind symlinks dh-systemd

然后中途遇到了这个错误:

/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/5/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc

这个问题的通用解决方法是,去运行一下 /usr/bin/ld -lgcc -verbose,然后看看输出:

attempt to open //usr/local/lib/x86_64-linux-gnu/libgcc.so failed
attempt to open //usr/local/lib/x86_64-linux-gnu/libgcc.a failed
attempt to open //lib/x86_64-linux-gnu/libgcc.so failed
attempt to open //lib/x86_64-linux-gnu/libgcc.a failed
attempt to open //usr/lib/x86_64-linux-gnu/libgcc.so failed
attempt to open //usr/lib/x86_64-linux-gnu/libgcc.a failed
attempt to open //usr/local/lib64/libgcc.so failed
attempt to open //usr/local/lib64/libgcc.a failed
attempt to open //lib64/libgcc.so failed
attempt to open //lib64/libgcc.a failed
attempt to open //usr/lib64/libgcc.so failed
attempt to open //usr/lib64/libgcc.a failed
attempt to open //usr/local/lib/libgcc.so failed
attempt to open //usr/local/lib/libgcc.a failed
attempt to open //lib/libgcc.so failed
attempt to open //lib/libgcc.a failed
attempt to open //usr/lib/libgcc.so failed
attempt to open //usr/lib/libgcc.a failed
attempt to open //usr/x86_64-linux-gnu/lib64/libgcc.so failed
attempt to open //usr/x86_64-linux-gnu/lib64/libgcc.a failed
attempt to open //usr/x86_64-linux-gnu/lib/libgcc.so failed
attempt to open //usr/x86_64-linux-gnu/lib/libgcc.a failed

这个是我的输出,经过一番寻找之后发现需要安装 libc6-dev-i386 这个包。(也有可能是gcc-multilib g++-multilib?)

只要 ld 说 -lxxx 找不到了,都可以使用 ld -lxxx -verbose 来查找丢了什么库。

编译在我这里大概花费 40-50 min,然后最后一个个安装 deb 包即可。

如果 glibc 的包碰到安装失败,可以试试 apt install glibc-doc-reference

如果你不想编译的话,可以在这里下载我编译好的 deb 包。自担风险!


如果喜欢本文,欢迎点击下方的「鼓掌」按钮!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK