Score:2

How to Configure A New Monitor As the Only Monitor

cn flag

I'm using Ubuntu 20.04.3 LTS and I'm not familiar with X. When I installed the OS, I was temporarily using an old monitor, with an HDMI to VGA adapter. Then, I bought a new monitor and found that Ubuntu gave me a black screen on the new monitor. Later, I found that before I login, it can only display on the old monitor and after logging in, it can display normally on my new monitor. What I have to do now is to plug in the old monitor, log in, and unplug the old monitor, switch to the new one (with a single HDMI port on the graphics card).

What I suspect is that Ubuntu "remembers" the old monitor and treats it as the primary monitor, so it displays login screen only on the old one.

I'm wondering is there any way to fix this issue?

in flag
Does the new display show the boot splash and go black at login? Or is it off the entire time the system is booting?
cn flag
@matigo It shows UEFI screen during booting, and goes black at login.
Score:0
in flag

Sometimes the easiest fix is to reset xrandr. Here's how:

If you are booting with the new display connected:

  1. When your system finishes booting and goes to a black screen, press Ctrl+Alt+F1.
    Note: You should be able to use any of the F# keys for this, but F1 is a fine place to start.
  2. Log into the system via the console
  3. Move on to the "Reset xrandr" section of this answer

If you are booting with the previous display connected:

  1. Boot normally
  2. Sign in normally
  3. Open Terminal

Reset xrandr:

  1. Reset xrandr:
    xrandr -s 0
    
  2. There is no further step ... hopefully.

What this does:

From the documentation regarding the -s option:

-s, --size size-index or --size widthxheight
    This sets the screen size, either matching by size or using the index into the list
    of available sizes.

So -s 0 will reset the connected display to use the first available size identified via the HDMI handshake. If you would like to see a full list of display resolutions available, you can do so like this:

xrandr -d :0

Which will give you something like this:

Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 16384 x 16384
eDP-1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 309mm x 174mm
   1920x1080     60.05*+  60.01    59.97    59.96    59.93  
   1680x1050     59.95    59.88  
   1600x1024     60.17  
   1400x1050     59.98  
   1600x900      59.99    59.94    59.95    59.82  
   1280x1024     60.02  
   ...
DP-1 disconnected (normal left inverted right x axis y axis)
HDMI-1 disconnected (normal left inverted right x axis y axis)
DP-2 disconnected (normal left inverted right x axis y axis)

If your graphics adapter has just a single HDMI output, then you will likely see information just for HDMI-1.

cn flag
With the new display connected, I ran the `xrandr -s 0` command and reboot the computer. It still gives a black screen during login. I called out console by CTRL+ALT+F5, and `xrandr -s 0` gives something like `Can't open screen`. The problem persists.
in flag
What do you see when you type `xrandr -q` after getting the `Can't open screen` message?
cn flag
`xrandr -q` also gives `Can' open display`, the same happens to a single command `xrandr`
in flag
This is most irregular. As a final measure, let's name the display and set a resolution: `xrandr --output HDMI-1 --mode 1920x1080`. Generally when this sort of issue is persistent, it's because the HDMI device is not sending any signal back to the video card, but it would be very odd for a display to *not* do this. And, as you can get the new display to work when connecting it after the fact, it must be sending *some* configuration data back. Are you using an XFCE desktop or the default Gnome?
cn flag
When I'm using the new monitor after login, `xrandr --output HDMI-0 --mode 1920x1080` works well (I assume no change meaning it works well since I'm using a resolution at 1920x1080). When I reboot the machine, call out `tty5` before login, and input that command, `Can't open display` happens again. Maybe there's no X session at all when using `tty5`?
in flag
Or your graphical console is not `tty5` but `tty7` ⇢ [Ctrl]+[Alt]+[F7]
cn flag
It's quite interesting... CTRL+ALT+F1 gives a black screen. I type my username and password blindly and then it goes to the normal desktop. I assume it's the normal login screen. CTRL+ALT+F2 to CTRL+ALT+F6 give `tty2` to `tty6`, and in each session, `xrandr` gives `Can't open display`. CTRL+ALT+F7 gives a line `/dev/sda2: clean, xxx/xxxx files, xxx/xxxx blocks`
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.