Have multiple monitors connected into your Ubuntu machine? Here’s the quick tip shows you how to configure which one to display the login screen.
It’s quite easy to set primary display in Ubuntu with default GNOME desktop. However, the login screen is always sticking to the built-in display in my laptop. In case you use the external monitor for the most time, you may also set it as primary display for the GDM login screen by following this tutorial.
NOTE: This tutorial is tested only in Ubuntu with default GNOME desktop! Though, it may also work in other Linux with GNOME (e.g., Fedora, Debian and Arch) or Linux with GDM display manager.
Step 1: Set Primary Display in Gnome Control Center
First of all, open Settings (aka Gnome Control Center) from the top-right corner system tray menu.
Then, navigate to Displays in the left, and choose the monitor in the right you want to use it as primary.
This step is required to generate a XML config file under user’s ‘.config
‘ folder. Though, you may switch to another display as primary at anytime as you want.
Step 2: Apply Primary Display for GDM Login Screen
As mentioned above, the previous step generates a XML config file automatically. By copying the file into GDM’s config folder will make it also work for the login screen.
To do so, press Ctrl+Alt+T on keyboard to open terminal. Then, run command:
sudo cp ~/.config/monitors.xml /var/lib/gdm3/.config/
Type user password (no asterisk feedback) when it asks and hit Enter. For other Linux, you may have to replace gdm3
in command with gdm
.
Now, save your work and log out to see the magic!
(Optional) Disable the built-in display on startup
Another annoying thing when using multiple monitor in Ubuntu Linux is that the Grub boot menu screen is always displaying in built-in monitor. I can’t figure out how to make it work in external screen as it seems to be responsible to BIOS.
However, you can disable the built-in display on startup and use the external screen only by adding a Kernel parameter.
NOTE: After this step, Grub boot-menu still shows in built-in display, though it goes always blank after that, even after disconnected the external monitor.
1. First, boot up and log into your Ubuntu desktop. Open terminal by pressing Ctrl+Alt+T shortcut on keyboard.
2. Disconnect the external monitor, and run command to get the device ID of built-in display:
for p in /sys/class/drm/*/status; do con=${p%/status}; \
echo -n "${con#*/card?-}: "; cat $p; done
Some said the last command does not work. If so, you may run command below instead. Usually, the first one is the ID of built-in display.
cat ~/.config/monitors.xml |grep connector
Or, just log out and choose login via ‘Ubuntu on Xorg’ via bottom right gear button. And, run xrandr -q
to see the display device name.
3. Re-connect your external monitor, and run command to edit the configuration file for Grub:
sudo gedit /etc/default/grub
Replace gedit with gnome-text-editor for Ubuntu 24.04 or use nano that works in most Linux. When file opens, add video=eDP-1:d as value of ‘GRUB_CMDLINE_LINUX_DEFAULT’. So the line will look like:
GRUB_CMDLINE_LINUX_DEFAULT="quite splash video=eDP-1:d"
Here ‘d‘ tells to disable the device. Though, you have to replace eDP-1 with your device name according to what you got in last step.
After saving the change, run sudo update-grub to reload the Grub settings and done!
In addition, you may add video=Device-Name:e or video=Device-Name:D kernel parameter to force enable external monitor on startup if need.