Why isn't sudo apt upgrade working on Ubuntu?

411 views Asked by At

I am trying to install upgrades on my server and I get this "error".

I'am quite new to Ubuntu so if you need any info to help me feel free to ask!

user@server~$ sudo apt upgrade

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
Get more security updates through Ubuntu Pro with 'esm-apps' enabled:
  libldns-dev libldns3 libjs-jquery-ui libavdevice58 libpostproc55 php-twig
  libavcodec58 libavutil56 libswscale5 libswresample3 libavformat58
  libpmix-dev libpmix2 libavfilter7
Learn more about Ubuntu Pro at https://ubuntu.com/pro
The following packages will be upgraded:
  postfix
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
3 not fully installed or removed.
1 standard LTS security update
Need to get 0 B/1,248 kB of archives.
After this operation, 1,024 B of additional disk space will be used.
Do you want to continue? [Y/n] y
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
(Reading database ... 174475 files and directories currently installed.)
Preparing to unpack .../postfix_3.6.4-1ubuntu1.3_amd64.deb ...
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
dpkg: error processing archive /var/cache/apt/archives/postfix_3.6.4-1ubuntu1.3_amd64.deb (--unpack):
 new postfix package pre-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/postfix_3.6.4-1ubuntu1.3_amd64.deb
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)

I've tried to search for a solution online but couldn't find anything.

2

There are 2 answers

1
Esha Varma On BEST ANSWER

The possible cause of this is

debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable

Since this process is locked either you can wait it to be released and try again the update or manually remove the lock on package and try again

sudo apt upgrade

or

sudo rm /var/cache/debconf/config.dat
sudo apt upgrade
0
Borislav Gizdov On

Unable to complete the upgrade because /var/cache/debconf/config.dat is locked by another process.

You can try the following:

  • Restart your server, this may release the lock.
  • Check if other processes are using apt or dpkg.
ps aux | grep -i apt
ps aux | grep -i dpkg

If any, run sudo kill PID to terminate the process.

  • Clear lock files (dangerous).
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock*

Run sudo apt --fix-broken install.

Finally, try to upgrade with sudo apt update && sudo apt upgrade.