“正在读取包裹清单...”冻结,直到按下回车键

“正在读取包裹清单...”冻结,直到按下回车键

当我运行sudo apt-get update我的一个脚本时,它被挂在了某个Reading package lists...部分。我让它在那里待了一个小时,它仍然什么也没做。澄清一下,我是apt-cache policy docker-engine在 Ubuntu 上设置 Docker 的过程中运行后直接执行此操作的。

这与其他问题的不同之处reading package list freeze:按下“enter”(或“return”)后,20 秒后它继续运行。似乎有一些错误,但它继续运行,一切正常。以下是按下时的输出enter

ebconf: unable to initialize frontend: Dialog
debconf: (Dialog frontend will not work on a dumb terminal, an emacs shell buffer, or without a controlling terminal.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
dpkg-preconfigure: unable to re-open stdin: 
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.13.0-77-generic /boot/vmlinuz-3.13.0-77-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.13.0-77-generic /boot/vmlinuz-3.13.0-77-generic
update-initramfs: Generating /boot/initrd.img-3.13.0-77-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 3.13.0-77-generic /boot/vmlinuz-3.13.0-77-generic
run-parts: executing /etc/kernel/postinst.d/x-grub-legacy-ec2 3.13.0-77-generic /boot/vmlinuz-3.13.0-77-generic
debconf: unable to initialize frontend: Dialog
debconf: (Dialog frontend will not work on a dumb terminal, an emacs shell buffer, or without a controlling terminal.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
Searching for splash image ... none found, skipping ...
Found kernel: /boot/vmlinuz-3.13.0-77-generic
Found kernel: /boot/vmlinuz-3.13.0-77-generic
Updating /boot/grub/menu.lst ... done

run-parts: executing /etc/kernel/postinst.d/zz-update-grub 3.13.0-77-generic /boot/vmlinuz-3.13.0-77-generic
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.13.0-77-generic
Found initrd image: /boot/initrd.img-3.13.0-77-generic
done
Reading package lists... Building dependency tree... Reading state information... The following extra packages will be installed: crda iw libnl-3-200 libnl-genl-3-200 wireless-regdb The following NEW packages will be installed: crda iw libnl-3-200 libnl-genl-3-200 linux-image-extra-3.13.0-77-generic wireless-regdb 0 upgraded, 6 newly installed, 0 to remove and 72 not upgraded. Need to get 36.9 MB of archives. After this operation, 152 MB of additional disk space will be used. Do you want to continue? [Y/n] Get:1 http://nova.clouds.archive.ubuntu.com/ubuntu/ trusty-updates/main libnl-3-200 amd64 3.2.21-1ubuntu3 [45.7 kB] Get:2 http://nova.clouds.archive.ubuntu.com/ubuntu/ trusty-updates/main libnl-genl-3-200 amd64 3.2.21-1ubuntu3 [10.2 kB] Get:3 http://nova.clouds.archive.ubuntu.com/ubuntu/ trusty/main wireless-regdb all 2013.02.13-1ubuntu1 [6,456 B] Get:4 http://nova.clouds.archive.ubuntu.com/ubuntu/ trusty/main crda amd64 1.1.2-1ubuntu2 [15.2 kB] Get:5 http://nova.clouds.archive.ubuntu.com/ubuntu/ trusty/main iw amd64 3.4-1 [51.7 kB] Get:6 http://nova.clouds.archive.ubuntu.com/ubuntu/ trusty-updates/main linux-image-extra-3.13.0-77-generic amd64 3.13.0-77.121 [36.7 MB] Fetched 36.9 MB in 14s (2,582 kB/s) Selecting previously unselected package libnl-3-200:amd64. (Reading database ... 51153 files and directories currently installed.) Preparing to unpack .../libnl-3-200_3.2.21-1ubuntu3_amd64.deb ... Unpacking libnl-3-200:amd64 (3.2.21-1ubuntu3) ... Selecting previously unselected package libnl-genl-3-200:amd64. Preparing to unpack .../libnl-genl-3-200_3.2.21-1ubuntu3_amd64.deb ... Unpacking libnl-genl-3-200:amd64 (3.2.21-1ubuntu3) ... Selecting previously unselected package wireless-regdb. Preparing to unpack .../wireless-regdb_2013.02.13-1ubuntu1_all.deb ... Unpacking wireless-regdb (2013.02.13-1ubuntu1) ... Selecting previously unselected package crda. Preparing to unpack .../crda_1.1.2-1ubuntu2_amd64.deb ... Unpacking crda (1.1.2-1ubuntu2) ... Selecting previously unselected package iw. Preparing to unpack .../archives/iw_3.4-1_amd64.deb ... Unpacking iw (3.4-1) ... Selecting previously unselected package linux-image-extra-3.13.0-77-generic. Preparing to unpack .../linux-image-extra-3.13.0-77-generic_3.13.0-77.121_amd64.deb ... Unpacking linux-image-extra-3.13.0-77-generic (3.13.0-77.121) ... Processing triggers for man-db (2.6.7.1-1ubuntu1) ... Setting up libnl-3-200:amd64 (3.2.21-1ubuntu3) ... Setting up libnl-genl-3-200:amd64 (3.2.21-1ubuntu3) ... Setting up wireless-regdb (2013.02.13-1ubuntu1) ... Setting up crda (1.1.2-1ubuntu2) ... Setting up iw (3.4-1) ... Setting up linux-image-extra-3.13.0-77-generic (3.13.0-77.121) ... Processing triggers for libc-bin (2.19-0ubuntu6.7) ...
Ign http://nova.clouds.archive.ubuntu.com trusty InRelease
Hit http://nova.clouds.archive.ubuntu.com trusty-updates InRelease
Hit http://security.ubuntu.com trusty-security InRelease
Hit http://nova.clouds.archive.ubuntu.com trusty-backports InRelease

从此以后,apt-get update一切正常。有人知道为什么我必须按enter才能不被挂断Reading package lists...吗?他们并没有显示错误然后我必须按enter,或者我被提示了什么。

我正在寻找一种拨打电话的方式,这样如果这个问题无法解决,apt-get update我就不必按下(或者在绝对必要时模拟按下它)。enter

答案1

只需将其放在脚本顶部即可

export DEBIAN_FRONTEND=noninteractive

这将改善所有那些“无法初始化前端”的问题。当脚本在无人值守的情况下执行时(例如在远程框或启动的系统上),您无法确认交互式提示,因此上述设置告诉系统只执行默认操作

相关内容