Operating Systems 2015F: Tutorial 5: Difference between revisions

From Soma-notes
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
In today's tutorial you will be getting your own virtual machine set up in OpenStack.  Your tasks are as follows:
In today's tutorial you will be getting your own virtual machine set up in OpenStack.  Your tasks are as follows:
'''Note: the directions below have been updated.'''


# Connect to the SCS Openstack web portal at https://openstack.scs.carleton.ca
# Connect to the SCS Openstack web portal at https://openstack.scs.carleton.ca
Line 19: Line 21:
# Build the kernel by running "make bzImage"
# Build the kernel by running "make bzImage"
# Build the modules by running "make modules"
# Build the modules by running "make modules"
# Install the modules by running "sudo make modules_install"  ('''Do this before make install.''')
# Install the kernel by running "sudo make install"
# Install the kernel by running "sudo make install"
# Install the modules by running "sudo make modules_install"
# While waiting for your kernel to build, try tracing various kernel events in /sys/kernel/debug/tracing as detailed in Lecture 11.  Try to trace:
# While waiting for your kernel to build, try tracing various kernel events in /sys/kernel/debug/tracing as detailed in Lecture 11.  Try to trace:
#* entry to the chdir system call
#* entry to the chdir system call
Line 28: Line 30:


==Hints==
==Hints==
* It is very easy to make your instance not bootable by installing a bad kernel.  Before installing a new kernel verify that you can choose which kernel you boot from the console by hitting escape and getting the boot menu.  You may also want to increase the timeout from 5 seconds to something longer, e.g. 30 or 60 seconds, in order to give you time to get to the console.
* You can configure a kernel an existing config file by copying it to .config and running "make oldconfig".  A minimal config that works in the class VM is [http://homeostasis.scs.carleton.ca/~soma/os-2015f/code/minimal-config here].  Save it as ".config" in the top level of the kernel source directory.
* You can configure a kernel an existing config file by copying it to .config and running "make oldconfig".  A minimal config that works in the class VM is [http://homeostasis.scs.carleton.ca/~soma/os-2015f/code/minimal-config here].  Save it as ".config" in the top level of the kernel source directory.
* '''New:''' If you want to just build the modules your distribution kernel uses, then you should:
*# Copy the config file for the currently running kernel from /boot to .config
*# Run "make localmodconfig" to update the config file.  Just hit return for any questions that it asks (accept the default answer).
*# Run "make bzImage; make modules; sudo make modules_install; sudo make install".  It should run much faster than building a kernel with all of the distribution's modules enabled.
* Builds can take a long time!  You can always redirect the output to a file and then walk away, however.  For example, to build the kernel and redirect standard out and error to the file make.log, and put it in the background, just run <pre>make bzImage >& make.log &</pre>
* Builds can take a long time!  You can always redirect the output to a file and then walk away, however.  For example, to build the kernel and redirect standard out and error to the file make.log, and put it in the background, just run <pre>make bzImage >& make.log &</pre>
* Note this configuration has no modules; however, previously the following modules were loaded (see below).  However, the kernel works fine without them.  Which of these modules need to be built and loaded?  Why or why not? <pre>Module                  Size  Used by
* Remember you can ssh in to your instances!  If you can't ssh, you probably forgot to add the instance to the ssh and ping security groups.  Find the "Edit Security Groups" option and change it there.  (Click around, you'll find it on one of the button menus for the instance.)
* Note this configuration has no modules; however, previously the following modules were loaded (see below).  However, the kernel works fine without them.  Which of these modules need to be built and loaded?  Why or why not?
<pre>
Module                  Size  Used by
ppdev                  20480  0  
ppdev                  20480  0  
kvm_intel            151552  0  
kvm_intel            151552  0  

Latest revision as of 19:05, 24 November 2015

In today's tutorial you will be getting your own virtual machine set up in OpenStack. Your tasks are as follows:

Note: the directions below have been updated.

  1. Connect to the SCS Openstack web portal at https://openstack.scs.carleton.ca
  2. Login using your MyCarletonOne username and the default password (your username and student number) or the password you have set.
  3. Create an instance based on the snapshot "comp3000-base-snap"
    • You don't need an ssh keypair
    • Set the name of the instance to be your username-1. Thus if your username is janedoe, then call your instance janedoe-1.
  4. Assign a floating IP address to your instance.
  5. Check that your instance is running; if not, start it. Then log in to the console using the standard student account.
  6. For regular work, ssh to the floating IP address assigned to your instance. Make sure you specify "student" as the username. The password is "tneduts!", same as the Virtualbox VMs. (If you used one of the standard cloud ubuntu images and set up a keypair, the username is "ubuntu" and the account has no password.)
  7. Change the hostname of your machine to be whatever you want by editing /etc/hostname. Also change the hostname in /etc/hosts.
  8. Edit /etc/default/grub, and make sure the following variables have the values below. These settings enable a countdown that, if you hit a key during it, you can select which kernel to load.
    • GRUB_DEFAULT=0
    • GRUB_HIDDEN_TIMEOUT=5
    • GRUB_HIDDEN_TIMEOUT_QUIET=false
    • GRUB_TIMEOUT=5
  9. Run "sudo update-grub" to update the grub configuration.
  10. Configure your kernel by running "make menuconfig"
  11. Build the kernel by running "make bzImage"
  12. Build the modules by running "make modules"
  13. Install the modules by running "sudo make modules_install" (Do this before make install.)
  14. Install the kernel by running "sudo make install"
  15. While waiting for your kernel to build, try tracing various kernel events in /sys/kernel/debug/tracing as detailed in Lecture 11. Try to trace:
    • entry to the chdir system call
    • entry into the fork system call
    • all system calls
    • other functions in the kernel

Hints

  • It is very easy to make your instance not bootable by installing a bad kernel. Before installing a new kernel verify that you can choose which kernel you boot from the console by hitting escape and getting the boot menu. You may also want to increase the timeout from 5 seconds to something longer, e.g. 30 or 60 seconds, in order to give you time to get to the console.
  • You can configure a kernel an existing config file by copying it to .config and running "make oldconfig". A minimal config that works in the class VM is here. Save it as ".config" in the top level of the kernel source directory.
  • New: If you want to just build the modules your distribution kernel uses, then you should:
    1. Copy the config file for the currently running kernel from /boot to .config
    2. Run "make localmodconfig" to update the config file. Just hit return for any questions that it asks (accept the default answer).
    3. Run "make bzImage; make modules; sudo make modules_install; sudo make install". It should run much faster than building a kernel with all of the distribution's modules enabled.
  • Builds can take a long time! You can always redirect the output to a file and then walk away, however. For example, to build the kernel and redirect standard out and error to the file make.log, and put it in the background, just run
    make bzImage >& make.log &
  • Remember you can ssh in to your instances! If you can't ssh, you probably forgot to add the instance to the ssh and ping security groups. Find the "Edit Security Groups" option and change it there. (Click around, you'll find it on one of the button menus for the instance.)
  • Note this configuration has no modules; however, previously the following modules were loaded (see below). However, the kernel works fine without them. Which of these modules need to be built and loaded? Why or why not?
Module                  Size  Used by
ppdev                  20480  0 
kvm_intel             151552  0 
kvm                   483328  1 kvm_intel
serio_raw              16384  0 
parport_pc             32768  0 
parport                45056  2 ppdev,parport_pc
autofs4                40960  2 
crct10dif_pclmul       16384  0 
crc32_pclmul           16384  0 
ghash_clmulni_intel    16384  0 
aesni_intel           172032  0 
aes_x86_64             20480  1 aesni_intel
lrw                    16384  1 aesni_intel
gf128mul               16384  1 lrw
glue_helper            16384  1 aesni_intel
ablk_helper            16384  1 aesni_intel
cryptd                 20480  3 ghash_clmulni_intel,aesni_intel,ablk_helper
psmouse               118784  0 
floppy                 77824  0