I accidentally installed desktop environment at the debian install. Now I'm trying to remove it but no chance: tasksel remove desktop changed only i to u if tasksel --list-tasks.

sudo apt-get remove task-desktop doesn't work neither: no output at all.

I even cannot see what task-desktop package has as meta-package in there.

I just want to get a server debian, not a desktop.


What I would do, in preference order:

  1. Reboot and reinstall my server using PXE + preseed. This way you have a reproducible method of installing without error prone human intervention. The time spent setting this up pays off the second time you use it.

  2. If reinstallation is off the table:

    a. I'd try to find out what packages were installed by the task selection, starting by listing available selections:

    $ tasksel --list-tasks
    u desktop       Debian desktop environment
    u web-server    Web server
    u print-server  Print server
    u database-server       SQL database
    u dns-server    DNS Server
    u file-server   File server
    u mail-server   Mail server
    u ssh-server    SSH server
    u laptop        Laptop

    b. Followed by listing the specific selection:

    $ tasksel --task-packages desktop

    c. Show the package metadata to find out its dependencies:

    $ aptitude show task-desktop
    Package: task-desktop
    State: not installed
    Version: 3.16
    Priority: optional
    Section: tasks
    Maintainer: Debian Install System Team <debian-boot@lists.debian.org>
    Architecture: all
    Uncompressed Size: 21.5 k
    Depends: tasksel, xorg, xserver-xorg-video-all, xserver-xorg-input-all, desktop-base, menu
    Recommends: task-gnome-desktop | task-kde-desktop | task-lxde-desktop | task-xfce-desktop, xdg-utils, avahi-daemon, libnss-mdns, anacron, libgl1-mesa-dri, eject, iw, alsa-utils, alsa-base, pm-utils
    Description: Debian desktop environment
     This task package is used to install the Debian desktop.

    d. You can repeat the last step for each and everyone of the dependencies, or use another tool to find that information directly:

    $ apt-cache depends task-desktop
      Depends: tasksel
      Depends: xorg
      Depends: xserver-xorg-video-all
      Depends: xserver-xorg-input-all
      Depends: desktop-base
      Depends: menu
     |Recommends: task-gnome-desktop
     |Recommends: task-kde-desktop
     |Recommends: task-lxde-desktop
      Recommends: task-xfce-desktop
      Recommends: xdg-utils
      Recommends: avahi-daemon
      Recommends: libnss-mdns
      Recommends: anacron
      Recommends: libgl1-mesa-dri
      Recommends: eject
      Recommends: iw
      Recommends: alsa-utils
      Recommends: alsa-base
      Recommends: pm-utils

    e. There are tools to list forward and reverse dependencies, with output filtering options:

    $ apt-rdepends -r task-desktop --state-follow=Installed
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
      Reverse Depends: task-gnome-desktop (3.16)
      Reverse Depends: task-kde-desktop (3.16)
      Reverse Depends: task-lxde-desktop (3.16)
      Reverse Depends: task-xfce-desktop (3.16)
    $ apt-rdepends task-desktop --state-follow=Installed
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
      Depends: desktop-base
      Depends: menu
      Depends: tasksel
      Depends: xorg
      Depends: xserver-xorg-input-all
      Depends: xserver-xorg-video-all
      Depends: dpkg (>= 1.15.4)
      Depends: install-info
      Depends: libc6 (>= 2.2.5)
      Depends: libgcc1 (>= 1:4.1.1)
      Depends: libstdc++6 (>= 4.6)
      PreDepends: libbz2-1.0
      PreDepends: libc6 (>= 2.11)
      PreDepends: liblzma5 (>= 5.1.1alpha+20120614)
      PreDepends: libselinux1 (>= 1.32)
      PreDepends: tar (>= 1.23)
      PreDepends: zlib1g (>= 1:1.1.4)

    f. At this point, you can start uninstalling stuff, using tools like orphaner to ensure you leave nothing behind, or start looking at option 1. with better eyes.

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.