Exercise 2 – Manage SystemBoot

Booting a system refers to initialisation various parameters of the system or any hardware device. The booting process loads various files and libraries from the operating system.

In this exercise, you will understand the files used in the system bootup process and boot events.

Please refer to your course material or use your favourite search engine to research for more information about this topic.

Task 2 – Understand Upstart

Upstart is a new package that replaces the traditional package, sysvinit. Upstart is an event-driven process and is backward compatible with sysvinit. Using upstart, you can manage the tasks and services that need to start during system boot-up, manage the services while system is running, and stopping the tasks and services during system shutdown. A number of these default jobs are installed into the /etc/init directory.

In this task, you will learn to use upstart.

Step 1

Clear the screen by entering the following command:

Clear

Note: The clear command is used before every step to enable the learners to get a clear view of the output of each command. Otherwise, it is not mandatory to use the clear command before every command.

To view the list of services running on the system, enter the following command:

initctl list

More Info : If your linux terminal keep show you error messages, check this article.
https://graycs.home.blog/2019/02/08/linux-centos-ubuntu-list-services-that-start-on-startup/

Step 2

Clear the screen by entering the following command:

clear

Upstart manages a number of jobs that are stored in the /etc/init directory.

To view the jobs stored in this directory, enter the following command:

ls -l /etc/init

Step 3

Clear the screen by entering the following command:

clear

To view a file, enter the following command:

cat /etc/init/console.conf

Note: You may choose to open any configuration file from this directory.

In the output, specific runlevels for the start and stop are defined. In the given result for console.conf, the service will start when the system reaches runlevel 2, 3, 4, or 5. The service will stop if whenever system is not at the runlevel 2, 3, 4, or 5.

Task 3 – Check Boot Events in the Log Files

In Linux, log files are stored in the /var/log/ directory. The /var/log/ directory contains a number of subdirectories that contain logs for specific purpose, such as printer and user login.

The key subdirectories in /var/log/ directory are:

  • /var/log/messages: Contains general log messages
  • /var/log/boot: Contains system boot log messages
  • /var/log/debug: Contains debugging log messages
  • /var/log/auth.log: Contains user login and authentication logs messages
  • /var/log/daemon.log: Contains running services messages
  • /var/log/dmesg: Contains Linux kernel ring buffer log messages
  • /var/log/dpkg.log: Contains binary package log including package installation messages
  • /var/log/faillog: Contains failed login log messages
  • /var/log/kern.log: Contains kernel messages
  • /var/log/lpr.log: Contains printer messages
  • /var/log/mail.*: Contains mail server messages
  • /var/log/mysql.*: Contains MySQL server messages
  • /var/log/user.log: Contains userlevel logs messages
  • /var/log/xorg.0.log: Contains X.org messages
  • /var/log/apache2/*: Contains Apache Webserver messages
  • /var/log/lighttpd/*: Contains Lighttpd Webserver messages
  • /var/log/fsck/*: Contains fsck messages
  • /var/log/apport.log: Contains application crash report messages

In this task, you will view the system boot messages in the /var/log/boot log.

To view the boot events, perform the following steps:

Step 1

To view the logs files in the /var/log directory, enter the following command:

ls /var/log
Fedora linux and Ubuntu linux

Step 2

To view the events in the boot log, enter the following command:

cat /var/log/boot.log
Only fedora distribution showed the list.

Step 3

Clear the screen by entering the following command:

clear

To view the events in the kernel log, which stores the booting events, enter the following command:

cat /var/log/syslog
This time, only ubuntu showed the list.

Step 4

Clear the screen by entering the following command:

clear

You can also view the dmesg log to obtain information about the system hardware. The dmesg can be useful when you are trying to troubleshoot a system hardware issue.

To view the dmesglog, enter the following command:

dmesg

Note: Executing the dmesg displays all the kernel messages. The long list of messages appears with a big vertical scroll. To view all the messages page-by-page, you can use the piping method (less command).

Step 5

Clear the screen by entering the following command:

clear

You can also capture specific information using the dmesg command. For example, if you want to capture serial port specific message, enter the following command:

dmesg | grep -i tty

Step 6

To find out the amount of physical memory in a system, enter the following command:

dmesg | grep -i memory

Step 7

Clear the screen by entering the following command:

clear

The output of the dmesg command is maintained at the following path:/var/log/dmesg

To view the contents of the /var/log/dmesg file, enter the following command:

cat /var/log/dmesg | less

Note: Continue to hit Enter to keep viewing the dmesg logs. You can break the command using CTAL +C to return to the command prompt.
In my case, Control + z worked.

Leave a comment