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‘ will disable the device. Though you have to change eDP-1 to your device name 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.
Thanks. This worked nicely on 20.04.
Thanks for this Ji. It worked great.
Great post Ji!
I tried it on Ubuntu 24.04 and it didn’t work.
Any tips?
Thank you very much.
It works in my case. Try deleting the config file:
rm ~/.config/monitors.xml
Then, re-connect external monitor, re-configure the primary monitor to re-generate the config file.
Thanks. Solved my problem with an old “headless” Thinkpad that I use with an external monitor. The LCD screen in this laptop died years ago, so I’ve just been using it with an external monitor. A recent upgrade to Ubuntu 24.04 caused some headaches, but your article got me around them. Thanks
You are great!
Thank you!
Solved my problem also on Fedora, after many fruitless hours googling.
Both content and presentation/formatting/pictures of the tutorial was excellent.
Have a “Lucky Goldstar” award, Ji ! (my secondary display was a LG C2 tv)