Monday, January 31, 2022
There are times when you need to reinstall GRUB which is the tool to manage Linux boot system. It could be corrupted and such. It's also important to know the defaults that you have to work with once it's installed. In this post we are going to go through the steps to do both.
Here are the steps to install GRUB.
1. Log in and open a terminal session as root
2. There's two ways install GRUB that first is to install it locally by typing grub2-install /dev/sda and the second way is to use the yum package manager to install. Type yum reinstall grub2-efi shim notice we are using the reinstall option for the yum command because grub should already be in the system we are just reinstalling because something is wrong with it
2. Once you have GRUB installed you can work with the defaults by using a text editor to edit the /etc/default/grub configuration file. So type vi /etc/default/grub to edit the grub default.
We are going to change the countdown to 10 seconds instead of 5 and set the GRUB_DISABLE_RECOVERY="true" to get rid of the recovery options in the boot menu, esc :x to save the changes
3. Once the changes have been made to the file you have to run the command grub2-mkconfig -o /boot/grub2/grub.cfg to regenerate the grub configuration file
4. Now if you reboot you should not see the recovery options anymore in the boot menu and the countdown will be 10 seconds instead of 5
Monday, January 24, 2022
On normal startup of the Linux system you probably see this menu every time you boot up
In this post we are going to add a recovery mode for each of these choices.
Here are the steps to create recovery mode options in the GRUB menu:
1. Log into the system normally
2. Open a terminal session, switch to root privilege or root user
3. Type vi /etc/default/grub to edit the grub file
4. Once you are in the grub file find the line that says GRUB_DISABLE_RECOVERY="true" and change it to GRUB_DISABLE_RECOVERY="false" then press esc then type :wq!
5. When you get your command prompt back type grub2-mkconfig -o /boot/grub2/grub.cfg to regenerate the grub file
6. When you reboot the system you will see that for each choice on the menu there's an equivalent recovery mode option, you can press esc to stop the menu countdown
Monday, January 17, 2022
There are times when you need to change the root password, it could be that you are trying to prevent a malicious former employee or that you yourself have forgotten the password. Well you don't have to rebuild the system. That would be an option and a costly one at that. What you could do instead is to reset the root password on the existing install.
Here are the steps to reset the root password on your Linux system:
1. Boot up your Linux system normally when you get the boot menu press esc to stop the countdown, then press e to edit the boot file.
2. Go to the line where you see rhgb and quiet then remove the options from the line
4. Press Ctrl+x to continue with the boot process, as you can see you are now stopped at the switch_root:/# prompt which will give you the opportunity to switch to the root's filesystem
8. So with the /sysroot filesystem remounted with read and write permission and chroot as the false root we can now run the passwd command and change the password like we normally would
9. Now it's very important that we set everything back to normal, so type exit to get out and type
mount -o remoumt,ro /sysroot
to set the root filesystem back to read only, type exit to continue with the boot process
10. Depending on weather you have SELinux enabled or not, your experience will might be different. If you don't have have it enable you will have it enabled then you will be taken to the login screen and your machine will operate the way that it should with the new root password. But regardless of your experience you should revert boot file configuration back to the way it is by doing the reverse of 2 and 3
11. Before we even do that we want to reinforce security if you have it enabled before by typing the following commands
restorecon /etc/shadow
setenforce 1
Monday, January 10, 2022
I've done a post on this before, but it was for an older version of Linux CentOS it no longer works for CentOS 8 Stream. So instead of updating the existing post, I am doing another post so it won't confuse you. The older post is for older version of CentOS and this one is for CentOS 8
The first thing you noticed after your install of CentOS on VirtualBox is that it's pretty small even if you put it in Fullscreen mode, it doesn't not fill the whole screen at all, as a matter of fact the size stayed the same.
In this post we are going to install the Guest Addition tool in VirtualBox to make the VM fullscreen truly fullscreen.
Here are the steps to make the VM fullscreen:
1. Log into your system as root
2. Run dnf update -y, if you have no internet access type dhclient -v to get access
3. Next we want to install Red Hat's repository of tools with this command dnf install epel-release
4. Once the update is finished run the command dnf install gcc make perl kernel-devel kernel-headers bzip2 dkms -y to install headers and build tools
9. Type in the root password and click on "Authenticate"
10. If you don't see your VM going fullscreen, then try reboot
11. Once rebooted click on "View", then "Full-screen Mode" to use your VM in fullscreen mode