It turns out that when I prepared a certain Raspberry Pi several months ago, I used the full Raspbian image. Since then, that Pi is on headless duty just running some server software. When I run updates on it, a whole lot of stuff I'll never use gets updated. Migrating from jessie to stretch took unnecessary hours.

What can I do to move to the lite version from within the existing installation?

I would presume that I can remove some package and install another, like the ubuntu-desktop on Ubuntu, but what would that be on Raspbian?

  • 2
    install a lite version from scratch
    – jsotola
    Apr 23, 2018 at 3:56
  • read man apt, man apt-get, man dpkg. remove all installed packages, then manually clean in /etc and elsewhere.
    – user2497
    Apr 23, 2018 at 4:07
  • 3
    @user2497 "Remove all installed packages" seems like an absurd suggestion...
    – goldilocks
    Apr 23, 2018 at 14:14
  • @goldilocks Not if OP has heavily modified his installation with custom scripts etc - and who doesn’t? He has already expressed a desire to keep his current install, and why do you think that is? Purging takes 15 minutes. Rebuilding will take longer. OP: try apt-get purge \*, but do back up /etc and other relevant folders first.
    – user2497
    Apr 23, 2018 at 14:22
  • 2
    @user2497 your advice is dangerous at best! Removing all packages and manually cleaning /etc (whatever that means) - you may as well just delete the partition. Apr 23, 2018 at 16:54

2 Answers 2


I don't like answers that simply say install a clean image as if the OP wasn't aware of that possibility and it also disregards the work that the OP has already done on their installation.

So to answer your question directly, here's how to remove the GUI:

sudo apt-get remove --purge x11-common
sudo apt-get autoremove

The first line invalidates a lot of packages that are then removed by the second line leaving a much reduced codebase although it will not be identical to a Lite installation.

You can also use the tasksel command to remove top-level tasks which will consist of a number of packages.

  • 1
    This basically did it for me, but I needed do a few other things to completely remove old packages and their on-disk files: apt-get clean; apt-get autoremove -y; apt-get update && apt-get upgrade; apt-get autoremove -y; apt-get purge -y $(dpkg --list |grep '^rc' |awk '{print $2}')
    – Colin Dean
    Apr 24, 2018 at 3:55

What can I do to shift to the lite version?

There is no reliable and user-friendly way to "shift" from an already installed "Raspbian Stretch with desktop" to "Raspbian Stretch Lite".

In theory you need to find all different packages and replace respectively remove them. But in practice this is very time-consuming.

To get the lite version the most sensible way is to install the correct image.


Removing the GUI will not transform an installation of "Raspbian Stretch with desktop" into "Raspbian Stretch Lite". There are a lot more differences between both versions. For further details about the differences please see:

  • Is Debian package system not reliable? This notion people have of ditching a whole installation for a few tiny changes makes me cringe. OP has stated clearly he’d like a headless raspbian, and doesn’t need a GUI. -1
    – user2497
    Apr 23, 2018 at 14:53
  • 1
    @user2497 Looking forward to your answer explaining these "few tiny changes".
    – Fabian
    Apr 23, 2018 at 15:43
  • Explanation of a few tiny changes: removal of all packages, installation of required packages, copying saved configurations to the correct locations.
    – user2497
    Apr 23, 2018 at 15:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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