AllTechWiki



A Place for All Technical Stuff Linux Cloud etc

RHEL 8.x / 7.x

1) How to change the Default Boot Entry OR how to boot with older kernel (n-1 kernel) in Redhat 7.x and Redhat 8.x

Tested centos&redhat7 and Centos & redhat 8

awk -F\' '$1=="menuentry " {print $2}' /boot/grub2/grub.cfg    #Command to list the available kernels

grubby --info=ALL 

grubby --default-kernel                                        #Command to check the default selected kernel

grubby --default-index                                         #To find out the index number of the default kernel,

vi /etc/default/grub   # change value GRUB_DEFAULT=1 for the n-1 kernel boot ,GRUB_DEFAULT=saved option will take entry from /boot/grub2/grubenv file.

grub2-mkconfig -o /boot/grub2/grub.cfg       #BIOS-based

grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg  #UEFI Based


2) yum local download to install a package with its dependency 

https://www.baeldung.com/linux/offline-install-rpm-package-dependencies

dnf install --downloadonly --downloaddir packge-download/ kernel-devel-4.18.0-305.28.1.el8_4.x86_64

yum --disablerepo=* localinstall *.rpm


3) Disable the subscription warning for RHEL OS.

This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. If you want to suppress or prevent this message while running the dnf or yum command then edit the file /etc/yum/pluginconf.d/subscription-manager.conf :

# vim /etc/yum/pluginconf.d/subscription-manager.conf

and change the parameter enabled=1 to enabled=0:


4) How to reset the permissions of all installed packages to their default settings

sudo rpm --setperms --all  ==>This option resets the file permissions and ownership of all files in the installed packages to the values defined in the RPM database.


5) How to reset the user and group ownership of all files their default settings

sudo rpm --setugids --all ==> This option resets the user and group ownership of files to the values defined in the RPM package metadata.

Ref : https://access.redhat.com/solutions/281923

6) How to restore all file attributes, including permissions, ownership, and SELinux contexts if applicable.

sudo rpm --restore package_name ==> To restore the attributes of a specific package

sudo rpm --restore --all ==>To restore the attributes of all installed packages

Key Options:
  • --setperms: Resets the file permissions.

  • --setugids: Resets the user and group ownership.

  • --restore: Restores all file attributes, including permissions, ownership, and SELinux contexts if applicable.












Post a Comment

Previous Post Next Post

Basic Useful Links