arch完美升级glibc

DeveloperWiki:usrlib

All files in the /lib directory have been moved to /usr/lib and now /lib is a symlink to usr/lib.

所有的lib下的库现在全都移到了/usr/lib下。现在前者是后者的一个软链接

During this update, pacman will identify a conflict in the /lib directory with the message:

升级期间如果出现如下错误

error: failed to commit transaction (conflicting files)
glibc: /lib exists in filesystem
Errors occurred, no packages were upgraded.


Warning: DO NOT USE --force! This will seriously break your system. If you are coming to this guide too late and you have already used --force... there are ways to fix your system.  These  two do not even require a rescue disk.
千万不要使用--force选项强制升级,如果你已经挂了就参考论坛上另外的文章


In the simplest case, the update can be performed by doing:

最简单的方式:

pacman -Syu --ignore glibc,curl
pacman -Su


Note: for installs that have not been updated during 2012, it will save you some time to do:
pacman -U http://pkgbuild.com/~allan/glibc-2.16.0-1-<arch>.pkg.tar.xz
where <arch> is replaced by i686 or x86_64 as required. Add a single "-d" if needed.


There are two possible issues that might occur during this update.

Contents

 [hide

Issue 1: glibc dependency errors

If running "pacman -Syu --ignore glibc,curl" gives:

warning: ignoring package glibc-2.16.0-2
warning: cannot resolve "glibc>=2.16", a dependency of "gcc-libs"

...

:: The following packages cannot be upgraded due to unresolvable dependencies:
     binutils  gcc  gcc-libs

Do you want to skip the above packages for this upgrade [y/N]

Say "y" to skipping the packages, then install them all using (e.g.):

pacman -Sd binutils gcc gcc-libs
跳过检测包依赖
Warning: If pacman is part of this list, install the glibc-2.16.0-1 package from the above note first, to prevent breakage.

Note the use of a single "-d" only ignores the versioning of dependencies and not the actual dependency itself. Then finish the update using:

pacman -Su

Issue 2: The final "pacman -Su" still has conflicts in /lib

检测包含有lib中的文件的包并卸载或升级这些包

Packages that own files in /lib

If after this the "pacman -Su" still has conflicts with /lib, this is likely because a package on your system other than glibc owns files in /lib. Such packages can be detected using:

$ grep '^lib/' /var/lib/pacman/local/*/files

These packages need rebuilding so as not to include the /lib directory. They can also simply be uninstalled and reinstalled again after upgrading glibc. The the final "pacman -Su" will successfully install glibc if there are no untracked files (see the next section).

Unpackaged files

This means that you have files or folders still in /lib or pacman thinks a package apart from glibc still own /lib. You can see which package own files in /lib by using:

$ find /lib -exec pacman -Qo -- {} +
   
   
pacman -Qo /lib/*

这个命令可以找到不被任何包依赖的文件(……)。google文件名即可。

一般只要卸载这些软件包就可以了,当然也可重装(如果软件升级了的话)。

可能还会有如下错误

error: cannot determine ownership of directory '/lib/modules'

这是一些老版本kernel的驱动模块什么的,因为arch滚的特别快,所以就被抛弃了……

然后直接rm或者mv即可

If any package apart from glibc is listed as owning a file, that package needs to be updated to install its files in /usr/lib. Any files unowned by a package should either be deleted or moved to /usr/lib and any directories within /lib need deleted (after they are empty...).

One common source of files in /lib is left overs from running depmod after upgrading the kernel, but prior to reboot. The kernel modules included with the linux package in the repositories are now stored in /usr/lib/modules.

Success

You can confirm the update is complete by looking in your root directory to see that lib is a symlink to usr/lib.

$ ls -ld /lib
lrwxrwxrwx   1 root root     7 Jul 11 21:10 lib -> usr/lib
成功升级后lib将会软链接奥usr/lib
Ubuntu 是一种流行的开源操作系统,其软件包管理系统使用的是 Advanced Package Tool (APT)。如果你想升级系统中的 glibc(GNU C Library),特别是在国内访问速度较慢的情况下,可以考虑更换为国内的镜像源。 首先,确保你已经安装了 `curl` 和 `apt-transport-https`: ```bash sudo apt-get update sudo apt-get install curl gnupg lsb-release ``` 然后,找到一个可靠的国内 Ubuntu 镜像源列表,如阿里云、腾讯云或中科大软件学院等提供的 Ubuntu 镜像地址。在国内访问较快的网站上查找并复制相应的 gpg 公钥 URL。 接下来,添加新的镜像源到 `/etc/apt/sources.list.d/` 文件中: ```bash echo "deb [arch=amd64 signed-by=/usr/share/keyrings/<repository_keyring.gpg>] <mirror_url> <ubuntu_release>-main" | sudo tee /etc/apt/sources.list.d/my_mirror.list ``` 将 `<repository_keyring.gpg>` 替换为所获取的 gpg 公钥文件名,`<mirror_url>` 替换为具体的镜像地址,`<ubuntu_release>` 为你当前的 Ubuntu 发行版代号,例如 "bionic", "focal", 或 "jammy"。 接着,更新和安装新镜像的 GPG 密钥: ```bash curl -fsSL <repository_keyring_gpg_url> | sudo gpg --dearmor -o /usr/share/keyrings/<repository_keyring_name>.gpg sudo apt-key add /usr/share/keyrings/<repository_keyring_name>.gpg ``` 最后,刷新和安装软件包: ```bash sudo apt-get clean sudo apt-get update sudo apt-get upgrade glibc ``` 完成上述步骤后,你的系统应该会从国内镜像源下载和升级 glibc。记得定期检查镜像源是否稳定,因为如果镜像不稳定可能会导致升级过程出现问题。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值