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!
Prerequisites
Before we jump into the steps, ensure:
- Your Raspberry Pi is running Raspberry Pi OS (formerly known as Raspbian).
- 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:
- 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).
- 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:
Select Boot / Auto Login from the submenu:
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).
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.
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:
- Double-check raspi-config settings: Ensure you selected the correct boot mode and saved changes.
- 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
- 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. 🚀