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:

 

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 set a static IP address in RHEL8

How to set a static IP address in RHEL8
# get the current connection name
[root@localhost ~]# nmcli con show
NAME UUID TYPE DEVICE
ens160 6b0e7866-7d4f-4668-afbf-a485f9a1e6db ethernet ens160

# Note the NAME of the connection
# To see what IP, gateway and DNS you are currently using do
[root@localhost ~]# nmcli con show ens160 | grep ipv4
ipv4.method: auto
ipv4.dns: 8.8.4.4
ipv4.addresses: 192.168.0.33/32
ipv4.gateway: 192.168.0.1

# If that doesn’t show the information you need, try this command instead:
[root@localhost ~]# nmcli con show ens160 | grep IP4
IP4.ADDRESS[1]:
IP4.GATEWAY[1]:
IP4.DNS[1]:
IP4.DNS[2]:
# set a static IP of 192.168.0.33
[root@localhost ~]# nmcli con mod ens160 ipv4.address 192.168.0.33 ipv4.gateway 192.168.0.1 ipv4.dns 8.8.4.4 ipv4.method manual
# apply new settings to device
[root@localhost ~]# nmcli dev reapply ens160
NOTE : Your connection name, IP address, gateway and DNS information will probably be different to the above, so change it where necessary.