92

On Ubuntu 18.04, I have connected my laptop to an external display and I am able to set the external display as primary and external display only mode. But when I turn on my laptop or log out from my session the display login screen is displayed only on my(internal) laptop screen. But once I login the display switches to external only and my laptop screen turns off as expected.

Is there a way I can make the login screen appear only on the external screen on bootup or on logout as in 16.04? Also the login screen does not follow my cursor as in 16.04.

muru
  • 207,970
Aravind
  • 1,468

3 Answers3

117

This is a known and reported bug with gdm3. The current workaround appears to be:

  1. Go into Settings > Devices > Displays and configure your monitors the way you want for your login screen (in your case, internal laptop display disabled). Click the "Save" button when done.
    (Note: Changing this setting with an alternate desktop environment—such as Cinnamon—may not propagate the intended change.)
  2. Copy your user's monitors.xml file into the home folder for gdm user.

To copy the monitors.xml file, open a terminal and perform the following:

sudo cp ~/.config/monitors.xml ~gdm/.config/monitors.xml
sudo chown gdm:gdm ~gdm/.config/monitors.xml

Then, reboot and see if your changes persist. If this doesn't work, try going through the whole process again. It took me two times in order to get it to stick. I was also able to reboot with my external display disconnected and it switched back to my internal laptop display. I rebooted again and reconnected it and it switches back to my external monitor.

Hope this helps!

Damian T.
  • 1,295
  • Thank you for your suggestion. For some reason it’s not sticking to the external display on boot up, tried about 4 times. Will wait for the bug to be resolved. – Aravind Jun 05 '18 at 01:27
  • It works for me. – jdthood Oct 17 '18 at 07:24
  • To me the terminal statements were enough to fix the issue. This means that I didn't executed the second part from the Aravind answer. Thanks Damian. Still I don't get WHY this isn't resolved by Ubuntu itself after so many years. – José Cabo Mar 13 '20 at 17:01
  • Thank you. It is 2020 and this bug is still not fixed. Why?? – Martin Zeltin May 01 '20 at 09:25
  • 3
    +1 Thank you - with Ubuntu 20.04 I found this solution to work. This and the currently accepted answer ( https://askubuntu.com/a/1048966/7072 ) are almost the same steps. In my situation I have three monitors, one of them is connected via a StarTech USB3 to HDMI running with DisplayLink driver. Initially the screen I wanted for login was the case but strangely for a reason I don't know, the login was displayed on one of the other screens. Doing your solution appears to have fixed the issue in my case. I rebooted and the screen I wanted the login to appear is still as required. – therobyouknow May 26 '20 at 02:40
  • I did not have to do "And in the /etc/gdm3/custom.conf uncomment WaylandEnable=false" in the currently accepted answer. – therobyouknow May 26 '20 at 02:42
  • This works with Ubuntu 20.04. In my case I have two screens. I swapped the screens between left and right as a better fit for my need because the connectors and the size are not the same. It works fine with my session, but not on the login screen. The screens were still swapped to the default. I managed to fix it with your method. Thank you very much. – chmike Jun 05 '20 at 09:07
  • 1
    This solution worked on my Ubuntu 20.04 computer, with 3 DisplayPort screens. – Mathieu Bour Jul 11 '20 at 18:37
  • Those two lines work perfectly on Ubuntu 22.04. Repeating the procedure was not necessary. – Marvo Jun 27 '22 at 07:09
  • Those two lines work perfectly on Ubuntu 23.10. Repeating the procedure was not necessary. – Tameem Khan Nov 04 '23 at 16:22
  • 1
    Still working on Ubuntu 24.04 LTS. – effeffe Jun 16 '24 at 10:21
  • As I commented on the accepted answer, configuration may have to be made in the defaut session type. As of Ubuntu 24.04, it's X11 with a NVidia GPU, otherwise it's Wayland. The hint is in the session choices: "Ubuntu / Ubuntu on Wayland", or "Ubuntu / Ubuntu on X11"?

    I think it's best deleting the monitors.xml file then reconfiguring the screen setup. Also, scaling (e.g. 125%) does not work, even on Wayland. scale must be set to 1. Otherwise the login screen will still be shown on the internal screen.

    – SylvainC Aug 15 '24 at 01:26
  • I have a 2 monitor setup (1x DP, 1 HDMI). Login screen always shows on the one connected via HDMI, although I have followed the steps above to display it on the one connected via DP. What did the trick for me was deleting every monitor configuration insides gdm's monitor.xml except the one on the desired DP port. – sea212 Mar 13 '25 at 18:07
40

This Solved my Isuue:

Go into Settings > Devices > Displays and configure your monitors the way you want for your login screen (in your case, internal laptop display disabled). Click the "Save" button when done.

Copy your user's monitors.xml file into the home folder for gdm user.

To copy the monitors.xml file, open a terminal and perform the following:

sudo cp ~/.config/monitors.xml ~gdm/.config/monitors.xml
sudo chown gdm:gdm ~gdm/.config/monitors.xml

And in the /etc/gdm3/custom.conf uncomment WaylandEnable=false

Aravind
  • 1,468
  • 17
    How is this answer different from Damian T.'s answer? – Kennet Celeste Oct 29 '18 at 15:40
  • 2
    This is the only answer that made the login screen appear on my external monitor. However, when I actually logged in, I only got a black screen and had to recovery-mode to undo the WaylandEndable=false. – drhagen Feb 20 '19 at 13:44
  • It worked for me. I tried the other answers and they didn't work, but this one works. Thanks a lot. – amedina Oct 20 '19 at 08:20
  • 2
    DO NOT DO THIS!!! you will loose ability to login (blank screen and kick back to login) until you undo changes in /etc/gdm3/custom.conf – Anton Matosov Jun 28 '20 at 20:10
  • 1
    In my case (Ubuntu 20.04) that really helped. I had to uncomment WaylandEnable=false. – Michał Maluga Jul 09 '20 at 19:18
  • Tried this method a dozen and still can't get the login screen to show up on the right monitor. On Ubuntu 21.04 btw – TechEmperor95 Nov 05 '21 at 09:16
  • 1
    @TechEmperor95, had the same trouble and found out that you have to configure monitors specifically in x11 session before coping monitors.xml - Waylang and X-server has different settings – Leonid Jun 15 '22 at 19:18
  • Perfect answer for 22.04. Worked exactly as expected (and I didn't lose the ability to login or get a blank screen). Try CTRL+ALT+F2 or any other function key to get to a login prompt. CTRL+ALT+F1 goes back to the graphical desktop/login screen. – Dave Apr 27 '23 at 14:46
  • Actually, it seems that configuring monitors must be done in the default session according to the hardware: with an Nvidia graphics card, X11 is the default session. Otherwise, the configuration has to be done in a Wayland session. I found out because I have to use X11 on my dual GPU AMD+Nvidia laptop, but Wayland on my AMD laptop with an internal GPU. The hint is on the login screen: what are your session choices? "Ubuntu" and "Ubuntu on Wayland", or "Ubuntu" and "Ubuntu on X11"? – SylvainC Aug 15 '24 at 01:21
39

I too have an external monitor. This worked for me:

  • Set your display mode as desired using Settings > Devices > Displays

  • Open a terminal window by pressing CtrlAltT and then type:

    sudo cp ~/.config/monitors.xml /var/lib/gdm3/.config

  • Hit Enter

  • Reboot the computer

J D
  • 490
  • 2
    This was the only answer that worked for me on Ubuntu 18... this folder actually exists unlike /home/gdm – finsbury Oct 20 '18 at 15:05
  • 6
    /var/lib/gdm3 is ~gdm , its gdm's home directory. Services user accounts don't usually get home directories in /home . – Amias Jan 05 '19 at 15:41
  • 1
    cp: cannot create regular file '/var/lib/gdm/.config': No such file or directory; cp: cannot create regular file '/var/lib/gdm3/.config': No such file or directory; cp: cannot create regular file '~gdm/.config': No such file or directory;

    Great. Where has the folder moved in Ubuntu 18.04.1 LTS? Does it matter I'm using Gnome 3.28.2 and Wayland?

    – Ayelis Feb 06 '19 at 18:56
  • This solution worked for me, the accepted one did not. Ubuntu 18.04 with gnome-flashback. My display configuration now even works with a multi-computer KVM switch. – painfulenglish May 04 '20 at 07:27
  • 2
    Worked for Ubuntu 20.04 Focal. – dess Aug 13 '20 at 14:06
  • Thanks for sharing the correct path to gdm3 home. Using "~gdm" does not get me anywhere (at least not on Debian Buster). – Terje Mikal Feb 25 '21 at 07:56
  • Note that ~gdm != ~/gdm – onlycparra Jul 25 '21 at 23:24
  • Worked for Ubuntu 21.04! – morhook Apr 06 '22 at 16:07
  • Worked for me in Ubuntu 22.10 using an RX 6800 GPU with 2 outputs (DisplayPort = LG Monitor, HDMI = Samsung TV). Ubuntu was always starting with a black screen because the logon screen was using the TV as output (which was off). Now It boots using my PC monitor. – sebastianer Apr 02 '23 at 11:32