更新了下Archlinux

又是好久没有更新了。
这次总共更新了204个包。
glibc 包在更新时要特殊处理(详见http://www.archlinux.org/news/the-lib-directory-becomes-a-symlink/):
更新时会遇到以下错误:

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

这时,一般按照官方的教程做就可以了:

1
2
pacman -Syu --ignore glibc
pacman -Su

可是我的按照这个还是不能升级glibc.
对于这种情况,官方同样给出了链接:
https://wiki.archlinux.org/index.php/DeveloperWiki:usrlib
我这里的情况是属于Issue 2: The final "pacman -Su" still has conflicts in /lib

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

发现有glibc 和 hal 。官方说要先把除glibc之外的包卸载了,成功更新glibc之后再安装上。
于是我

1
pacman -R hal

事实上,官方说HAL已经是deprecated了:
Note: HAL is deprecated and has been dropped from the official repositories. Use udev/PolicyKit instead.

然后,还是不能升级glibc.
于是继续按照它下面的步骤找出Unpackaged files:

1
2
3
4
5
6
7
8
find /lib -exec pacman -Qo -- {} +
error: cannot determine ownership of directory '/lib/security'
error: cannot determine ownership of directory '/lib/modules'
error: cannot determine ownership of directory '/lib/modules/3.4.4-2-ARCH'
error: cannot determine ownership of directory '/lib/modules/3.4.4-2-ARCH/kernel'
error: cannot determine ownership of directory '/lib/modules/3.4.4-2-ARCH/kernel/drivers'
error: cannot determine ownership of directory '/lib/modules/3.4.4-2-ARCH/kernel/drivers/char'
error: cannot determine ownership of directory '/lib/modules/3.4.4-2-ARCH/kernel/drivers/char/drm'

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.

这个是我自己编译的kernel,转移之:

1
huangye# mv /lib/modules/2.6.39.2-ARCH-HuangYe-revision1/ /usr/lib/

这个经查看,是一个空目录,删除之:

1
2
huangye# ls /lib/modules/3.4.4-2-ARCH/kernel/drivers/char/drm
huangye# rmdir /lib/modules/3.4.4-2-ARCH/kernel/drivers/char/drm

删除空的modules和security目录:

1
2
rm -rf  /lib/modules
rm -rf /lib/security

再更新:

1
pacman -Su

查看下,可以看到 /lib 已经被成功链接到了 /usr/lib:

1
2
huangye# ls -ld /lib
lrwxrwxrwx 1 root root 7 Jul  7 19:04 /lib -> usr/lib

这次的情况不同,完了之后要重启。

grub 2.x终于到[core] repo了。
不过,并不会自动更新。
安装grub2之前的准备工作:
备份旧版grub的数据:

1
mv /boot/grub /boot/grub-legacy

备份MBR:

1
2
3
4
huangye# dd if=/dev/sda1 of=/home/admin/backups/mbr_backup bs=512 count=1
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.330756 s, 1.5 kB/s

万一grub2安装失败,可以退回到老版本:

1
2
mv /boot/grub /boot/grub.nonfunctional
cp -af /boot/grub-legacy /boot/grub

可以用以下命令用我们的备份来恢复sda MBR和其后的62个扇区(其实是分区表):
注意:这条命令同时把硬盘的分区表也恢复了,所以要当心不要用老的分区表把已经改变的分区表给覆盖了!它会搞糟你的整个系统。。。

1
 #dd if=/path/to/backup/first-sectors of=/dev/sdX bs=512 count=1

一种用于恢复MBR的比较安全的方式是用如下方法:

1
#dd if=/path/to/backup/mbr-boot-code of=/dev/sdX bs=446 count=1

好了,开始安装:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
huangye# pacman -S grub-bios
resolving dependencies...
looking for inter-conflicts...
:: grub-common and grub are in conflict. Remove grub? [y/N] y

Targets (3):

Name         Old Version  New Version  Net Change  Download Size

grub         0.97-21                   -0.78 MiB                
grub-common               2.00-1       13.46 MiB        3.72 MiB
grub-bios                 2.00-1       2.11 MiB         0.56 MiB

Total Download Size:    4.28 MiB
Total Installed Size:   15.57 MiB
Net Upgrade Size:       14.79 MiB

Proceed with installation? [Y/n] y
Downloaded 576.5 kilobytes in 1 second. (292.66 KB/s)
(2/2) checking package integrity                   [######################] 100%
(2/2) loading package files                        [######################] 100%
(2/2) checking for file conflicts                  [######################] 100%
(3/3) checking available disk space                [######################] 100%
(1/1) removing grub                                [######################] 100%
(1/2) installing grub-common                       [######################] 100%
Generating grub.cfg.example config file...
This may fail on some machines running a custom kernel.
done.
Optional dependencies for grub-common
    libisoburn: provides xorriso for generating grub rescue iso using
    grub-mkrescue
    os-prober: to detect other OSes when generating grub.cfg in BIOS systems
    mtools: for grub-mkrescue FAT FS support
(2/2) installing grub-bios                         [######################] 100%
huangye#

有两个可选的包还是装一下吧,比较有用:

1
pacman -S --needed libisoburn os-prober

还有就是:Install media 2012.07.15 released
Changes to rc.conf and crypttab

更多
2 Responses Post a comment
  1. 依云

    删多级空目录用 rmdir -p 吧,不会误删没有发现的文件。
    PS:glibc 这个更新搞死了 少人的系统呢。按照官方通知做从来是很安全的,升级升崩了的还要自己努力啊。

Leave a Reply

Note: You may use basic HTML in your comments. Your email address will not be published.

Subscribe to this comment feed via RSS