In this article, we’ve included 4th set of 10 basic Linux Interview Questions and detailed answers that will help candidates prepare for the Linux interview.
These Linux interview questions and answers will be useful for both freshers and experienced users.
It is very important for a Linux administrator to understand the Linux system boot process to troubleshoot boot problems.
In this session, we will show you an overview of the Linux boot process with a flowchart diagram for a better explanation.
In Linux, the traditional init (aka SysV init boot system) system booting process consists of 6 distinct stages.
'vmlinuz'
kernel image and extracts the contents of 'initrd'
image.'/sbin/init'
program.'/etc/inittab'
file and load the associated runlevel programs. Usually the system default run level would be 3 or 5.The following flowchart diagram shows how the boot process happens in systemd system.
The systemd system booting process consists of 5 distinct stages as shown below.
'vmlinuz'
kernel image and extracts the contents of 'initramfs'
image.'systemd'
.'/etc/systemd/system/default.target'
file and execute the associated programs.A runlevel is one of the mode that a Unix-based operating system runs in.
The “/etc/inittab” file contains the default runlevel information for the SysVinit system, which is used to boot the Linux system into the specific runlevel.
Once the specified runlevel is identified, it starts all other associated applications in the background according to the run level.
There are 7 different run levels in the Linux system for different purposes (run level 0-6). The details are given below.
Run Level | Short Description |
---|---|
0, halt | Halt System (To shut down the system) |
1, S, single | Single user mode |
2 | Basic multi user mode without NFS |
3 | Full Multi User with Network (text based) |
4 | Experimental (No User or Unused) |
5 | Multi user mode with Graphical User Interface |
6, reboot | To Reboot a System |
You can check your current runlevel in Linux using the “runlevel” command.
sudo runlevel
N 5
Systemd has a concept of targets, which serves a purpose like runlevels, but operates slightly differently. Each target is named instead of numbers and is intended to serve a specific purpose.
The “/etc/systemd/system/default.target” file contains the default target information for the systemd system, which is used to boot the system into the corresponding target.
Once the specified target is identified, it starts all other processes and applications in the background according to the target.
Below is the available target for Linux (there are seven targets from zero to six). The details are given below.
Target Units | Short Description |
---|---|
runlevel0.target, poweroff.target, systemctl halt | Halt System (Shut down and power off) |
runlevel1.target, rescue.target | Single User Mode |
runlevel[234].target, multi-user.target | Full Multi User with Network (text based) |
runlevel5.target, graphical.target | Multi user mode with Graphical User Interface |
runlevel6.target, reboot.target, systemctl reboot | Shut down and reboot the system |
To check current runlevel of systemd system, run:
systemctl get-default graphical.target
System Manager is the first process started by the kernel during system boot.
It holds the process ID (PID) of 1. It will continue to run in the background until the system is shut down.
Below are three system administrators that are widely used in Linux.
You can easily identify the system manager by running ps command on your system.
ps -p1 | grep "init\|upstart\|systemd" 1 ? 00:18:09 systemd
Single user mode, also referred to as maintenance mode, allows a super user to recover/repair the system from problems that cannot be resolved in a multi-user environment or system boots, but does not function properly or you cannot log in to it.
It uses ‘runlevel 1’ in the SysVinit system whereas ‘runlevel1.target’ or rescue.target in systemd system.
It only enable few services and minimal functionality to repair the system. This method is most useful if you want to run fsck to fix corrupted file systems or reset a forgotten root password or change the “/etc/fstab” file.
You can boot the system with emergency mode to repair your system when the system cannot enter rescue mode. This provides a very minimal environment for the user.
In emergency mode, the system mounts the root file system for read-only purposes and does not attempt to load any other local file systems. Also, it does not activate network interfaces and only starts some essential services.
If your system unable to complete a regular booting process due to an issue, you can boot the system into rescue (single-user) mode for further troubleshooting.
In rescue mode, the system tries to mount all local file systems and start only few important system services, but it does not activate network interfaces or allow more users to log into the system at the same time.
Make a note: The rescue mode of the installation program differs from the rescue mode (equivalent to single-user mode) and the emergency mode, which are provided as part of the systemd system and service manager.
It can be done in two methods:
You can boot the system directly into rescue mode from the GRUB2 menu because you have the option for that.
You need to boot your Linux system into rescue mode using the installation DVD or ISO to repair the corrupted '/boot'
partition.
This mode can be used to perform a wide variety of troubleshooting.
'1'
and then press enter to continue.Finally, run the below command to gain your root environment.
chroot /mnt/sysimage
SELinux (stands for Security Enhanced Linux) is a security feature of the Linux kernel that add additional security layer to the Linux system.
It implements mandatory access control (MAC) that allows users and administrators more control over discretionary access control (DAC).
SELinux defines access control policies for applications, processes, sockets, and files that dictate them what they can or can’t be accessed, which protects the system from malicious or flawed applications that can damage or destroy the system.
When enabled, SELinux can run in one of two modes:
Execute one of the following commands to check in which mode SELinux is running.
getenforce or sestatus
The ‘getenforce’ command returns the SELinux status such as Enforcing, Permissive, or Disabled whereas the ‘sestatus’ command returns the SELinux status and the SELinux policy being used.
To permanently change the SELINUX mode from one to another, you must modify the mode value in the following SELinux configuration file.
sudo vi /etc/selinux/config
In this guide, we’ve included the most frequently asked 4th set of 10 basic Linux Interview Questions and detailed answers for your reference purpose and we hope it will be very useful.
If you have any questions or feedback, feel free to comment below.
Cron is a command-line job scheduler available on Linux operating systems that allows users to…
In computing, there are two types of IP addresses, IPv4 and IPv6. By default, IPv6…
A tarball is commonly known as a TAR file, short for tape archive, which is…
A tar archive is a file that stores a collection of directories and files, also…
On Linux, you can quickly find out how LUNs are mapped to the underlying OS…
Keeping your Ubuntu system up-to-date is critical to ensuring a system's stability and security. This…
This website uses cookies.