Lab 1 - Boot Management

Alexandru Calcatinge bio photo By Alexandru Calcatinge

In this laboratory you will exercise working with GRUB, system shutdown and restart, /proc filesystem and Kernel runtime parameters.

Contents:

Lab 1.1 Booting the system

Lab objective 1: Shutdown, halt, reboot

Lab objective 2: Booting into non-graphical mode from GRUB

Lab 1.2 Change Kernel runtime parameters

Lab objective 3: Working with the /proc filesystem

Lab objective 4: Change Linux Kernel runtime parameters

 


Laboratory objective 1: Shutdown vs. halt vs. reboot

Commands used: shutdown

Solution:

  1. Boot up the system. By default it will boot into Graphical mode. Open a terminal and reboot the system from the console using the command:
sudo shutdown -r now
  1. After reboot, do the same as in previous exercise and now execute the command:
sudo shutdown -h now

 

↑Top


Laboratory objective 2: Booting into non-graphical mode from GRUB

Solution:

For the purpose of this exercise, I strongly recommend testing on a virtual machine, not on a live system. My solution is given on a openSUSE Leap system inside a virtual machine.

  1. boot the system and when GRUB is loading, hit the key “e” on your keyboard. This will get you into editing the GRUB file.

  2. find the line in the file that says: linux /boot/vmlinuz-4.4.76-1-default root=UUID=d8bba85c-d1ec-4b77-814a-7210fcd22113fd ${extra_cmdline} resume=/dev/sda1 splash=silent quiet showopts - NOTE: your line could be different depending on the system, but what is important is to find the exact line that consists of the string: “splah=silent quiet” or something like this.

  3. set your cursor on that line and insert a “3” after the string quiet, so that it will look like this:

splah=silent quiet 3 showopts

The number 3 comes from init3, which represents the command mode specific runlevel.

NOTE: if you are working on a Debian based system (like Ubuntu, Debian or Mint) you should use runlevel 2 instead of 3, as runlevels 3,4 and 5 are not used by Debian based distros, compared to the rpm based ones like CentOS and OpenSUSE.

  1. now press Ctrl-x or F10 to continue to boot your system. Now it will boot in console mode, not Graphical mode.

  2. to get back to your graphical mode, you should use one of the following commands, depending on your Graphical Environment. In my case, on that virtual machine, openSUSE is running with XFCE, so I will have to do:

sudo systemctl start lightdm

lightdm is the default display manager for XFCE

If you have another graphical environment, you should use:

sudo systemctl start gdm - for standard GNOME sudo systemctl start lightdm - for Ubuntu running Unity sudo systemctl start mdm - for MATE and Cinnamon (in case of Mint) sudo systemctl start kdm - for KDE

 

↑Top


Laboratory objective 3: Working with the /proc filesystem

Commands used: sysctl, less, wc

 

Solution:

  1. explore the /proc filesystem - it represents the default method to handle processes and system information. /proc/sys is the place where you find information about your system devices, drivers and kernel features.

  2. to modify the kernel runtime parameters you will use the sysctl command. Use the -a option to see the complete list of Kernel parameters. Use it with a pipe to less, as the output is very large…

sudo sysctl -a | less
  1. to view the number of parameters that can be modified can be viewed with the command:
sudo sysctl -a | wc -l

My output is:

alexandru@linux-vje9:~> sudo sysctl -a | wc -l
 1193
  1. analyze a specific line, for example:
dev.cdrom.info = drive name: sr0

this indicates that sr0 (srzero) is an alias for the optical drive and that the kernel knows the drive as sr0 and uses that name to refer to it.

 

↑Top


Laboratory objective 4: Change and modify Linux Kernel runtime parameters

Commands used:cd, sysctl, echo

 

Solution:

The name of a parameter matches the directory structure inside /proc/sys.

  1. this is a test on some of the parameters, to see how the sysctl output relates to the /proc/sys/ directory
alexandru@linux-vje9:~> cd /proc/sys
alexandru@linux-vje9:/proc/sys> ls
abi debug dev fs kernel net vm
alexandru@linux-vje9:/proc/sys> sudo sysctl dev.cdrom.autoclose
[sudo] password for root:
dev.cdrom.autoclose = 1
alexandru@linux-vje9:/proc/sys> cat /proc/sys/dev/cdrom/autoclose
1
alexandru@linux-vje9:/proc/sys> sudo sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 0
alexandru@linux-vje9:/proc/sys> cat /proc/sys/net/ipv4/ip_forward
0
  1. modify the Linux Kernel parameters by using the sysctl command, with the -w option, the parameters name, the equal sign and the value to be changed. For example:
sudo sysctl -w net.ipv4.ip_forward=1
  1. try the same with the echo command and redirection:
echo 0 > /proc/sys/net/ipv4/ip_forward

 

↑Top