当ubuntu 8.04升级到10.04时,“不能utime:错误的文件描述符”

在运行do-release-upgrade --proposed在我的Ubuntu Server 8.04上提出的,我得到了这样的信息:

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

search升级输出,我发现这个:

 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). 

显然,这是一个已知的错误 。 更多细节在这里和这里 。

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

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

使用以下内容在/usr/local/sbin下创build一个名为tar的文件:

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

做:

 chmod +x /usr/local/sbin/tar 

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

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

 export TAR_OPTIONS='--touch' 

然后继续你的

 apt-get upgrade 

我得到了这个相同的错误,因为焦油被破坏,我无法用aptitude安装任何东西。 我必须离开/usr/local/sbin/tar这样aptitude才能继续正常工作。