After having first tried installing the Guest additions, which didn't work, I found another solution elsewhere: linuxbsdos.com.
Use Xdiagnose from the Dashboard. Search for and launch Xdiagnose, then enable all the options under the Debug section. Click the Apply button, then close the window and restart the system.
That's what finally did the trick! Now I get 1024 x 768 resolution instead of 640 x 480.
I never uninstalled the Guest additions, so it might be I needed to take both these measures.
---------- EDIT ---------
I have come to realize that the solution described above is just a fallback, in case installing the Guest Additions failed for some reason. I have finally managed to successfully install them, and can now choose from a bigger range of resolutions in the display settings. Here is how I did it, after having tried all of the above.
One thing I had already tried earlier was
sudo apt-get install virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11
This is not enough in itself, but might be a necessary prerequisite for the following steps (of which some might not be necessary...).
- Update Virtualbox to the latest version (currently 4.3.24)
- In Terminal in the Guest system type:
sudo apt-get install dkms
sudo apt-get install build-essential module-assistant
sudo m-a prepare
If you have no top menu in the Guest system, it's because you're in scale mode which causes it to be hidden. In that case, press
Host + C to toggle scale mode (where Host is Right Control by default)
- In the Guest system, go to the top menu, and click Devices->Insert Guest Additions CD Image. This should mount the CD image.
- In my case, Autostart worked, and the installation started with a prompt. If it doesn't autostart, you can do the following
Just be sure to replace <username> by the logged in user's username.
And then a restart, as JTIM pointed out...