CS3 Operating Systems 2013-14, Practical Exercise. PHASE 1 ------- Running a virtual Linux system ------------------------------ For rather obvious reasons, we can't let you loose in the kernel of one of our machines. However, nowadays there are available excellent emulators which allow you to run an entire modern system inside an emulated PC - and modern PCs are so fast that this emulation is itself capable of running applications (never mind OS exercises) at a perfectly reasonable speed. Therefore you will do your kernel programming inside such a virtual machine. The emulator we'll use is Oracle's VirtualBox. You *could* run it at home, but on the whole I recommend doing the practical on DICE. Running VirtualBox on DICE machines ----------------------------------- NOTE: these instructions work ONLY on DICE machines, and moreover you must have an X display set. That is, you must either be on a DICE workstation, or you must be logged from via ssh with X display forwarding enabled. (Or you must have explicitly set an appropriate DISPLAY.) Do NOT run VirtualBox on any of the School's server machines. A former Teaching Assistant Zheng Wang has made it very easy for you to set up VirtualBox for this practical. Here is what to do: Bring up an xterm (or whatever other shell window you use -- doing this inside an Emacs shell buffer is possible, but advisable only for hardcore Emacsers). Make a directory for this practical, and cd into it. Then issue the command: /group/teaching/cs3/os/VBox/setup.sh and follow the instructions it gives you. After this, you will be able to start your virtual machine just by starting VirtualBox . When you start VirtualBox, the application GUI will appear; when you start the virtual machine just created, a console window (which is the console tty of the VM) will appear. You will see a normal Linux boot sequence, and then you should see a login prompt. Now log in (as "root" if you're feeling confident, or "user" if you're feeling nervous) and have a look round the virtual machine. Shutting down: to shutdown your virtual machine, log in to the console as root, and do shutdown -h now Note that an unclean shutdown will have the same mangling effect on your virtual disk that an unclean shutdown of a real machine has on its real disks, so you should always follow this procedure. The VM has two virtual disks attached. One is mounted on /, and contains the system - it is a stripped down Fedora system. NOTE that you cannot make any permanent changes to files - any changes you make will be lost when you shut down the VM. To provide VM-internal storage, a second disk is mounted on /work, and changes in here are persistent. Note that this second virtual disk is in reality a file in your filespace, so consumes part of your quota - so don't copy any BIG files into /work . When the VM was set up for you, a directory called "shared" was created in your practical directory. You can mount this in the VM by (as root): mount -t vboxsf shared /mnt/shared Finally, you may (indeed, will!) get to a state where your console is wedged with a command not responding. It is not possible (currently) to ssh in to your VM from outside; however, like all standard Linux systems, the system has six virtual (i.e. virtually virtual!) consoles available on the (virtually real) system console. You can switch to virtual console N by pressing Host-FnN, where Host is the right Control key (unless you've changed it). So to switch to virtual console 2, press Host-Fn2. You can then log in there.