You commented that ps -e | grep -i virtualbox
is not showing anything, so there is no currently running virtualbox process to stop. Try running sudo apt install virtualbox-5.2
in a more isolated environment.
Immediately after the BIOS/UEFI splash screen during boot, with BIOS, quickly press and hold the Shift key, which will bring up the GNU GRUB menu. (If you see the Ubuntu logo, you've missed the point where you can enter the GRUB menu.) With UEFI press (perhaps several times) the Esc key to get to the GRUB menu. Sometimes the manufacturer's splash screen is a part of the Windows bootloader, so when you power up the machine it goes straight to the GRUB screen, and then pressing Shift is unnecessary.
From the GRUB screen select Advanced options for Ubuntu and press Enter.

A new purple screen will appear showing a list of Linux kernels, which includes options of booting the kernels normally or in recovery mode.
Use the arrow keys on the keyboard to select an earlier kernel version and press Enter to boot with the selected kernel.
Open a text-only virtual console by pressing the keyboard combination Ctrl+Alt+F3.
At the login:
prompt type your username and press Enter.
At the Password:
prompt type your user password and press Enter. After you have logged in, you can run commands from the virtual console.
Install virtualbox-5.2.
sudo apt remove virtualbox
sudo apt-get install --install-suggests virtualbox-5.2
To bring up the normal Ubuntu login screen run this command:
sudo systemctl start graphical.target