Updated: 2014-04-14 14:29 EDT
Do not print this assignment on paper!
- On paper, you will miss updates, corrections, and hints added to the online version.
- On paper, you cannot follow any of the hyperlink URLs that lead you to hints and course notes relevant to answering a question.
- On paper, scrolling text boxes will be cut off and not print properly.
23h59 (11:59pm) Thursday April 17, 2014 (end of Week 14)
Do not print this assignment on paper! On paper, you cannot follow any of the hyperlink URLs that lead you to hints and course notes relevant to answering a question.
This is an overview of how you are expected to complete this assignment. Read all the words before you start working.
Do not print this assignment on paper. On paper, you cannot follow any of the hyperlink URLs that lead you to hints and course notes relevant to answering a question. You also don’t get any of the later updates to the assignment. Do not print this assignment on paper.
You will create filesystem structure in your CLS home directory containing various directories and files. You will also make changes in your own Linux Virtual Machine running CentOS 6.5. You can use the Checking Program to check your work as you do the tasks. You can check your work with the checking program as often as you like before you submit your final mark. Some task sections below require you to finish the whole section before running the checking program; you may not always be able to run the checking program successfully after every single task step.
When you are finished the tasks, leave the files and directories in place on both the CLS and your own Linux Virtual Machine 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 on the CLS; you must have your term work available on the CLS right until term end.
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 mistakes detected by the Checking Program.
The current term’s 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 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.
All references to the “Source Directory” below are to the CLS directory ~idallen/cst8207/13f/assignment14/
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
(seven letters).
You do not have permission to list the names of all the files in the Source Directory, but you can access any files whose names you already know.
Review course notes Booting and GRUB.
Use the on-line help (man
command) for the commands listed below for more information.
chkconfig
– display or change Run Level information and servicesgrub
– GRand Unified Bootloader (legacy version 0.9x - not the Version 2 GRUB numbered 1.9x). The man page is useless. See this instead: GRUB manualrunlevel
– display previous and current Run Leveltelinit
– change Run Levelsuname
– print system information: display system name, kernel release and version number, machine, processor, and O/S type/etc/inittab
– documentation on Run Levels; contains the default Run Level/boot/grub/grub.conf
– the GRUB Legacy (version 1) configuration fileMost of the commands in this assignment require root
privilege. You must use the su
command to start a shell with the permissions of another user. The root
user can use su
to become any other user without requiring a password.
If you start a root
subshell, your prompt will tell you if you are the root
user by changing to include a #
character instead of a $
character. You can also use the commands id
or whoami
to show your current userid.
Some answers require you to record command lines. Do not include the shell prompt with your command lines. Give only the part of the command line that you would type yourself.
Make sure you know the difference between a command line (which is what you type into the shell) and command output (which is what the command displays on your screen). Pay attention to whether the question asks you to record the command line or the command output.
I recommend that once you have booted your CentOS VM, you connect to it and work using a remote login session (e.g. ssh
or PuTTY
) where copy-and-paste works and where you can have multiple simultaneous connections into the VM. The VMware console is not friendly.
If you can’t get an SSH (PuTTY or ssh
) connection working into your Linux VM, see the Network Diagnostics page.
Note that SSH sessions (and whatever you are doing inside them) do not survive across a VMware suspend. Make sure you save your editor files and exit your SSH session before you pause or suspend your virtual machine. (Editor sessions that run inside the VMware console do survive across suspend and resume, since they don’t depend on a network connection.)
Advanced users may look into the various virtual terminal programs such as
tmux
andscreen
that do allow you to suspend and resume your sessions even from a remote login.
answer.txt
IndexWhere you are required to record or save a command line or its output into The Answer File, do the command and then copy and record the command line or its output as a separate line into an answer.txt
file in your CentOS assignment14
directory. You will be told how many lines to save in the file.
If you can’t answer a question, leave a blank line in this answer file. (The vim
option :set number
may be useful to you as you edit.)
You can use either nl
or cat -n
to show the contents of a file with line numbers, to make sure each answer is on its correct line number.
Do a Remote Login to the Course Linux Server (CLS) from any existing computer, using the host name appropriate for whether you are on-campus or off-campus.
Create the CLS directory ~/CST8207-14W/Assignments/assignment14
Create the check
symbolic link needed to run the Checking Program, as described in the section Part II - Check and Submit below.
Run Part II - Check and Submit to verify your work so far.
~/CST8207-14W/Assignments/assignment14
(the same hierarchy as you have already made on the CLS).This CentOS assignmment14
directory is the base directory for all pathnames in this assignment. Store your CentOS files and answers below in this base assignment14
directory.
Run the Fetch and Checking Program to verify your work so far.
Review Booting and GRUB.
You can select a different GRUB configuration file at boot time.
Record the number of lines in a standard Linux boot menu entry as Line 1 in The Answer File (one number).
myconfig
in its same grub
directory.
myconfig
file:
title
line of the only boot menu entry in the file, change the word CentOS
to MY OWN CentOS
myconfig
file.Compare the current GRUB configuration file with the new myconfig
GRUB configuration file. The new file should have two more words. A file difference using the diff
command should show the one line change:
$ diff grub.conf myconfig
14c14
< title CentOS (2.6.32-431.el6.i686)
---
> title MY OWN CentOS (2.6.32-431.el6.i686)
You can preview much of a GRUB configuration file from multi-user mode without having to reboot the system to test it, but you can’t actually select a new kernel until you reboot.
myconfig
GRUB configuration file in its correct partition.
(xxx,x)/xxxxx
GRUB can be run as a shell-like utility that has many built-in commands. Start the command-line GRUB utility by running the command named grub
as root
from your shell without rebooting the machine. When you run this grub
command you will see a grub>
prompt:
# grub
Probing devices to guess BIOS drives. This may take a long time.
GNU GRUB version 0.97 (640K lower / 3072K upper memory)
[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename.]
grub>
The comments about TAB completion don’t apply to this command-line version of GRUB. (Sorry – this is a bug!) TAB only works when GRUB is run at boot time as the boot loader.
help
at thegrub>
prompt to see a partial list of GRUB utility commands. You can also type help commandname
to get a bit more help on commandname
^C
will also terminate this GRUB utility.)Note (and try) which GRUB command will display partitions on a disk:
grub> geometry (hd0)
drive 0x80: C/H/S = 261/255/63, The number of sectors = 4194304, /dev/sda
Partition num: 0, Filesystem type is ext2fs, partition type 0x83
Partition num: 1, Filesystem type unknown, partition type 0x82
grub> geometry (hd1)
drive 0x81: C/H/S = 130/255/63, The number of sectors = 2097152, /dev/sdb
Partition num: 0, Filesystem type is ext2fs, partition type 0x83
Partition num: 1, Filesystem type is ext2fs, partition type 0x83
Partition num: 3, Filesystem type is fat, partition type 0xc
Partition num: 4, Filesystem type unknown, partition type 0x82
Partition num: 5, Filesystem type unknown, partition type 0x7
GRUB is not very intelligent about the file systems inside partitions. Above, it mistakes both ext3
and ext4
file systems as type ext2fs
. (You can actually mount both ext3
and ext4
file systems as type ext2
and the journalling feature will be disabled. Don’t do it!)
Note (and try) which GRUB command displays (and sets) the current partition/device prefix, and which command displays a text file:
grub> cat /etc/hosts
Error 1: Invalid device requested
grub> root
(fd0): Filesystem type unknown, partition type 0x0
grub> root (hd0,0)
Filesystem type is ext2fs, partition type 0x83
grub> root
(hd0,0): Filesystem type is ext2fs, partition type 0x83
grub> cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
127.0.0.2 abcd0001
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
myconfig
file name:
configfile
command you will need to specify both the partition and the pathname to the new GRUB configuration file you edited above.When you get the configfile
command and GRUB pathname to your myconfig
file right, you will see output similar to this:
GNU GRUB version 0.97 (640K lower / 3072K upper memory)
-------------------------------------------------------------------
0: MY OWN CentOS (2.6.32-431.el6.i686)
-------------------------------------------------------------------
Use the ^ and v keys to select which entry is highlighted.
Press enter to boot the selected OS, 'e' to edit the
commands before booting, 'a' to modify the kernel arguments
before booting, or 'c' for a command-line.
Ignore the information about which keys work – none of these keys work in this command-line version of GRUB. The keys only work after a reboot in the boot loader version of GRUB. We are only using GRUB in command-line mode to preview our GRUB menu to make sure it works.
MY OWN CentOS
menu, break out of (interrupt) the GRUB utility and return to the BASH shell prompt.
MY OWN CentOS
menu, edit and fix the myconfig
file until you do.MY OWN CentOS
menu entry, as shown above, you are ready to try your new file in the real GRUB boot process:
grub>
prompt.grub>
prompt, use the exact same configfile
line you used earlier to select your new myconfig
GRUB configuration file. (In this boot loader version of GRUB, TAB completion now works for both GRUB command names, disk names, partition names, and file names. Use TAB to help you type the correct GRUB command line.)MY OWN CentOS
menu entry, like this:Run the Fetch and Checking Program to verify your work so far.
See the course notes on Legacy Run Levels and Services. As with most system maintenance activities, you will need to use the root
user to run the privileged commands in this section.
root
) sysadmin account.
Use a command to list all services and all run level information into file chkconfig-before.txt
in your CentOS assignment14
directory. It should be approximately 22 lines. Two of the lines should look like this:
ntpdate 0:off 1:off 2:off 3:off 4:off 5:off 6:off
postfix 0:off 1:off 2:on 3:on 4:on 5:on 6:off
Use the same command name to enable (turn on) the NTP Date service only in Run Level 4 (a normally unused Run Level in CentOS).
Use the same command name to disable (turn off) the above Postfix Mail Service service in Run Level 4.
Save a second listing of all services and all run levels into file chkconfig-after.txt
in your CentOS assignment14
directory. It should still be approximately 22 lines. Two of the lines should now look like this:
ntpdate 0:off 1:off 2:off 3:off 4:on 5:off 6:off
postfix 0:off 1:off 2:on 3:on 4:off 5:on 6:off
Use the diff
command to compare the before listing file with the after listing file. Only two lines should have changed.
postfix
.
postfix.txt
file.Record as Line 5 in The Answer File the Linux absolute pathname of the system configuration file that gives the default Run Level for your CentOS system.
Record as Line 6 in The Answer File the one line from the above system configuration file that sets the default Run Level for your CentOS system. (Hint: It’s the only non-comment line in the file!)
Use a command to confirm that your current Run Level is the same as the CentOS default Run Level. (This should be true unless you are running in single-user mode, which you should not be.)
udev
event manager will retrigger some events.ntpdate
service will try to synchronize the time, and fail.Use the command that displays the previous and current Run Level (two words on one line) and record this line of output as Line 7 in The Answer File.
ntpdate
service did not work:
ntpdate
talks about a socket being in use.ntpdate
log message as Line 9 in The Answer File.postfix
userid.
postfix
userid will be found. (You might see a process run by you, searching for postfix
.)udev
event manager will retrigger some events.Use the command that displays the previous and current Run Level (two words on one line) and record this line of output as Line 10 in The Answer File.
Confirm that the postfix
processes are again running.
Run the Fetch and Checking Program to verify your work so far.
See the section on Starting and Stopping Services in the Booting and GRUB page. As with most system maintenance activities, you will need to use the root
user to run the privileged commands in this section.
Make sure your system is running as the default CentOS Run Level.
postfix
service:
pid
of the service and say that it is running.pid
) as Line 11 in The Answer File.postfix
service:
Shutting down postfix: [ OK ]
postfix
service:
postfix
service:
Starting postfix: [ OK ]
ntpdate
service:
[FAILED]
Run the Fetch and Checking Program to verify your work so far.
That is all the tasks you need to do.
Check your work a final time using the Fetch and Checking Program and save the output on the CLS as described below. Submit your mark following the directions below.
Optional: Keeping your main CentOS Virtual Machine snapshot, remove any intermediate snapshots you no longer require, to free up disk space. - Be careful not to remove your current work!
Summary: Do some tasks, then run the Fetch and checking program to verify your work as you go. You can run the Fetch and checking program as often as you want. When you have the best mark, upload the marks file to Blackboard.
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.
The checking program resides on the Course Linux Server, but your work is on your CentOS Virtual Machine. There is a Fetch program that you must download and use on your CentOS Virtual Machine to copy information from your CentOS 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 CentOS Virtual Machine, you need to run the Fetch program again on CentOS 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 on your CentOS VM when you make changes on your CentOS Virtual Machine.
Do all the following steps on your CentOS Virtual Machine. Read through the whole list before you start typing anything. An example of what to type is given below the descriptions that follow.
Failure to read all the words will lock your account out of the CLS.
root
account (same userid as Blackboard).CST8207-14W/Assignments/assignment14
(use the same directory hierarchy as you already have in your own account on the CLS). This is your base directory for this assignment.curl
to get a copy of the Fetch program from the given URL into a file named do.sh
. Make sure you have a file named do.sh
in your sysadmin base directory. You only need to download this once per assignment.curl
program.$ whoami ; hostname ; pwd
abcd0001 # your userid, not abcd0001
abcd0001 # your userid, not abcd0001
/home/abcd0001/CST8207-14W/Assignments/assignment14
$ url=http://teaching.idallen.com/cst8207/14w/notes/data/assignment14do.sh
$ curl -A mozilla "$url" >do.sh
[... make sure you scroll right to read the full web URL above ...]
[... various download statistics print here ...]
$ fgrep -i 'error' do.sh # make sure no errors (no output)
$ head -n1 do.sh # make sure it's a shell script
#!/bin/sh -u
You must run the do.sh
script you just downloaded. You must run the script as the root
user with the USER
environment variable set to your own CLS account userid. (Do not use abcd0001
; use your own.) Failure to set the USER=
variable as shown below will cause your account to be locked out of the CLS.
Use su
to run the do.sh
script:
$ echo "$USER" ; pwd
abcd0001 # your userid, not abcd0001
/home/abcd0001/CST8207-14W/Assignments/assignment14 # your userid, not abcd0001
$ su -c "USER=$USER sh do.sh" # must be double quotes, not single
This do.sh
script runs a Fetch program that will connect from your CentOS machine to the CLS using your account name in the USER
variable. It will copy selected files from your CentOS machine to your assignment14
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, as shown below:
---------------------------------------------------------------------------
abcd0001: FETCH version 3. 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 assignment14fetch_server.sh version 9 run by abcd0001.
Please wait; collecting info from abcd0001 Virtual Machine
---------------------------------------------------------------------------
VM files collected into CST8207-14W/Assignments/assignment14/abcd0001.tar.bz on CLS.
Now running checking program for abcd0001 on CLS:
[... checking program output appears here ...]
tar
archive in your account under assignment14
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 CentOS VM and it will just check the existing files saved under assignment14
on the CLS..bashrc
file or world-writable files on the CLS). These errors are on the CLS, not on your CentOS machine.When you are done with your assignment, you need to run the checking program one last time on the CLS (not from CentOS) and submit the output file, as follows:
Do all this on the Course Linux Server when you are ready to submit:
There is a Checking Program named assignment14check
in the Source Directory on the CLS. Create a Symbolic Link to this program named check
under your new assignment14
directory on the CLS so that you can easily run the program to check your work and assign your work a mark on the CLS. Note: You can create a symbolic link to this executable program but you do not have permission to read or copy the program file.
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 fetched CentOS 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.)
Remember: The checking program does not fetch new files to the CLS from your CentOS VM. You must run the Fetch program on your CentOS VM to update the fetched files on the CLS so that the checking program can mark them on the CLS.
You may run the “check” program as many times as you wish, to correct mistakes and get the best mark. Some task 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.
assignment14.txt
under your assignment14
directory on the CLS. Use the exact name assignment14.txt
in your assignment14
directory. Case (upper/lower case letters) matters. Be absolutely accurate, as if your marks depended on it. Do not edit the file.
YOUR MARK for
assignment14.txt
file from the CLS to your local computer and verify that the file still contains all the output from the checking program. 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.
YOUR MARK for
Upload the assignment14.txt
file under the correct Assignment area on Blackboard (with the exact correct name) before the due date. Upload the file via the assignment14 “Upload Assignment” facility in Blackboard: click on the underlined assignment14 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 need to comment on any assignment submission, send me email.
You can upload the file more than once; I only look at the most recent. You must upload the file with the correct name; you cannot correct the name as you upload it to Blackboard.
You will also see the Review Submission History page any time you already have an assignment attempt uploaded and you click on the underlined assignment14 link.
You cannot delete an assignment attempt, but you can always upload a new version. I only mark the latest version.
Your instructor may also mark files in your 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!
I do not accept any assignment submissions by email. Use only the Blackboard Attach File. No word processor documents. Plain Text only.
Use the exact file name given above. Upload only one single file of Linux-format plain text, not HTML, not RTF, not MSWord. No fonts, no word-processing. Linux plain text only.
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 16-character, lower-case 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!