将 ubuntu 8.04 升级到 10.04 时出现“无法 utime:错误的文件描述符”

将 ubuntu 8.04 升级到 10.04 时出现“无法 utime:错误的文件描述符”

在我的 Ubuntu Server 8.04 上运行后do-release-upgrade --proposed,我收到以下消息:

The upgrade is completed but there were errors during the upgrade process.

搜索升级输出,我发现了这个:

Setting up tar (1.22-2) ...

tar: ./md5sums: Cannot utime: Bad file descriptor
tar: ./control: Cannot utime: Bad file descriptor
tar: .: Cannot utime: Bad file descriptor
tar: Exiting with failure status due to previous errors
dpkg-deb: subprocess tar returned error exit status 2
dpkg: error processing /var/cache/apt/archives/diff_1%3a2.8.1-18_all.deb (--unpack):
 subprocess dpkg-deb --control returned error exit status 2
Errors were encountered while processing:
 /var/cache/apt/archives/diff_1%3a2.8.1-18_all.deb
Exception during pm.DoInstall():  E:Sub-process /usr/bin/dpkg returned an error code (1)

Could not install the upgrades

The upgrade is now aborted. Your system could be in an unusable
state. A recovery will run now (dpkg --configure -a).

显然,这是一个已知错误. 更多详情这里这里

我将发布我找到的解决方法作为答案。

答案1

作为一种解决方法,您可以创建一个包装器来tar添加以下--touch选项:

tar创建一个名为的文件,/usr/local/sbin内容如下:

#!/bin/sh
exec /bin/tar --touch -"$@"

做:

chmod +x /usr/local/sbin/tar

现在运行aptitude dist-upgrade以继续升级过程。安装完成后删除此文件。

答案2

有时 /usr/local/sbin/tar 技巧不起作用。但我发现这个选项对我有帮助。运行

export TAR_OPTIONS='--touch'

然后继续

apt-get upgrade

答案3

我遇到了同样的错误,由于 tar 损坏,我无法安装任何东西aptitude。我不得不离开,/usr/local/sbin/tar这样aptitude才能继续正常工作。

相关内容