尝试通过 apt-get 安装软件包时出现以下错误。我收到的第一个错误是:
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
并且,如果我运行该命令,盒子就会失控,我会在 /var/log/syslog 中看到以下内容
Aug 29 20:21:08 ip-10-202-191-4 kernel: [20571563.398546] ------------[ cut here ]------------
Aug 29 20:21:08 ip-10-202-191-4 kernel: [20571563.398552] WARNING: at /build/buildd/linux-3.0.0/arch/x86/xen/multicalls.c:182 xen_mc_flush+01c0()
Aug 29 20:21:08 ip-10-202-191-4 kernel: [20571563.398561] Modules linked in: acpiphp
Aug 29 20:21:08 ip-10-202-191-4 kernel: [20571563.398568] Pid: 31063, comm: java Tainted: G D W 3.0.0-14-virtual #23-Ubuntu
Aug 29 20:21:08 ip-10-202-191-4 kernel: [20571563.398576] Call Trace:
Aug 29 20:21:08 ip-10-202-191-4 kernel: [20571563.398580] [<c0648265>] ? printk+0x2d/0x2f
Aug 29 20:21:08 ip-10-202-191-4 kernel: [20571563.398586] [<c0150462>] warn_slowpath_common+0x72/0xa0
Aug 29 20:21:08 ip-10-202-191-4 kernel: [20571563.398593] [<c0104883>] ? xen_mc_flush+0x1b3/0x1c0
Aug 29 20:21:08 ip-10-202-191-4 kernel: [20571563.398599] [<c0104883>] ? xen_mc_flush+0x1b3/0x1c0
Aug 29 20:21:08 ip-10-202-191-4 kernel: [20571563.398605] [<c01504b2>] warn_slowpath_null+0x22/0x30
Aug 29 20:21:08 ip-10-202-191-4 kernel: [20571563.398611] [<c0104883>] xen_mc_flush+0x1b3/0x1c0
Aug 29 20:21:08 ip-10-202-191-4 kernel: [20571563.398617] [<c0104e7a>] ? xen_extend_mmu_update+0x4a/0x70
Aug 29 20:21:08 ip-10-202-191-4 kernel: [20571563.398624] [<c0106565>] xen_set_pud_hyper+0x75/0x80
Aug 29 20:21:08 ip-10-202-191-4 kernel: [20571563.398630] [<c01065b9>] xen_set_pud+0x49/0x60
Aug 29 20:21:08 ip-10-202-191-4 kernel: [20571563.398636] [<c0132105>] pud_populate+0x45/0x60
Aug 29 20:21:08 ip-10-202-191-4 kernel: [20571563.398642] [<c0208a24>] __pmd_alloc+0x74/0x90
Aug 29 20:21:08 ip-10-202-191-4 kernel: [20571563.398648] [<c0208cb7>] handle_mm_fault+0x277/0x2c0
Aug 29 20:21:08 ip-10-202-191-4 kernel: [20571563.398655] [<c065f45b>] do_page_fault+0x15b/0x4a0
Aug 29 20:21:08 ip-10-202-191-4 kernel: [20571563.401923] [<c020ba24>] ? remove_vma+0x44/0x60
Aug 29 20:21:08 ip-10-202-191-4 kernel: [20571563.401923] [<c020d9b6>] ? sys_mmap_pgoff+0x106/0x1c0
Aug 29 20:21:08 ip-10-202-191-4 kernel: [20571563.401923] [<c065f300>] ? vmalloc_fault+0x190/0x190
Aug 29 20:21:08 ip-10-202-191-4 kernel: [20571563.401923] [<c065c79f>] error_code+0x67/0x6c
Aug 29 20:21:08 ip-10-202-191-4 kernel: [20571563.401923] ---[ end trace 0b105e2a179ad013 ]---
答案1
问题在于,负责设置软件包的脚本(preinst 或 postinst)中有一个命令会导致内核崩溃,或者只是内核错误。因此,我们必须清除坏软件包,以防止它尝试运行dpkg
并再次导致崩溃。为此,只需按键盘上的Ctrl++打开终端。打开后,逐个运行以下命令。AltT
sudo rm /var/lib/apt/lists/lock
sudo cp -arf /var/lib/dpkg /var/lib/dpkg.backup
sudo mv /var/lib/dpkg/status /var/lib/dpkg/status-bad
sudo cp /var/lib/dpkg/status-old /var/lib/dpkg/status
sudo mv /var/lib/dpkg/available /var/lib/dpkg/available-bad
sudo cp /var/lib/dpkg/available-old /var/lib/dpkg/available
sudo rm -rf /var/lib/dpkg/updates/*
sudo rm -rf /var/lib/apt/lists
sudo rm /var/cache/apt/*.bin
sudo mkdir /var/lib/apt/lists
sudo mkdir /var/lib/apt/lists/partial
LANG=C;sudo apt-get clean
LANG=C;sudo apt-get autoclean
LANG=C;sudo apt-get --purge autoremove
LANG=C;sudo apt-get update
sudo dpkg --configure -a
(以上命令是 ObsessiveFOSS 的补充)
完成这些之后,如果一切正常,请按照以下说明安装您的软件包。
要安装 RRDTool,只需按下键盘上的Ctrl+ Alt+T打开终端。打开后,运行以下命令。确保您拥有所有必需的依赖项。
sudo apt-get install libpango1.0-dev libxml2-dev
sudo apt-get install librrds-perl rrdtool
或者您可以从 Ubuntu 软件中心安装它,方法是单击以下内容:
如果安装再次失败,请执行上面列出的修复步骤并针对软件包提交错误,指出 preinst 或 postinst 似乎导致了内核恐慌。