0

Every time I try to

sudo apt-get upgrade

I get

E: Could not get lock /var/lib/dpkg/lock - open 
   (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/),
   is another process using it?

Upon running sudo dpkg --configure -a

Setting up linux-image-4.13.0-46-generic (4.13.0-46.51) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
The link /initrd.img is a dangling linkto /boot/initrd.img-4.13.0-46-generic
vmlinuz(/boot/vmlinuz-4.13.0-46-generic) points to /boot/vmlinuz-4.13.0-46-generic
 (/boot/vmlinuz-4.13.0-46-generic) -- 
doing nothing at /var/lib/dpkg/info/linux-image-4.13.0-46-generic.postinst line 491.
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.13.0-46-generic
    /boot/vmlinuz-4.13.0-46-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.13.0-46-generic
    /boot/vmlinuz-4.13.0-46-generic

After this the upgrading stalls.

I am unable to install anything, there's always dpkg to be fixed. I have tried everything, but still nothing works.

Zanna
  • 70,465
Debadatta
  • 101
  • 2

1 Answers1

0

Try to kill processes using /var/lib/dpkg/lock file with fuser utility with -k option:

sudo fuser -uck /var/lib/dpkg/lock

Monitor will be blinking during the fuser command execution If fuser doesn't help remove /var/lib/dpkg/lock file:

sudo rm -rf /var/lib/dpkg/lock

Finally do:

sudo apt update
Bob
  • 2,533
  • I have applied as you said but still while installing it shows E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem. – Debadatta Jul 16 '18 at 05:28
  • @Debadatta Execute: sudo dpkg --configure -a – Bob Jul 16 '18 at 13:12