4

I installed many additional packages on my PC. dpkg --get-selections command displays all the installed packages. From the installed packages how do I know which are important for system booting (if we remove any one package from the important packages list, system won't boot or system doesn't appear like normal).

If I know that, I'm aware of it and I won't remove these kind of important packages. So how do I know that these packages are important and these packages are not important from the output of dpkg --get-selections?

2

If the installed package has priority important or required then this kind of packages are considered as most important packages.

apt-cache show <package-name> 

The above command shows the priority of the corresponding package.

avinash@avinash-Lenovo-IdeaPad-Z500:~$ apt-cache show hostname
Package: hostname
Essential: yes
Priority: required

So run the below command to find all the packages which has the priority important or required.

dpkg --get-selections | xargs apt-cache show {} | awk -F' *: *' '$1=="Package"{p=$2;next} $1=="Priority"&&$2~/(important|required)/ {print p}'

Essential packages has the an extra record "Essential: yes" in the output of apt-cache show <package-name> command.These essential packages also has the priority important or required.To get the list of only essential packages then run the below command.

dpkg --get-selections | xargs apt-cache show {} | awk -F' *: *' '$1=="Package"{p=$2;next} $1=="Essential"&&$2=="yes" {print p}'

Save the above commands output to a text file for future use.

1

I don't know if Ubuntu has this set up, but should follow the Debian standard. There are packages flagged as important and required, you need for that aptitude:

sudo apt-get install aptitude

Now you can look at what packages are required:

aptitude search '~prequired'

or important:

aptitude search '~pimportant'

You could also do more and see which packages that you have installed are not important nor required:

aptitude search '?and(~i, !~pimportant, !~prequired)'

(the above search means: search for installed package that are not important nor required)

Be aware that no GUI package is important or required. Both section are the bare minimum to have a bootable system (think about a server without services) and download more programs, if you remove any of this packages is probable that you will be left with an unbootable system, if you remove everything but these is definitive that you won't have any GUI.

Reference:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.