1

Of late, I've done a lot of configuration changes on my Trusty laptop (14.04 LTS). Firstly, I installed gnome-shell, did all updates and migrated to the LTS enablement stack. After that, I added the gnome 3 staging ppa and upgraded gnome-shell from v3.10 to v3.12 from there. Now, when I run apt-get autoremove, I get these packages in the list:

The following packages were automatically installed and are no longer required:
  evolution-indicator gdm gir1.2-gkbd-3.0 gir1.2-tracker-0.16 gir1.2-xkl-1.0 libgtksourceview2.0-0
  libgtksourceview2.0-common libiptcdata0 libtracker-extract-0.16-0
  libtracker-miner-0.16-0 libtracker-sparql-0.16-0 linux-headers-4.2.0-23
  linux-headers-4.2.0-23-generic linux-image-4.2.0-23-generic
  linux-image-extra-4.2.0-23-generic python-gtksourceview2

As I understand, gdm is a critical package which is very much needed as I'm using the gnome-shell. I've also looked at this answer which suggests marking a package as "needed" by just running apt-get install <package>. But how do I know which packages of this list I can safely remove without affecting my system? I know for a fact, however, that I don't need linux-image-* and linux-headers packages as I've already upgraded to later kernel versions. But how do I know about the rest of the packages?

Prahlad Yeri
  • 1,647
  • 2
  • 14
  • 33
  • maybe gdm was replaced by another displaymanager....same for me, when upgrading my ubuntu....lightdm was used instead of gdm... – Ben Jan 25 '16 at 07:47
  • I can understand gdm, but what about the other bunch of packages? Maybe I should edit the title because the issue is about all the extra packages, not just `gdm`. – Prahlad Yeri Jan 25 '16 at 07:50
  • looks like the **automatically installed packages** are not needed anymore...there are none references (from any installed package) to it anymore.So, you should be safe. (you could reinstall the removed packages when you have problems) – Ben Jan 25 '16 at 07:54
  • @Ben But how do I *absolutely and certainly* know that I can just remove them? Like `gdm`, what if any of those are critical packages? – Prahlad Yeri Jan 25 '16 at 07:55
  • Write down the removed packages and remove them...when you have problems, reinstall them. – Ben Jan 25 '16 at 07:58
  • @Ben Is there no way to find the dependency? The critical apps I use are many like `firefox`, `thunderbird`, `geany`, etc. How can I know if any of them depends on these packages directly or indirectly? – Prahlad Yeri Jan 25 '16 at 08:07
  • When all your installed packages are installed/managed by the package-manager, all references / dependencies should be automatically checked.Anyway, you could just re-install them, when you have problems. – Ben Jan 25 '16 at 08:10

1 Answers1

1

the command apt-cache showpkg <package> will tell you the packages "reverse depends" i.e. what other packages - in your configured repositories (not necessarily installed packages) - depend on that package.
In the case of gdm there are alot, so I wrote this script to iterate through all of the reverse dependencies to check if any were installed - which would indicate that you probably shouldnt remove gdm.

#!/bin/bash

package=$1

apt-cache showpkg $package | sed '1,/Reverse Depends:/d;/Dependencies:/,$d'  > /tmp/dependencies.txt

while read line
do
    reverse_dependency=$(awk -F '[:,]' '{print $1}' <<< $line)
    if dpkg -s $reverse_dependency &> /dev/null
    then
        echo "$line is installed and depends on $package"
    fi
done < /tmp/dependencies.txt

If you invoke the script you need to pass the package as a parameter i.e.

./script "gdm"

On my machine the result was

$ ./script.sh gdm
plymouth:i386,gdm 3.0.4-0ubuntu11 is installed and depends on gdm
plymouth,gdm 3.0.4-0ubuntu11 is installed and depends on gdm
plymouth:i386,gdm 3.0.4-0ubuntu11 is installed and depends on gdm
plymouth,gdm 3.0.4-0ubuntu11 is installed and depends on gdm
the_velour_fog
  • 2,290
  • 5
  • 23
  • 34
  • Thanks a lot for this script! When I pass `gir1.2-gkbd-3.0` as parameter, I get `gnome-shell is installed and depends on gir1.2-gkbd-3.0`. Does that mean removing this simple package will remove the `gnome-shell` ? – Prahlad Yeri Jan 25 '16 at 15:43
  • no it means if you remove `gir1.2-gkbd-3.0` you will break the `gnome-shell` package. that was your basic question right *if I remove a package will my system break*? I probably should have mentioned, if the script produces no output it means there is nothing installed on your conputer that uses the package you passed as a parameter - and theorectically you can remove it and your system would be ok – the_velour_fog Jan 25 '16 at 19:00
  • Okay. So, if I remove `gir1.2-gkbd-3.0`, the `gnome-shell` package might break, but my system will not, right? Or do I need to worry about some gnome application depending on that package being intact? My basic question was "whether my system will break or not by removing these packages?" But as I understand it is only the package that might break, not the gnome desktop system, right? – Prahlad Yeri Jan 25 '16 at 19:05
  • If other apps/packages or the desktop depend on gnome-shell and you break gnome-shell by removing a dependency, then yes you could risk breaking things. an automatically installed package is one that apt/dpkg installed "behind the scenes" because another package needed it. however if you remove the original package the automatically installed packages dont get removed - you get the message you have been getting and you have to run `apt-get autoremove` yourself. – the_velour_fog Jan 25 '16 at 19:24