Resetting the Root Password of RHEL-8

Resetting the Root Password of RHEL-8

Resolution
1) Break the boot sequence by adding ‘rd.break’ at kernel stanza in grub. To do this, restart your system and when the GRUB splash screen comes:

  1. Select/highlight the kernel you wish to boot using the up/down arrow keys.
  2. Press the e key to edit the entry.
  3. Select/highlight the line starting with the word kernel or linux.
  4. Press the e key to edit the line.
  5. Add ‘rd.break’ at the end.
  6. Press ENTER to accept the changes.
  7. Press the ‘ctrl + x’ key to boot the kernel with the modified command line.

2) The system will provide a shell which will be from initramfs:

.
.
Entering emergency mode. Exit the shell to continue.
Type "journalctl" to view system logs.
You might want to save "/run/initramfs/rdsosreport.txt" to a USB stick or /boot
after mounting them and attach it to a bug report.
switch_root:/#

3) Root filesystem will be mounted read-only at ‘sysroot’ directory:

switch_root:/# mount | grep -i sysroot
/dev/mapper/rhel-root on /sysroot type xfs (ro,relatime,attr2,inode64,noquota)

4) Remount it with read-write mode:

switch_root:/# mount -o remount,rw /sysroot

5) Chroot into it:

switch_root:/# chroot /sysroot/
sh-4.4#

6) Change the password:

sh-4.4# passwd
Changing password for user root.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.

 
7) Relabel the filesystem:

sh-4.4# touch /.autorelabel

8) Exit from the shell:

sh-4.4# exit
exit
switch_root:/#
switch_root:/# exit

9) The system will continue the paused booting sequence:

.
Starting Relabel all filesystems...
[  OK  ] Started Manage Sound Card St
localhost login:

 

Manually importing a FreeNAS Jail

I just had this same issue today and came across your post.
The reason mine crashed was because the plugin i was importing was huge (about 10GB in size).
–What i ended up having to do was manually create a dataset. Im using plex as an example.
zfs create zpool/iocage/jails/Plex
or use the GUI
–Then unzip the file that you got from your export. I unzipped it to the iocage/images folder. you should have two files, one the same name as the zip file and one with _root added to the name.
–Next i had to import the data from the unzipped files.
zfs recv -F zroot/iocage/jails/plex < plex_2019-10-30
zfs recv -F zroot/iocage/jails/plex/root < plex_2019-10-30_root
Once you do this then you should see it in freenas in the jails section. It came up as if nothing had ever happened for me. Hope this helps anyone else that came across this.
as i was also changing pools i had to edit the fstab file in the jails/<jail> directory
source

Setting an static IP address in RHEL (the old way)

In RHEL8, you use NetworkManager or NMCLI to configure the networking, but in RHEL7 and before, you had to do it a different way.
In this post I show you which files you need to configure to be able set a static IP in REHL7.
Continue reading Setting an static IP address in RHEL (the old way)

How to Change Authentication Method in MySQL

First, to check what is being used run this,
SELECT user, authentication_string, plugin, host FROM mysql.user;
If the user you are having issues with is set to auth_socket then you may need to change it to method with mysql_native_password
Like this,
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
Change root to the user you need and set the password to whatever the password is supposed to be.

Installing software into a FreeNAS jail

Go to Jails
On the right side of the page click the triple dots next to the Plex jail and select Shell
type “whoami” and make sure the response is root (if not use su – or sudo)
type vi /usr/local/etc/pkg/repos/FreeBSD.conf and press enter
If the file exists, look for a line with “FreeBSD: { enabled: no }” and change the no to a yes
OR
If the file is empty type out “FreeBSD: { enabled: yes }
(if you are unfamiliar with vi, to edit just press the letter “a” then type the above stuff without the quotes)
To save, hit the escape button twice and type “:wq” without the quotes
type “exit”
Hit the triple dots again and hit restart for the plex jail
After a few seconds and it is back online hit the triple dots and go to shell
type “pkg update -f” if it prompts you for anything say yes
type “pkg upgrade” and if it prompts you for anything hit yes
You should now be able to install what you need by doing: “pkg install wget ca_root_nss curl perl5 -y”