Apologies if this seems straight forward but I've recently downloaded XFCE to replace LXDE environment.

I did this by using

sudo apt-get install xfce4

and following all the instructions.

Then to remove LXDE I carried out:

sudo apt-get --purge remove lxde
sudo apt-get clean

My problem lies that whenever I run


it still opens and runs LXDE? I know that I should be running


but I want to know how to completely remove LXDE? and understand how startx works?

Edit: Also how do I modify the startx file so that I can choose (if both are installed) which desktop environment I want startx to run?

Follow the step-by-step guide provided by yours truly :-)

First install XFCE4 (consider also installing the xfce4-goodies package for extra visual candy)

sudo apt-get install xfce4

Then list all installed LXDE-related apps

sudo dpkg --get-selections | grep "^lx"

...and remove them

sudo apt-get remove lxappearance lxde lxde-* lxinput lxmenu-data lxpanel lxpolkit lxrandr lxsession* lxsession lxshortcut lxtask lxterminal

Note that alongside lxterminal also pistore will be purged! So if you want the Pi Store, don't remove the lxterminal package

During removal the update-alternatives script will be executed and set xfce4 as the default x-session-manager in /usr/bin/x-session-manager.

Reboot the RPi, for the changes to take effect.

Last but not least you should run the autoremove and autoclean command to clean any unnecessary packages

sudo apt-get autoremove && sudo apt-get autoclean

And you're all set! Enjoy the much more user-friendly XFCE.

up vote 5 down vote accepted

I posted this question in the Linux Stack Exchange as well, and a user named Vasa1 suggested to check

apt-cache show lxde

which listed all the associated packages with lxde, and therefore since lxde is a meta package, I therefore had to delete and remove the other associated packages in order to run startx to boot xfce4.

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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