Grub File Overview (Demo)

Video Activity
Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *
or

Already have an account? Sign In »

Time
21 hours 25 minutes
Difficulty
Intermediate
CEU/CPE
21
Video Transcription
00:00
>> Hello Cybrarians.
00:00
>> Welcome back to the Linux+ course here at Cybrary.
00:00
>> I am your instructor, Rob Goelz.
00:00
In today's lesson we'll be talking about Grub file.
00:00
Upon completion of today's lesson,
00:00
you'll be able to locate the Grub file and we'll
00:00
also discuss the contents of Grub files and directories.
00:00
Demo time.
00:00
I don't know about everyone else here,
00:00
but I like to learn by getting my hands in,
00:00
getting my hands dirty, possibly breaking things.
00:00
We're going to see a lot of images of things blowing up,
00:00
things getting destroyed here
00:00
as we go through the course and that's going to be
00:00
our cue to cut over to
00:00
the demo environment and learn some stuff.
00:00
Without further ado, we're going to go
00:00
ahead and cut over to CentOS here.
00:00
Here we are in our CentOS distribution.
00:00
This is actually an older CentOS distribution
00:00
known as CentOS 6,
00:00
and it's a legacy distribution that we
00:00
need to use because,
00:00
well, Grub is the legacy bootloader.
00:00
What we're going to do is we're going to navigate
00:00
into the boot Grub directory,
00:00
which is where all the configuration files are going to
00:00
be that we need to look at for looking at Grub.
00:00
Specifically, we're going to look at
00:00
a file here called grub.conf.
00:00
Now we can see all the files in the directory
00:00
by running the list command and I actually
00:00
like using ls-al that allows us to see
00:00
a long listing of the files and it
00:00
also allows us to skinny hidden files.
00:00
Let's go ahead and run that.
00:00
Inside of here, we can see that grub.com file,
00:00
but we also notice that menu.lst is pointing to grub.com.
00:00
Menu.lst is the same link to grub.conf,
00:00
and that's because Grub historically
00:00
wants to use menu.list as the default file,
00:00
but in this distribution, in CentOS 6,
00:00
the grub.com files, the one that
00:00
actually holds all the information we want to see.
00:00
Now, I know from past experience that
00:00
unfortunately in order to get into that file,
00:00
we have to run a pseudo command,
00:00
pseudo edit in order to get into grub,conf,
00:00
and that's because that file is not viewable
00:00
by anybody who does not have a privileged user account.
00:00
In order to get privileged on my user account,
00:00
in order to edit that file or view it,
00:00
I need to run pseudo.
00:00
I'm going to run pseudoedit so we can
00:00
actually edit the file if you wanted to.
00:00
We're not going to do that today,
00:00
but let's just go have a look.
00:00
There's pseudoedit grub.conf,
00:00
and then we're going to go ahead and specify
00:00
my password so we can get in and
00:00
escalate privileges and now we can
00:00
see the contents of this file.
00:00
The first thing we want to look
00:00
at when we look at Grub is
00:00
the devices and device
00:00
naming because it's a little bit wacky.
00:00
What we notice here is we see things like hd 0,
00:00
0 or down here again,
00:00
we see hd 0, 0.
00:00
In Grub legacy,
00:00
all devices start with zero,
00:00
and Grub actually can't distinguish between
00:00
a scuzzy drive or an IDE drive,
00:00
so it just generically uses the device identifier of HD,
00:00
hard drive, for all devices.
00:00
The syntax for naming that device is device type,
00:00
drive number, and partition number.
00:00
Here we see hd 0, 0.
00:00
Well, what that really represents is
00:00
the first partition on the first hard disk,
00:00
which in this system is dev/sda 1.
00:00
Now, there are also
00:00
global settings that are
00:00
used to identify operating parameters.
00:00
Well, what are our global settings?
00:00
Well, these are the things that we can see
00:00
like default over here.
00:00
Default equals 0.
00:00
Well, it's zero because it's used to determine
00:00
the default OS we're going to load
00:00
and it's a zero-based index,
00:00
which means that the most recent loaded OS
00:00
we could use is actually zero,
00:00
which means one is the first one,
00:00
but because the index starts with zero,
00:00
it's always going to be zero.
00:00
We can also see the timeout,
00:00
timeout equals 5,
00:00
which is right below the default value here.
00:00
A timeout sets the time in seconds that
00:00
Grub will wait for operator intervention.
00:00
When the Grub menu comes up,
00:00
it's going to sit there for five seconds
00:00
and wait in case we want to go
00:00
in and edit anything or
00:00
change the way that the boot operates.
00:00
We can also see the splash image right
00:00
below that and this is used
00:00
to define the image or background
00:00
used in the Grub menu displays,
00:00
so if you want to change the
00:00
background and do something fancy,
00:00
you could do that by specifying
00:00
a different path through a different image file there.
00:00
Now, on this system we don't have a password specified,
00:00
but you could also have a password line that contains
00:00
a plain text or encrypted password and that would be
00:00
necessary if you wanted to go in and edit
00:00
any Grub settings or
00:00
execute commands during the Grub boot process.
00:00
You would need to specify
00:00
that password before you
00:00
could get in and change anything.
00:00
The last thing we want to talk about here
00:00
is this area right here.
00:00
We're going to talk first of all about the title.
00:00
The title is what is used to
00:00
define the available operating system,
00:00
and we only have one here.
00:00
But the title that we're looking at is
00:00
this most recent one 2.6.32,
00:00
and that actually specifies the kernel version.
00:00
Now the root down here is used to specify
00:00
the location of Grub's root directory or slash boot,
00:00
which is where the operating
00:00
system is going to be loaded,
00:00
and as I said previously, hd 0,
00:00
0 is actually dev/sda 1.
00:00
The kernel line down here,
00:00
it actually specifies the kernel file
00:00
to load and how to mount the kernel,
00:00
so vmlinuz is weird.
00:00
What that actually means is that this is
00:00
a compressed kernel file and we can
00:00
see that it's vmlinuz is 2.6.32, etc.
00:00
This is the kernel file,
00:00
the compressed kernel file
00:00
that we're going to load and then
00:00
we have information on
00:00
loading it and how are we going to do so.
00:00
We have information about the UUID that's
00:00
used to identify the device it's going to load on.
00:00
We have information about lux,
00:00
which we'll learn about later in
00:00
the language we're using,
00:00
and that's a localization thing.
00:00
We'll learn about that later as well.
00:00
Then finally we see down here initrd,
00:00
some of the initrd settings.
00:00
Well, initrd specifies
00:00
the initrd file that uses initial RAM disk,
00:00
and that is a file system that has
00:00
executables and drivers we need to boot the kernel.
00:00
With that being said,
00:00
>> in this lesson we covered where to
00:00
>> find Grub and Grub2 files and CentOS,
00:00
and we also discussed
00:00
the contents of Grub file and directories.
00:00
Thanks for being here and I hope
00:00
to see you in the next lesson.
Up Next