Login screen appears on second monitor [duplicate]

Ubuntu 18.04 login screen Display settings

Copying the file monitors.xml from /home/user/.config into /var/lib/gdm3/.config/ and

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

In /etc/gdm3/custom.conf changing from #WaylandEnable = false to WaylandEnable = false solved the issue.


UPDATE

The same things happen on Ubuntu 20.04 LTS Focal Fossa, gdm somehow does not recognize which monitor is set as primary and the login screen appears on second Monitor.

Copying only monitors.xml solves the issue

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