1
00:00:00,000 --> 00:00:13,000
In this video, you'll learn about managing the INIT-RAMFS, also known as the INIT-RD.

2
00:00:13,000 --> 00:00:19,600
So the main purpose of the INIT-RAMFS is to provide kernel modules, which are required

3
00:00:19,600 --> 00:00:25,540
to mount the root file system. INIT-RAMFS or INIT-RD is generated automatically when

4
00:00:25,540 --> 00:00:31,580
you install your system. The installer detects all the hardware that is present, and it generates

5
00:00:31,580 --> 00:00:36,900
the INIT-RAMFS for you. And the INIT-RAMFS consists of a set of directories that are

6
00:00:36,900 --> 00:00:44,619
required to create it, and it is bundled into a CPIO archive. CPIO is an ancient way of

7
00:00:44,619 --> 00:00:49,099
making backups. Every now and then you will encounter it, and every now and then it's

8
00:00:49,099 --> 00:00:57,459
still used as a format. This CPIO archive is extracted at boot time. And if all modules

9
00:00:57,459 --> 00:01:02,500
that are required to mount the root file system are compiled in the kernel, booting can happen

10
00:01:02,500 --> 00:01:09,419
without INIT-RAMFS. But that is never the case. INIT-RAMFS can also offer additional

11
00:01:09,419 --> 00:01:15,300
functionality, which allows the system to boot from non-default storage, like LVM, encrypted

12
00:01:15,300 --> 00:01:21,260
root file system, or a network-based root file system. If ever you want to reconfigure

13
00:01:21,260 --> 00:01:25,980
your system later on to do something like that, you need to know how to rebuild your

14
00:01:25,980 --> 00:01:32,820
INIT-RAMFS. So how does that work? Well, on Red Hat family distributions, the DRAKUT utility

15
00:01:32,820 --> 00:01:38,260
has become the standard tool for building an INIT-RAMFS. And it can be configured with

16
00:01:38,260 --> 00:01:45,099
settings in etcdrakut.conf. And when you are running DRAKUT without configuration arguments,

17
00:01:45,099 --> 00:01:50,980
it will build an INIT-RAMFS based on current settings. So after adding new hardware, of

18
00:01:50,980 --> 00:01:55,339
which you want to have the drivers in your INIT-RAMFS, first make sure that the hardware

19
00:01:55,339 --> 00:02:04,379
drivers are present, and then run DRAKUT. On Ubuntu, you can use mkinitrd. And mkinitrd

20
00:02:04,379 --> 00:02:09,979
is the Ubuntu alternative for generating the INIT-RAMFS. Now there's a funny thing that

21
00:02:09,979 --> 00:02:15,380
we can do on Red Hat. On Red Hat, you can use the rd.breakboot argument to boot straight

22
00:02:15,380 --> 00:02:21,460
into the INIT-RAMFS. And that can be useful for troubleshooting. Let me show you. So to

23
00:02:21,460 --> 00:02:27,100
use this boot argument, you need to go to the group boot menu. Press E to open the editor

24
00:02:27,100 --> 00:02:33,179
interface. And from there, at the end of the line that loads Linux, you type rd.break.

25
00:02:33,179 --> 00:02:38,740
And then you use Ctrl-X to continue booting. So what is this doing? Well, this is entering

26
00:02:38,740 --> 00:02:43,860
the emergency mode. And kind of fun, we do need to pass the root password. So I'm going

27
00:02:43,860 --> 00:02:50,500
to enter the root password. And then I'm in the shell. And what is the shell? Well, if

28
00:02:50,500 --> 00:02:57,619
you type mount, then you can see on the top line that I have a rootfs on slash type rootfs.

29
00:02:57,619 --> 00:03:03,580
And that is my INIT-RAMFS. So when I type ls slash, the directories that I see are in

30
00:03:03,580 --> 00:03:09,539
the INIT-RAMFS. And this environment can be handy for troubleshooting. Now, this is

31
00:03:09,539 --> 00:03:15,919
the RAM file system that is normally processed while booting. The root file system is already

32
00:03:15,919 --> 00:03:25,899
on the sysroot directory, which is in slash. And here, your booting will continue once

33
00:03:25,899 --> 00:03:30,660
you have passed your options in the INIT-RAMFS. You can see that in the last line of output

34
00:03:30,740 --> 00:03:36,259
of the mount command, you can also see that this slash sysroot is read-only. You see the

35
00:03:36,259 --> 00:03:41,779
letters ro indicating it's read-only. So if ever you want to do something from this point

36
00:03:41,779 --> 00:03:50,259
of view, then you need mount minus o remount comma rw on slash sysroot. And that is giving

37
00:03:50,259 --> 00:03:56,139
access to all files on your ordinary operating system. And that's how you can boot into the

38
00:03:56,139 --> 00:04:02,220
INIT-RAMFS using rd.break on Red Hat. It's a Red Hat-specific option, so it won't work

39
00:04:02,220 --> 00:04:03,860
on Ubuntu, for instance.

