1 00:00:07,050 --> 00:00:08,730 - All right, so previously we have talked 2 00:00:08,730 --> 00:00:12,120 about the different phases in the boot procedure. 3 00:00:12,120 --> 00:00:14,730 Now we need to talk about which tools you can use 4 00:00:14,730 --> 00:00:16,443 in case anything goes wrong. 5 00:00:17,580 --> 00:00:20,220 Well, if it goes wrong very early 6 00:00:20,220 --> 00:00:23,869 like before you see the boot loader prompt 7 00:00:23,869 --> 00:00:26,460 then there is only one option 8 00:00:26,460 --> 00:00:27,933 and that is the rescue disk. 9 00:00:31,740 --> 00:00:34,020 The rescue disk typically is the installation disk 10 00:00:34,020 --> 00:00:36,510 of your Linux distribution and it allows you 11 00:00:36,510 --> 00:00:39,720 to access a prompt from which you can access your hard drive 12 00:00:39,720 --> 00:00:43,470 and actually fix it like reinstall grub 2. 13 00:00:43,470 --> 00:00:47,580 If you do see grub 2 but you don't get to your kernel 14 00:00:47,580 --> 00:00:52,147 you might have an option to get through the grub menu 15 00:00:53,130 --> 00:00:56,400 and on the grub menu you might change parameters 16 00:00:56,400 --> 00:00:58,680 to tell your kernel how to load. 17 00:00:58,680 --> 00:01:02,130 If the kernel and the initramfs are doing okay, 18 00:01:02,130 --> 00:01:05,430 well then still from the grub boot menu 19 00:01:05,430 --> 00:01:07,950 you can do a couple of things. 20 00:01:07,950 --> 00:01:12,803 You can use the option init = slash bin slash bash. 21 00:01:15,120 --> 00:01:18,060 That is if you have a very early problem in System d. 22 00:01:18,060 --> 00:01:20,580 It allows you to break into your system 23 00:01:20,580 --> 00:01:23,363 before system d is actually loading. 24 00:01:23,363 --> 00:01:26,493 Otherwise, there is the emergency target. 25 00:01:30,150 --> 00:01:33,030 Which is a target in System d, and that allows you 26 00:01:33,030 --> 00:01:36,450 to get into the System d procedure pretty early. 27 00:01:36,450 --> 00:01:39,480 And if the problem is a little bit later 28 00:01:39,480 --> 00:01:42,093 there's also the rescue.target. 29 00:01:43,380 --> 00:01:47,310 The rescue target is also interrupting the boot procedure 30 00:01:47,310 --> 00:01:49,650 and that allows you to get into System d 31 00:01:49,650 --> 00:01:51,420 but a little bit later. 32 00:01:51,420 --> 00:01:55,590 So if you have a problem loading your disk devices 33 00:01:55,590 --> 00:01:57,210 for instance in System d 34 00:01:57,210 --> 00:02:00,120 well then emergency target is more appropriate. 35 00:02:00,120 --> 00:02:02,100 Rescue target is bringing you in 36 00:02:02,100 --> 00:02:04,260 a little bit further in the procedure. 37 00:02:04,260 --> 00:02:05,530 All of these options 38 00:02:06,570 --> 00:02:08,760 are all parameters that are also entered 39 00:02:08,760 --> 00:02:10,860 on the grub boot menu. 40 00:02:10,860 --> 00:02:14,820 The difference is that here they are kernel arguments 41 00:02:14,820 --> 00:02:17,310 and here if something is preventing you 42 00:02:17,310 --> 00:02:20,520 from seeing the kernel, you might use the grub boot menu 43 00:02:20,520 --> 00:02:22,260 to refer to another kernel. 44 00:02:22,260 --> 00:02:24,270 So that is what you can do for troubleshooting. 45 00:02:24,270 --> 00:02:25,563 Let's go check it out. 46 00:02:29,460 --> 00:02:33,420 So I just pressed the shift key to enter the grub boot menu 47 00:02:33,420 --> 00:02:35,040 on this CentOS Stream system 48 00:02:35,040 --> 00:02:38,430 and we are going to use e for edit. 49 00:02:38,430 --> 00:02:42,570 And I would like to get started by using the most minimal 50 00:02:42,570 --> 00:02:45,693 of all init = slash bin slash bash, 51 00:02:46,980 --> 00:02:49,680 which is making sure that we get into the system 52 00:02:49,680 --> 00:02:50,913 before system d. 53 00:02:54,000 --> 00:02:57,510 So what is so interesting about init = slash bin slash bash, 54 00:02:57,510 --> 00:02:58,500 Do you see that? 55 00:02:58,500 --> 00:03:00,180 I have a root prompt. 56 00:03:00,180 --> 00:03:01,013 Who am I? 57 00:03:01,013 --> 00:03:03,513 I'm root and I did not enter a password. 58 00:03:04,530 --> 00:03:08,190 But the thing is that we are in a very minimal mode. 59 00:03:08,190 --> 00:03:09,930 We don't even have system d. 60 00:03:09,930 --> 00:03:14,640 So system ctl list units is giving me what? 61 00:03:14,640 --> 00:03:16,650 It's giving me fail to connect to bus, 62 00:03:16,650 --> 00:03:18,952 no such file or directory. 63 00:03:18,952 --> 00:03:22,860 Init = bin bash means don't give me init, 64 00:03:22,860 --> 00:03:24,420 which is the normal system d 65 00:03:24,420 --> 00:03:27,180 give me bash, and that's where we are. 66 00:03:27,180 --> 00:03:28,470 And if at this point 67 00:03:28,470 --> 00:03:32,183 I want to get to the system d environment, 68 00:03:32,183 --> 00:03:37,183 I need to use exec slash usr slash lib slash system d 69 00:03:38,130 --> 00:03:40,380 slash system d. 70 00:03:40,380 --> 00:03:41,940 Now what is this thing? 71 00:03:41,940 --> 00:03:45,780 Well, exec, if you use it in order to start a program 72 00:03:45,780 --> 00:03:48,330 you remove the current program from memory 73 00:03:48,330 --> 00:03:50,190 you replace it with a target program 74 00:03:50,190 --> 00:03:51,540 And that's exactly what we need 75 00:03:51,540 --> 00:03:54,720 because system d needs to be pid 1. 76 00:03:54,720 --> 00:03:56,550 If I would just start system d 77 00:03:56,550 --> 00:03:58,530 then system d would become a child 78 00:03:58,530 --> 00:04:01,020 of the current best process that's not working 79 00:04:01,020 --> 00:04:02,430 and that's why I needed this 80 00:04:02,430 --> 00:04:06,150 exec to usr lib system d, system d 81 00:04:06,150 --> 00:04:08,700 which is the name of the system d binary. 82 00:04:08,700 --> 00:04:09,533 Now we are back 83 00:04:10,380 --> 00:04:12,843 and I can show you some more. 84 00:04:14,040 --> 00:04:15,603 So let me restart again. 85 00:04:17,160 --> 00:04:20,310 Shift key to enter the grub boot menu 86 00:04:20,310 --> 00:04:23,550 and again e for for edit 87 00:04:23,550 --> 00:04:26,430 where again I'm going to the end of the line 88 00:04:26,430 --> 00:04:27,330 that reads Linux. 89 00:04:27,330 --> 00:04:31,290 I'm removing rhgb and quiet and I'm using system d dot 90 00:04:31,290 --> 00:04:36,153 unit = emergency.target cause that is where I wanna be. 91 00:04:39,720 --> 00:04:42,060 Now where init = bin bash is letting you in 92 00:04:42,060 --> 00:04:45,510 without entering any passwords here 93 00:04:45,510 --> 00:04:47,463 you need to enter the root password. 94 00:04:48,693 --> 00:04:51,273 So system ctl, 95 00:04:53,280 --> 00:04:54,340 list units 96 00:04:57,360 --> 00:04:59,880 showing all the units, we have 49 in total. 97 00:04:59,880 --> 00:05:01,890 This is a minimal troubleshooting mode 98 00:05:01,890 --> 00:05:04,170 as I've already shown you before. 99 00:05:04,170 --> 00:05:06,900 Even your root valve system is in read-only mode 100 00:05:06,900 --> 00:05:11,850 So you need mount minus o remount comma rw on slash 101 00:05:11,850 --> 00:05:14,670 to make it reach right ball and then you can reboot. 102 00:05:14,670 --> 00:05:17,190 I'm going to leave CentOS for now 103 00:05:17,190 --> 00:05:19,190 and we are going to check out to Ubuntu. 104 00:05:26,070 --> 00:05:27,520 So here we are on Ubuntu 105 00:05:29,160 --> 00:05:33,363 pressing e to edit and looking for the line that ends Linux. 106 00:05:35,070 --> 00:05:38,790 I am going to remove the quiet and splash. 107 00:05:38,790 --> 00:05:40,450 And I would like to show you 108 00:05:42,210 --> 00:05:46,743 system d dot unit = rescue dot target. 109 00:05:49,050 --> 00:05:51,000 And control X to boot with that option. 110 00:05:52,020 --> 00:05:55,770 So here we are in the in the rescue mode. 111 00:05:55,770 --> 00:05:58,200 Now in Ubuntu it's pretty interesting 112 00:05:58,200 --> 00:06:01,740 because in Ubuntu you don't have to enter a root password. 113 00:06:01,740 --> 00:06:06,270 Why not? Well, Ubuntu root user doesn't have a password. 114 00:06:06,270 --> 00:06:10,320 So we get free access, which makes it a bit vulnerable 115 00:06:10,320 --> 00:06:12,180 but it's the way it is. 116 00:06:12,180 --> 00:06:14,440 So I just press enter and I'm in a root shell 117 00:06:15,330 --> 00:06:18,450 where I can use all of my troubleshooting skills 118 00:06:18,450 --> 00:06:22,650 like system ctl list units. 119 00:06:22,650 --> 00:06:24,360 That's not really troubleshooting 120 00:06:24,360 --> 00:06:26,250 but I want you to get an idea 121 00:06:26,250 --> 00:06:30,780 of the units that are currently loaded, 104. 122 00:06:30,780 --> 00:06:34,080 On CentOS, it's about the same number. 123 00:06:34,080 --> 00:06:36,270 The thing here is that the rescue target 124 00:06:36,270 --> 00:06:38,760 is bringing you in a quite complete system. 125 00:06:38,760 --> 00:06:43,020 An emergency target is only giving you a minimal system. 126 00:06:43,020 --> 00:06:45,300 I think that's enough for troubleshooting. 127 00:06:45,300 --> 00:06:47,640 Let's reboot and in the next video 128 00:06:47,640 --> 00:06:50,193 you'll learn about using the rescue disk.