Not able to maximize screen in ubuntu 18.04 LTS

This worked for me:

sudo su
cd /media
mkdir cdrom
mount /dev/cdrom /media/cdrom
cd cdrom
sh VBoxLinuxAdditions.run

Guest window automatic resize seems to be a feature of Guest Additions which can be installed by pulling down Devices on the guest menu. For a Ubuntu 20.04, new modules will be built but guest additions install failed since gcc build environment for kernels was not yet installed. Guest Additions was then unable to mount due to an open lock even after installing build dependencies.

My fix was to look in /var/log/vboxadd-install.log which had a command line to build require modules (after sudo apt install build-essential). After building modules and restarting guest, the Auto Resize Guest Display pick was available in the guest View menu and display would auto resize.

Install Guest Addition in Devices menu still shows the lock.