Cyberithub

Solved "The following packages have been kept back:" error

Advertisements

In this article, we will see how to solve "The following packages have been kept back:" error if you are also seeing this error message on the output screen. Recently you might have noticed that while running upgrade, at the end you will get this error on the output. This is something which you didn't get to see before Ubuntu introduced phased updates in 2013 to detect serious breakages little early before it even start causing problem for large number of users.

In phase update, whenever a new package update is released, it is basically rolled out in phases which means it will only be available for some limited number of users to update. Then Ubuntu will wait for the bug to be identified. If it generates any crash report or detect any problem with the update then rollout will be held back until the bug is fixed.

After fixing the bug, if no further error comes then more and more users will start getting that update and this process will continue until it gets fully implemented in phased manner and all the users receives the update. This directly benefits the user as it helps secure safety, stability and reliability of Ubuntu systems.

When you see some packages has been kept back then it means that package is not available in current phase and probably will be installed in next phase so that you have to either wait or you can follow certain methods to get it as soon as possible. We will certainly see all those methods here which you can employ to get rid of  "The following packages have been kept back:" error.

 

Solved "The following packages have been kept back:" error

Solved "The following packages have been kept back:" error

Also Read: How to Install LuaJIT library on Ubuntu/Debian Linux

As I was explaining, when you try to upgrade your system packages using sudo apt update && sudo apt upgrade command then sometimes you will see "The following packages have been kept back:" error on the output as shown below. While technically it is not thrown as an error but for the moment let's consider it as an error so that we can solve this. For demo purpose, we will take the example of gjs package as shown below but you can replace this package with your system packages which has been kept back.

cyberithub@ubuntu:~$ sudo apt update && sudo apt upgrade
Hit:1 http://in.archive.ubuntu.com/ubuntu jammy InRelease
Hit:2 http://security.ubuntu.com/ubuntu jammy-security InRelease
Hit:3 https://artifacts.elastic.co/packages/8.x/apt stable InRelease
Get:4 https://brave-browser-apt-release.s3.brave.com stable InRelease [7,546 B]
Hit:5 http://in.archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:6 http://in.archive.ubuntu.com/ubuntu jammy-backports InRelease
Hit:7 https://dl.google.com/linux/chrome/deb stable InRelease
Hit:8 https://ngrok-agent.s3.amazonaws.com buster InRelease
Fetched 7,546 B in 3s (2,561 B/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
2 packages can be upgraded. Run 'apt list --upgradable' to see them.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
gjs libgjs0g
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.

If you are thinking how to solve above error then don't worry, just follow given below solutions whichever suits you best. But before that let me explain you further about this error a bit. During upgrade, if the dependencies of any of the packages installed have changed then there would be new packages to install to perform the upgrade, those packages will then be shown as kept back. Now that you understood the root cause, let's see how to deal with it.

 

Method 1: Don't Panic !!

Yes, you read it right - don't panic by seeing "The following packages have been kept back:" error on the output. I myself kept ignoring this error for quite a long time and nothing happened. I was able to use and work on my system just fine. This error never caused me any problem. Then one day when you further run upgrade or reboot your system then you will notice that this error is long gone. But if you don't want to follow this approach and looking for quick resolution then you can continue checking below given methods.

 

Method 2: Run apt install or apt-get install

The most safest approach would be to get past the error by running sudo apt install gjs or apt-get install gjs command. This will give the kept back packages whatever they need to upgrade.

cyberithub@ubuntu:~$ sudo apt install gjs
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
.......................................................

 

Method 3: Upgrade Package Manually

Another approach you can take is that you can upgrade that specific package manually by running sudo apt upgrade gjs command as shown below.

cyberithub@ubuntu:~$ sudo apt upgrade gjs
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
gjs libgjs0g
2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 509 kB of archives.
After this operation, 9,216 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://in.archive.ubuntu.com/ubuntu jammy-updates/main amd64 gjs amd64 1.72.4-0ubuntu0.22.04.1 [106 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu jammy-updates/main amd64 libgjs0g amd64 1.72.4-0ubuntu0.22.04.1 [403 kB]
Fetched 509 kB in 1s (385 kB/s)
(Reading database ... 234150 files and directories currently installed.)
Preparing to unpack .../gjs_1.72.4-0ubuntu0.22.04.1_amd64.deb ...
Unpacking gjs (1.72.4-0ubuntu0.22.04.1) over (1.72.2-0ubuntu2) ...
Preparing to unpack .../libgjs0g_1.72.4-0ubuntu0.22.04.1_amd64.deb ...
Unpacking libgjs0g:amd64 (1.72.4-0ubuntu0.22.04.1) over (1.72.2-0ubuntu2) ...
Setting up libgjs0g:amd64 (1.72.4-0ubuntu0.22.04.1) ...
Setting up gjs (1.72.4-0ubuntu0.22.04.1) ...
Processing triggers for libc-bin (2.35-0ubuntu3.1) ...

 

Method 4: Using --with-new-pkgs option

You can use --with-new-pkgs option with upgrade to allow new packages to be installed. This will let you know the list of packages to be installed and prompt you before installing the package.

cyberithub@ubuntu:~$ sudo apt --with-new-pkgs upgrade gjs
[sudo] password for cyberithub:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
.............................................

 

Method 5: Run apt dist-upgrade

Another aggressive way is to use either apt dist-upgrade or apt-get dist-upgrade command to upgrade all the packages smoothly that have latest versions available along with any new dependencies required to be installed.

cyberithub@ubuntu:~$ sudo apt dist-upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
..............................................

Now if you run the upgrade again, you will see no packages has been kept back for the upgrade and all the updates are fully installed in your system. Hope this helps !!

cyberithub@ubuntu:~$ sudo apt update && sudo apt upgrade
Get:1 https://brave-browser-apt-release.s3.brave.com stable InRelease [7,546 B]
Hit:2 https://artifacts.elastic.co/packages/8.x/apt stable InRelease
Hit:3 http://security.ubuntu.com/ubuntu jammy-security InRelease
Hit:4 https://dl.google.com/linux/chrome/deb stable InRelease
Hit:5 http://in.archive.ubuntu.com/ubuntu jammy InRelease
Hit:6 http://in.archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:7 http://in.archive.ubuntu.com/ubuntu jammy-backports InRelease
Hit:8 https://ngrok-agent.s3.amazonaws.com buster InRelease
Fetched 7,546 B in 1s (5,178 B/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Leave a Comment