All programming assignments must compile and run on a standard 32-bit Ubuntu 16.04 system ("standard" means following all the instructions on this web page). To minimize the chance of hardware incompatibility, the best way to run Ubuntu Linux is to first install a virtual machine hypervisor (Oracle VirtualBox is recommended because it's free and available on both Windows and Mac OS X machines), then install 32-bit Ubuntu 16.04 into a virtual machine inside the hypervisor. This web page contains instructions on how to first install a virtual machine hypervisor (Oracle VirtualBox in particular) into your desktop/laptop, and then install a standard 32-bit Ubuntu 16.04 system into a virtual machine running inside the virtual machine hypervisor.

Another major advantage of using this approach is that you can install as many virtual machines into VirtualBox. Therefore, you should install a standard 32-bit Ubuntu 16.04 into a virtual machine for the sole purpose of doing programming assignments for this class. Do NOT use this virtual machine for anything else and follow the instructions here as closely as possible!

Please note that it's a really bad idea to upgrade your host machine's operating system (i.e., Windows or Mac OS X) in the middle of the semester because you may not be able to access your virtual machine after the upgrade (it's also possible that VirtualBox may be incompatible with the new operating system)! You should only upgrade your host machine's operating system near the beginning of the semester (when there is not much at stake) or after the semester is over.

You need a machine that runs a real desktop operating system, such as Windows 10/11 or Mac OS X. If you can only get your hands on a machine that runs Android/iOS/ChromeOS or Windows 8 or something even older, please talk to the instructor before proceeding. (If you are considering buying a machine for school, it's best that you buy a Intel/AMD-based machine that runs Windows 10/11 or Mac OS X.)

If you have a Windows machine or an Intel-based Mac OS X machine, the minimum hardware requirement for running a virtual machine hypervisor is that you should have an Intel Core i3 or faster processor with 4GB or more memory. If your laptop/desktop has a slower CPU, non-Intel compatible CPU, or less than 4GB memory, please talk to the instructor before proceeding.

We can ONLY grade your programming assignments on a standard 32-bit Ubuntu 16.04 machine running QEMU 2.5. (Furthermore, the kernel assignments are ONLY known to work properly on 32-bit Ubuntu 16.04.)  Therefore, you MUST implement and test your programming assignments on this platform. If you don't want to install Ubuntu 16.04 on your machine because you already have another version of Ubuntu installed, please talk to the instructor before proceeding. If you choose to implement and test your programming assignments on something other than a standard 32-bit Ubuntu 16.04, you may end up getting zeroes in your programming assignments since the graders are not allowed to grade your assignments on other platforms or on your machine!

Ubuntu 16.04 is not the current release of Ubuntu. If you just go to the Ubuntu web site, you will be downloading the WRONG version of Ubuntu. Also, it's best not to install Ubuntu 16.04 from scratch. It's better to install from a virtual appliance.

If you are running Windows 10/11 and your machine supports "virtualization" in BIOS, although it's not required, it's a good idea to have it enabled so things can run faster. If you don't know how to do that or check if you machine supports virtualization, just google "Enable virtualization in BIOS in Windows 10/11".

Please do NOT use Ubuntu 17.04 or above to do our programming assignments. The graders are not permitted to grade your programming assignments on those systems. I also know for sure that our kernel assignments are NOT compatible with Ubuntu 17.04 or above. You should definitely NOT use Ubuntu 17.04 or above to do our kernel assignments.

The New Mac

Apple threw us a curve at the end of 2020 by switching to a non-Intel/AMD CPU for their new Macs. These systems are so new, it's not clear if VirtualBox would work on such a system. Even if VirtualBox works on such a system, it's not clear if you can run a 32-bit Ubuntu 16.04 system inside of it. If you have such a system, it would be great if you can follow the installation procedure mentioned below and let me know if it works on such a system or not.

If it ends up that there is no way to run a 32-bit Ubuntu 16.04 system on it and the only machine you can use to work on our assignments is such an machine, then we have to have an alternative for you. Here are the three options.

  1. Borrow an Intel/AMD-based laptop from your family or friend, if they have a spare one!

  2. Run your 32-bit Ubuntu 16.04 in AWS Free Tier (free for one year).

  3. USC has an equipment rental program where you can rent a laptop (most likely, running Windows 10/11) for free for an entire semester (subject to availability). But of course, they may change their policy. Now it looks like the above link is invalid. Maybe they have been removed this free service, although it's not clear if this is temporary or permanent.

    Viterbi has a laptop loaner program. But the purpose of those loaner laptops are mainly for students who have to do "field work" and require "environmentally hardened laptops".

  4. Another option is to run a standard 32-bit Ubuntu 16.04 system on Viterbi's MyDesktop (VMware Horizon) environment To work on this system, you need to have a decent Internet connection since you can only access this system when you have a live Internet connection (in that respect, it's kind of like using Zoom). By default, students do not have accounts on MyDesktop. Request to create accounts on MyDesktop must go through me (and this can only be done after the semester has started). This type of account takes time to set up. If the IT people are busy, it can take several days to get such an account up and running. Therefore, if your system does not meet the above requirements and it's the only systemm you have access to, please let me know (and tell me what system you do have) so I can make a request on your behalf.

    Please note that this is the last resort because copying files into and out of this particular MyDesktop environment is not very convenient (for example, such a system doesn't have an Internet connection, so file transfers must be done using some desktop apps). You should go with this approach only if the first three options are absolutely not available to you.

The only virtual machine hypervisor platform that I would recommend is the Oracle VirtualBox. Oracle VirtualBox is free and runs well on both Windows 10/11 and Mac OS X. (I was told that it also runs on a Linux machine, although I have never tried it myself.)

There may be other ways to install a 32-bit Ubuntu 16.04 system so you can do your programming assignments. In the interest of time, we will only present one solution for everyone. If you are thinking about doing it in a different way, please talk to the instructor before proceeding to see if it's going to acceptable. The goal is for students to do the programming assignments. I really don't want students to waste time on system issues because that's not what this class is about.

Below are my instructions on how to install VirtualBox and then how to install Ubuntu 16.04 inside VirtualBox. Please understand that I cannot keep track of all the latest changes in VirtualBox and Ubuntu 16.04. Therefore, please do not be surprised if things don't look exactly the same as the figures or text on this web page. If you have questions, please feel free to send e-mail to the instructor.

During installation, if something is not working, please check the bottom of this web page and see there is already a known solution to your problem on your system.

Installing VirtualBox should be pretty straight-forward. Just visit the VirtualBox 6.1 Download page and download and install the latest stable 6.1 release (please do not waste your time on experimental releases). It's my understanding that VirtualBox 6.1.46 is pretty good and it's known to work on Windows 10/11 and Mac OS X. In the rare case the latest stable 6.1 release doesn't work for you, please go to the older builds of VirtualBox web page and download and install VirtualBox 6.1.22 (which is also known to work on Windows 10/11 and Mac OS X).

Click and download VirtualBox for the type of machine/host you have and follow the on-screen instructions to install VirtualBox onto your machine. (The terminology is that if you are running Windows 10/11, you have a Windows Host; if you are running on Mac OS X, you have a Mac Host.) Below are the typical steps you will see. It may be the case that you are not seeing the same screens since our machines may not be configured the same way. You should typically stick with the defaults, unless you are very familiar with VirtualBox know what you are doing.

  1. Welcome screen: just click on the Next button.
  2. Custom Setup screen (select features): just click on the Next button.
  3. Custom Setup screen (choose options): just click on the Next button.
  4. Warning about Network Interfaces screen: just click on the Yes button.
  5. Ready to Install screen: just click on the Install button.
  6. If you get a screen asking you about permissions, please give permission to install VirtualBox.
  7. Installation Complete screen: just click on the Finish button.
The next thing to do is to install 32-bit Ubuntu 16.04 into VirtualBox.

You have two choices. You can either installed a pre-canned 32-bit Ubuntu 16.04 system by following the instructions below. Or, you can install a 32-bit Ubuntu 16.04 system from scratch. The first method saves a lot of time, and therefore, is preferred for this class. With VirtualBox is that you can install as many virtual machines as you'd like. You can use the second method to gain experience in installing virtual machines from scratch when you have extra time. It would look good on your resume! For now, you should use the first method.

The easiest way is to install a pre-canned 32-bit Ubuntu 16.04 system from a virtual appliance called "md32xu16047eolvm-vbox6118-f1". There are two places from which you can download this virtual appliance: Save the downloaded file as "md32xu16047eolvm-vbox6118-f1.ova". This file is about 3.5GB in size and it can take a while to download. If you have a poor Internet connection, it may take over an hour to download this file! Once you have downloaded this file, you should not delete it because you may need it again if one day your system refuses to boot (trust me, this can happen).

When you are done with installing VirtualBox, your machine would launch VirtualBox automatically and you will get a screen that looks like the following:

If you click con About VirtualBox under the Help Menu, you will see the version of the VirtualBox you are running. The screenshots here are from VirtualBox-6.1.6. If you are using a newer version of VirtualBox, your screens may look different and some of the default values may be different.

Step 1: Import Virtual Appliance

Click on the Import button and your screen will look like the following:
Click on the yellow folder icon on the right to select a virtual appliance. Select the "md32xu16047eolvm-vbox6118-f1.ova" file you have just downloaded and your screen will look like the following (please note that the photo is a bit old and the strings on the screen will not match what you see and that's okay)):
On the screen shown above, it's important that you check the "Import hard drives as DVI" checkbox.

Click on the Import button at the bottom and it will start importing the virtual appliance. It can take a few minutes to finish importing. When you are done, your screen should look like the following (if the right side looks different, it's perfectly fine):

The most important two buttons on the right are the Settings button and the Start button. The most important setting is the setting for the Display. For now, just click on the Settings button and you will get a popup window. In the popup window, click on Display on the left and you will see a screen that looks like the following for the Display setting:
Don't click on anything! I just want you to see the checkbox that's labeled, "Enable 3D Acceleration". This is a very important checkbox! In the above screenshot, it's showing that this checkbox is currently checked. If things go wrong, you might want to come back here and uncheck this checkbox and try again! For now, keep it checked because it will make your virtual machine run faster.

If your host machine is running Mac OS X, another important setting in the above screen is the amount of video memory your virtual machine gets. In the above screenshot, it's showing that your virtual machine will be given 16 MB of video memory. If things go wrong, you might want to come back here and set the video memory to 128 MB and try again.

Another important setting is the setting for the "base memory". Click on System on the left and you will see a screen that looks like the following for the System setting:

Check the Enable I/O APIC checkbox and don't click on anything for now! (Please note that if it turns out that your hardware is incompatible with Enable I/O APIC, you should uncheck that checkbox.) You should see that "Base Memory" is set at 1024MB (i.e., 1GB) by default. You should run as few things inside your virtual machine as possible because things are slower when you run them inside a virtual machine. For example, if you want to use a web browser, it's best that you run your web browser on your host machine and not inside the virtual machine (unless there is a good reason for it). If you must run many applications inside your virtual machine, you can give your virtual machine more memory by changing the Base Memory setting here. Please understand that the more memory you give to your virtual machine, the less memory your host machine will be left with! So, you need to first figure out how much memory your host machine has. I think it's a good rule that Base Memory should never exceed 1/3 of the total amount of memory of your host machine. For now, keep the Base Memory at 1024MB.

Now click on the OK button to save your setting and go back to the start screen and proceed to start your virtual machine.

Step 2: Start Your Virtual Machine

Now your 32-bit Ubuntu 16.04 system is ready to go! The name of your system is "md32xu16047eolvm-vbox6118-f1". All you need to do is to click on the Start button to boot up your 32-bit Ubuntu 16.04 system. So, go ahead an click on the Start button (looks like a green arrow in the above screenshot). It can take several minutes for your system to boot. Be patient.

If all goes well, you will see the following screen (this is the XUbuntu Desktop):

The above screenshot is from a Windows machine. If you have a Mac, then the screen will of course look different (for example, the menubar will be on the very top of your screen, just like for all Mac applications). On some systems, you will get a popup window saying something about an "Indicator Plugin", just click the Remove button.

If you don't see the above screen but get a black screen instead, then you need to trouble-shoot to figure out what's wrong. If you get a black screen, you should first turn off the virtual machine. Since you were not able to start Ubuntu 16.04 successfully, you must do a forced shutdown of your virtual machine. If you are on Windows, you should click on the Close Box as shown in the screenshot above. You will get a popup window asking if you want to "save the machine state", "send the shutdown signal", or "power off the machine". At this time you must select "power off the machine" and click on the OK button. Wait for the virtual machine to completely shutdown (i.e., when the virtual machine window disappears) before proceeding to trouble-shoot. This can take some time, so please be patient. After the virtual machine has completely shutdown, the first thing you should try is to uncheck the Enable 3D Acceleration checkbox and restart and hope that you will get a better result! If you don't, you should contact the instructor.

If all goes well and you got the XUbuntu Desktop, please click on the Terminal program and your screen should look like the following:

You are logged in automatically by default. Your user ID is "student" and this is an administrator account. Your password is also "student". Please note that this is also your administrator password! Any time you are prompted for the "admin password", you should enter this password.

Your default commandline shell is "bash". If you want to switch to use "tcsh", you can just type:

    tcsh
and you should see that your commandline shell prompt will look different.

Once in a while, you will get a popup window asking you to update your system, please just cancel the popup window! If you really want to update your system, all you have to do is to type the following in your commandline shell:

    upgrade
You will be prompted for the admin password. You should enter your admin password and proceed with updating your system. (Please note that this command is called "upgrade", but it doesn't really "upgrade" your system. It updates your system.)

One more thing to try before proceeding... Maximize the window of your virtual machine and see if the size of the Ubuntu desktop would fill the virtual machine window. If the Ubuntu desktop size doesn't change, you should first install Guest Additions before proceeding. If the Ubuntu desktop resizes automatically, it means that you have Guest Additions already installed (which only needs to be done once).

Step 3: Set Up Shared Folder

It's very useful to be able to exchange files between your virtual machine and your host machine. The way to do it is to use a shared folder. To setup a shared folder, you need to first shutdown your virtual machine. The proper way to shutdown your virtual machine is to click on Main Menu in the XUbuntu Desktop. You will get the following screen (which is the main Xbuntu Menu):
From this screen, you can find a lot of programs to run. For now, just click on the Power off button in the lower right corner and you should get the following screen:
Click on the Shut Down button to shutdown your virtual machine and go back to the VirtualBox start screen. If for some reason this doesn't work, you can also do the following. Start a Terminal and simply type the following:
    halt
Click on the Settings button and then follow the instructions to set up a shared folder. To match what's already set up in your pre-canned virtual machine, please make sure to enter "/Shared-ubuntu" as your "Mount point" when you set up your shared folder and make appropriate adjustments. After this is all set up, when you run your Terminal program, you can access the shared folder using the "Shared-ubuntu" folder in your home directory. By the way, shared folder can only work if you have installed Guest Additions.

If you get an error when accessing your shared folder, please try this fix and see if it works.

Once your Ubuntu 16.04 system is running smoothly, you should never need to shutdown your virtual machine again! Whenever you need to shutdown your virtual machine, you should just suspend it. On Windows, you can simply click on the Close Box and select "save the machine state" to suspend your virtual machine. If you do it this way, next time when you need to start your virtual machine, just click on the green Start button in VirtualBox and your virtual machine state will be restored and this is much faster than cold-booting your virtual machine.

Step 4: Backup Files You Have Created

Since it can take a while for your virtual machine to start, I would recommend that you do not shut down your virtual machine! If you simply close the lid of your laptop, everything will go to sleep, including your virtual machine. Although if you let your laptop battery run out, your virtual machine would crash when your laptop dies. Most of the time, no harm is done when this happens. Although I have heard from students that when you are unlucky, you may not be able to get back into your virtual machine! When this happens, as far as I know, there is no way to recover the data inside your virtual machine! Therefore, it's imperative that you backup files you have created by copying them out of your virtual machine and into the shared folder and use your host machine's backup software to backup your shared folder. It's also a good idea to not overwrite files you have previously backed up (or use a version-control system) in case you need to get back to some older versions of your files.

To make backup easy, you should put all your files in one place. For example, you can do all your work somewhere under the Documents folder in your home directory. Then you can do the following to create a backup file and copy it into your shared folder using the following commands:

    cd $HOME
    tar cvzf Shared-ubuntu/Documents-backup-`date +%d%b%Y-%H%M%S`.tar.gz Documents
The above command assumes that you have already setup a shared folder in the Shared-ubuntu folder in your home directory. Please do not type the above command by hand! Just copy the above two lines and paste into your Terminal. (If you get a "cannot open" error when you tried the last command, please try this fix and see if it would help.)

Another way (probably a more cumbersome way) is to use your Google Drive to backup your files from within the virtual machine. In this case, you will need to start your browser and login to your Google Drive and then upload your files. No matter which way you choose, it's extremely important that you have a backup strategy and have a good habit of backing up files you have created at least once a day.

Step 5: Run Your VirtualBox Headless

This is totally unnecessary. But if you really want to run your VirtualBox "headless", i.e., without a desktop user interface, please read on (and I will assume that you are an Linux expert). Otherwise, you are done and you don't need this step.

Shutdown Ubuntu 16.04 and do the following (this is a quick summary of this website):

  • Click on Settings, then Network.
  • Under Adapter 1, click on Advanced, then Port Forwwarding.
  • Click on the "+" icon to add an entry and enter SSH under Name, TCP under Protocol, 127.0.0.1 under Host IP, 5679 under Host Port, leave Guest IP empty, and 22 under Guest Port, then click on OK to finish creating this entry.
  • (Only do this if you are planning on getting a desktop user interface over VNC. Click on the "+" icon to add another entry and enter VNC under Name, TCP under Protocol, 127.0.0.1 under Host IP, 5901 under Host Port, leave Guest IP empty, and 5901 under Guest Port, then click on OK to finish creating this entry.)
  • Click on Adapter 2, click on Enable Network Adapter, select Host-only Adapter for "Attached to", and select vboxnet0 or VirtualBox Host-Only Ethernet Adapter for "Name", then click on OK to finish setting up Adapter 2. (If nothing is available select under "Name", please take a look at this web page and go to 'File', then Host Manager, then press Create to create a host network with the specified IP address above.) On Windows 10/11, you may also want to check out this web page in case things are not working.
  • Click on System and check the Network checkbox in Boot Order and check the Enable I/O APIC in Extended Features.
  • Click on OK to finish Settings then start your Ubuntu 16.04 system.
In Ubuntu 16.04, start a Terminal and run the following command to install the OpenSSH Server:
    sudo apt-get install openssh-server
After you the OpenSSH Server is installed, run the following command:
    ifconfig
and you will see a printout that looks like the following, showing all the "interfaces" of your Ubuntu 16.04 system:
    enp0s8    Link encap:Ethernet  HWaddr 08:00:27:85:b3:3c  
              inet addr:192.168.56.102  Bcast:192.168.56.255  Mask:255.255.255.0
              inet6 addr: fe80::751b:b7d0:e668:1eca/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:1 errors:0 dropped:0 overruns:0 frame:0
              TX packets:40 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:590 (590.0 B)  TX bytes:5560 (5.5 KB)
    
    lo        Link encap:Local Loopback  
              inet addr:127.0.0.1  Mask:255.0.0.0
              inet6 addr: ::1/128 Scope:Host
              UP LOOPBACK RUNNING  MTU:65536  Metric:1
              RX packets:28 errors:0 dropped:0 overruns:0 frame:0
              TX packets:28 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:1893 (1.8 KB)  TX bytes:1893 (1.8 KB)
The important part is highlighted in red. The above is showing that my Ubuntu 16.04 system has two interfaces. The "lo" interface is to be used internally (i.e., from withint Ubuntu 16.04) and the other interfaces may be suitable for you to ssh into. In my case, my only choice is the enp0s8 interface which has an "inet addr" (i.e., IP addres) of 192.168.56.102. Therefore, if I want to ssh into this machine, from outside of this virtual machine, you would do:
    ssh -X -Y student@192.168.56.102
If the above command does not work, please try:
    ssh -X -Y student@127.0.0.1 -p 5679
Once you have verified that this works, you can shutdown your Ubuntu 16.04 system. Next time you start Ubuntu 16.04, instead of just click on the green Start button, click on the drop-down menu on the right side of the green Start button and select "Headless start". You can watch the Preview window to estimate if your Ubuntu 16.04 system is up and running or not. Then try the above ssh command. Please remember that you don't have a desktop user interface any more!

Finally, where can you ssh from? You need a commandline app. On Mac OS X, you can run a "terminal" program. On Windows 10/11, you can run a PowerShell, or you can download putty (just google "putty download"). Please note that if you want to run a program on Ubuntu 16.04 that has a graphical user interface, then you need to run an X11 server on your host machine. If your system is an Mac OS X system, you can install XQuartz and if your system is running Window 10, you can install X-Win32 from ITS software website. Please note that if you get X-Win32 from ITS, you need USC VPN in order to run X-Win32. If you don't want to run USC VPN, another choice for Windows 10/11 is Cygwin (although it's kind of an overkill since it's a full-blown Linux-like system).

If you would prefer to do all the coding on your host machine, you can use FileZilla to transfer files between your host machine and a VM. This way, you can edit your files with your favorite editor on your laptop and use FileZilla to quickly copy your files into the VM using drag-and-drop. After you get FileZilla installed, just run it. Click on the File Menu then click on Site Manager. Click on the New Site button. In the popup window, enter the host name (also known as DNS name) of the VM into the Host box and keep the Port box empty. Select SFTP as the Protocol and select Normal as the Logon Type. Enter "student" as User and enter the password for the "student" account in the VM into the Password box. Click on OK to save all the information about this new site. Then click on the File Menu then click on Site Manager again. This time, click on the Connect button. Once you are connected, you can drag files from your laptop into your VM. If you get a popup window asking you to trust the host you are connecting to and add a key to the cache, you should read what's in the window. If everything looks right, check the checkbox and click OK so that you won't get this popup window every time you connect.

Some students have reported that they had trouble installing Ubuntu 16.04 into VirtualBox. It does not mean that these systems won't work. I'm just keeping track of what people have seen here. It usually mean that the standard procedure may not work and you should try the suggestions in the "Solutions" column below to see what you need to do. If you have the same system and are experiencing the same problem, please send me an e-mail so I know the problem is wide spread. If you are having trouble getting Ubuntu 16.04 to work on a system that's not listed, please send me an e-mail so I can add it to the list.
System Description Solutions
Ubuntu Get a "Could not get lock ..." message when trying to install software. You cannot install more than one thing at a time. You should wait until one installation is done before you install something else.

If you know that you are not installing anything else, then you should proceed to remove the lock file mentioned in the message. For example, if you message says

Could not get lock /var/lib/dpkg/lock-frontend ...
then you should do:
sudo rm -f /var/lib/dpkg/lock-frontend
sudo dpkg --configure -a
sudo apt-get install -f
Ubuntu Got a "/dev/sda contains a file system with error" message when starting the virtual machine If you were able to run your VM without problem before, but all of a suddent got this error message, it means that your file system was somehow corrupted. Please try out the solution mentioned on this web page.

Things like this can happen to anyone! This is why you need to backup all your work inside the VM at least once a day and copy the data out of the VM.

Ubuntu Got cannot access/open error message when trying to access shared folder. If you have followed the install from virtual appliance instruction and when you type:
ls /Shared-ubuntu
you get:
ls: cannot access '/Shared-ubuntu': No such file or directory
Then type the following command to see where the shared folder is:
df | grep Shared-ubuntu
If the printout looks like (you may see different numbers, but they are not important; what's important is the last string in the printout):
Shared-ubuntu   12287996 8585840   3702156  70% /media/sf_Shared-ubuntu
The above is saying that your shared folder is not at "/Shared-ubuntu" but at "/media/sf_Shared-ubuntu" instead. In this case, please do:
cd $HOME
rm Shared-ubuntu
ln -s /media/sf_Shared-ubuntu Shared-ubuntu
Now you should be able to access the shared folder in the "Shared-ubuntu" folder in your home directory since it now points to "/media/sf_Shared-ubuntu".
Mac OS X Fail to start virtual machine with VERR_VM_DRIVER_NOT_INSTALLED error (-1908) Maybe VirtualBox was not installed properly due to permission issues (newer Macs have much stricter permissions). Please give this a try: https://medium.com/@Aenon/mac-virtualbox-kernel-driver-error-df39e7e10cd8.

You can also try the following steps:

  1. Uninstall VirtualBox manually.
  2. Install VirtualBox using Homebrew.
  3. Uninstall VirtualBox using Homebrew (This will clean the system of any files of VirtualBox)
  4. Install using Homebrew again. You will get the option to give permission again. Don't forget to allow and restart this time.
Please also see: https://www.howtogeek.com/658047/how-to-fix-virtualboxs-%E2%80%9Ckernel-driver-not-installed-rc-1908-error/.
Mac OS X Big Sur VirtualBox will not run on Big Sur (Mac OS 11) VirtualBox 6.1.6 definitely will not work with Big Sur! You need to get the latest VirtualBox (at least VirtualBox 6.1.18) and give permissions to run it on Big Sur. Please see this web page and this other web page.
  • Uninstall VirtualBox using VirtualBox_uninstall.tool
  • Download the newest VirtualBox and install it
  • At the end of the install, go to System Preferences, Security and Privacy, and the click the allow button to authorize application from Oracle America (you may need to "unlock" the UI with admin password first)
  • Restart the machine when prompted
  • Start VirtualBox and VM
  • Take heed of the change needed in system preferences for key strokes
By the way, this assumes that you have an Intel/AMD Mac. If you have an M1 Mac, I don't think there is a way to run VirtualBox on it. If that's the case, please see your options.

In the end, if there is no way to run Ubuntu 16.04 inside VirtualBox on Big Sur (on a Intel/AMD Mac), you can replace VirtualBox with VMware Fusion and I was told that this can work. On this web page, it says that home users can get VMware Fusion Player free for non-commercial use and you need to register. (I would recommend that you use the Chrome browser for this because the cookies settings on this website seems to be very picky.) If you click on the Register Now link, it should take you to the this registration page (you need to make sure that you authorize their cookies or you will get a blank page). The installation procedure of VMware Fusion is kind of convoluted and you might have to search for some videos to figure out how to get it installed properly. The teaching staff will try their best to help you. But in the end, it's your Mac and you need to figure out a way to get this software installed by searching for helpful information on the Internet.

Mac OS X Ventura Failed to open a session (with result code NS_ERROR_FAILURE) Please uninstall your VirtualBox 6 completely and then install VirtualBox 7.0.4 (or newer).
Mac OS X Failed to import appliance (with result code NS_ERROR_INVALID_ARG) It's possible that the created virtual disk somehow got corrupted. You can try the following. Go to the File Menu of VirtualBox and select Virtual Media Manager. Select md32xu16047eolvm-vbox6118-f1-disk001.vdi and click on the Remove button. If the Remove button is grayed out, you need to find the directory that contains md32xu16047eolvm-vbox6118-f1-disk001.vdi and delete that directory. You should be able to find the location of the directory by selecting Preferences from the File Menu. I think this is the same as removing the md32xu16047eolvm-vbox6118-f1 virtual machine. Then you should re-import the virtual appliance again.

Also, please check and make sure that you are not running out of disk space. Ubuntu 16.04 takes up 10GB of disk space.

Also, when you are importing the virtual appliance, make sure you check the "Import hard drives as DVI" checkbox.

If there is really no way to get beyond this problem, since this seems to be a VirtualBox problem, you may want to give VMware Fusion a try.

Mac OS X Screen goes blank soon after clicking Start in VirtualBox Maybe you didn't give enough video memory to the virtual machine. Slide the video memory slider all the way to the right and see if that would help.
Mac OS X Sublime Text is slow/sluggish Make sure you have Enable 3D Acceleration checkbox checked and set video memory to 128MB, adjust Scale Factor to 100% (in VirtualBox's Display setting), then increase font size of Sublime Text application and icon size to readable size. Do not go into fullscreen mode for your virtual machine and adjust VM window size smaller (typically, the smaller the window size, the smoother the graphics is).

If you want things to look bigger, you can click on the View Menu of the virtual machine window that Ubuntu is running in and look at the very bottom of that menu and select the "virtual screen" that corresponds to your virtual machine and select a suitable scaling percentage there.

Mac OS X Switching or moving windows is slow inside VirtualBox If you are running the Unity desktop, you should install and switch to the Xfce/Xubuntu desktop. On the Mac, it's always a good idea to slide the video memory slider all the way to the right and see if that would help.
Mac OS X Everything seems to install fine but get a message saying that installation failed. By default, Mac will not allow you to install apps downloaded from the Internet. It only allows apps from AppStore. So, try going to System preferences->Security and Privacy->General to provide permissions to VirtualBox. Please see this tech note from Apple.
Mac OS X Everything in VirtualBox looks very small You probably have a retina display. If you want things to look bigger, you can click on the View Menu of the virtual machine window that Ubuntu is running in and look at the very bottom of that menu and select the "virtual screen" that corresponds to your virtual machine and select a suitable scaling percentage there. Please do NOT use the "Scale Factor" in the Display setting screen in VirtualBox.
Mac OS X CPU usage goes to 100% when VirtualBox is running and the system become very slow and unusable You probably have audio enabled. Shutdown Ubuntu and go to the VirtualBox setup screen, click on Audio on the left and make sure the "Enable Audio" checkbox is unchecked.

If audio already is disabled and if you are running the Unity desktop, you should install and switch to the Xfce/Xubuntu desktop.

Mac OS X Ubuntu desktop goes blank when Ubuntu is running or when I maximize the virtual machine window If you are in full-screen mode, press <Cmd+F> to get out of full-screen mode and then shutdown Ubuntu. Then do the above.

The instructions above are suppose to work with VirtualBox 6.x! If it's not working, you can try uninstall everything and reinstall from scratch and follow the instructions as slowly as possible. If it still doesn't work, please contact the instructor. In the end, if nothing would fix these Mac OS X issues, the last resort is to uninstall VirtualBox 6.x (and delete Ubuntu before you uninstall VirtualBox). Then download and install VirtualBox 5.2 and then install Ubuntu into this older and hopefully more stable version of VirtualBox. The screens you see will be slightly different from above. So, you have to make some guesses as to how to proceed.

Another thing you can try is to change the scaling factor (please also checkout this video).

Mac OS X Cannot see "/Shared-ubuntu" in Step 7 above and copy and paste from host to Ubuntu doesn't work May be when you installed Guest Additions, there was an error. Go back to the Step 7 screen above. The last line looks something like (you may see different numbers and names):
/dev/sr0    84534   84534       0 100% /media/SOMETHING/VBox_GAs_6.1.6
Type the following in the Terminal window to reinstall the Guest Additions (replace "SOMETHING/VBox_GAs_6.1.6" with something appropriate for your system):
cd /media/SOMETHING/VBox_GAs_6.1.6
sudo ./VBoxLinuxAdditions.run
If you are prompted for your admin password, just type it and press <ENTER> to proceed. If you are prompted with yes/no questions, read the questions carefully and respond appropriately (you should probably say "yes" most of the time).

When this is done, reboot your system and see if copy and paste works now and see if you can see the "/Shared-ubuntu" when you type "df" into a Terminal.

Windows 10/11 When I start the virtual appliance, I see a "Spectre V2" message saying "LFENCE not serializing" followed by some error messages and then it freezes. My machine has an Nvidia graphics card and some blogs I've read on the Internet says that there may be a conflict between Nvidia graphics card and VirtualBox. First, give this a way. Go to the Systems Settings screen and check the Enable I/O APIC, save the settings and restart to see if it would work.

If the above doesn't work, then your only optionn is to give VMware Workstation Player a try. After you've got it installed, when you run it for the first time, select the free license. I seem to remember that if you try to import the virtual appliance, you will get an error message saying that the file format was bad. But if you click on Retry, it will go ahead and install it anyway and that's what you should do.

By the way, I usually don't recommend VMware Workstation Player (unless you have no choice) since it only runs on Windows. On the Mac, there is no VMware Workstation Player, but you can install something called VMware Fusion.

When you run Ubuntu 16.04 for the first time, you will get a popup window asking you to install VMware Tools. Make sure you click on Download/Install. If later on you cannot change the size of the Ubuntu desktop, it means that VMware Tools installation actually didn't work. A common problem is because VMware Workstation Player does not create the CD/DVD device by default. You need to shut down Ubuntu and go to Settings of the VM and add a CD/DVD device then I was able to install VMware Tools (or maybe you should check this before you launch Ubuntu 16.04). VMware Tools are kind of important because if you don't install it, all you get is a small window to work with and you cannot do copy and paste between Windows and Ubuuntu.

To setup shared folder, click on settings, then Options tab, then shared folders, enable it, then add. After starting Ubuntu, do:

rm Shared-ubuntu
ln -s /mnt/hgfs/Shared-ubuntu Shared-ubuntu
Someone has suggested that you may also want to try checking the "Enable I/O APIC" checkbox on this screen and click on the Processor tab and increase the number of CPUs to 2 and see if that would help.

According to this post, you can try the following and see if this works:

  • press <Ctrl><Alt><F2>
  • login as "student"
  • type the following:
    sudo apt-get update
  • type the following:
    sudo apt-get install xserver-xorg-video-intel
  • finally, reboot the system by typing:
    reboot
Windows 10/11 Ubuntu desktop goes blank when Ubuntu is running or when I maximize the virtual machine window If you change the VirtualBox's settings of graphics controller to VBoxVGA and disabling 3D acceleration and that fix this behavior, it probably means that there is some hardware compatibility issue with VirtualBox. Since running your virtual machine with 3D acceleration disabled can lead to very poor performance, you should try switching to VMware Workstation Player and see if that works better.
Windows 10/11 Ubuntu desktop won't resize when I maximize the virtual machine window (I have installed guest additions since copy and paste works) Make sure you have set video memory to 128MB. You can also try changing the Scale Factor to 100% (in VirtualBox's Display setting) and see if anything changes.
Windows 10/11 Whenever I start the Ubuntu VM, it prints a few lines of text on top of a black screen (and last line being "/dev/sda0: clean, ...") and then it freezes. Shut the VM down and try this and see if it helps. Click on the Settings button and click on System to get to this screen. Check the "Enable I/O APIC" checkbox and select the Processor tab and increase the number of CPUs to 4. Then start the VM and see if it works. After it's working, change the number of CPUs to 1 or 2 next time you reboot your VM.
Windows 10/11 When I start the Ubuntu VM, it prints out a bunch of stuff and looks like it's working, but eventually got a kernel panic. Shut the VM down and try this and see if it helps. Click on the Settings button and click on System to get to this screen. Check the "Enable I/O APIC" checkbox and select the Processor tab and increase the number of CPUs to 2. Then start the VM and see if it works.
Windows 10/11 Cannot launch VS Code, Sublime Text, or Firefox inside Ubuntu. Start a Terminal and type:
glxinfo
If this program crashes, it may be the case that your Windows 10/11 graphics driver is incompatible with VirtualBox. In this case, the only solution I know of is to give up on VirtualBox and try the same fix as the above case.
Windows 10/11 Got a blank/black screen with a blinking cursor when running Ubuntu (or get a message saying that raw-mode in unavailable because of Hyper-V).
1)   Check to see if you are running Hyper-V (virtualization technology from Microsoft). VirtualBox is not compatible with Hyper-V. So, you should disable Hyper-V. (If you don't want to disable Hyper-V but install Ubuntu 16.04 into Hyper-V instead, you will be doing this at your own risk. Please understand that the grader must grade your programming assignments using Ubuntu 16.04 running in VirtualBox!)

Start Control Panel and search for "Turn Windows features on or off". If the Hyper-V checkbox is checked, then you are running Hyper-V. If you uncheck it, you would turn off Hyper-V and you should reboot the system and verify that Hyper-V has been turned off.

 
2)   If it turns out that you do not have Hyper-V enabled, you should try the following.

First, uncheck 3D acceleration.

Even though you are suppose to have 3D acceleration checked, but if there is a problem with the graphics device driver, you should disable 3D acceleration first, then after you are able to see things, go ahead and install Guest Additions so you get the right graphics device driver. Then you check 3D acceleration and see if it now works.

 
3)   Make sure you have virtualization enable in your BIOS (in UEFI settings). The steps for Windows 10/11 Home can be found here.
Windows 10/11 At first reboot after Guest Additions is installed, get a blank/black screen If your Graphics Controller is "VMSVGA", you can go to the Display settings and change it to "VBoxSVGA" or "VBoxVGA" and see if it would make any difference.
Windows 10/11 Cannot see the button I need to click during installation During installation of the keyboard, the window you see may be too narrow that you cannot see the "Continue" button. When you can do is to press the <TAB> key on your keyboard and you should see that different part of the window got highlighted. Keep tabbing until you see the "Detect Keyboard Layout" button become highlighted. If you tab two more times, the "Continue" button will become highlighted (even though you may not see it because it's off to the right of the window). Just press the <ENTER> key and it would be the same as clicking the "Continue" button.

The screen after this screen has the same problem and you should do the same thing. After you have entered your information, keep pressing the <TAB> key until you see the "Back" button is highlighted (you won't see "Back", but you should check the image above to know where the "Back" button is. Once you are there, if you press the <TAB> key one more time and press the <ENTER> key, it would have the same effect as click the "Continue" button.

Windows 10/11 Wifi stopped working in Windows If you have something called Lavasoft Web Companion, it may have interfered with VirtualBox networking. Uninstalling Lavasoft Web Companion would fix the problem. Please see https://superuser.com/questions/1192452/networking-on-virtualbox-suddenly-stopped-working.

By the way, please do not choose to use wifi inside your virtual machine. Just keep the default networking settings.

Windows 10/11 Get "cannot switch monitor configuration" message If you get this popup message box after you installed Guest Additions and you have a high resolution graphics display, it may be that the default video memory was not enough. Try shutdown Ubuntu and increasing Video Memory to something like 128 MB and see if that helps.
Windows 10/11 VirtualBox fails to start with VERR_NEM_VM_CREATE_FAILED error message Please see this web page for instructions to turn off Hyper-V and Windows Sandbox. Another solution, as proposed by a student, is to launch the "Run" app and enter the following command: "bcdedit /set hypervisorlaunchtype off".
Windows 10/11 No Internet (browser cannot connect to any website) Please see this web page. Try chaning network adapter setting from NAT to Bridged Adapter and see if that would fix the problem.