Due date: (Not due)
Note, you must have formed groups and received your machine and root password from the TAs before starting this project.
The last project for this course will involve modifying the Linux kernel. This project is designed to get you familiar with the Linux system: how to create and add users, how to use some common Unix tools, where the kernel (the operating system) source code is located, how to re-compile the kernel and reboot, and how to save your work onto the Fossil server. The set of commands is not intended to be exhaustive. Rather, it is to get you started on the kinds of things you will need to do for future projects.
As you work the project below, feel free to explore further than the basic commands below, if you so desire. Refer to the Hotlinks section for more information on Linux and the Fossil lab. You may also send questions to the TA mailing list at cs3013_ta@cs.wpi.edu.
Have fun!
This project primarily involves running the following commands in a
"cookbook-like" fashion and then answering some simple questions. For
any of the commands listed below, you may use the man
command to get more information. You should consider getting familiar
with reading Linux man
pages as one of the goals of this
projects, too.
You will be the system administrator for your Linux machine for the
entire term. Fortunately, this will not typically involve much
effort, as each machine is configured to provide the necessary initial
configuration to do all projects. Here, you will create some user
accounts and give them the ability to access system-private stuff as
root
.
Carry out following steps:
root
. You should then
change the root password on the first login. Choose a smart password.
Remember, if the machine is compromised, it will hurt you the most!
useradd
.
You may want to use the -m
flag, too.
passwd
command.
sudo
permissions to the new account by editing
the file /etc/sudoers
with your favorite editor
(emacs
, vi
or pico
, say). If
you like vi
, you might consider running the command
visudo
. Add a line to the end of the
sudoers
file that looks like:
newuser ALL=(ALL) ALLreplacing "newuser" with your new account name.
/etc/group
). You'll need this to get access to linux
kernel sources.
chmod -R o-rwx
/usr/src/linux*
login
or su
. From a different Fossil machine use
slogin
or ssh
. From a different WPI machine, you
must first login to the Fossil server (fossil.wpi.edu
) using
slogin
or ssh
.
passwd
to change your password or
chsh
to change your shell as desired.
userdel
,
with a -r
option to remove home directories. Please note
that the user accounts "guest" and "admin" should never be deleted.
If you ever find a machine with the "guest" account not working,
please report it to the TA mailing list (cs3013_ta@cs.wpi.edu).
After the above steps, you will typically log into your machine as
a normal user and then use the sudo
command to perform
any commands that require root access. This is the preferred
method used below.
Here, you will find where the Linux source code is located, how many lines of code it is, how large the "core" part of the kernel is and locate some specific kernel modules.
cd /usr/src/linux
.
find
to see how many files there are.
find | wc -l
to count how many
files there are.
find -name '*.c'
to see how many
.c
files there are.
/usr/src/linux/kernel
,
the core part of the Linux operating system) by Linus Torvalds using:
grep -l Linus `find -name '*.c'` | wc -l
Some of the projects you do for this class will involve re-compiling the kernel and rebooting. You will re-compile the kernel, set it up so that your new kernel will be used instead of the default kernel, and then reboot.
/usr/src/linux
.
sudo make xconfig
. (Enter your user password,
if requested by sudo
.) Normally, you would customize
any aspects of the kernel you need to. In this case, just
select "Save and Exit."
sudo make dep
to set up all the dependencies
correctly.
sudo make bzImage
to create a compressed kernel
image. This will take some time and you can watch the new kernel
being built, or go out for a quick cup of coffee and come back. When
done, you should have a new kernel in
/usr/src/linux/arch/i386/boot/bzImage
.
cp /usr/src/linux/arch/i386/boot/bzImage
/boot/vmlinuz.proj0
.
/etc/lilo.conf
(using sudo
and your favorite
editor) and add the following lines to the end of the file:
image = /boot/vmlinuz.proj0 root = /dev/hda5 label = proj0
sudo /sbin/lilo
.
who
command. If there is, ask them to log out (use talk
or
write
or something similar). Once they log out, use
sudo /sbin/reboot
to reboot the machine. Note, in
general, if you cannot reach a remotely logged in user and need to
reboot, you may try using sudo /sbin/shutdown -r +5
to
reboot it in 5 minutes, sending out warning messages periodically.
proj0
to select the new kernel you have for booting.
You can use /sbin/reboot
to reboot and then select
"linux" to get back to the original kernel.
All the client machines are on a private network. The only remote
access to the rest of WPI (and the rest of the Internet) is through
the Fossil server (fossil.wpi.edu
), which is a
Firewall.
Your client machines are not backed up. You should save your source code and any other class-specific files by copying the files to the Fossil server, which is backed up nightly.
ssh ccc.wpi.edu
and login to a CCC machine (bert
, reno
...).
ping
, of course) your
assigned machine.
slogin fossil.wpi.edu
and log into the server
(using the account given to you by the TAs).
slogin
to log into your assigned machine.
scp /usr/src/linux/.config
fossil:/home/newuser/config.save
to save the linux kernel
configuration to the fossil server, replacing "newuser" with your
login name. In general, you should use scp
to backup
your work to the fossil server.
Answer the following questions:
.c
are there in the Linux kernel?
make
bzImage
command) the first time? If you run the same command a
second time, how long does it take?
ping
your assigned
machine from wpi.wpi.edu
? What does it say if you
try and ping wpi.wpi.edu
from your assigned machine?
The main Fossil home page is at http://fossil.wpi.edu. It has additional information on the Lab itself, system administration, and Linux.
Send all project questions to the TA mailing list.
Send all Fossil administrative questions to the Fossil mailing list.