尝试安装 libmemcached-dev 时出现 dpkg 错误

尝试安装 libmemcached-dev 时出现 dpkg 错误

我正在尝试安装libmemcached-dev对于 php,我遇到了一个错误:

E:dpkg 中断,您必须手动运行“sudo dpkg --configure -a”来解决问题。

然后我输入了sudo dpkg --configure -a,第一次尝试时它给出了一个内部错误并要求报告。然后我又试了一次(3-4 次):sudo dpkg --configure -a,我的笔记本电脑总是挂起。在它完全没有反应之前,幸运的是打印屏幕工作正常,下面是文本:

[sudo] password for japjap:
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
japjap@laptop:~$ sudo dpkg --configure -a
Setting up linux-image-4.4.0-47-generic (4.4.0-47.68) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
initrd.img(/boot/initrd.img-4.4.0-47-generic
) points to /boot/initrd.img-4.4.0-47-generic
 (/boot/initrd.img-4.4.0-47-generic) -- doing nothing at /var/lib/dpkg/info/linux-image-4.4.0-47-generic.postinst line 491.
vmlinuz(/boot/vmlinuz-4.4.0-47-generic
) points to /boot/vmlinuz-4.4.0-47-generic
 (/boot/vmlinuz-4.4.0-47-generic) -- doing nothing at /var/lib/dpkg/info/linux-image-4.4.0-47-generic.postinst line 491.
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-47-generic /boot/vmlinuz-4.4.0-47-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-47-generic /boot/vmlinuz-4.4.0-47-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-47-generic
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.4.0-47-generic /boot/vmlinuz-4.4.0-47-generic
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.4.0-47-generic /boot/vmlinuz-4.4.0-47-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.4.0-47-generic /boot/vmlinuz-4.4.0-47-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.4.0-47-generic /boot/vmlinuz-4.4.0-47-generic

有人能帮我解决这个问题吗?我无法安装任何东西。

我的前 20 行/etc/default/grub

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nomodeset"
GRUB_CMDLINE_LINUX=""

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

更新:

df -h

Filesystem      Size  Used Avail Use% Mounted on
udev            946M     0  946M   0% /dev
tmpfs           194M  6.2M  187M   4% /run
/dev/sda1       228G  8.9G  207G   5% /
tmpfs           966M  536K  965M   1% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           966M     0  966M   0% /sys/fs/cgroup
tmpfs           194M   64K  193M   1% /run/user/1000

lsblk

NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 232.9G  0 disk 
├─sda1   8:1    0   231G  0 part /
├─sda2   8:2    0     1K  0 part 
└─sda5   8:5    0     2G  0 part [SWAP]
sr0     11:0    1  1024M  0 rom  

sudo blkid

/dev/sda1: UUID="6416ac0d-4822-47aa-9035-a3fadf5033b2" TYPE="ext4" PARTUUID="118168b7-01"
/dev/sda5: UUID="437c42c7-26b8-4fb9-8fd7-10267ba9276a" TYPE="swap" PARTUUID="118168b7-05"

cat /etc/fstab

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sdb1 during installation
UUID=6416ac0d-4822-47aa-9035-a3fadf5033b2 /               ext4    errors=remount-ro 0       1
# swap was on /dev/sdb5 during installation
UUID=437c42c7-26b8-4fb9-8fd7-10267ba9276a none            swap    sw              0       0

更新:

free

              total        used        free      shared  buff/cache   available
Mem:        1976820      860788       80364      140768     1035668      766212
Swap:       2024444        2508     2021936

sudo apt-get autoclean
[sudo] password for japjap: 
E: Could not get lock /var/cache/apt/archives/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the download directory

答案1

您遇到了驱动程序问题。

使用 grub 选项启动nomodeset

要执行此操作Grub 菜单点击e选项ubuntu。然后将nomodeset参数添加到显示以下内容的行quiet splash。编辑后点击F10启动。

然后编辑/etc/default/grub文件并将此参数添加到启动默认值。

更改自:

# 有关此文件中选项的完整文档,请参阅:                                                                          
# info -f grub -n ‘简单配置’                                                                                          

GRUB_DEFAULT="已保存"
GRUB_SAVEDEFAULT="true"
#GRUB_HIDDEN_TIMEOUT="0"                                                                                                            
GRUB_HIDDEN_TIMEOUT_QUIET="true"
GRUB_TIMEOUT="10"
GRUB_RECORDFAIL_TIMEOUT="$GRUB_TIMEOUT"
GRUB_DISTRIBUTOR="`lsb_release -i -s 2> /dev/null || echo Debian`"
GRUB_CMDLINE_LINUX_DEFAULT="安静的启动"

改成:

# 有关此文件中选项的完整文档,请参阅:                                                                          
# info -f grub -n ‘简单配置’                                                                                          

GRUB_DEFAULT="已保存"
GRUB_SAVEDEFAULT="true"
#GRUB_HIDDEN_TIMEOUT="0"                                                                                                            
GRUB_HIDDEN_TIMEOUT_QUIET="true"
GRUB_TIMEOUT="10"
GRUB_RECORDFAIL_TIMEOUT="$GRUB_TIMEOUT"
GRUB_DISTRIBUTOR="`lsb_release -i -s 2> /dev/null || echo Debian`"
GRUB_CMDLINE_LINUX_DEFAULT="安静启动无模式设置"

唯一需要关注的行是用粗体突出显示的行。

编辑器示例

使用您喜欢的编辑器来编辑文件。以下是编辑文件的示例:

$ sudo nano /etc/default/grub

或者

$ sudo pksudo gedit /etc/default/grub

进行更改后,请grub使用以下命令更新:

$ sudo update-grub
$ sudo update-grub

这将解决您的笔记本电脑的锁定问题(由于硬件和驱动程序冲突)并允许您完成sudo dpkg --configure -a遇到问题的命令。

答案2

看起来软件更新失败了,导致您只更新了部分内容。我们会尝试以最快捷的方式修复此问题...

从 Unity 仪表板启动Synaptic。转到edit菜单并选择Fix broken packages。退出 Synaptic。

更新:如果您无法使用 Synaptic,请执行以下操作:

  1. 启动系统并进入GRUB菜单
  2. 选择Advanced Options
  3. 选择Recovery mode
  4. 选择dpkg - fix broken packages
  5. 返回菜单后,选择root access
  6. 类型reboot
  7. 重新启动后,打开终端,输入sudo dpkg --configure -a
  8. 无论步骤 7 是否有效,请执行下面的命令 1-5

从 Unity 仪表板启动terminal。逐个输入以下命令(最好使用复制和粘贴):

sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get update
sudo apt-get -f install
sudo apt-get upgrade

相关内容