Book Title: eTextbook: COMPTIA Linux Guide to Linux Certification
Chapter 8. System Initialization, X Windows, and Localization
Hands-On Projects
Hands-On Projects
454
These projects should be completed in the order given. The hands-on projects
presented in this chapter should take a total of three hours to complete. The
requirements for this lab include:
A computer with Fedora Linux installed according to Hands-On Project
2-1 and Ubuntu Server Linux installed according to Hands-On Project 6-
7.
Project 8-1
In this hands-on project, you use and configure the GRUB2 boot loader on
Fedora 28.
Boot your Fedora Linux virtual machine. After your Linux system
1
has been loaded, switch to a command-line terminal (tty5) by
pressing Ctrl+Alt+F5 and log in to the terminal using the user
name of root and the password of LINUXrocks!.
At the command prompt, type less /boot/grub2/grub.cfg and press
2
Enter. Which line sets the default timeout for user interaction at
the boot screen? Examine the menuentry paragraphs. Do many of
the options match those in the original GRUB bootloader?
At the command prompt, type vi /etc/default/grub and press
3
Enter to edit the GRUB2 configuration file. Change the value of
GRUB_TIMEOUT to 30 . Save your changes and quit the vi editor.
At the command prompt, type grub2-mkconfig –o
4
/boot/grub2/grub.cfg and press Enter to rebuild the GRUB2
configuration file with your change.
Reboot your system by typing reboot and pressing Enter. At the
5
GRUB2 boot screen, view the available options. How long do you
have to interact with the GRUB2 boot loader after POST before the
default operating system is booted? Next, press c to obtain a
command prompt.
At the grub> prompt, type help and press Enter to see a list of
6
available commands, pressing the spacebar to cycle through the
entire list. Next, type lspci and press Enter to see a list of detected
PCI devices. Following this, type list_env and press Enter to view
the variables present. By default, there should be a single variable
called saved_entry that lists the default OS that is booted by GRUB2
(the previously chosen OS stored within /boot/grub/grubenv). Type
reboot and press Enter to reboot your system.
At the GRUB2 boot screen, press e to edit your configuration.
7
Where did you see these contents recently?
Locate the first line that starts with the word “linux” and navigate
8
to the end of this line (the last two keywords on this line should be
rhgb and quiet). Add the word single after the word quiet and
press F10 to boot your modified configuration. What does this
option tell the boot loader to do?
Supply your root password of LINUXrocks! when prompted.
9
At the command prompt, type runlevel and press Enter. What is
10
your current runlevel? What is the most recent runlevel?
455
At the command prompt, type cat /proc/cmdline and press Enter.
11
Note the command that was used to start your current Linux
kernel.
Reboot your system by typing reboot and pressing Enter. Allow
12
your system to boot normally.
Project 8-2
In this hands-on project, you explore and configure the SysV and Systemd
system initialization processes on Fedora 28.
Switch to a command-line terminal (tty5) by pressing Ctrl+Alt+F5
1
and log in to the terminal using the user name of root and the
password of LINUXrocks!.
At the command prompt, type runlevel and press Enter. What is
2
your current runlevel? What is the most recent runlevel?
At the command prompt, type cat /etc/inittab and press Enter.
3
View the commented sections. Why is /etc/inittab not used in
Fedora 28?
At the command prompt, type ls /lib/systemd/system and press
4
Enter. What do the contents represent?
At the command prompt, type ls /etc/rc.d and press Enter. Do you
5
see init.d and rc[runlevel].d subdirectories? Why?
At the command prompt, type ls /etc/rc.d/init.d and press Enter.
6
Which UNIX SysV daemons are available on Fedora 28?
At the command prompt, type chkconfig --list livesys and press
7
Enter. In which runlevels is the livesys daemon started by default?
At the command prompt, type chkconfig --level 2345 livesys on
8
and press Enter to configure the livesys daemon to start in
runlevels 2 through 5. Next, type ls /etc/rc.d/rc[2-5].d and press
Enter. Does the symbolic link to the livesys rc script start with S?
Why?
At the command prompt, type init 3 and press Enter to switch to
9
runlevel 3 (multi-user.target). Note that you are on tty1 and the
gdm is not loaded. Log in to the terminal using the user name of
root and the password of LINUXrocks!.
Next, type runlevel and press Enter. What is your current and
10
most recent runlevel?
At the command prompt, type init 1 and press Enter to switch to
11
single user mode (rescue.target). Supply the root password of
LINUXrocks! when prompted.
Next, type runlevel and press Enter. What is your current and
12
most recent runlevel?
At the command prompt, type systemctl isolate graphical.target
13
and press Enter to switch to runlevel 5 (graphical.target). Note
that the gdm is loaded. Press Ctrl+Alt+F5 and log in to the
terminal using the user name of root and the password of
LINUXrocks!.
At the command prompt, type systemctl status crond.service
14
and press Enter. Is the Systemd cron daemon running? Press q to
return to your command prompt.
At the command prompt, type systemctl restart crond.service
15
and press Enter to restart the cron daemon.
456
At the command prompt, type systemctl disable crond.service
16
and press Enter to prevent the system from starting the cron
daemon in your current runlevel/target. Note that the existing
symbolic link in the crond.service rc script is removed. Why was
this link from the /etc/systemd/system/multi-user.target.wants
directory instead of the /etc/systemd/system/graphical.target.wants
directory?
At the command prompt, type systemctl enable crond.service
17
and press Enter to start the cron daemon in your current
runlevel/target. Was the symbolic link re-created?
At the command prompt, type service livesys restart and press
18
Enter. Note that Systemd restarted the UNIX SysV netconsole
daemon using the systemctl command because Systemd is
backwards compatible with UNIX SysV.
At the command prompt, type exit and press Enter to log out of
19
your shell.
Project 8-3
In this hands-on project, you configure a basic rc script that is used to execute a
shell script (/bootscript.sh) during the Systemd system initialization process on
Fedora 28.
Switch to a command-line terminal (tty5) by pressing Ctrl+Alt+F5
1
and log in to the terminal using the user name of root and the
password of LINUXrocks!.
At the command prompt, type vi /bootscript.sh and press Enter.
2
Add the following lines. When finished, save and quit the vi editor.
At the command prompt, type chmod u+x /bootscript.sh and
3
press Enter to ensure that the newly created script can be
executed by the system.
At the command prompt, type vi
4
/etc/systemd/system/bootscript.service and press Enter. Add the
following lines. When finished, save and quit the vi editor.
At the command prompt, type systemctl start bootscript.service
5
and press Enter. Next, type journalctl | tail at the command
prompt and press Enter. Did your boot script execute
successfully? How can you tell?
At the command prompt, type systemctl enable
6
bootscript.service and press Enter. Why was a symbolic link
created in the /etc/systemd/system/multi-user.target.wants/
directory?
457
At the command prompt, type reboot and press Enter. After the
7
system has rebooted, press Ctrl+Alt+F5 and log in to the terminal
using the user name of root and the password of LINUXrocks!.
At the command prompt, type journalctl | grep -i "Boot script"
8
and press Enter. Note the timestamps shown. Did your boot script
execute successfully during the previous boot?
At the command prompt, type poweroff and press Enter to power
9
off your Fedora Linux virtual machine.
Project 8-4
In this hands-on project, you explore and configure the upstart and SysV
system initialization processes on Ubuntu Server 14.04.
Boot your Ubuntu Server Linux virtual machine. After your Linux
1
system has been loaded, log into tty1 using the user name of root
and the password of LINUXrocks!.
At the command prompt, type runlevel and press Enter. What is
2
your current runlevel? What is the most recent runlevel?
At the command prompt, type ls /etc/init.d and press Enter. What
3
do the contents represent?
At the command prompt, type ls /etc/init and press Enter. What
4
do the contents represent?
At the command prompt, type cat /etc/init/ssh.conf and press
5
Enter. In which runlevels is the ssh daemon started?
At the command prompt, type restart ssh and press Enter. Why
6
did the restart command successfully restart the ssh daemon?
At the command prompt, type ls /etc/rc2.d and press Enter. Are
7
there any traditional UNIX SysV daemons started in your current
runlevel? Why? Is the postgresql daemon started before or after
the apache2 daemon? Why?
At the command prompt, type restart postgresql and press Enter.
8
Why did you receive an error message?
At the command prompt, type /etc/init.d/postgresql restart and
9
press Enter. Did the postgresql daemon restart?
At the command prompt, type update-rc.d –f postgresql remove
10
and press Enter to remove the symbolic links that start the
postgresql daemon. Which runlevels was the postgresql daemon
originally started in?
At the command prompt, type update-rc.d postgresql defaults
11
and press Enter to configure the symbolic links to start the
postgresql daemon in runlevels 2 through 5.
At the command prompt, type telinit 6 and press Enter to reboot
12
your system. Could you have used the init command in place of the
telinit command?
Once your system has rebooted, log into tty1 using the user name
13
of root and the password of LINUXrocks!.
At the command prompt, type poweroff and press Enter to power
14
off your Ubuntu Server Linux virtual machine.
458
Project 8-5
In this hands-on project, you start X Windows without the gdm as well as
examine X Windows configuration utilities, accessibility options, and
localization.
Boot your Fedora Linux virtual machine. After your Linux system
1
has been loaded, switch to a command-line terminal (tty5) by
pressing Ctrl+Alt+F5 and log in to the terminal using the user
name of root and the password of LINUXrocks!.
At the command prompt, type init 3 and press Enter to switch to
2
runlevel 3 (multi-user.target). Note that the gdm is no longer
loaded in tty1. Log into tty1 using the user name of root and the
password of LINUXrocks!.
At the command prompt, type startx and press Enter. What
3
desktop environment was loaded by default and why? Because the
root user has not logged into GNOME previously, you will be
prompted to choose GNOME preferences.
a. At the Welcome screen, ensure that English (United
States) is selected and click Next.
b. At the Input Sources screen, ensure that the English (US)
keyboard layout is selected and click Next.
c. At the Privacy screen, turn off both options and click Next.
d. At the Online Accounts screen, click Skip to bypass
personal account configuration.
e. On the Ready to Go screen, click Start using Fedora.
f. Close the Getting Started window.
Click the power icon in the upper-right corner of the GNOME
4
desktop, click root, Log Out, and then click Log Out again to log
out of the GNOME desktop. Were you returned to your original
BASH shell on tty1?
At the command prompt, type init 5 and press Enter to switch to
5
runlevel 5 (graphical.target). Note that the gdm is now loaded in
tty1. Log into the GNOME desktop using your user name and the
password of LINUXrocks!.
Click the Activities menu and navigate to Show Applications,
6
Settings. Navigate to Devices, Displays and note that you can
configure the resolution for your current display, which is limited
by the virtualized graphics adapter provided by your hypervisor.
Next, click the Back button in the upper-left corner of the Settings
application and select Universal Access. Explore the different
assistive technologies available and close the Settings window
when finished.
Click the Activities menu and navigate to Show Applications,
7
Utilities, Terminal to open a command-line terminal. At the
command prompt, type su - root and press Enter to switch to the
root user. Supply the root user password of LINUXrocks! when
prompted.
At the command prompt, type system-config-keyboard and press
8
Enter. Note that your default keyboard matches the localization
options you specified during installation, but that you can
optionally choose a different keyboard for use with X Windows.
Use the Tab key to select the Cancel button and press Enter to quit
the Keyboard Selection utility.
459
At the command prompt, type cat /etc/X11/xorg.conf.d/00-
9
keyboard.conf and press Enter. Note the keyboard localization
used by X Windows.
At the command prompt, type locale and press Enter. Which
10
locale is used by default for all format types? Next, type locale -a |
less and press Enter. View the available locales on your system
and press q to return to your command prompt when finished.
At the command prompt, type cat /etc/locale.conf and press
11
Enter. Next, type localectl and press Enter. Does the default
locale listed by both commands match the output of the previous
step?
At the command prompt, type timedatectl and press Enter. Next,
12
type ll/etc/localtime and press Enter. Does the output of each
command indicate the correct time zone information for your
system?
At the command prompt, type poweroff and press Enter to power
13
off your Fedora Linux virtual machine.
Book Title: eTextbook: COMPTIA Linux Guide to Linux Certification
Chapter 8. System Initialization, X Windows, and Localization
Discovery Exercises
Discovery Exercises
1. Describe what would happen if you changed the default
runlevel/target on your system to runlevel 6 or reboot.target.
2. On your Ubuntu Server 18 virtual machine, explore the available
system initialization processes available. Does Ubuntu Server 18
contain Systemd, upstart, or SysV processes? Use the appropriate
commands to view, start, and stop daemons, as well as configure
them to start within a particular runlevel/target.
3. On your Ubuntu Server 14 virtual machine, perform the same steps
that you performed in Project 8-1. In order to accomplish this, you’ll
need to remember that Ubuntu Server uses slightly different names
for GRUB2 configuration files and commands.
4. On your Ubuntu Server 14 virtual machine, use the appropriate
commands to explore the localization options available. When
finished, explore the same options on your Ubuntu Server 18 virtual
machine.
5. Use the Internet to learn more about three Linux window managers
or desktop environments that were not discussed in this chapter. For
each, describe its common usage and benefits over other window
managers and desktop environments. In addition, list how each was
developed.