Ubuntu – VirtualBox Repository Configuration


VirtualBox is a great product and has routine updates. Setting up the repositories for automatic updates and installs seemed to be more challenging than most other software packages.


Originally, after following the simple directions on VirtualBox’s web site, I received this error:

"Error: W: Failed to fetch http://download.virtualbox.org/virtualbox/debian/dists/precise/Release Unable to find expected entry 'contrib/source/Sources' in Release file (Wrong sources.list entry or malformed file)".

I read that by following VirtualBox’s directions, two resposities were added, one for software and one for source code, but as the source code isn’t distributed from Oracle in the respository, it should be disabled.
After disabling the respository, I still wasn’t seen the latest update and had to further research the issue.


I found the most comprehensive solution on a Ubuntu community page, which gave one long command that performs all the correct steps to properly setup the VirtualBox repository:

sudo sh -c "echo 'deb http://download.virtualbox.org/virtualbox/debian '$(lsb_release -cs)' contrib non-free' > /etc/apt/sources.list.d/virtualbox.list" && wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add - && sudo apt-get update && sudo apt-get install virtualbox-4.3 dkms

The above commands add the VirtualBox repository download link for the distribution’s specific name (lsb_release -cs) to virtualbox.list, then downloads the public key to verify the authenticity of the VirtualBox downloads, adds the key to local storage, refreshes the package list and installs the latest version of VirtualBox plus DKMS for keeping the modules updated.


Remove sources from repository list
Comprehensive solution
VirtualBox Directions

Leave a Reply

Your email address will not be published. Required fields are marked *