Ubuntu 20.04 interface font too small after restart, even with high scaling factor

Update 2020-10-07

The bug is now fixed, you can get it with apt and remove any workaround you had chosen.

Original answer

It's a recently introduced bug in Mutter which is the default window manager for Gnome Shell.
https://bugs.launchpad.net/ubuntu/+source/mutter/+bug/1892440

It seems to affect mainly Nvidia cards.

It was fixed in Pop!_OS by removing the patch named "x11-Add-support-for-fractional-scaling-using-Randr.patch"
https://github.com/pop-os/pop/issues/1170 https://github.com/pop-os/mutter/commit/a912c7fc25f4797047790fc5df1711eeb31af282

Ubuntu devs did not say how they will resolve this but at least they acknowledged the problem and someone is assigned to it.

The only known workaround for now is what you described: in Gnome Tweaks, change the scaling factor to something else and back to the original value. Unfortunately, as you noted this will be needed after each login and even after each restart of Gnome Shell (ALT+F2, r).


EDIT 2020/10/07

The bug has been fixed in the package mutter (3.36.6-1ubuntu0.20.04.2), available via apt.

Original answer

Inspired by this answer I implemented a temporary workaround in my machine. I'm currently using Ubuntu 20.04.1 with GNOME Shell 3.36.4.

This does NOT fix the font size in GDM login screen, but only after the login. This trick simply avoids to repeat an annoying sequence of commands after every reboot. Of course this trick may be useful only till the bug in Mutter is fixed.

  1. Create a script (I put it in ~/.local/bin) with the following content:

    sleep 5s
    gsettings set org.gnome.desktop.interface text-scaling-factor 1.01
    sleep 0.5s
    gsettings set org.gnome.desktop.interface text-scaling-factor 1.00
    

    '1.01' it's just a number to trigger the changes, it may be any value. I decided to use a value very near to the final one. '1.00' is the value that I eventually want. Feel free to put your target value. Same thing for the sleep times, you can change them.

  2. Make it executable running:

    chmod +x ~/.local/bin/fix-font-size.sh
    
  3. Run the script (I named it fix-font-size.sh) at boot. For this reason I run Startup Applications Preferences app and created a new item with the following command:

    bash -c "/home/username/.local/bin/fix-font-size.sh"
    

    Also see the screenshot for reference (where "Modifica programma d'avvio" means "Startup Applications Preferences"):

    add command to startup applications

  4. Save and you should have a correct size font after login without manually inserting commands in the terminal or by GUI.


As mentioned in the bug report:

You can downgrade libmutter package temporarily as a workaround:

sudo apt install libmutter-6-0=3.36.1-3ubuntu3 gir1.2-mutter-6=3.36.1-3ubuntu3
sudo apt-mark hold libmutter-6-0

Remember to unhold after fix comes out!