1 00:00:06,900 --> 00:00:11,370 - Alright, well sometimes you cannot boot into grip anymore. 2 00:00:11,370 --> 00:00:12,480 Then what can you do? 3 00:00:12,480 --> 00:00:14,400 You can use a rescue disk, 4 00:00:14,400 --> 00:00:17,520 and I know I'm on a fully installed system here, 5 00:00:17,520 --> 00:00:19,140 but that is because I want to show you 6 00:00:19,140 --> 00:00:20,760 how to connect to the rescue disk 7 00:00:20,760 --> 00:00:23,550 from the virtualization software. 8 00:00:23,550 --> 00:00:25,530 This is one of the few cases where I do think 9 00:00:25,530 --> 00:00:28,680 it's useful to know about a virtualization software 10 00:00:28,680 --> 00:00:31,260 because you need to insert a disk, right? 11 00:00:31,260 --> 00:00:33,930 How are you inserting a disk in virtualization? 12 00:00:33,930 --> 00:00:36,780 Well, typically by going to your devices, 13 00:00:36,780 --> 00:00:39,450 and by connecting your CD, DVD 14 00:00:39,450 --> 00:00:42,300 which in VMWare Fusion is this option right here. 15 00:00:42,300 --> 00:00:44,430 And you need to look for something similar 16 00:00:44,430 --> 00:00:46,503 if you're also in virtualization. 17 00:00:47,880 --> 00:00:51,570 Next, we need to get access to a boot prompt, 18 00:00:51,570 --> 00:00:53,940 and that can be a little bit challenging 19 00:00:53,940 --> 00:00:56,790 because while you see the boot logo 20 00:00:56,790 --> 00:01:00,570 in my virtualization environment that'll be the VMware logo 21 00:01:00,570 --> 00:01:05,570 I need to press a key, probably the escape key 22 00:01:05,820 --> 00:01:10,820 with the exact key depends on your boot software. 23 00:01:10,830 --> 00:01:13,110 Might be escape, might be F12, 24 00:01:13,110 --> 00:01:15,630 might be F10, might be something else. 25 00:01:15,630 --> 00:01:18,360 I'm going for escape and I'm going to show you right now. 26 00:01:18,360 --> 00:01:19,413 Let's restart. 27 00:01:22,680 --> 00:01:24,730 All right, so here we have the boot menu. 28 00:01:25,737 --> 00:01:28,590 I finally got there by pressing escape at the right moment, 29 00:01:28,590 --> 00:01:31,560 but my VMware BIOS is giving me a second or less. 30 00:01:31,560 --> 00:01:33,480 So you really need to be fast, 31 00:01:33,480 --> 00:01:35,613 and I'm selecting CD ROM drive. 32 00:01:38,190 --> 00:01:40,830 And with the CD ROM drive connected, this is what I get. 33 00:01:40,830 --> 00:01:44,850 So this time we are not going to install CentOS Stream 9, 34 00:01:44,850 --> 00:01:47,220 no, I'm going to select troubleshooting. 35 00:01:47,220 --> 00:01:49,770 No matter which distribution you are using, 36 00:01:49,770 --> 00:01:52,230 on the installation disk, you will always have an option 37 00:01:52,230 --> 00:01:55,530 to start a live system, or a troubleshooting system. 38 00:01:55,530 --> 00:01:56,940 And if you're using Ubuntu, 39 00:01:56,940 --> 00:01:59,910 and you want to start a live system from the DVD, 40 00:01:59,910 --> 00:02:01,110 that's okay as well. 41 00:02:01,110 --> 00:02:03,420 From the live system, you are going to access your disk, 42 00:02:03,420 --> 00:02:05,850 and you can do your troubleshooting. 43 00:02:05,850 --> 00:02:09,600 Now I am not going for install, 44 00:02:09,600 --> 00:02:13,683 I am going for a rescue CentOS Stream system. 45 00:02:16,560 --> 00:02:20,550 So at this point it is really booting from an initramfs 46 00:02:20,550 --> 00:02:24,153 that is installed on the installation disk. 47 00:02:26,310 --> 00:02:27,900 It's basically the same program 48 00:02:27,900 --> 00:02:31,170 as what you use to install Linux. 49 00:02:31,170 --> 00:02:32,400 Now what do we see? 50 00:02:32,400 --> 00:02:34,020 We see that the rescue environment 51 00:02:34,020 --> 00:02:36,720 will now attempt to find the Linux installation. 52 00:02:36,720 --> 00:02:37,950 I don't wanna do that. 53 00:02:37,950 --> 00:02:40,440 I want to make it a little bit harder for myself. 54 00:02:40,440 --> 00:02:43,443 I'm going to use option three to skip to the shell, 55 00:02:44,280 --> 00:02:47,940 and yet it's not mounting the system, that is right. 56 00:02:47,940 --> 00:02:51,360 I wanna do it myself because I want to show you something 57 00:02:51,360 --> 00:02:53,190 that works in all cases. 58 00:02:53,190 --> 00:02:56,220 So here's my cell, a root shell. 59 00:02:56,220 --> 00:03:00,960 I'm using lsblk for list block devices and what do we see? 60 00:03:00,960 --> 00:03:04,710 Well, we see sda1 and sda2. 61 00:03:04,710 --> 00:03:09,710 sda2 is the partition that has my lvm, oh boy lvm. 62 00:03:14,370 --> 00:03:18,180 So lvs is what I wanna do, and fortunately; 63 00:03:18,180 --> 00:03:20,850 lvs is showing me the logical volumes. 64 00:03:20,850 --> 00:03:24,120 So I have my root logical volume that is visible. 65 00:03:24,120 --> 00:03:26,190 So how am I going to access it? 66 00:03:26,190 --> 00:03:31,190 mount /dev/cs, that's the volume group 67 00:03:31,620 --> 00:03:35,227 as we can see in the vg column in the output of lvs, 68 00:03:36,476 --> 00:03:41,476 /root /mnt I just need to mount it on a temporary directory, 69 00:03:41,790 --> 00:03:44,887 and oh that's not going smoothly, I'm getting a message. 70 00:03:44,887 --> 00:03:48,840 "Special device dev/cs/root does not exist." 71 00:03:48,840 --> 00:03:52,023 So we need vgs to inspect the volume groups. 72 00:03:53,100 --> 00:03:54,540 And that is interesting, 73 00:03:54,540 --> 00:03:57,033 I do see the volume group with the name cs. 74 00:03:57,930 --> 00:04:01,680 I do see the lv with the name root, 75 00:04:01,680 --> 00:04:03,840 but I don't see it as a device. 76 00:04:03,840 --> 00:04:05,580 So we need to further investigate. 77 00:04:05,580 --> 00:04:09,390 lv display is what I'm going to do this time 78 00:04:09,390 --> 00:04:12,570 because I want to check that it is available. 79 00:04:12,570 --> 00:04:14,400 And what do we see in lv status 80 00:04:14,400 --> 00:04:17,940 for both of them we see not available. 81 00:04:17,940 --> 00:04:22,940 Well if that is what you get, you need to activate them. 82 00:04:23,400 --> 00:04:24,813 And what is that? 83 00:04:24,813 --> 00:04:28,050 vgchange, vgchange --help. 84 00:04:28,050 --> 00:04:29,760 This is one of these commands 85 00:04:29,760 --> 00:04:34,200 that most people don't use too often, 86 00:04:34,200 --> 00:04:36,570 and oh boy, too much help output. 87 00:04:36,570 --> 00:04:40,353 I'm just looking for what again whilst this syntax. 88 00:04:41,280 --> 00:04:45,480 So the command that you need is vgchange -a y, 89 00:04:45,480 --> 00:04:47,070 that is going to activate it. 90 00:04:47,070 --> 00:04:49,590 And now if I use lvdisplay again 91 00:04:49,590 --> 00:04:52,470 now I can see that my lvstatus is available. 92 00:04:52,470 --> 00:04:55,710 That means that I can now repeat my mount command. 93 00:04:55,710 --> 00:04:58,710 And there we go, in the mnt directory, 94 00:04:58,710 --> 00:05:02,250 I now have access to my operating system. 95 00:05:02,250 --> 00:05:05,203 Now next step in troubleshooting will be "chroot .", 96 00:05:06,300 --> 00:05:08,220 which will make the current directory 97 00:05:08,220 --> 00:05:09,870 your new root directory, 98 00:05:09,870 --> 00:05:12,840 and from here you can do whatever you wanna do. 99 00:05:12,840 --> 00:05:14,820 Well if you needed a rescue disk, 100 00:05:14,820 --> 00:05:19,567 then most likely you need to use grub2 install 101 00:05:21,840 --> 00:05:24,300 because if you needed to rescue this, 102 00:05:24,300 --> 00:05:27,270 then your grub configuration was damaged. 103 00:05:27,270 --> 00:05:30,840 But hey, in order to install grub to the boot loader, 104 00:05:30,840 --> 00:05:34,920 we do also need access to the boot partition, 105 00:05:34,920 --> 00:05:37,470 and ls /boot is giving me nothing. 106 00:05:37,470 --> 00:05:40,470 Now, fortunately there is mount -a, 107 00:05:40,470 --> 00:05:44,697 and now can we use grub to install on /dev/sda 108 00:05:44,697 --> 00:05:47,013 to reinstall the grip boot loader, 109 00:05:48,330 --> 00:05:50,107 and oh boy, I am getting, 110 00:05:50,107 --> 00:05:53,370 "error: cannot find a device for /boot/grub2". 111 00:05:53,370 --> 00:05:55,560 The thing is that I now have access 112 00:05:55,560 --> 00:05:58,290 to my root file system, and the boot partition, 113 00:05:58,290 --> 00:06:01,680 but my proc directory is still empty, 114 00:06:01,680 --> 00:06:05,520 and my dev directory is still empty, that's not good. 115 00:06:05,520 --> 00:06:07,860 The dev directory is the first thing that I need, 116 00:06:07,860 --> 00:06:12,330 and I am going to use exit to take care of it 117 00:06:12,330 --> 00:06:16,320 because in the rescue disk, we do have a dev directory. 118 00:06:16,320 --> 00:06:18,450 This dev directory contains devices, 119 00:06:18,450 --> 00:06:20,760 and this directory is dynamically generated 120 00:06:20,760 --> 00:06:22,230 while you are booting. 121 00:06:22,230 --> 00:06:27,230 And I'm going to use mount -o bind /dev /mnt/dev, 122 00:06:28,740 --> 00:06:32,070 and that makes that within the /mnt/dev, 123 00:06:32,070 --> 00:06:35,490 I now have my devices, so where am I? 124 00:06:35,490 --> 00:06:37,710 I'm still in the mnt directory. 125 00:06:37,710 --> 00:06:41,670 That's good, so I can go get back in my root environment. 126 00:06:41,670 --> 00:06:45,270 Next I need mount proc proc proc. 127 00:06:45,270 --> 00:06:48,960 Believe it or not, we want to mount the proc file system 128 00:06:48,960 --> 00:06:53,010 on the proc directory with the option -t proc and okay, 129 00:06:53,010 --> 00:06:57,390 I admit /proc makes it a little bit easier to understand, 130 00:06:57,390 --> 00:06:59,580 but it's cool to type mount proc proc proc, 131 00:06:59,580 --> 00:07:01,260 and actually it makes sense. 132 00:07:01,260 --> 00:07:05,490 Now we have proc, we have dev, and that means that 133 00:07:05,490 --> 00:07:10,290 I should be able to run my grub2 install at this point. 134 00:07:10,290 --> 00:07:15,290 Okay, there we go, grub2, telling me no error report it. 135 00:07:15,660 --> 00:07:18,150 Please ignore the the messages that you see. 136 00:07:18,150 --> 00:07:21,060 You should be good and you should be able to reboot 137 00:07:21,060 --> 00:07:23,820 back into a normal operating system right now. 138 00:07:23,820 --> 00:07:26,280 Oops, get out of the to root environment, 139 00:07:26,280 --> 00:07:28,863 then you can reboot and you should be good. 140 00:07:29,760 --> 00:07:32,040 Oh no, we messed it up. 141 00:07:32,040 --> 00:07:33,660 Well that means that we need to 142 00:07:33,660 --> 00:07:36,870 try something else to repair it, let's do it. 143 00:07:36,870 --> 00:07:40,050 I just restarted and I see grub, great then, 144 00:07:40,050 --> 00:07:44,010 and I don't see anything else anymore, that's not good. 145 00:07:44,010 --> 00:07:45,780 So what can we do from here? 146 00:07:45,780 --> 00:07:48,330 Well we do have a grub boot menu, 147 00:07:48,330 --> 00:07:53,330 and in the grub boot menu, we can try to troubleshoot. 148 00:07:53,490 --> 00:07:56,850 Now this grub boot menu is a very rich environment. 149 00:07:56,850 --> 00:08:00,780 The environment is so rich that I don't like it very much. 150 00:08:00,780 --> 00:08:04,050 It's confusing and if I get problems like this, 151 00:08:04,050 --> 00:08:06,573 then I am getting back to my rescue system. 152 00:08:07,440 --> 00:08:09,720 So let's get back to the rescue system, 153 00:08:09,720 --> 00:08:12,153 and see if we can get it going again. 154 00:08:15,240 --> 00:08:17,133 So back to the CD-ROM Drive. 155 00:08:19,230 --> 00:08:21,750 And on this CentOS system, there's another option 156 00:08:21,750 --> 00:08:25,920 that's hidden in troubleshooting, boot from local drive. 157 00:08:25,920 --> 00:08:28,923 This boot from local drive is making it a little bit easier, 158 00:08:32,520 --> 00:08:35,160 and oh, not bringing me anywhere. 159 00:08:35,160 --> 00:08:37,593 Okay then I need to go hardcore. 160 00:08:42,510 --> 00:08:44,313 And back to the CD-ROM Drive, 161 00:08:45,840 --> 00:08:49,230 and troubleshooting once more. 162 00:08:49,230 --> 00:08:52,840 So I definitely need my rescue with CentOS Stream system 163 00:08:54,120 --> 00:08:57,573 because with this grub boot prompt, we don't get very far. 164 00:09:00,090 --> 00:09:02,670 So this time, I am going to use this option 165 00:09:02,670 --> 00:09:06,630 where the rescue system is trying to load everything. 166 00:09:06,630 --> 00:09:08,193 So that is option number one. 167 00:09:09,090 --> 00:09:12,390 That's giving me access to a completely functional system, 168 00:09:12,390 --> 00:09:13,800 and I like the idea of having 169 00:09:13,800 --> 00:09:15,573 a completely functional system. 170 00:09:16,560 --> 00:09:21,560 So it's telling me chroot /mnt/sysroot, sounds good. 171 00:09:21,720 --> 00:09:26,373 So chroot /mnt/sysroot, 172 00:09:28,740 --> 00:09:30,600 and there we have all these directories. 173 00:09:30,600 --> 00:09:33,480 Now I need to do my checks, ls /boot. 174 00:09:33,480 --> 00:09:34,800 We do have a boot. 175 00:09:34,800 --> 00:09:38,070 ls /dev, we do have a dev, 176 00:09:38,070 --> 00:09:43,070 ls /proc, that's not ls. 177 00:09:43,680 --> 00:09:46,290 ls /proc, we do have a proc. 178 00:09:46,290 --> 00:09:51,060 And last, ls /sys, we also do have a sys, that's all good. 179 00:09:51,060 --> 00:09:55,050 So now I'm going to try to run my grub 180 00:09:55,050 --> 00:09:59,550 to install on /dev/sda, again, 181 00:09:59,550 --> 00:10:02,853 because that definitely filled in the first attempt. 182 00:10:04,650 --> 00:10:07,110 So here we go, I don't have my errors anymore. 183 00:10:07,110 --> 00:10:09,510 So that is looking all good. 184 00:10:09,510 --> 00:10:12,210 Using exits to get out of the true deal 185 00:10:12,210 --> 00:10:14,283 using a reboot to reboot. 186 00:10:18,210 --> 00:10:19,560 And then what do I get? 187 00:10:19,560 --> 00:10:23,310 I get access to my CentOS Stream, again, 188 00:10:23,310 --> 00:10:25,893 and that means that this problem has been fixed.