Linux Interview Questions and Answers for experienced

If you are preparing for a DevOps interview or for a Linux administrator, consider this Linux Interview Questions and Answers for the experienced tutorial as your lucky friend, which will help you pass the Certificate or the Linux interview.

Let’s get into this Ultimate Linux Interview Questions and Answers for an experienced guide without further delay.

Join 53 other followers

PAPER-1

Q1. In which directory are Linux logs stored in the Linux file system?

  • Linux log files are stored under /var/log directory which contains system generated and application logs.
/var/log/ directory
/var/log/ directory

Q2. What does the /var/log/dmesg directory contain in the Linux file system?

  • When you Power on Linux machines BIOS calls POST and MBR is loaded. MBR further calls GRUB and finally GRUB calls kernel and kernel gets loaded in memory. While all these process takes place kernel generates lots of messages related to hardware, BIOS, mount file system and stores in /var/log/dmesg directory in the Linux file system which can be viewed using dmesg command.
/var/log/dmesg directory
/var/log/dmesg directory

Q3. What does the /var/log/apt/history.log directory contain in the Linux file system?

  • /var/log/apt/history.log directory contain in the Linux file system provides all the details such as which software or Linux packages were removed, installed or upgraded in the Linux machine. For example when you execute commands like sudo apt update, sudo apt install apcahe2 then all the logs are captured in the /var/log/apt/history.log directory.
/var/log/apt/history.log
/var/log/apt/history.log

Q4. What does the /var/log/auth.log directory contain in the Linux file system?

  • /var/log/auth.log directory contains logs related to the system and user access. Whenever any user log in to the machine or SSH into remote machine to perform any activity all the logs get captured under this file. /var/log/auth.log directory in the Linux file system helps you to find password locked out issues or someone trying to SSH into your machine unnecessarily.
/var/log/auth.log
/var/log/auth.log

Q5. To list all packages in the log file installed using the below command.

cat /var/log/apt/history.log | grep "install"
Listing all the packages in the history.log file
Listing all the packages in the history.log file

Q6. What does the /var/log/kern.log directory contain in the Linux file system?

  • /var/log/kern.log directory provides the information related to kernel warnings, Kernel error messages and Kernel events to the Linux system.
/var/log/kern.log
/var/log/kern.log

Q7. What does the /var/log/Syslog directory in the Linux file system?

  • /var/var/log/Syslog directory provides the in-depth information about your system, application, kernel warnings, Kernel error messages and Kernel events etc. and stores logs. If you are unable to find information in any other files then Syslog directory is your last resort.
/var/log/syslog
/var/log/syslog

Q8. What does the /var/log/apport.log directory contain in the Linux file system?

  • /var/log/apport.log directory provides the in-depth information about the system crash, reports access related issues and OS related failures.
/var/log/apport.log directory
/var/log/apport.log directory
  • If you wish you can configure to schedule these logs in the /etc/logrotate.d/apport directory.
/etc/logrotate.d/apport directory
/etc/logrotate.d/apport directory

Q9. What does the /var/log/ufw.log directory contain in the Linux file system?

  • /var/log/ufw.log directory provides the in-depth information about firewall and network connectivity in the Linux machine.

Q10. What does the /var/log/daemon.log directory contain in the Linux file system?

  • /var/log/daemon.log directory provides the information logged by the various background daemons running in the Linux machine.

Q11. What does the /var/log/apache2/access.log directory contain in the Linux file system?

  • /var/log/apache2/access.log directory contains information logged by apache2 web server. As soon as you install apache2 using the apt install apache2 command you will see this access.log gets created in the Linux machine.
/var/log/apache2/access.log directory
/var/log/apache2/access.log directory

Q12. What does the /var/log/dpkg.log directory contain in the Linux file system?

  • /var/log/dpkg.log directory provides the information related to package installation and similar to /var/log/apt file in the Linux machine.

Q13. Why “.” files are not included in the ls command in the Linux file system?

  • The reason is the configuration files are less likely to be accessed or not accessed at all in the Linux machine.

Q14. Explain the File permissions of the below file in the Linux file system?

drwxr-xr-x   2     sam sam 4096 2015-05-16 17:07 Documents
  • d is a filetype (directory) however it can also have - which represents a file or c that represents character device and finally b represents block device
  • rwxr-xr-x are the permissions of user, group and others respectively where r is read, w is write and x is execute permission. User has rwx permissions, group has r-x permissions and others have r-x permissions.
    • r represents read permission and it has 4 octal value.
    • w represents write permission and it has 2 octal value.
    • x represents execute permission and it has 1 octal value.
    • u represents user, g represents group , o represents others and a represents all( user, group and others)
  • l is the number of links that a file contains.
  • sam is the owner of the file that is documents is owned by the user sam. Group contains multiple users and sam user is part of the sam group which is his primary group.
  • 4096 is the size of the file.
  • 2015-05-16 17:07 displays when was file last accessed.
  • Documents is the file name

Q15. Explain the chmod command practically to change the permissions on the file in the Linux file system?

Chmod: To change the permissions on the file using the chmod command. Let’s learn how to work with the chmod command.

  • chmod a-w file.txt – Subtracting the write permission from all user, group and others.
  • chmod u+rwx file.txt – Adding the read, write and execute permission for user.
  • chmod g-r file.txt – Subtracting the read permission from group
  • chmod 666 file.txt – Granting the read and write access to all user, group and others
  • chmod 714 file.txt
    • Granting the read, write and execute permissions to user.
    • Granting the execute permission to group.
    • Granting the read and write access to others.

Q16. Explain the umask command practically in the Linux file system? Linux file system?

The umask command works like a filter that masks your permissions.

  • 0 represents that it has all the permissions ie. read, write and execute
  • 7 represents no permissions that means it masks all the actual values.
  • UMASK 037 will create a file with -rwxr—– permissions
  • UMASK 000 will create a file with -rwxrwxrwx permissions
  • UMASK 222 will create a file with -r-x-r-x-r-x

Q17. How to check the file type of a file using the file command.

file name_of_the_file
check the filetype of a file
check the filetype of a file

Q18. How to check the permissions of the file using the getfacl command.

 getfacl name_of_the_file
getfacl command
getfacl command

Q19. How to set the permissions of the file using the setfacl command.

# Setting rwx permission for user sam on name_of_the_file
setfacl -m u:sam:rwx name_of_the_file

Q20. Explain all the below Linux commands?

  • Find command in linux: find command in linux search files and directories according to conditions. For example find all .mp3 files that are greater than 10MB and delete them using one single command.
find / -type f -name *.mp3 -size +10M -exec rm{} \;
  • gzip command in linux: gzip command in linux compresses the file size
gzip file_name
  • chattr command in linux: chattr command in linux helps to alter attributes of files but only with root user. For Ex: make directory(+i) and sub files(-R) immutable.
chattr -R +i  temp/
  • Chown command in linux: Chown command in linux allows to change the owner of a file or directory.
chown -R tomat:tomcat /opt
  • mkfs command in linux: mkfs command in linux allows to create a file system.
mkfs.ext2 ~/tmp.img
  • unzip command in linux: unzip command in linux extracts all files from specified ZIP achieves.
unzip myfile.zip
  • mount command in linux: mount command allows to mount the Linux file systems to a directory.
mount  /dev/sda1 media/usb
  • dd command in linux: dd command in linux copies a file, converts and then formats according to the operands.
# Backup the MBR partitioned system, where size is 512b, "if" is input source and "of" is output file.
sudo dd if=/dev/sda bs=512 count=1 of=mbr.img
  • fdisk command in linux: fdisk command in linux stands for Format disk which allows you to create, view, resize, delete and change the partitions on a hard drive.
fdisk /dev/sda
  • sort command in linux: sort command in linux helps in sorting the lines of text files or arranging them.
sort -o output.txt file.txt
  • swap command in linux: swap command in linux is used when the amount of physical RAM memory is full. When a Linux system runs out of RAM, inactive pages are moved from the RAM to the swap space
  • tar command in linux: tar command in linux which stands for Tape Archive is used to compress files which is known as tarball.
tar cjvf abc.tar.gz directory1
  • uniq command in linux: uniq command in linux filters or removes repeated lines in a file.
# -c option specifies how many uniq lines were removed
uniq -c file.txt

Join 53 other followers

Conclusion

In this ultimate guide, you had a chance to revise everything, such as the Linux file system, Linux commands, and Linux log files that you need to know to pass and crack the Linux interview.

Now that you have sound knowledge of Linux and are ready for your upcoming interview.

Advertisement

The Ultimate Handbook of Linux command cheat sheet

If you are new to Linux operating system, then this handbook is a Linux command cheat sheet for you that will help you to jumpstart in the Linux world.

In this ultimate Handbook of Linux command cheat sheet, you will find a variety of Linux command that you are used every day in the Linux administrator role.

Join 53 other followers

Table of Content

  1. Prerequisites
  2. Linux command cheat sheet
  3. Conclusion

Prerequisites

This post will be a step-by-step tutorial. If you’d like to follow along, be sure you have:

  • CentOS 8 machine or preferably CentOS 7 plus , if you don’t have any machine you can create a ec2 instance on AWS account. Recommended to have 4GB RAM and at least 5GB of drive space.

how to check linux version or the kernel version : You can use uname –kernel-name –kernel-release –machine command

Linux command cheat sheet

In this section, you will see the Linux command, and they are executed. You should try these commands on your centos machine which will help you to command linux operating system.

  • Linux uptime command: Linux uptime command provides the details about how long the Linux system is active and running.
uptime
Linux uptime command execution
Linux uptime command execution
  • uname command in linux: uname command in linux provides the information about the current kernel of your linux machine.
uname
uname command in Linux execution
uname command in Linux execution
PurposeCommand to execute
System uptime informationuptime
kernel informationuname -r 
The IP address of the machinehostname -I
last rebootlast reboot
Who you are logged in aswhoami
who is onlinew or who
CPU informationcat /proc/cpuinfo
Memory Informationcat /proc/meminfo
free and used memory free -h
hardware infodmidecode
Processestop
List files opened by the userlsof -u user
all the currently running processesps -ef
your currently running processesps
mysql processps –ef | grep mysql
Date & Time Settingschronyd
Date & Time Settingsntpd
Displaying the Current Date and Timedate
Displaying the Current Date and Timetimedatectl
Command to manage systemdsystemctl
System-wide locale settings/etc/locale.conf
Listing available system locale settings:localectl list-locales
current status of the system locales settingslocalectl status
configuring network accessnmcli
configuring network accessnmtui
modify the existing connection:nmcli con mod “con-name”
display all connections:nmcli con show
display the active connection:nmcli con show –active
Linux Softwares areRPM packages
Repo Directory/etc/yum.repos.d/
available repositories:subscription-manager repos –list
currently enabled repositories:yum repolist
Searching for packagesyum search string
Installing a package:yum install package_name
Updating all packagesyum update
Updating a package:yum update package_name
Uninstalling a packageyum remove package_name
installed and available packagesyum list all
installed packages:yum list installed
enable a servicesystemctl enable service_name
disable a servicesystemctl disable service_name
Firewall service firewalld
current status of the firewallsystemctl status firewalld
Start firewallsystemctl start firewalld
the additional layer of system securitySELinux
Display the current SELinuxgetenforce
Change the state of SELinuxsetenforce Enforcing/Permissive
Permanent SELinux State/etc/selinux/config
SSH connectionfacilitates client-server communication
Disabling SSH Root Loginvi /etc/ssh/sshd_config
PermitRootLogin no
systemctl restart sshd
Min value in useraddUID_MIN 1000
Max value in useraddUID_MAX 60000
Adding a user to a group:usermod -a -G group_name user_name
<1000Reserved userID details in/etc/login.defs
Brilliant Guide to Linux command line sheet

Join 53 other followers

Conclusion

In this ultimate Handbook of Linux command cheat sheet, you learned various Linux commands that you can use in the Linux administrator role.

So now you are Linux command pro, so you should consider creating shell scripts with all these commands and try.

How to Protect Ubuntu network and ubuntu firewall

In today’s world, there are high chances that attackers may attack your system because machines may be open to the world in one or another way. To eliminate all vulnerabilities and attacks, you should consider protecting the Ubuntu network and ubuntu firewalls.

In this tutorial, you will learn how to Protect the Ubuntu network and ubuntu firewall with various ways to keep your machine far from attacks and more secure.

Let’s go!

Join 53 other followers

Table of Content

  1. Prerequisites
  2. Checking ubuntu vulnerabilities
  3. How to check the list of running services on ubuntu 21.04 machine
  4. How to stop ubuntu service running on ubuntu 21.04 machine
  5. Scanning ubuntu 21.04 machine using various tools
  6. Scanning ubuntu 21.04 with Rootkit hunter or Rkhunter
  7. Protecting ubuntu 21.04 using tcptrace command
  8. How To Set Up the UFW Firewall on Linux
  9. UFW commands for ubuntu machine ( ufw firewall , ufw allow port , uwf limit etc.)
  10. Conclusion

Prerequisites

This post will be a step-by-step tutorial. If you’d like to follow along, be sure you have:

  • Ubuntu 21.04 machine or preferably Ubuntu 18.04 version plus , if you don’t have any machine you can create a ec2 instance on AWS account. Recommended to have 4GB RAM and at least 5GB of drive space

Checking ubuntu vulnerabilities

Let’s kick off this tutorial by first checking potential reasons for ubuntu vulnerabilities. There are multiple points that one must consider to get rid of vulnerabilities like:

  • Regularly check requirement of the applications such as softwares that are needed or no longer needed and if not needed make sure to purge those softwares or uninstall them.
  • Delete the services that no longer need for example to install apache2 web server you only need apache2 service and avoid installing some other extra services that are not required.
  • Disable services that are longer required in long run and are open to the world.

How to check the list of running services on ubuntu 21.04 machine

Consider running the below service command to check the list of running services on the ubuntu 21.04 machine.

service --status-all | grep '\[ + \]'
list of running services on ubuntu 21.04
list of running services on ubuntu 21.04

How to stop ubuntu service running on ubuntu 21.04 machine

To stop the ubuntu service no longer required on the ubuntu 21.04 machine, run the following command.

# service <service-name> stopservice
service apport stop 
# To check the status of service use service <service-name> status
How to stop ubuntu service running on ubuntu 21.04 machine
How to stop ubuntu service running on ubuntu 21.04 machine

Scanning ubuntu 21.04 machine using various tools

There are various tools that one should use and scan the ubuntu machine to look for any connectivity issue or unknown IP attacking your system. Let’s start with the Nmap.

Running nmap commands

Nmap is, also known as network mapper, is most widely used to do an analysis of network, monitor host details, and connections audits, and check all ports and connectivity on your machine or remote machine.

After you run the Nmap command, you will see it displays all the closed ports, DNS records, etc.

nmap ip-address
nmap command
Nmap IP-address command
  • You can also run the Nmap command using the hostname instead of Ip address of network component.
nmap Hostname      # nmap ip-10-111-4-53  
nmap hostname command
Nmap hostname command

Scanning ubuntu 21.04 with Rootkit hunter or Rkhunter

Rootkit hunter or RKhunter tool is used to find the issues in file and directories permission, hash changes and executables with incorrect file permissions, hidden files.

  • Run rkhunter command to check the system files and configurations.
rkhunter -c  # To check our own machine's  system check
Rootkit hunter
Running Rootkit hunter
Rootkit hunter summary
Rootkit hunter summary

Protecting ubuntu 21.04 using tcptrace command

Another way to protect the Linux or ubuntu 21.04 machines is by running the tcptrace command. tcptrace is used to trace the TCP Packet information on the receiving and sending end of connections.

  • Run tcptrace to check the tcp connections as shown below.
 tcptrace -houtput
Running tcptrace command on ubuntu 21.04
Running tcptrace command on ubuntu 21.04

How To Set Up the UFW Firewall on Linux

Without a firewall, there are no rules or restrictions on your network traffic, and that leads to several negative consequences. The Linux system comes with a default firewall configuration tool called Uncomplicated Firewall (UFW). But how do you set up a UFW firewall?

UFW service enables you to implement selective or restrictive policies regarding access to your System and interface to iptables. Let’s check ufw commands in detail to understand better.

  • To install ufw firewall on ubuntu machine ( Note: Although this is already installed but incase it is not available)
apt install ufw 
 install ufw firewall on ubuntu machine
install ufw firewall on ubuntu machine
  • Now, check if ufw is successfully installed on your machine by running service ufw status command.
service ufw status
Checking the ufw firewall on ubuntu machine
Checking the ufw firewall on ubuntu machine
  • To check the UFW status on ubuntu 21.04 machine without running service command run the following command.
ufw status                 # Don't use service command 
Checking the ufw firewall status on ubuntu machine
Checking the ufw firewall status on ubuntu machine
  • To enable ufw on ubuntu 21.04 run the ufw enable command.
ufw enable  # select yes to proceed 
Enabling the ufw firewall status on ubuntu machine
Enabling the ufw firewall status on ubuntu machine
  • To allow port 80 and port 22 using ufw allow command.
ufw allow ssh   ufw allow 80
Allow the ufw firewall status on ubuntu machine
Allow the ufw firewall status on the ubuntu machine
  • To enable logging for ufw commands run the ufw loggin on commad else ufw logging off.
ufw logging on 
This image has an empty alt attribute; its file name is image-131.png
Enabling the logging using ufw command on ubuntu machine

UFW commands for ubuntu machine ( ufw firewall , ufw allow port , uwf limit etc.)

Let’s quickly check the list of all UFW commands useful for network connectivity on ubuntu 21.04 machines. Let’s do a quick summary of ufw commands.

ufw enable ✏ ufw enable command enables the firewall on the machine.
ufw disable ✏ ufw disable command disables the firewall on the machine.
ufw reload ✏ufw reload command reloads the firewall to ensure changes are applied
ufw logging on|off ✏ ufw logging on|off command enables or disables logging ufw on the machine
ufw allow ✏ ufw allow command adds an allow rule on the machine.
ufw deny ✏ ufw deny command adds a deny rule on the machine.
ufw reject ✏ ufw reject command adds a reject rule on the machine.
ufw limit ✏ ufw limit command adds a limit rule on the machine.
ufw delete ✏ ufw delete command deletes the rule on the machine.
ufw status ✏ ufw status command shows the firewall status on the machine.
ufw-version ✏ufw-version command displays version information on the machine.

The Uncomplicated Firewall (ufw) is a front-end for iptables and is particularly well-suited for host-based firewalls, so you can block or allow traffic based on IP address, NIC, port, network, and more. You can set iptables to log all actions or just specific actions.

sudo iptables -L     #  Lists the currently set firewall rules
Lists the currently set firewall rules using iptables
Lists the currently set firewall rules using iptables
sudo iptables -L -vn   #  Lists the currently set firewall rules with more details
Lists the currently set firewall rules in details using iptables
Lists the currently set firewall rules in detail using iptables
sudo iptables -F    #  Deletes the currently set firewall rules 

Join 53 other followers

Conclusion

Throughout this tutorial, you’ve realized that setting up a firewall and protecting the ubuntu machine is important. There are multiple ways to protect, such as using UFW, NMap commands, tcptrace.

You should now have a good understanding of how to protect the Ubuntu network and ubuntu firewall; why not build on this newfound knowledge.

How to Install Jenkins on Ubuntu Machine Step by Step

Are you spending a lot of time deploying code in your infrastructure and with many steps and software? Don’t worry; you are at the right place to learn about the famous open-source tool Jenkins, which helps build and deploy the code with a click of a button and has various other benefits.

In this tutorial, you will learn what is Jenkins and how can you install Jenkins on ubuntu 18.04 and setup step by step. Still Interested?

Join 53 other followers

Table of Content

  1. What is Jenkins
  2. Prerequisites
  3. How to Install Java on ubuntu 18.04 machine
  4. How to Install Jenkins on Ubuntu 18.04 LTS
  5. How to setup Jenkins on ubuntu
  6. Workflow of Jenkins and Code deployment
  7. Conclusion

What is Jenkins?

Jenkins is an open-source automated CI/CD tool where CI stands for continuous integration and CD stands for Continuous delivery. Jenkins has its own built-in Java servlet container server, which is Jetty. Jenkins can also be run in different servlet containers such as Apache tomcat or glassfish.

  • Jenkins can be deployed to the local machine or premises data center, or any cloud.
  • Jenkins takes your code, any sort of code such as python, java, or go or JS, etc., and compiles it using different compilers such as MAVEN, one of the most used compilers, and then builds your code in war or Zip format and sometimes as a docker image.
  • Jenkins deploys the code when required and integrates easily with various third-party tools.

Related: Python Flask Tutorial: All about Python flask

Prerequisites

  • Ubuntu 18.0.4 machine preferably; if you don’t have any machine, you can create an ec2 instance on the AWS account.
  • It is recommended to have 4GB of RAM
  • At least 5GB of drive space

You may incur a small charge for creating an EC2 instance on Amazon Managed Web Service.

How to Install Java Version 11 on ubuntu 18.04 machine

Before you dive into the installation of Jenkins on your ubuntu machine, you will need Java as a prerequisite, without which Jenkins will not work. So, let’s begin and learn how to Install Java Version 11 on an Ubuntu 18.04 machine using a few basic steps.

  • Firstly, install java using the apt install command as shown below.
sudo apt install default-jdk  # Here we are installing Java Version: Java SE 11 (LTS)
  • Next, verify the java version on your machine.
java -version               # To check the Installed Java Version
Checking the Java version
Checking the Java version
  • Check the location of java by using the which and where command.
which java :         # It will locate executable file location which is /usr/bin/java 
whereis java         # It will give the location  of all the files related to Java 
Checking the Java location
Checking the Java location

The Installation directory of Java is /usr/lib/jvm/java-1.8.0-openjdk-amd64, and this confirms that Java is successfully installed on our ubuntu 18.04 machine. Now, let us install Jenkins.

How to Install Jenkins on Ubuntu 18.04 LTS

Now that you have Java installed on your ubuntu machine. Now, it’s time to install Jenkins, an easier and more straightforward task. Let’s dive in to install Jenkins on Ubuntu 18.04 LTS machine.

  • First, update your system packages on the ubuntu machine using the below command.
sudo apt update
  • Next, add Jenkins Public key to your system so that this key can trust the jenkins.io site to download the repository or any packages.
wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
  • Now, add the Jenkins repository to your system and update your system.
sudo sh -c 'echo deb https://pkg.jenkins.io/debian-stable binary/ > \
    /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
  • Now install the Jenkins package using the apt-get command.
sudo apt-get install jenkins

As of now, Jenkins service should be up and running. To check the status of Jenkins, run the below command as shown.

service jenkins status
Checking the Java Service status
Checking the Java Service status

How to setup Jenkins on ubuntu

Now that you have installed Jenkins on your ubuntu machine successfully and verified by running the service command. But the installation is just an initial stage; you will need to set the Jenkins to make it work properly. Let’s learn step by step how to set Jenkins instance.

  • Open the Jenkins instance on your favorite web browser by going to <Jenkins-installation-server-ip-address>:8080.
  • As soon as the URL is opened, it will prompt for the administrator password. The password can be found on /var/lib/Jenkins/secrets/initialAdminPassword directory, as shown below.
Unlocking the Jenkins initial password
Unlocking the Jenkins initial password
  • Now obtain the password by going to the Jenkins server and viewing the following content.
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
  • After successfully adding the Jenkins admin password, you will be prompted for Plugins installation. We will select the Install Suggested Plugins option as this is the demo.
Installing Plugins in Jenkins
Installing Plugins in Jenkins
Plugins installing and Jenkins getting started
Plugins installing and Jenkins getting started.
  • Once the plugins are successfully installed, then it will prompt to create a First admin user. Please fill in the required information and keep it safe with you, as you will use this later to log in.
Creating first Admin User in Jenkins
Creating the first Admin User in Jenkins
  • Now Jenkins URL configuration screen will appear, and you can keep the default URL as it is and click on save and finish.
Configuring the Jenkins Instance
Configuring the Jenkins Instance
Jenkins is ready to be used
Jenkins is ready to be used.
  • Now Jenkins instance is ready for use. Click “Start using Jenkins.” After you click, you will see Jenkins Dashboard, where you create New Jobs by clicking on New Item.
Jenkins Dashboard
Jenkins Dashboard

Workflow of Jenkins deployment

This section is an additional section that provides you a basic overview of how a Jenkins deployment happens step by step and what Jenkins can do for you. Let’s get into it.

  • Once Jenkins is installed, install plugins as per the requirement, whether terraform, bitbucket, python, blue-ocean, etc.
  • Jenkins is configured so that it can fetch the code from any of the repositories such as GIT, bitbucket, SVN, or TFS.
  • Once you define the code repository, Jenkins pulls the code, compiles it using plugins if required, and later builds it. You can include a few test cases along with a build to test some functionalities of code.
  • Later you deploy the code on required environments such as AWS, GCP, Windows machines, Linux machines, etc.
Jenkins deployments workflow
Jenkins deployments workflow

Join 53 other followers

Conclusion

In this tutorial, you learned what Jenkins is, how to install Java on the ubuntu 18.04 machine, how to Install Jenkins on Ubuntu 18.04 LTS, and how to set up Jenkins on ubuntu and setup.

Jenkins is a handy tool for CI and CD purposes and is most widely used, which helps manage your organization’s deployments.

Now that you have Jenkins installed and set up, which application are you planning to deploy?

How does the grub menu solve the booting problem

Knowing the grub menu is important if you face issues while booting your machine. GRUB is a powerful boot loader that allows you to load multiple operating systems such as windows, ubuntu, Linux, etc.

There could be various reasons why your system doesn’t start properly, and at times even machines don’t boot; that’s a huge problem! To solve that, one of the keys is to check the grub menu and bios settings.

In this tutorial, you will learn, step by step, how knowing about the grub menu along with the bios setting solves the booting problem.

Let’s begin!

Join 53 other followers

Table of Content

  1. Prerequisites
  2. Checking and performing BIOS update
  3. Checking GRUB menu
  4. Reinstall GRUB
  5. Conclusion

Prerequisites

This tutorial will assume you have any Ubuntu version, such as Ubuntu 14.04 or the latest Ubuntu 21.04, which you will need to perform the testing and fix.

Checking and performing BIOS update

BIOS is the first software program to load into the system. If your system cannot boot even with a LIVE DVD or USB Drive, there could be two possibilities: you accidentally deleted the boot device, or a hardware issue. To solve the boot issues, the first thing you could do is try to restore the BIOS settings or do a bios update.

To restore the BIOS settings or bios update, follow the below steps:

  • The first step is to restart or Power the system on and quickly press the “F2” button until the BIOS setting menu is displayed.
  • Next, restore BIOS settings to default settings or set “Reset Config Data” in BIOS.
  • Once you select the default setting, you will hear a beep tone.
  • Finally, restart the system.

Related: Windows Boot Process Step by Step

Checking GRUB menu

In the previous section, you learned that if you cannot boot with DVD/USB or a hardware issue, consider replacing hardware or changing the BIOS Settings, which is the first step. But If you can turn on the computer and get past the initial BIOS startup, consider checking the GRUB menu.

A few things might have been overwritten or caused corruption in the system, which can be solved using the recovery mode within the GRUB menu. To recover from the above problems, follow the steps as shown below:

  • Press the Shift key after the BIOS to access the GRUB menu and select the Advanced Options for Ubuntu menu from the down drop list.
Accessing the GRUB menu and selecting the Advanced Options for Ubuntu menu
Accessing the GRUB menu and selecting the Advanced Options for Ubuntu menu
  • Further from the Advanced options menu, select an entry with the words recovery mode, which boots the machine into a recovery menu with options to automatically fix several possible problems. At least it lets you boot into a minimal recovery-mode version of Ubuntu with only the most necessary processes loaded. From here, you may be able to fix disks, check file systems, drop to a root prompt to fix file permissions, etc.

As you can see below in the image, there are two additional options for every kernel: upstart and recovery.

  • (upstart): an event-based replacement for the /sbin/init daemon, which handles starting tasks and services during boot, stopping them during the shutdown, and supervising them while the system is running.
  • (recovery mode): to recover the kernel from any failures in the system.
Displaying of kernels in GRUB menu
Displaying of kernels in the GRUB menu

Reinstall GRUB

Earlier in the previous section, you learned how to check the GRUB menu and fix the corruption of file systems or kernels. But what if you cannot bring up the GRUB menu then reinstalling GRUB is your last resort.

To reinstall GRUB perform the below steps as mentioned below:

  • Boot the Ubuntu machine from a live DVD or bootable USB drive with the same Ubuntu release as your system, such as 16.04. To find the ubuntu release run the below command.
lsb_release -a
Command to check ubuntu release version
Command to check the ubuntu release version
  • To determine the boot drive on your system open a terminal and run the below command to list the drives attached to the system.
sudo fdisk -l
Command to check drivers attached to the system
Command to check drivers attached to the system
  • Next, search for an entry in the output with an * in the boot column. This should be the boot device similar to something like /dev/sda1.
  • Now, mount the Ubuntu partition at /mnt by replacing /dev/sda1 with the information you just found.
sudo mount /dev/sda1 /mnt
  • Next, reinstall GRUB by replacing /dev/sda1
sudo grub-install --boot-directory=/mnt/boot /dev/sda1
  • Finally, restart the computer, and Ubuntu should boot properly.
Ubuntu restart network
Ubuntu restart network

Join 53 other followers

Conclusion

In this critical post, you learned how to bring back an ubuntu machine that didn’t boot using different stages such as Checking and performing BIOS updates, Checking the GRUB menu, and reinstalling the GRUB that you should consider to recover them in the future.

Now, you are pro in fixing the ubuntu machine that doesn’t boot, so which method will you plan to check first while troubleshooting the issue.