Search code examples
archlinuxpacman-package-manager

Removing package group except some packages


So, I was trying to remove GNOME by

sudo pacman -Rsn gnome

but I got the error

checking dependencies... :: removing networkmanager breaks dependency 'networkmanager' required by network-manager-applet

In fact, I don't want to remove the package networkmanager, that is contained in the package group gnome. How can I remove the whole group gnome except networkmanager?


Solution

  • I found a solution here, even if I don't know if it's the best solution.

    Basically you have to generate the list of the packages from the group package (e.g., gnome) by typing

    sudo pacman -Qgq gnome > pkglist
    

    After that you have to remove from the generated file pkglist all the package names that you don't want to remove. And now you have simply to remove the packages by giving in input to pacman the pkglist file, that is

    sudo pacman -R - < pkglist