如何使用 Ubuntu Server 12.04.3 中的 debootstrap 纠正此错误?

如何使用 Ubuntu Server 12.04.3 中的 debootstrap 纠正此错误?

使用工具 xen-create-image 时,我遇到了 debootstrap 过程错误。

跑步

root@xen/tmp# debootstrap --arch amd64 precise /tmp/ubuntu 
I: Retrieving Release
I: Retrieving Release.gpg
I: Checking Release signature
I: Valid Release signature (key id 630239CC130E1A7FD81A27B140976EAF437D05B5)
I: Retrieving Packages
I: Validating Packages
I: Resolving dependencies of required packages...
I: Resolving dependencies of base packages...
I: Checking component main on http://us.archive.ubuntu.com/ubuntu...
I: Retrieving adduser

...
I: Extracting xz-utils...
I: Extracting zlib1g...
I: Installing core packages...
W: Failure trying to run: chroot /tmp/ubuntu dpkg --force-depends --install /var/cache/apt/archives/debconf_1.5.42ubuntu1_all.deb

所以我尝试运行:

chroot /tmp/ubuntu dpkg --force-depends --install /var/cache/apt/archives/debconf_1.5.42ubuntu1_all.deb

交互地。

root@xen:/# chroot /tmp/ubuntu dpkg --force-depends --install /var/cache/apt/archives/debconf_1.5.42ubuntu1_all.deb
(Reading database ... 1944 files and directories currently installed.)
Preparing to replace debconf 1.5.42ubuntu1 (using .../debconf_1.5.42ubuntu1_all.deb) ...
Illegal instruction (core dumped)
dpkg: warning: subprocess old pre-removal script returned error exit status 132
dpkg - trying script from the new package instead ...
Illegal instruction (core dumped)
dpkg: error processing /var/cache/apt/archives/debconf_1.5.42ubuntu1_all.deb (--install):
 subprocess new pre-removal script returned error exit status 132
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (Can't locate Term/ReadLine.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
debconf: falling back to frontend: Teletype
Illegal instruction (core dumped)
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 132
Errors were encountered while processing:
 /var/cache/apt/archives/debconf_1.5.42ubuntu1_all.deb

输出:非法指令(核心转储)似乎暗示 debconf 存在一些基本问题。有没有办法解决这个问题,以便我可以让 debootstrap 脚本无错误地运行?

答案1

尝试

apt-get install dialog

找到了这里遇到同样的问题后。(我遇到过debootstrap wheezy --variant=minbase

或者,您可以使用

export DEBIAN_FRONTEND=noninteractive

运行之前apt-get。这将回退到纯文本控制台界面,该界面也适用于脚本或 Dockerfile。

答案2

到目前为止,我遇到过两次同样的问题,这是由一个混乱的软件包引起的。在终端中运行以下命令应该可以解决问题:

apt-get update && apt-get dist-upgrade

相关内容