How to Make Raspberry Pi Boot into GUI By Default

Ended up with Raspberry Pi booting into command line interface by default? You can go back to GUI by making some config changes. Here's how to do that.
Warp Terminal

I have previously written about installing Raspberry OS on a SD card in Ubuntu. I did the same once again and installed Raspberry Pi OS once again but this time, I accidentally skipped choosing the desktop version during setup.

As a result, when I booted up my Pi, I was greeted with the command line instead of the graphical interface.

So, how do you get the Raspberry Pi OS GUI up and running in such cases? Let’s find out!

📋
Even though I initially installed Raspberry Pi OS Lite, I later installed the desktop environment on top of it. It’s a flexible option if you ever find yourself needing the GUI after starting with a lightweight setup!

Prerequisites

Before we jump into the steps, ensure:

  1. Your Raspberry Pi is running Raspberry Pi OS (formerly known as Raspbian).
  2. You have access to a keyboard, mouse, and display or can SSH into your Pi remotely.

Step 1: Access the Raspberry Pi configuration tool

The Raspberry Pi has a built-in utility called raspi-config, which allows you to tweak various system settings, including auto-boot behavior.

Here’s how to access it:

  1. Open a terminal: If you’re on the desktop, launch the terminal from the menu. If you are connected to monitor, you should have the terminal/TTY open already. If headless, SSH into your Raspberry Pi (I'm accessing mine via SSH).
  2. Run the configuration tool: Type the following command and press Enter:
sudo raspi-config

This will open the Raspberry Pi software configuration tool, a text-based menu system for configuring your Pi.

Step 2: Configure auto boot options

Once you’re in the raspi-config menu, navigate to System Options:

raspi-config main menu, selecting system options

Select Boot / Auto Login from the submenu:

select the Boot/ Auto Login option

You’ll see four main options:

  • Desktop (B1): Boots to the graphical desktop, requiring you to log in manually.
  • Desktop Autologin (B2): Boots directly into the desktop GUI and logs in automatically.
  • CLI (B3): Boots to the terminal command line, requiring manual login.
  • CLI Autologin (B4): Boots to the terminal and logs in automatically.

For a seamless GUI experience, choose Desktop Autologin (B2).

Select B4 Desktop Autologin Desktop GUI to automatically login with GUI enabled

Press Enter to save your selection.

Step 3: Reboot to apply changes

To apply the new boot settings, select Finish in the raspi-config menu, it'll automatically prompt you to reboot.

Finally reboot to apply the changes

If it doesn't then you can do that yourself with the help of terminal by typing:

sudo reboot now

Your Pi will restart and boot straight into the desktop environment.

Bonus Tip: Start desktop from command line

The above tip will always make Pi boot into the desktop/GUI. If you want to access the desktop from the command line only on some occasions, you can do that too.

From the command line interface, use this command:

startx

Please note that this won't work if you are accessing the system via SSH.

Troubleshooting

If your Pi doesn’t boot as expected:

  1. Double-check raspi-config settings: Ensure you selected the correct boot mode and saved changes.
  2. Verify Desktop Installation: If your GUI doesn’t load, it might not be installed. Install it with:
sudo apt update
sudo apt install --no-install-recommends raspberrypi-ui-mods
  1. Reconfigure Boot Options: Force reconfiguration by running:
sudo dpkg-reconfigure lightdm

Advanced customizations

Beyond simply booting into the desktop, you can:

  • Auto-login as a different user: Modify the /etc/lightdm/lightdm.conf file to set a custom user.
  • Boot to a specific application: Use ~/.xinitrc to launch an app directly upon starting the GUI.
  • Switch environments: Install and boot into lightweight desktop environments like Xfce or LXDE for a snappier experience.

Why set your Raspberry Pi to boot into GUI?

Auto-booting into the GUI is more than just a convenience. Here’s why it matters:

  • Time-saving: Automatically launching the desktop environment saves you from manually logging in and typing startx every time.
  • User-friendliness: If you’re using your Pi for tasks like web browsing, gaming, or media playback, starting directly in the GUI offers immediate access to your applications.
  • Dedicated functionality: A Pi set up for specific roles, such as a media center, can boot right into the interface required for the task, without extra steps.

Wrapping Up

Whether you're using your Raspberry Pi as a desktop replacement or a media hub, auto-booting into the GUI makes the experience seamless and user-friendly.

This small tweak can save time, simplify workflows, and enhance its usability for desktop-like tasks.

Got questions or ran into any issues? Drop a comment below, and I’ll be happy to assist! Enjoy your streamlined Raspberry Pi journey. 🚀

About the author
Abhishek Prakash

Abhishek Prakash

Created It's FOSS 11 years ago to share my Linux adventures. Have a Master's degree in Engineering and years of IT industry experience. Huge fan of Agatha Christie detective mysteries 🕵️‍♂️

Become a Better Linux User

With the FOSS Weekly Newsletter, you learn useful Linux tips, discover applications, explore new distros and stay updated with the latest from Linux world

itsfoss happy penguin

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to It's FOSS.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.