Updated: 2013-05-08 21:04 EDT

1 Due Date and DeliverablesIndexup to index

WARNING: Some inattentive students upload Assignment #13 into the Assignment #12 upload area. Don’t make that mistake! Be exact.

2 Purpose of this AssignmentIndexup to index

This assignment is based on your weekly Class Notes. All work is done in your own Fedora 12 Virtual Machine.

  1. Configure Booting and GRUB.
  2. Practice listing and modifying services in various Run Levels.
  3. Practice starting and stopping system services.

Remember to READ ALL THE WORDS to work effectively and not waste time.

3 Introduction and OverviewIndexup to index

This is an overview of how you are expected to complete this assignment. Read all the words before you start working.

  1. Complete the Tasks listed below.
  2. Verify your own work before running the Checking Program.
  3. Run the Checking Program to help you find errors.
  4. Submit the output of the Checking Program to Blackboard before the due date.
  5. READ ALL THE WORDS to work effectively and not waste time.

Since I also do manual marking of student assignments, your final mark may not be the same as the mark submitted using the current version of the Checking Program. I do not guarantee that any version of the Checking Program will find all the errors in your work. Complete your assignments according to the specifications, not according to the incomplete set of the mistakes detected by the Checking Program.

When you are finished the tasks, leave the files and directories in place as part of your deliverables. Do not delete any assignment work until after the term is over! Assignments may be re-marked at any time; you must have your term work available right until term end.

3.1 Searching the course notesIndexup to index

All the course notes are always available on the Internet here: CST8207 GNU/Linux Operating Systems I.

All the current and previous terms notes files are also stored on the CLS. You can learn about how to read and search these notes files using the command line on the CLS under the heading Copies of the CST8207 course notes near the bottom of the page Course Linux Server.

3.2 The Source DirectoryIndexup to index

All references to the “Source Directory” below are to the CLS directory ~idallen/cst8207/13w/assignment13/ and that name starts with a tilde character “~” followed by a userid with no intervening slash. The leading tilde indicates to the shell that the pathname starts with the HOME directory of the account idallen.

4 TasksIndexup to index

4.1 Set UpIndexup to index

  1. On the Course Linux Server, make the directory CST8207-13W/Assignments/assignment13, in which some information will be stored related to this assignment.

  2. Create the check symbolic link needed to run the Checking Program, as described in the section Checking Program below.

  3. Complete your Fedora 12 Virtual Machine Installation.

  4. From previous assignments, finish the modifications to the GRUB Configuration File and modifications to enable sudo.

  5. On your Fedora 12 Virtual Machine also create a directory in your own account named CST8207-13W/Assignments/assignment13 (exactly the same directory hierarchy as you created on the CLS).

  6. Before you begin this assignment, create a snapshot of your Fedora 12 Virtual Machine.
    • Enter a comment explaining where and when you took this snapshot.
    • You can restore back to this snapshot if anything goes wrong.

4.2 Worksheet 13 - Booting and GRUBIndexup to index

  1. Before you start the following worksheet, save a copy of your current 17-line GRUB configuration file into file grub-before in your Fedora 12 assignment13 directory. You will need this saved file later.

  2. Review the course notes on Booting and GRUB.

  3. Complete Worksheet #13 ODT in your Fedora 12 Virtual Machine.

  4. Save your post-worksheet GRUB configuration file (the one you created by doing the Worksheet #13 ODT above) into file grub-after in your Fedora 12 assignment13 directory.

4.3 Configure a GRUB boot menuIndexup to index

  1. Take a VM snapshot if you haven’t done so already.

  2. Restore your GRUB configuration file to its saved 17-line pre-worksheet version (grub-before) that you started with before you added the passwords and new boot menu entries in Worksheet #13 PDF.
    • Your pre-worksheet GRUB configuration file was only 17 lines long.
    • It had only one four-line Fedora boot menu entry and no password lines.
    • The timeout was set to 30 seconds set in a previous assignment.
    • (If you forgot to save your pre-worksheet configuration file, you can start up an early snapshot of your VM, made before you did the worksheet, and use File Transfer to copy the pre-worksheet configuration file to the CLS, and then copy it back to Fedora.)
  3. Edit your restored 17-line GRUB configuration file as follows: copy the existing default four-line boot menu entry and create three new ones below it, for a total of four boot menu entries. Each new boot menu entry is a copy of the original four-line boot menu entry. Adding three more boot menu entries means adding a total of 12 additional lines. The resulting file will be 17+12=29 lines long.

Do not make any changes to the first four-line boot menu entry.

You have created three new four-line boot menu entries. In each of the three new boot menu entries, insert the words given below at the start of the title for that boot menu entry, as you did for the boot menu entries you added in Worksheet #13 PDF. Make the following changes to each of the three new boot menu entries:

  1. For the second boot menu entry (the first new one):
    1. Change the title to start with: single user in front of Fedora.
    2. Remove the Red Hat Graphical Boot and quiet options.
    3. Configure this entry with a kernel option to boot in single-user mode.
  2. For the third boot menu entry (the second new one):
    1. Change the title to start with: text only in front of Fedora.
    2. Remove the Red Hat Graphical Boot and quiet options.
    3. Configure this entry with a kernel option to boot in full multi-user but text-only mode (no GUI).
  3. For the fourth boot menu entry (the third new one):
    1. Change the title to start with: default in front of Fedora.
    2. Remove the Red Hat Graphical Boot and quiet options.
  4. Make the following changes to the top section of your GRUB configuration file, before all the boot menu sections:
    1. Have GRUB time out after 45 seconds.
    2. Have GRUB ask for an encrypted password: grublock
    3. Have GRUB choose the fourth (last) default boot menu entry when the system reboots.
    4. Comment-out the splashimage line. (Make it a comment in the same way as you made hiddenmenu into a comment in a previous lab.)
  5. Save your changes. Reboot. You should find that GRUB has no blue background image and that it automatically chooses the fourth boot menu entry, the one with the words default Fedora at the start of the title, after 45 seconds of count-down.

  6. Log in and check your work using the Checking Program.

4.4 Changing System V Run LevelsIndexup to index

See the section on Legacy Run Levels and Services in the Booting and GRUB page. You will need to use the sudo command to run the privileged commands in this section.

  1. Login in to the Fedora 12 GUI as your ordinary (non-root) account and start a terminal.

  2. Copy the seven-line description of Run Levels from the comments in your Fedora 12 inittab file to a new file runlevelhelp in your Fedora 12 assignment13 directory. Your new file should have a wc of 7 56 252. (Hint: You can use grep with a pattern that matches in just these seven lines, or you can copy the whole file and text-edit away the other lines.)

  3. Copy the default run level line from your Fedora 12 inittab file to file initdefault in your Fedora 12 assignment13 directory. Your new file should have a wc of 1 1 18.

  4. Use the command that displays your previous and current Run Level and save the output into file runlevel5-before in your Fedora 12 assignment13 directory. Your new file should have a wc of 1 2 4. Look at the contents of the file to see the previous and current run level numbers. (You should be in Run Level 5 now.)

  5. Count all the processes running on your machine. (The count should be about 150 processes in Run Level 5.)

  1. Using the terminal and command line, change your run level to run level 3.
    • Hint: You will need to use a prefix command to run the command to change run levels with root privileges.
    • This run level change will kill your terminal, web browser, and anything else you have open in the graphical GUI!
    • The X11 GUI will disappear from the VMware console and you should see a black Fedora console login screen with messages.
    • In the black console screen, push the Enter key once or twice and you should see a Fedora login banner with a login: prompt and cursor.
    • If you see nothing but a black screen on your VMware console, with no text, use the previous work-arounds in the previous step, above.
  2. Log in to the black console screen as your regular account.
    • If you see nothing but a black screen on your VMware console, use the work-arounds given in the previous step, above.
  3. Use the command that displays your previous and current Run Level and save the output into file runlevel3 in your Fedora 12 assignment13 directory. Your new file should have a wc of 1 2 4. Look at the contents of the file to see the previous and current run level numbers. (You should be in Run Level 3 now.)

  4. Place a full list of all processes for all users, BSD format, all users, text user name (not numeric UID), full wide listing (not truncated at all), into file psbsd3 in your Fedora 12 assignment13 directory. It should be “approximately” 100 lines and 8KB while in Run Level 3. One of the very long lines will look similar to this (use grep to find it in the output):

    root 1495 0.0 0.1 2676 880 ? S Mar27 0:00 /sbin/dhclient -d -sf /usr/libexec/nm-dhcp-client.action -pf /var/run/dhclient-eth0.pid -lf /var/lib/dhclient/dhclient-ad12d8a2-c7c0-4c10-9847-6a0c3bc3818f-eth0.lease -cf /var/run/nm-dhclient-eth0.conf eth0
  5. Change your run level from Run Level 3 to Run Level 2. In the VMware console screen, you will see status messages as the system stops and starts processes to correspond to the new Run Level. (You won’t see these if you are using a terminal connection.)

  6. If necessary, log in again to the black console screen as your regular sysadmin account.

  7. Use the command that displays your previous and current Run Level and save the output into file runlevel2 in your Fedora 12 assignment13 directory. Your new file should have a wc of 1 2 4. Look at the contents of the file to see the previous and current run level numbers. (You should be in Run Level 2 now.)

  8. Place a full list of all processes for all users, UNIX format, all users, text user name (not numeric UID), full wide listing (not truncated at all), into file psunix2 in your Fedora 12 assignment13 directory. It should be “approximately” 88 lines and 6KB while in Run Level 2. One of the very long lines will look similar to this (use grep to find it in the output):

    root 1495 1483 0 Mar27 ? 00:00:00 /sbin/dhclient -d -sf /usr/libexec/nm-dhcp-client.action -pf /var/run/dhclient-eth0.pid -lf /var/lib/dhclient/dhclient-ad12d8a2-c7c0-4c10-9847-6a0c3bc3818f-eth0.lease -cf /var/run/nm-dhclient-eth0.conf eth0
  9. Change your run level from Run Level 2 back to Run Level 5. In the VMware console screen, you will see status messages as the system starts processes to correspond to the new Run Level and then the X11 GUI will start up again and give you a full graphical login screen. (You won’t see these if you are using a terminal connection.)

  10. Use the command that displays your previous and current Run Level and save the output into file runlevel5-after in your Fedora 12 assignment13 directory. Your new file should have a wc of 1 2 4. Look at the contents of the file to see the previous and current run level numbers. (You should be in Run Level 5 again.)

  11. Count all the processes running on your machine. The count should again be about 150 processes in Run Level 5.

  12. Check your work using the Checking Program.

4.5 Changing Run Level ServicesIndexup to index

See the section on Legacy Run Levels and Services in the Booting and GRUB page. You will need to use the sudo command to run the privileged commands in this section.

  1. Login in to Fedora 12 as your ordinary (non-root) account.

  2. Save a listing of all services and all run levels into file chkconfig-before in your Fedora 12 assignment13 directory. It should be “approximately” 57 lines and 3KB. One of the lines should look like this:

    httpd           0:off   1:off   2:off   3:off   4:off   5:off   6:off
  3. Disable (turn off) the Bluetooth service in all run levels.

  4. Completely remove the smolt service from chkconfig management.

  5. Enable the Apache HTTP Server service only in Run Level 5.

  6. Save a second listing of all services and all run levels into file chkconfig-after in your Fedora 12 assignment13 directory. It should be “approximately” 56 lines (one line less than the before version) and 3KB. One of the lines should now look like this:

    httpd           0:off   1:off   2:off   3:off   4:off   5:on    6:off
  7. Use the diff command to compare the before listing file with the after listing file. Two lines have changed and one line was deleted.

  8. Check your work using the Checking Program.

4.6 Manually Starting/Stopping ServicesIndexup to index

See the section on Legacy Run Levels and Services in the Booting and GRUB page. You will need to use the sudo command to run the privileged commands in this section.

  1. Start the Apache HTTP Server service using the service command.

  2. Confirm that the Apache service is running by using the Firefox web browser inside Fedora 12 to open the web URL http://localhost/. You should see the Fedora Test Page. Close the web browser.

  3. Use the lpc stat command to display the printers known to your Fedora 12 system. (You should see your lp126 printer in the list.)

  4. Stop the CUPS printer service using the service command.
    • What does the acronym CUPS stand for?
  5. Try lpc stat again and see no output at all – CUPS is not running.

  6. Try the lpq command and note the unable to connect error message.

  7. Redirect the above lpq error message into file lpq-stderr in your Fedora 12 assignment13 directory. (You may need to remember how to redirect standard error to a file.)

  8. Start the CUPS printer service again.

  9. Check your work using the Checking Program.

4.7 When you are doneIndexup to index

When you are finished, run the Checking Program to create an overall mark. Submit the output to Blackboard in the correct location.

Since I also do manual marking of student assignments, your final mark may not be the same as the mark submitted using the current version of the Checking Program. I do not guarantee that any version of the Checking Program will find all the errors in your work. Complete your assignments according to the specifications, not according to the incomplete set of the mistakes detected by the Checking Program.

  1. Optional: Keeping your base Fedora 12 Virtual Machine snapshot, remove any intermediate snapshots you no longer require, to free up disk space.
    • Be careful not to remove your current work!

5 Checking, Marking, and Submitting your WorkIndexup to index

The checking program resides on the Course Linux Server, but your work is on your Fedora 12 Virtual Machine. There is a new Fetch program that you must download and use on your Fedora 12 machine to copy information from your Fedora 12 Virtual Machine to your account on the CLS so that the checking program can check it on the CLS.

Once the Fetch program has fetched these files from your Virtual Machine to the CLS, you can run the checking program on the CLS to check what is saved in the files. When you make changes on your Fedora 12 Virtual Machine, you need to run the Fetch program again to update the saved files on the CLS.

Simply running the checking program on the CLS will not update the saved files on the CLS. You must run the Fetch program when you make changes on your Fedora 12 Virtual Machine.

5.1 Part I - Fetch and CheckIndexup to index

Do all the following steps on your Fedora 12 Virtual Machine. Read through the whole list before you start typing anything.

  1. Log in to Fedora 12 as your non-root account (same userid as Blackboard).
  2. Create a directory in your account named CST8207-13W/Assignments/assignment13 (exactly the same directory hierarchy as you already have on the CLS).
  3. Change to your above assignment13 directory.
  4. As shown below, use wget to get a copy of the Fetch program from this URL into a file named do.sh: http://teaching.idallen.com/cst8207/13w/notes/data/assignment13wget.sh

    Fedora$ wget -O do.sh http://teaching.idallen.com/cst8207/13w/notes/data/assignment13wget.sh
    `do.sh' saved [545/545]              # size may differ slightly

    Make sure you have a file named do.sh in your directory. You only need to download this once per assignment.

  5. As shown below, use sudo and sh to run the do.sh script you just downloaded to Fedora 12 with the USER environment variable set to your own CLS account userid (as stored in the USER variable).

    Fedora$ sudo USER=$USER sh do.sh
  6. This Fetch program will connect from Fedora 12 to the CLS using your account name. It will copy files from Fedora 12 to your assignment13 directory on the CLS. It will then run the checking program on the CLS to check your work. You will need to answer one question about your IP address, and then wait and type in your CLS password.

It will look something like this:

Fedora$ whoami
abcd0001
Fedora$ hostname
abcd0001
Fedora$ pwd
/home/abcd0001/CST8207-13W/Assignments/assignment13
Fedora$ wget -O do.sh http://teaching.idallen.com/cst8207/13w/notes/data/assignment13wget.sh
`do.sh' saved [545/545]              # size may differ slightly
Fedora$ sudo USER=$USER sh do.sh
---------------------------------------------------------------------------
abcd0001: FETCH version 1.  Connecting to CLS as USER='abcd0001' using ssh
---------------------------------------------------------------------------
abcd0001: Use local Algonquin IP cst8207-alg.idallen.ca [y/N]? n
abcd0001: Please wait; using ssh to connect to user 'abcd0001' on cst8207.idallen.ca ...
*** COURSE LINUX SERVER ***
abcd0001@cst8207.idallen.ca's password:         # enter your CLS password
---------------------------------------------------------------------------
idallen-ubuntu assignment13fetch_server.sh version 0 run by abcd0001.
Please wait; collecting info from abcd0001 Virtual Machine
---------------------------------------------------------------------------
VM files collected into CST8207-13W/Assignments/assignment13/abcd0001.tar.bz on CLS.
Now running check program for abcd0001 on CLS:
----------------------------------------------------------------------------
idallen-ubuntu check: CST8207-13W/Assignments/assignment13 check program version 00
*** Checking account for abcd0001 on idallen-ubuntu ***
[... checking program output appears here ...]

5.1.1 Notes on the Fetch programIndexup to index

  • This Fetch program updates your saved files on the CLS and then runs the checking program on the CLS. If you only run the checking program on the CLS, it won’t update the files from your Fedora 12 VM and will check the exiting files saved under assignment13 on the CLS.
  • The checking program is running on the CLS, not on your Fedora 12 VM. At the start, the checking program will issue messages relevant to your account on the CLS (e.g. errors in your CLS .bashrc file or world-writable files on the CLS). These errors are on the CLS, not on your Fedora 12 machine.

5.2 Part II - Check and SubmitIndexup to index

When you are done with your assignment, you need to run the checking program one last time on the CLS and submit the output file, as follows:

Do all this on the Course Linux Server:

  1. There is a Checking Program named assignment13check in the Source Directory on the CLS. Create a Symbolic Link to this program named check under your new assignment13 directory so that you can easily run the program to check your work and assign your work a mark. Note: You can create a symbolic link to this executable program but you do not have permission to read or copy the program file.

  2. Execute the above “check” program on the CLS using its symbolic link. (Review the Search Path notes if you forget how to run a program by pathname from the command line.) This program will check your work, assign you a mark, and display the output on your screen. (You may want to paginate the long output so you can read all of it.)

    You may run the “check” program as many times as you wish, to correct mistakes and get the best mark. Some tasks sections require you to finish the whole section before running the checking program at the end; you may not always be able to run the checking program successfully after every single task step.

  3. When you are done with checking this assignment, and you like what you see on your screen, redirect the output of the Checking Program into the text file assignment13.txt under your assignment13 directory on the CLS. Use the exact name assignment13.txt in your assignment13 directory. You only get one chance to get the name correct. Case (upper/lower case letters) matters. Be absolutely accurate, as if your marks depended on it. Do not edit the file.

  4. Transfer the above assignment13.txt file from the CLS to your local computer and verify its contents. Do not edit this file! No empty files, please! Edited or damaged files will not be marked. You may want to refer to your File Transfer notes.

  5. Submit the assignment13.txt file under the correct Assignment area on Blackboard (with the exact name) before the due date. Upload the file via the assignment13 “Upload Assignment” facility in Blackboard: click on the underlined assignment13 link in Blackboard. Use “Attach File” and “Submit” to upload your plain text file.

    No word-processor documents. Do not send email. Use only “Attach File”. Do not enter any text into the Submission or Comments boxes on Blackboard; I do not read them. Use only the “Attach File” section followed by the Submit button. (If you want to send me comments about your assignment, use email.)

  6. Your instructor may also mark the assignment13 directory in your CLS account after the due date. Leave everything there on the CLS. Do not delete any assignment work from the CLS until after the term is over!

Use the exact file name given above. Upload only one single file of plain text, not HTML, not MSWord. No fonts, no word-processing. Plain text only.

Did I mention that the format is plain text (suitable for VIM/Nano/Pico/Gedit or Notepad)?

NO EMAIL, WORD PROCESSOR, PDF, RTF, or HTML DOCUMENTS ACCEPTED.

No marks are awarded for submitting under the wrong assignment number or for using the wrong file name. Use the exact name given above.

WARNING: Some inattentive students don’t read all these words. Don’t make that mistake! Be exact.

READ ALL THE WORDS. OH PLEASE, PLEASE, PLEASE READ ALL THE WORDS!

Author: 
| Ian! D. Allen  -  idallen@idallen.ca  -  Ottawa, Ontario, Canada
| Home Page: http://idallen.com/   Contact Improv: http://contactimprov.ca/
| College professor (Free/Libre GNU+Linux) at: http://teaching.idallen.com/
| Defend digital freedom:  http://eff.org/  and have fun:  http://fools.ca/

Plain Text - plain text version of this page in Pandoc Markdown format

Campaign for non-browser-specific HTML   Valid XHTML 1.0 Transitional   Valid CSS!   Creative Commons by nc sa 3.0   Hacker Ideals Emblem   Author Ian! D. Allen