1

I am on Ubuntu 20.04

Because of some reason I needed to reinstall Gnome, but now after purging it I can't reinstall it. I am getting unmet dependencies error.

Exact error message -

sudo apt-get install ubuntu-gnome-desktop
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 ubuntu-gnome-desktop : Depends: ubuntu-desktop but it is not going to be installed
                        Depends: gnome-session but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

What I tried -

  1. Cleaning
sudo apt autoclean

sudo apt clean

sudo apt autoremove

my computer was already clean so no output

  1. Fixing using f parameter
sudo apt install -f ubuntu-gnome-desktop

sudo apt --fix broken

OUTPUT -

sudo apt --fix-broken install

Reading package lists... Done

Building dependency tree
       
Reading state information... Done

0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
  1. Dpkg reconfigure
sudo dpkg --configure -a

Didn't return anything

  1. Using aptitude
sudo aptitude install ubuntu-gnome-desktop

Didn't work.


Other details

  • Currently, I am doing it via xfce Desktop. I don't like it.

  • I do not having GDM installed.

  • I want ubuntu-gnome-desktop only.

  • This unmet dependencies problem is only with packages related to gnome.

  • If you don't have any solution about ubuntu-gnome-desktop then I can also install only gnome desktop, but that is not preferred.

  • output of sudo apt update -

sudo apt update
Hit:1 http://ppa.launchpad.net/mozillateam/firefox-next/ubuntu focal InRelease 
Hit:2 http://archive.canonical.com/ubuntu focal InRelease                      
Hit:3 http://archive.ubuntu.com/ubuntu focal InRelease
Hit:4 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:5 http://archive.ubuntu.com/ubuntu focal-security InRelease
Hit:6 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Reading package lists... Done
Building dependency tree       
Reading state information... Done
1 package can be upgraded. Run 'apt list --upgradable' to see it.
  • output of sudo apt upgrade
sudo apt upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
  • I just want gnome-desktop

  • repositories enabled

enter image description here

0

2 Answers 2

2

What worked for me:

I simply installed the task-package of ubuntu-desktop. You can install it by:

sudo apt install ubuntu-desktop^

^ means task package

If you prefer GUI:

sudo apt install tasksel
sudo tasksel
# arrow keys to navigate and space bar to select.

select ubuntu desktop and press enter

Some other things to try:

First, try updating the repositories:

sudo apt update

If that didn't worked, try using force install:

sudo apt -f install ubuntu-desktop

You can also try using aptitude:

# install aptitude
sudo apt install aptitude

# install the packages
sudo aptitude install ubuntu-desktop

## aptitude will suggest solutions to fix the error, if you find them ok then accept the solutions.

Using aptitude with -f parameter.

sudo aptitude -f install ubuntu-desktop

Using -f with task package:

sudo aptitude -f install ubuntu-desktop^

Try removing error .deb files from apt cache directory.

sudo rm /var/cache/apt/archives/*.deb

Try clearing of the status of conflicting packages:

# create a backup first:
sudo cp -r /var/lib/dpkg/status /var/lib/dpkg/status.bak

# view the file:
view /var/lib/dpkg/status
# Now, find the information given about the error packages and try removing it.

Try installing the dependencies, yourself:

sudo apt install <package>

Try installing the normal version of the package i.e gnome-session

sudo apt -f install gnome-session

Feel free to edit and add more solutions.

0

From GitHub Gists

APT - Dependency Errors Fix

Setting the Stage

One night, I attempted to use the APT: Package Manager—which I've successfully done thousands of times before—and I ran into a metric-f-ton™️ of dependency errors that halted the installation like the snail-crawl-parking-lot-exodus©️ after a NFL game or Shania Twain concert.

After repeatedly punching 👊 my keyboard and 🖥️ while rapidly uttering expletives in my "OUTSIDE" voice, I took a deep breath and set out to show APT who's boss.

Below, I've recorded in painstaking detail my steps to salvation and the road back to sanity. My hope is this will help someone else who finds themselves on the loosing end of a automatic package upgrade that 💩 its own pants near completion.

TL;DR - The Short Answer

CAUTION: This could severely damage your OS's stability or make it inoperable altogether.

make sure to have a working backup ready to restore to in case of emergency!

All the typical suggestions didn't work for me. Here's a list of what I tried in no particular order:

$> sudo apt-get --fix-broken|f install  #fail 
$> sudo apt purge [broken-package]      #fail again  
$> sudo apt remove [broken-package]     #3rd times a fail
$> sudo apt --fix-broken install        #futility unchecked  
$> sudo dpkg -r [broken-package]        #definition of insanity
$> sudo apt --fix-broken --allow-unholy-hell-to-be-released #again?  
$> small-animal-sacrifices              #understandable  
$> large-animal-sacrifices              #starting-to-escalate-a-bit  

I tried the above commands hundreds of times and crossing every
possible permutation of fingers and toes. None of it worked. Until I did this...

$> sudo apt-get purge [broken-package]         #fail
    blah blah: unmet dependcy errors:  
      - [broken-packageA]: depends on [some-other-packageB]  

$> sudo apt-get purge [broken-packageA] [some-other-packageB]...[some-other-packageZ]   #improved failure

It took SEVERAL attempts of adding all of the listed unmet dependencies to my apt purge command, but every time I added another listed dependency issue package name, the reported list of dependency errors shrank.

This is in essence the solution to my particular problem. Attempt to run an apt remove or an apt purge on your broken package. Review the list of dependency issues (i.e. apps that depend on the package you're removing) and add that package-name to your list of apt remove --purge app1 app2 app3 ... appN packages until the command actually runs and executes.

If you get a partial execution with some additional failures/dependcy errors, just repeat the process with the listed problem packages.

Afterwards, run an apt autoremove && apt autoclean && apt update && apt dist-upgrade && apt full-upgrade etc. until your system is clean and reporting no more errors.

...

For all the gory details, read on for the full-blown snooze-fest

Continues in GitHub Gist format here: GitHub - Gist - APT Dependency Error Recovery

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .