All programming assignments must compile and run on 32-bit Ubuntu 16.04.
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 32-bit Ubuntu 16.04 into a virtual machine running inside the virtual machine hypervisor.
You need a machine that runs a real desktop operating system, such as Windows 10 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 machine that runs Windows 10 or Mac OS X.)
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 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 or talk to the instructor before proceeding. If you choose to implement and test your programming assignments on something other than a 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! 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. To download Ubuntu 16.04, you need to go to the Ubuntu 16.04 (Xenial Xerus) web site and download the desktop release of Ubuntu 16.04. We strongly encourage you to use the 32-bit Ubuntu 16.04 since all examples used in class will assume that your CPU is a 32-bit CPU. At the time of this writing, the file you should be downloading is "ubuntu-16.04.6-desktop-i386.iso". We will use this file name here. The important part of the file name is "16.04". The number after "16.04" is a release number and anything ≥ 4 would be fine. Please replaces all references to "ubuntu-16.04.6-desktop-i386.iso" with the file name of the ".iso" file you actually downloaded. If you are running Windows 10 and your machine supports "virtualization" in BIOS, although it's not required, it's probably 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". 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 only virtual machine hypervisor platform that I would recommend is the Oracle VirtualBox.
Oracle VirtualBox is free and runs well on both Windows 10 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 Ubuntu 16.04 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 in side 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.
Installing VirtualBox should be pretty straight-forward.
Point your web browser to the VirtualBox Download Page.
Please note that VirtualBox 6.0.0 seems to have problem with the display on Mac OS X. Therefore, if you are
running Mac OS X, I would recommend that you
download VirtualBox 5.2 instead (latest version would be fine).
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, 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.
Just want to mention that there is a way to run Ubuntu 16.04 in VirtualBox "headless" (i.e., no a desktop interface). If you are not an expert in running Linux, this would not be a good option. But if you are a Linux expert and you do not need a desktop interface, you can skip the section below and proceed to install VagrantBox (Vagrant with VirtualBox).
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-5.2.22. If you are using a newer version of VirtualBox, your screens may look different. Step 1: Create An Empty Virtual MachineTo install Ubuntu 16.04 into VirtualBox, first you need to create an empty virtual machine. Start with the above screen, if you click on the New button in the left-top corner and you should see the following screen:Enter "u32-16.04.6" in the Name textbox (to mean "ubuntu", "32-bit", "version 16.04", and "release4"). (Please ignore my typo! Instead of "u32", I have "u34" in all the screenshots! Also, if you are installing version 16.04.6, you should name it "u32-16.04.6".) Select "Linux" as Type and select "Ubuntu (32-bit)" as Version, then click on the Next button. You should then see the following screen: The default memory size is shown as 1GB and that's plenty if you just want to do your programming assignments! You should run as few applications inside your 32-bit Ubuntu 16.04 as possible and only use it to do your programming assignments. If you want to play around with Ubuntu 16.04, you can install another virtual machine. But you should keep this virtual machine lean and clean! You should definitely try to avoid running things like a web browser or a music player in this virtual machine. If you have to run a web browser inside this virtual machine and you have 8GB or more memory in your host machine (Windows 10 or Mac OS X), you should increase the memory for this virtual machine to 2BG. (A web browser is a memory hog!) Please do NOT set the memory size to anything more than 2GB because the more memory you give to Ubuntu 16.04, the less memory the rest of your machine has. In general, you should run memory intensive applications inside your host machine and not inside a virtual machine. After you set your memory size and click on the Next button, you should see the following screen: Don't change a thing and click on the Create button, you should see the following screen: Don't change a thing and click on the Next button, you should see the following screen: Don't change a thing and click on the Next button, you should see the following screen: Since the goal here is to work on your programming assignments, 10GB of disk space is plenty. Just click on the Create button, you should see the following screen: Step 2: Setup The Virtual MachineStart with the above screen, if you click on the Settings button near the left-top corner and you should see the following screen:You can see that General is selected on the left and the Basic tab is selected in the right pane. We should see that under the Basic tab, we are setting up the virtual machine that we set out to build (Name being "u32-16.04.6"), Type being "Linux", and Version "Ubuntu (32-bit)"). If your Version is "Ubuntu (64-bit)", please change it to "Ubuntu (32-bit)". Select the Advanced tab and you should see the following screen: Change the Shared Clipboard from "Disabled" to "Bidirectional" so that you can use the clipboard to copy from something running in the host and paste into something running inside the virtual machine or copy from something running inside the virthal machine and paste into something running in the host. Click on Display on the left and you should see the following screen: You should see that the "Enable 3D Acceleration" checkbox is not checked. Make sure you click on it to enable 3D acceleration. If you don't check this checkbox, your Ubuntu 16.04 will run very slowly. Click on Storage on the left and you should see the following screen: In the middle of the screen, inside a box that says "Storage Devices", there is a line that says "Controller: IDE". Right below it, it shows an icon of an optical disk with the word "Empty" right next to it. Click on the optical disk icon or "Empty" and you should see the following screen: In the right column, for "Optional Drive", it's showing "IDE Secondary Master". There is another icon of an optical disk immediately to the right of it. Click on that icon (and not the "IDE Scondary Master") and you should get a popup menu that looks like the following: Click on "Choose Virtual Optical Disk File" and navigate to the directory where you have downloaded the "ubuntu-16.04.6-desktop-i386.iso" file. Select the "ubuntu-16.04.6-desktop-i386.iso" file and you should see the following screen: Notice that in the middle of the screen and right below "Controller: IDE", the previously "Empty" optical disk now becomes "ubuntu-16.04.6-desktop-i386.iso". (The "i386" in "ubuntu-16.04.6-desktop-i386.iso" means that it's a 32-bit system. If you see "amd64" and not "i386", please download and select "ubuntu-16.04.6-desktop-i386.iso" instead.)
[BC: paragraph added 5/18/2019] Click on Shared Folders on the left and you should see the following screen: A Shared Folder allows your Ubuntu 16.04 to exchanged files with host machine. On the right edge of the screen, there's an icon of a folder with a green plus sign on it. Click on it and you should see the following screen: Immediately to the right of "Folder Path", there is an empty drop-down list. You are suppose to select a directory path for the Shared Folder. On a Windows 10 or Mac OS X host, I would now create a folder on the desktop and name the folder, "Shared-ubuntu". Then I would click on the empty drop-down list and get the following screen: Click on "Other" and navigate to the "Shared-ubuntu" folder on the desktop and select it. You should see the following screen (of course, if your name is not "Bill", your Folder Path should show something else): Please notice that the "Folder Name" is shown to be "Shared-ubuntu". This string is important when you setup your Ubuntu 16.04. Check the Auto-mount checkbox and click on the OK button to finish setting up the Shared Folder. Your screen should look something like the following: Finally, click on the OK button and you are done with setting up the virtual machine. Now you are ready to run your virtual machine for the first time. Step 3: Run Virtual Machine For The First TimeYour screen should now look like what it was at the end of Step 1.To run the virtual machine for the first time, select the Ubuntu 16.04 virtual machine on the left click on the Start button (which is to the right of the Settings button). A separate application window will be popped up that looks like the following (it may take up to a minute or so before the screen will look like the following, so be patient): You should resize the application window (or maximize it) so that you can see the entire Installation screen inside the virtual machine and have it look like this: Now click on the big Install Ubuntu on the right and you should see the following screen: Please do NOT change the networking setting in the right-top corner of the window! Right now it's showing two arrows, one points up and one points down. This means that you are using a "wired Internet connection". Some people would think that since they are connected to the Internet via a wireless connection, they should change it to a wireless Internet connection. Please do not do that! You are inside a virtual machine. The Internet connection is a virtual/fake connection! Keep it that way so that your virtual machine will automatically use the Internet connection of your host machine indirectly. That's the best way! Check the "Download updates while install Ubuntu" checkbox and click on the Continue button. (Please do NOT check the "Install third-party software" checkbox because you should keep this virtual machine as lean and mean as possible and use it only to do your programming assignments!) You should see the following screen: Don't change a thing and click on the Install Now button to erase the "virtual disk" inside the virtual machine and install Ubuntu 16.04 into this newly erased "virtual disk". You should see the following screen: Since we are installing Ubuntu 16.04 into a newly erased "virtual disk", it's perfectly okay to proceed. Click on the Continue button and wait a few seconds and you should see the following screen: Keep the timezone in "Los Angeles" and click on the Continue button and you should see the following screen: Select your keyboard and click on the Continue button and you should see the following screen: This is a very important screen! So, please set it up carefully or you may have to redo everything from scratch. Enter your name in the first textbox and come up with a name for your "virtual" computer. Under username, I would STRONGLY suggest that you use "local-part" of your USC E-mail address. (i.e., your USC e-mail address without the "@usc.edu") AND use the same password you used to ssh to nunki. This way, you will never forget what they are and this can make your life a lot easier! Please note that this password will also be your "Admin Password". Any time when you are running Ubuntu 16.04 and you are prompted for an "Admin Password", please enter this password. Again, using your password for logging into nunki.usc.edu here would mean that you have one less password to memorize. Click on "Log in automatically" (since this is not a real machine) and click on the Continue button. After you clicked on the Continue button, Ubuntu 16.04 starts to get installed into the virtual machine and this can take a long time (anywhere from 15 minutes to half an hour, depending on the speed of your machine). When installation is eventually finished, your will see the following screen: Click on the "Restart Now" button to finish the installtion. After a few seconds, you may see the following screen: Click anywhere inside the window (your pointer may disappear and that's perfectly fine) and press <ENTER> and the virtual machine should restart. When the virtual machine finished restarting, Ubuntu 16.04 should be running and you should see the following screen: If the above screen does not show up, please note the problem and scroll all the way to the bottom of this web page and try to match what you see with the items there and follow the steps to fix your problem. You may have to delete Ubuntu 16.04 and reinstall it from scratch. The panel of buttons on the left is known as the "Launcher".
Step 4: Run Ubuntu 16.04 For The First TimeThe first thing you should do is to disable the screen lock so that you don't have to be entering your password all the time. The reason you don't need screen lock is that you are running inside a virtual machine. If your host machnie's laptop/desktop is locked, you don't have to worry about the virtual machine inside. Please click on the Settings icon in the Launcher to setup your desktop. Your screen should look like the following:Click on "Brightness & Lock" and you should see the following screen: Change "5 minutes" to "Never" and click on Lock to turn screen lock off and your screen should look like the following: Click on the close box in the left-top corner of the "Brightness & Lock" window to finish up "Settings". The next thing you should do is to add the Terminal program to the Launcher. (The actual name for the Terminal program is the "gnome-terminal".) Move the pointer to the first icon in the Launcher and click on it. Then type "Terminal" and your screen should look like the following: Click on the icon for the Terminal program to run it. Your screen should look like the following: You should keep the Terminal icon in the Launcher so you don't have to search for it over and over again. Right-click on the Terminal icon in the Launcher and select "Lock to Launcher". Step 5: Install Guest AdditionsIf you try to copy some text from an application running in the host (such as a web browser) and paste into the Terminal, you will notice that it does not work! Also, some systems (especially on the Mac) can exhibit performance problems at this point or the display may not resize properly. You need to do the following now. Select "Insert Guest Additions CD Image..." from the Devices Menu in the outer-most window (greyed out in the above screenshot) and your screen should look like the following:Click on the Run button and you will be prompted for your admin password. Enter your admin password and click on the Authenticate button and the Guest Additions will start to install. This can take several minutes. When it's done, your screen can look like the following: Please notice that in the above screen, there is an error reported: VirtualBox Guest Additions: modprobe vboxsf failedSo, we are not done yet. As it turned out, this probably will automatically get fixed after we reboot the system. For now, just press <ENTER> and the 2nd Terminal window should close. In case you did not see the dialogbox with the Run button in the first image above, but got an error message instead. You should close the error message dialogbox and type "df" in the Terminal window. If you see a line that looks something like the following (doesn't have to be an exact match): /dev/sr0 56618 56618 0 100% /media/SOMETHING/VBox_GAs_5.2.22you should type the following in the Terminal window to install the Guest Additions: cd /media/SOMETHING/VBox_GAs_5.2.22 sudo ./VBoxLinuxAdditions.runIf you are prompted for your admin password, just type it and press <ENTER> to proceed. At this point, it's probably a good idea to reboot the system so you can use copy and paste to copy commands from the web browser and paste into a Terminal. Go ahead and reboot the system then proceed with the next step. Step 6: System UpdateThe Terminal program runs a Shell Program (sometimes referred to as the Login Shell). A Shell Program has a text-based, commandline user interface for you to enter Linux commands. In the above screenshot, the text in green is the commandline prompt. Yours will most likely be different from mime. From the commandline, you can perform a bunch of important tasks. Please see the Linux Shell section below for some of the commands you will need to run. The first thing you should do is to update your system by running the following commands in the Terminal:sudo apt-get -y update sudo apt-get -y dist-upgrade sudo apt-get -y upgradeThese commands can take 15 to 30 minutes to finish. Sometimes, it takes so long that you will be prompted for your admin password for the second time. Please note that the above 3 commands contain the word "upgrade". This particular "upgrade" is not to upgrade Ubuntu 16.04 to a different version of Ubuntu, but to "upgrade" only within current distribution. The above 3 commands is the only way you should "upgrade" the system. Please do not "upgrade" your system using any other method! This should be the ONLY time you need to update your system. For the rest of the semester, even if you are offered to update your system, you should NOT accept to update your system! If you update your system, you may unintentionally make your system incompatible with our programming assignments and you will have to delete everything (remember to backup all your work) and reinstall Ubuntu 16.04. The "apt-get" is the program for downloading and installing a piece of software. But only administrator can install software. Although you are an administrator on your own machine, you do not run at the administrator privilege level by default. The "sudo" command is used to temporarily raise you security privilege to the level of an administrator in order to execute the rest of the command you typed into the commandline. Therefore, when you run the above command, you will be prompted to enter your admin password before the rest of the command can be executed. The good news is that if you run the sudo command subsequently in the same console, you will not be prompted to enter your password, unless your console has been idle for some time. Please note that you can only run one instance of apt-get at a time. Internally, the Software Center also invokes apt-get to download and install software. So, if the Software Center is busy installing a program, you will be blocked from running apt-get until the Software Center is finished. Step 7: Install Software for Kernel AssignmentsYou should also install all the programs that's needed to do your programming assignments now. Please enter the following commands into the Terminal:sudo apt-get install -y tcsh vim dos2unix tmux valgrind git gitk git-core qemu cscope xorriso Step 8: RebootAfter you are done with the above, one final thing to consider is whether you want to change your default Linux Shell or not. When you are done with that, you should reboot your system.If you look at the last screenshot, in the right-top corner of the Ubuntu 16.04 system, immediately to the right of the current time is the System Menu. If you click on it, you can see that the last item in the menu is "Shut Down". Select Shut Down there and you will get a choice of either restarting the system or shutdown the system. If you click on the big Restart button on the left, the system would reboot. You can also click on the big Shut Down button on the right instead. Ubuntu 16.04 will shutdown and the virtual machine will also shut down. To run Ubuntu 16.04 again, you need to go back to the VirtualBox application (see the screenshot above), select this particular virtual machine and click on the Start button. (If you have setup everything correctly, you should never have to click on the Settings button ever again!) After the system is restarted, start a Terminal window. Inside the Terminal, type the following: dfand your screen should look like the following: What's important to notice above is that there is a file system called "Shared-ubuntu" which is the Shared Folder that you have created a while back! (Recall that there was an error because the system needs to be restarted. Now that the system has been restarted, Shared Folder should work now.) This file system is shown to be "mounted" on /media/sf_Shared-ubuntu to mean that it can be accessed by referring to /media/sf_Shared-ubuntu. Unfortunately, you cannot use it like this since it can only be accessed from the admin account. To make it accessible by you, you should do the following in a Terminal: sudo sed -i "1,$$s/vboxsf:x:998:/&${USER}/" /etc/group sudo sed -i "1,$$s/vboxsf:x:999:/&${USER}/" /etc/group cd rm Shared-ubuntu ln -s /media/sf_Shared-ubuntu Shared-ubuntuThe above commands add yourself to the access list for the Shared Folder and also create a "symbolic link" so that you can reach the shared folder using the "Shared-ubuntu" directory in your home directory. Please note that on some systems, instead of seeing "/media/sf_Shared-ubuntu", you may see "/Shared-ubuntu". If that's the case, please reaplce "/media/sf_Shared-ubuntu" with "/Shared-ubuntu" above. Try the following: cd cd Shared-ubuntu echo "Hello World!" > hello.txtThen go to your host machine and click open the Shared-ubuntu folder on your desktop and see if you can open the hello.txt file in it. Since the system has been restarted, bidirectional copy and paste between Ubuntu 16.04 and the host system should work. So, instead of typing all the text above, you can just highlight them in your browser and press <Cntrl+C> on Windows (or <Cmd+C> on the Mac) to copy the highlighted text into the shared bidirectional clipboard and click on a Terminal in Ubuntu 16.04 and press <Cntrl+Shift+V> to paste it into the commandline. This should save you a lot of typing and is also less error-prone! (If you want to copy and paste in the reverse direction, say to e-mail some text you see in a Terminal to me, you can highlight some text in a Terminal, press <Cntrl+Shift+C> to copy the highlighted text into the shared bidirectional clipboard and click on an application running in the host system (such as an e-mail app running in a web browser) and press <Cntrl+V> on Windows (or <Cmd+V> on the Mac) to paste the text into your e-mail app.) Now you are all setup to use Ubuntu 16.04!
If you are not an expert in running Linux without a desktop, this is not for you!
But if you are a Linux expert and you do not need a desktop interface to use Linux, you can install something
call Vagrant to run a "headless" (i.e., desktop-less)
Ubuntu 16.04 system. Vagrant can work with various virtual machine hypervisors. For this
class, please only use it with the Oracle VirtualBox.
Although Vagrant does not have a desktop, you may still need to run programs that has a graphical user interface (such as our kernel assignments). In order to be able to run those programs, you need to run an X11 Window Server. If your system is an Mac OS X system, please download and install XQuartz before proceeding. If your system is running Window 10, please install Cygwin before proceeding. The installation steps are very similar between Mac OS X and Windows 10. The only difference is that you will be running a Cygwin Terminal if you are running Window 10 and you will be running a XQuartz Terminal (i.e., a program with "xterm" in the titlebar). Here are the steps.
A Linux Shell program runs inside a Terminal program.
By default, your Linux Shell is bash. If you want your login
shell to be tcsh, you can simply type "tcsh" (assuming that you have installed it already).
If you want to change your default login shell, please do the following in a Terminal:
chshYou will be prompted for your admin password, again. Then enter: /bin/tcshAfter you have rebooted your system, your terminal will be running the new login shell.
It is imperative that your group uses a version management system.
The software of choice is Git,
originally designed and written by Linus Torvalds.
If you are not familiar with Git, please read the free online book, Pro Git, mentioned in the textbooks section of our course description web page. There are free web sites on the Internet that provide free Git repository service. You should be able to create an account there and share it along your team members. Please make sure that your code is private so that no one other than your team members can see or change the code. Please note that if others (such as the teaching staff) can see your code repository (because it is not private), it will be considered cheating and there are serious consequences. As I have mentioned in the first lecture, you do not have the right to display your assignment-related code in public (even if your prospective employer asks you to). If you display your assignment-related code in public in the middle of the semester, your group will get a zero for the assignment. (If others have cheated off of your code, then your case will be reported to the university and everyone in your group will end up failing the course.) If you display your assignment-related code in public after the semester is over, I will ask the university to change the grades of everyone in your team because you are helping future students cheat. (As I have mentioned in Lecture 1 that USC Student Conduct Code says that you must not knowingly allow other students to cheat from you.) So, please make double sure that your code repositories related to this class are all private. Please do NOT use github.com becuase your private repository automatically turns into a public one if you do not pay them! To start using BitBucket, please visit the relevant part of the projects page.
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.
|
|||||||||||||||||||||||||||||||||||||||