Running Ubuntu in VirtualBox can sometimes feel sluggish, especially if default settings are used. Here’s how to improve performance and make your virtual machine faster and smoother.
Guest Additions improve graphics, mouse integration, and overall system responsiveness.
sudo apt update
sudo apt install build-essential dkms linux-headers-$(uname -r)
Then insert the Guest Additions CD from the VirtualBox menu and run the installer.
Use the command below to manage startup services:
sudo systemctl disable service-name
Or use GUI tools like “Startup Applications” to turn off unnecessary programs at boot.
Make sure you're using the latest version of VirtualBox and that the Extension Pack is also installed for enhanced VM support.
Store your virtual machine files on an SSD instead of an HDD for faster boot and loading times.
In Ubuntu Settings → Accessibility or Tweaks, disable interface animations for a snappier experience.
sudo apt update && sudo apt upgrade
Latest patches often include performance improvements and fixes for known bugs.
Sometimes, VMware Workstation Player offers better graphics acceleration than VirtualBox, especially on lower-end hardware.
Is your Ubuntu Virtual Machine (VM) running slow on VirtualBox? You’re not alone. Many users face performance issues when running Ubuntu in a virtualized environment, especially on VirtualBox. Whether you’re a developer testing code or a Linux enthusiast exploring Ubuntu, slow performance can be frustrating. In this detailed guide, we will explore the common causes, troubleshooting steps, and proven solutions to make your VirtualBox Ubuntu faster and smoother.
There are multiple reasons why your Ubuntu VM might be lagging or responding sluggishly in VirtualBox. Here are the top culprits:
VirtualBox needs a reasonable share of your host system's CPU and RAM. If Ubuntu is sluggish, it may be starved of resources.
Without 3D acceleration, Ubuntu’s GNOME desktop and animations may lag or become unresponsive.
Guest Additions are a set of drivers that improve VM performance, allow full-screen mode, and smooth file sharing between guest and host.
sudo apt update
sudo apt install build-essential dkms linux-headers-$(uname -r)
Then go to the VM window → Devices → “Insert Guest Additions CD Image” and run:
sudo sh /media/username/VBox*/VBoxLinuxAdditions.run
Ubuntu GNOME requires more resources. Consider using:
These flavors use less RAM and CPU, resulting in faster VM performance.
Disk speed has a huge impact on performance. VMs hosted on traditional spinning drives are significantly slower.
If possible, store your VirtualBox VM on an SSD to enjoy faster boot times and snappier performance.
Hardware virtualization boosts performance significantly. Make sure it’s enabled in your BIOS/UEFI:
VirtualBox is actively updated for performance and compatibility improvements. Install the latest version from the official website and match it with updated Extension Packs.
Also, ensure Guest Additions are compatible with your VirtualBox version.
Some background processes in Ubuntu can slow things down, especially on limited VM resources.
gnome-session-properties
Disable apps like Bluetooth Manager, Snap updates, etc.
Dynamic disks grow with usage and can cause performance penalties. Fixed size disks are faster but take more space.
Convert using VBoxManage:
VBoxManage clonehd source.vdi target.vdi --variant Fixed
Enabling host I/O cache can improve disk performance for some setups.
In newer versions of VirtualBox, VBoxSVGA is the recommended graphics controller for modern Linux distributions.
Ensure this is selected under Settings → Display → Graphics Controller.
Remove unused packages, clear caches, and free up resources:
sudo apt autoremove
sudo apt clean
Use lightweight apps like xfce4-taskmanager or htop to monitor and control resource usage.
Snap and Flatpak are convenient but heavy. Limit them on low-resource VMs:
sudo systemctl disable snapd.service
Switch to traditional deb packages when possible.
If full-screen mode introduces lag, try using windowed mode with scaled resolution (1024x768 or 1366x768) for better responsiveness.
Use the following tools inside your Ubuntu VM to identify what’s slowing it down:
top – shows CPU/memory usagehtop – advanced process vieweriotop – monitors disk I/ONested paging helps improve virtualization efficiency. Make sure it’s enabled in VirtualBox:
VBoxManage modifyvm "VM Name" --nestedpaging on
This improves compatibility and performance for Linux guests.
Go to Settings → System → Acceleration → Set "Paravirtualization Interface" to KVM.
Swappiness controls how aggressively Linux uses swap. Reduce it to avoid unnecessary slowdowns:
sudo sysctl vm.swappiness=10
echo 'vm.swappiness=10' | sudo tee -a /etc/sysctl.conf
Every time you update the Linux kernel in your VM, you may need to reinstall Guest Additions to restore performance and full functionality.
Running Ubuntu in VirtualBox doesn't have to be slow or frustrating. With the right combination of virtual machine settings, guest system optimization, and hardware support, you can enjoy a responsive and smooth Ubuntu desktop experience inside VirtualBox. Whether you're testing applications, studying Linux, or using Ubuntu for daily tasks, these performance tips will help you reduce lag, increase responsiveness, and make your VM feel more like a native install.
If your Ubuntu VM takes too long to boot, the issue might lie in unnecessary services or boot order.
sudo systemctl disable bluetooth.service
bootchart to analyze boot timegnome-session-properties
systemd-analyze blame
zRAM creates a compressed block in RAM to reduce the need for disk-based swap, speeding up low-RAM systems.
sudo apt install zram-config
Or manually create it using modprobe zram and configuration scripts.
Disabling fancy desktop effects can significantly improve GUI responsiveness.
gsettings set org.gnome.desktop.interface enable-animations false
You can also switch to a classic session or fallback mode.
When Ubuntu runs out of memory, it starts swapping to disk, which can make your VM very slow, especially on HDDs.
echo 10 | sudo tee /proc/sys/vm/swappiness
For permanent change:
sudo nano /etc/sysctl.conf
vm.swappiness=10
If you’re using VirtualBox VMs on SSDs, you can optimize performance using TRIM commands inside the VM.
sudo fstrim -v /
This helps reclaim unused disk space and improve write speeds.
In GNOME-based Ubuntu systems, background file indexing services can slow down performance.
gsettings set org.freedesktop.Tracker.Miner.Files enable-monitors false
tracker3 reset --hard
Command-line tuning gives you more control than the GUI settings panel.
VBoxManage modifyvm "UbuntuVM" --cpus 2
VBoxManage modifyvm "UbuntuVM" --memory 4096
VBoxManage modifyvm "UbuntuVM" --vram 128
This ensures exact settings, especially useful for scripting VM provisioning.
High display resolutions can impact performance. If you don’t need full HD or 4K, scale down the resolution inside Ubuntu Settings → Display.
Additionally, avoid fractional scaling like 125%, which can slow down UI rendering.
Each GNOME extension uses resources. If your Ubuntu VM is running GNOME, disable unneeded extensions via:
gnome-extensions list
Then disable with:
gnome-extensions disable extension-name
For instance, instead of:
Lighter alternatives reduce memory usage and improve responsiveness.
Use systemctl list-unit-files to identify unnecessary services and disable them:
sudo systemctl disable cups.service
(Disables printer service, if not needed)
In the VM settings under “System → Processor,” you can set CPU Execution Cap to around 80-90% if other applications are affected. But for best Ubuntu performance, leave it at 100% unless you're multitasking heavily on the host OS.
In the VirtualBox system settings, enabling IO APIC and PAE/NX can improve CPU compatibility and multitasking support in Ubuntu.
Guest Additions also allow features like:
These enhance usability and responsiveness within the VM interface.
When installing Ubuntu, choose the “Minimal Installation” option. It skips installing games, media players, and unnecessary software — resulting in a cleaner and faster VM experience.
Use tools like:
htop – visualize system resource usagekill – terminate unresponsive apps:
kill -9 <PID>
Advanced users can modify kernel behavior to boost performance.
echo "vm.vfs_cache_pressure=50" | sudo tee -a /etc/sysctl.conf
This improves inode/dentry caching performance, useful for systems with many files.
Sometimes, switching to an LTS (Long-Term Support) version like Ubuntu 22.04 can provide a more stable and better-optimized environment for VirtualBox than the latest release.
Choose the appropriate networking mode in VirtualBox for better file transfers and performance:
Before trying any major performance changes, create a snapshot of your VM. This allows easy rollback if anything goes wrong:
VirtualBox → Select VM → Snapshots → Take Snapshot
Tuning Ubuntu for VirtualBox isn’t just about toggling settings—it’s about understanding how virtual machines allocate hardware, how Ubuntu utilizes resources, and how both can be optimized together. With the combined steps from hardware configuration, desktop environment selection, and software adjustments, you can transform a laggy Ubuntu VM into a responsive and productive environment.
As with any optimization process, keep backups and test each change gradually. With these advanced adjustments, your VirtualBox-powered Ubuntu can run nearly as smoothly as a native install.