Main Menu

Search

Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

LINUX: Conntrack Commands Cheatsheet (Conntrack to Track Network Connections)

Check the Dropped Packets in Conntrack

conntrack -s

Check the current connections count in conntrack

conntrack -c





Keywords

conntrack connection track tracking network networking linux how to debug debugging troubleshoot troubleshooting check checking connection 

LINUX: DMESG Command To Check the Disk IO Timeout Errors On Hard Drive / Attached Storage Devices

Below command can be used to Check the Disk IO Timeout Errors On Hard Drive / Attached Storage Devices

dmesg -T | egrep -i 'sda|blk_update|I/O error|timed out|reset|pvscsi'


In above command replace sda with the device name you want to check the Disk IO timeout errors. 

Note: You can check the devices using "lsblk" command.



Keywords:

timeout time out timing out io ioerror error input output network issue issues disconnect disconnected disconnecting latency slow slowness speed slowly device devices harddrive drive drives attached attaching lun luns iscsi


LINUX: How To Backup and Restore The Data Inside XFS Filesystem on the Linux Hosts?

XFS filesystem can be backed up on Linux hosts using xfsdump.

Below are steps.

Install xfsdump package if it does not exist.

 dnf -y install xfsdump

Backup the xfs filesystem using below xfsdump command.

xfsdump -f <filename>.dump <xfs filesystem to backup>

For example if you want to backup /var/lib/containers XFS filesystem and save the dump to /apps/images.dump, your command will look as follows:

xfsdump -f /apps/images.dump /var/lib/containers

Restore XFS filesystem from backup dump

If you want to restore the XFS filesystem from dump, use below command

xfsrestore -f <filename>.dump <xfs filesystem to restore to>

For example if you want to restore to /var/lib/containers XFS filesystem from the dump /apps/images.dump, your command will look as follows:

xfsrestore -f /apps/images.dump /var/lib/containers



Keywords:

backup backing restore restoring disasterrecovery DR disaster recover recovering dump file files original state 



LINUX: firewall-cmd Command To Add NFS Storage Services To Firewalld Rules

Below firewall-cmd Commands can be run to add NFS Services To Firewalld Rules. This is to enable NFS communication to the node where firewalld is running.

sudo firewall-cmd --permanent --add-service=nfs --add-service=rpc-bind --add-service=mountd

sudo firewall-cmd --reload


Keywords:

share shares storage rule rules firewall-cmd firewalls adding updating enable enabling protocol nfsv2 nfsv3 nfsv3 mount mountpoint mounts filesystem filesystems

LINUX: How to Check If Secure Boot Is Enabled On Linux Host?

Below command can be used to check if Secure boot is enabled on Linux hosts.
mokutil --sb-state

Keywords
secureboot booting secure kernel linux host hosts enable enabled enabling 

LINUX: How to Generate Hashed / Encrypted Passwords Using OpenSSL?

Below are commands to generate hashed / encrypted passwords using openSSL.

Generate MD5 password

openssl passwd -1 <password>

Generate SHA-256 password

openssl passwd -5 <password>

Generate SHA-512 password

openssl passwd -6 <password>


For e.g. for SHA-512 password, below is the snippet.

# openssl passwd -6 testing
$6$ENjdcvpGRHDEfXCE$ilnuHaz5VHdeAH.Y5eRDhL3ptR6WGXtfV1KfRltnMIiThqgF.615HO.ugPwqSozlaBaV29iGyI812L9TjzreW1



Keywords

passwords password encrypt encrypting hash hashing hashed algorithm algorithms securities security generating create creating ssl

LINUX: Chpasswd One Line Command To Update Password Without Prompt To Enter Password (Passwd)

Below chpasswd command can be used. Change username with the username to which you want to change password and password with the desired password you want to test.

echo "username:password" | chpasswd

For e.g. to change admin user password to testpwd, your command will look as follows

echo "admin:testpwd" | chpasswd


Keywords:

passwords changing modify modifying update updating oneline single



LINUX: How To Check All The Supported Filesystem On the Operating System / Kernel?

Following is the command to check all the supported filesystems on the Linux operating system / kernel

ls -a /lib/modules/$(uname -r)/kernel/fs | cat

Below is sample output of above command.

btrfs
cachefiles
ceph
cifs
cramfs
dlm
ecryptfs
ext2
ext4
fat
fscache
fuse
gfs2
isofs
jbd2
jffs2
lockd
mbcache.ko.xz
nfs
nfs_common
nfsd
nls
ocfs2
overlayfs
pstore
squashfs
ubifs
udf
xfs


Keywords:

filesystem filesystems file files system systems how to validate validating checking command commands verify verifying kernel kernels OS operating

LINUX: Command To Check Maximum Kernel Threads On OS (How To Docs)

Following command can be used to check the maximum kernel threads on OS.

sysctl -a| grep kernel.threads-max


Keywords:

thread threads maximum total checking operating system systems

PODMAN: Curl Command To List Container Images And Their Tags From Podman Private Registry Running On Remote Host

Following curl command can be used to list container images and their tags from podman private registry running on remote host. In below command replace private-registry with the hostname of the podman private registry host and 5000 with the port number of private podman registry.

curl https://private-registry:5000/v2/_catalog | jq '.repositories[]'  | sort  | xargs -I _ curl -s -k -X GET https://private-registry:5000/v2/_/tags/list

If you can connecting the insecure private registry using self signed certificates, following curl command with --insecure option can be used.

curl --insecure https://private-registry:5000/v2/_catalog | jq '.repositories[]'  | sort  | xargs -I _ curl -s -k -X GET https://private-registry:5000/v2/_/tags/list

Below is the example console output of above command.

{"name":"olcne","tags":["latest"]}
{"name":"olcne/alertmanager","tags":["v0.24.0"]}
{"name":"olcne/apiserver","tags":["v3.27.0","v3.25.1-2"]}
{"name":"olcne/ceph","tags":["v1.12.3","v1.11.6-2","v17.2.5-2","v1.10.9-1"]}
{"name":"olcne/cephcsi","tags":["v3.7.2-1","v3.9.0","v3.7.2-2"]}
{"name":"olcne/cert-manager-acmesolver","tags":["v1.14.5"]}
{"name":"olcne/cert-manager-cainjector","tags":["v1.16.3","v1.14.5","v1.9.1"]}
{"name":"olcne/cert-manager-controller","tags":["v1.16.3","v1.14.5","v1.9.1"]}
{"name":"olcne/cert-manager-startupapicheck","tags":["v1.16.3","v1.14.5"]}
{"name":"olcne/cert-manager-webhook","tags":["v1.9.1","v1.16.3","v1.14.5"]}
{"name":"olcne/cert-manager-webhook-oci","tags":["v1.1.0"]}


Keywords:

Remote external registries private mirror mirroring containers image connecting

LINUX: Command To List All the Sudo Users and Their Sudo Permissions

Below command can be used to list all the Sudo users and their sudo permissions

getent passwd | cut -f1 -d: | sudo xargs -L1 sudo -l -U | grep -v 'not allowed'

Below is sample output.

# getent passwd | cut -f1 -d: | sudo xargs -L1 sudo -l -U | grep -v 'not allowed'
Matching Defaults entries for root on control1:
    !visiblepw, always_set_home, match_group_by_gid, always_query_group_plugin, env_reset, env_keep="COLORS DISPLAY HOSTNAME HISTSIZE KDEDIR LS_COLORS", env_keep+="MAIL PS1 PS2 QTDIR USERNAME LANG LC_ADDRESS LC_CTYPE", env_keep+="LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES", env_keep+="LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE", env_keep+="LC_TIME LC_ALL LANGUAGE LINGUAS _XKB_CHARSET XAUTHORITY", secure_path=/sbin\:/bin\:/usr/sbin\:/usr/bin

User root may run the following commands on control1:
    (ALL) ALL
Matching Defaults entries for kubeuser on control1:
    !visiblepw, always_set_home, match_group_by_gid, always_query_group_plugin, env_reset, env_keep="COLORS DISPLAY HOSTNAME HISTSIZE KDEDIR LS_COLORS", env_keep+="MAIL PS1 PS2 QTDIR USERNAME LANG LC_ADDRESS LC_CTYPE", env_keep+="LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES", env_keep+="LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE", env_keep+="LC_TIME LC_ALL LANGUAGE LINGUAS _XKB_CHARSET XAUTHORITY", secure_path=/sbin\:/bin\:/usr/sbin\:/usr/bin

User kubeuser may run the following commands on control1:
    (root : ALL) NOPASSWD: /etc/kube/scripts/



Keywords:

commands listing sudoers sudo user permission setting settings sudoing users group groups ssh sshing access accessing

LINUX: How to Create Two or More Custom Partitions From Single Attached Disk (FDISK)

Lets Assume the Attached Disk of size 500GB for e.g. is shown as /dev/sdc. Below is the procedure to create 2 or more custom partitions from attached disk

1) List the size of the attached disk

fdisk -l /dev/sdc

Disk /dev/sdc: 500 GiB, 536870912000 bytes, 1048576000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf24ccf4c


2) Run fdisk command to create the 2 or more partitions as follows. In this example we are creating 3 partitions, partition 1 of 375G size, partition 2 of 100G size and partition 3 of 25GB size.

fdisk into the attached disk.

#fdisk /dev/sdc

Welcome to fdisk (util-linux 2.32.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p >>>> Enter p here to print 
Disk /dev/sdc: 500 GiB, 536870912000 bytes, 1048576000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf24ccf4c

In above output we see 500GB size.

Command (m for help): n     >>>> Enter n to create new partition
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p   >>>>> select p here for default partition.
Partition number (1-4, default 1):  >>>>> go with default, or enter the partition number here. In this case we are going with default of 1 for 1st partition
First sector (2048-1048575999, default 2048): >>>> hit enter.
Last sector, +sectors or +size{K,M,G,T,P} (2048-1048575999, default 1048575999): +375G     >>>>> here enter +375G which means that you want 375GB size for 1st partition.

Created a new partition 1 of type 'Linux' and of size 375 GiB.

As seen above we have now created 1st partition.

Command (m for help): n     >>>> Enter n here to create second partition. 
Partition type
   p   primary (1 primary, 0 extended, 3 free)
   e   extended (container for logical partitions)
Select (default p): p   >>>> select p for primary partition
Partition number (2-4, default 2): >>>> go with default or enter partition number. Default is 2 as it is second partition.
First sector (786434048-1048575999, default 786434048): >>>> Hit enter.
Last sector, +sectors or +size{K,M,G,T,P} (786434048-1048575999, default 1048575999): +100G >>>>>> here enter +100G for entering the size of 100GB for second partition.

Created a new partition 2 of type 'Linux' and of size 100 GiB.

As seen above 2nd partition is created above.

Now lets create the final third partition. If you want to create more than 3 partitions you have to specific the custom size here for Last section when prompted instead of going with default option of hitting enter which will take whatever the free attached space is.

Command (m for help): n    >>>>>>> Enter n for creating third new partition
Partition type
   p   primary (2 primary, 0 extended, 2 free)
   e   extended (container for logical partitions)
Select (default p): p >>>> Enter p for primary partition.
Partition number (3,4, default 3): >>>>> go with default by hitting enter which will be 3rd partition, if not provide the partition number.
First sector (996149248-1048575999, default 996149248): >>>> go with default
Last sector, +sectors or +size{K,M,G,T,P} (996149248-1048575999, default 1048575999): >>>> go with default it will take all the rest of the disk space.

Created a new partition 3 of type 'Linux' and of size 25 GiB.

As you can see above the 3rd partition is created with 25GB size.

Command (m for help):


Command (m for help): p >>>> print the partitions. As you can see we have 2 partitions /dev/sdc1, /dev/sdc2 and /dev/sdc3

Disk /dev/sdc: 500 GiB, 536870912000 bytes, 1048576000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf24ccf4c

Device     Boot     Start        End   Sectors  Size Id Type
/dev/sdc1            2048  786434047 786432000  375G 83 Linux
/dev/sdc2       786434048  996149247 209715200  100G 83 Linux
/dev/sdc3       996149248 1048575999  52426752   25G 83 Linux

Command (m for help):


Command (m for help): w >>>>> write and save the changes.

The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

3)  List the partitions for the attached disk to verify that the created partitoins are seen.

[root@ops var]#
[root@ops var]# fdisk -l /dev/sdc
Disk /dev/sdc: 500 GiB, 536870912000 bytes, 1048576000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf24ccf4c

Device     Boot     Start        End   Sectors  Size Id Type
/dev/sdc1            2048  786434047 786432000  375G 83 Linux
/dev/sdc2       786434048  996149247 209715200  100G 83 Linux
/dev/sdc3       996149248 1048575999  52426752   25G 83 Linux
[root@ops var]#

4) Format all the newly created partitions using below commands.

sudo mkfs.xfs -f /dev/sdc1
sudo mkfs.xfs -f /dev/sdc2
sudo mkfs.xfs -f /dev/sdc3

Below are sample outputs.

[root@ops var]# sudo mkfs.xfs -f /dev/sdc1
meta-data=/dev/sdc1              isize=512    agcount=4, agsize=24576000 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=1, rmapbt=0
         =                       reflink=1
data     =                       bsize=4096   blocks=98304000, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1
log      =internal log           bsize=4096   blocks=48000, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@ops var]# sudo mkfs.xfs -f /dev/sdc2
meta-data=/dev/sdc2              isize=512    agcount=4, agsize=6553600 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=1, rmapbt=0
         =                       reflink=1
data     =                       bsize=4096   blocks=26214400, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1
log      =internal log           bsize=4096   blocks=12800, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@ops var]# sudo mkfs.xfs -f /dev/sdc3
meta-data=/dev/sdc3              isize=512    agcount=4, agsize=1638336 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=1, rmapbt=0
         =                       reflink=1
data     =                       bsize=4096   blocks=6553344, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1
log      =internal log           bsize=4096   blocks=3199, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

5) Print the size of the partitions using parted command.

parted /dev/sdc print

Below is sample output.

[root@ops ~]# parted /dev/sdc print
Model: ATA VBOX HARDDISK (scsi)
Disk /dev/sdc: 537GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End    Size    Type     File system  Flags
 1      1049kB  403GB  403GB   primary  xfs
 2      403GB   510GB  107GB   primary  xfs
 3      510GB   537GB  26.8GB  primary  xfs


6) Mount the filesystems using the new partitions.

For e.g. if you want to mount /apps1, /apps2 and /apps3 for partitions sdc1, sdc2 & sdc3 you will need to have below entries in /etc/fstab file.

/dev/sdc2      /apps1       xfs     defaults        0 0
/dev/sdc3      /apps2       xfs     defaults        0 0
/dev/sdc1      /apps3       xfs     defaults        0 0

Alternatively you can mount filesystem using below commands.

sudo mount -t xfs /dev/sdc1 /apps1
sudo mount -t xfs /dev/sdc2 /apps2
sudo mount -t xfs /dev/sdc3 /apps3


Keywords:

Disk disks filesystem filesystems system systems files volume volumes attached attaching size increase expand reduce expanding reducing multiple partitions partition mount mounts points fdisk erase format formatting

LINUX: How To Add User to Sudoers With NOPASSWD Without Editing /etc/sudoers File?

 
Below is the command for adding the current user you are logged in as to sudoers with nopasswd setting (not to prompt for password) without updating /etc/sudoers file.

echo "$USER ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/$USER

Above command adds current user to sudoers. For adding any other specific user for e.g. appuser to sudoers you can run below command as root user.

echo "appuser ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/appuser


Key Words:
 
sudo access sudoers user users password without passwd authentication authenticated prompt


LINUX: How To Enable Debug Logging In Linux For Sudo (Sudoers, Sudo Users)?

 
For Enabling Debug Logging for sudo in Linux, edit /etc/sudo.conf file and add below lines.


Debug sudo /var/log/sudo_debug.log all@debug
Debug sudoers.so /var/log/sudo_debug.log all@debug
Defaults log_input, log_output

After the debugging is enabled to sudo, you will see /var/log/sudo_debug.log file created which will have the debug information. Following is example snippet of debug log.

Mar  8 16:03:54 sudo[6337] <- sudo_new_key_val_v1 @ ./key_val.c:55 := user=olcne
Mar  8 16:03:54 sudo[6337] user_info: user=olcne
Mar  8 16:03:54 sudo[6337] sudo_getpwnam: user olcne [] -> uid 975 [] (cached)
Mar  8 16:03:54 sudo[6337] sudo_get_gidlist: looking up group-IDs for olcne
Mar  8 16:03:54 sudo[6337] sudo_get_gidlist: user olcne has supplementary gid 974
Mar  8 16:03:54 sudo[6337] /etc/sudoers.d/olcne:3: CMNDALIAS ALIAS = COMMAND
Mar  8 16:03:54 sudo[6337] /etc/sudoers.d/olcne:4: WORD(6) ALL = ( WORD(6) : ALL ) NOPASSWD ALIAS
Mar  8 16:03:54 sudo[6337] user olcne matches sudoers user olcne: true @ userpw_matches() ./match.c:498
Mar  8 16:03:54 sudo[6337] user command "/etc/olcne/scripts/olcne-image-exists container-registry.oracl
e.com/olcne/kube-scheduler:v1.29.14" matches sudoers command "/etc/olcne/scripts/": true @ command_matc
hes() ./match_command.c:672
Mar  8 16:03:54 sudo[6337] userspec matched @ /etc/sudoers.d/olcne:4:49: allowed @ sudoers_lookup_check
() ./parse.c:170
Mar  8 16:03:54 sudo[6337] keep USER=olcne: NO
Mar  8 16:03:54 sudo[6337] keep HOME=/home/olcne: NO
Mar  8 16:03:54 sudo[6337] keep LOGNAME=olcne: NO
Mar  8 16:03:54 sudo[6337] sudo_putenv:



Key Words:
 
sudo sudoing sudoers sudo user debug debugging log logging verbose verbosity access

LINUX: XFS Command To Check the Label of the XFS Mount / Partition

Below XFS Command can be used to Check the Label of the XFS Mount / partition

xfs_admin -l /dev/nbd0p1

Below is the sample output.

# xfs_admin -l /dev/nbd0p1
label = "test-label"

Keywords:

Check Checking Label Labels Mount Mounts point points verify verifying validate validating commands partition partitions

LINUX: How to Write Linux ISO To USB Drive In Macbook Using "DD" Command?

Below are steps to write Linux ISO to USB Drive in Macbook/Mac OS

1) Plugin the USD Device to Macbook.

2) Run "diskutil list" command to list the attached USB disk volume

Below is sample command list the attached USB volume
/dev/disk4 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *31.0 GB    disk4
   1:                  Apple_HFS Untitled                31.0 GB    disk4s1

3) Unmount the target volume, in this example it is /dev/disk4s1

sudo diskutil unmount /dev/disk4s1
sudo diskutil unmount /dev/disk4s1
Below is console snippet.
# sudo diskutil unmount /dev/disk4s1

Volume Untitled on disk4s1 unmounted

4) Now run dd command to copy the DVD ISO content to the USB drive volume.

Below is the command to use.
# sudo dd if=Linux.iso of=/dev/disk4s1 conv=fsync oflag=direct status=progress

In above example we are copying Linux9.iso to USB volume /dev/disk4s1 with status bar of copy shown as well.

Below is console snippet.

# sudo dd if=Rocky-8.10-x86_64-dvd1.iso of=/dev/disk4s1 conv=fsync oflag=direct status=progress

  88080896 bytes (88 MB, 84 MiB) transferred 26.003s, 3387 kB/s 
  
When copy is done, you will see following snippet.
# sudo dd if=Linux9.iso of=/dev/disk4s1 conv=fsync oflag=direct status=progress

  14211072512 bytes (14 GB, 13 GiB) transferred 3620.013s, 3926 kB/s   
27761408+0 records in
27761408+0 records out
14213840896 bytes transferred in 3620.559391 secs (3925869 bytes/sec)


5) Eject the USB device once the dd command is completed. Console output in blue.
# diskutil eject /dev/disk4s1

Disk /dev/disk4s1 ejected

6) Unplug the USB drive from the macbook.



Keywords:

USB, drive, thumb, thumbdrive, ISO, copy, copying, image, images, ISOs, dd, commands, mac, mac book, macbook, apple, write, writing, external, device, devices

ORACLE LINUX 8: How to Uninstall UEK Kernel and Make Redhat Compatible Kernel (RHCK) Default Boot Kernel?

Following are steps to Uninstall UEK Kernel and Make Redhat Compatible Kernel (RHCK) Default Boot Kernel in Oracle Linux 8 (OL8)

1) List the currently installed kernels using "rpm -qa" command as shown below.

As we can see we have both Oracle UEK7 kernel 5.15.x and RHCK kernel 4.18.x installed.

# rpm -qa | egrep -i kernel

kernel-tools-libs-4.18.0-553.34.1.el8_10.x86_64

kernel-core-4.18.0-553.34.1.el8_10.x86_64

kernel-uek-core-5.15.0-304.171.4.el8uek.x86_64

kernel-headers-4.18.0-553.34.1.el8_10.x86_64

kernel-tools-4.18.0-553.34.1.el8_10.x86_64

kernel-uek-5.15.0-304.171.4.el8uek.x86_64

kernel-uek-modules-5.15.0-304.171.4.el8uek.x86_64

kernel-modules-4.18.0-553.34.1.el8_10.x86_64

kernel-devel-4.18.0-553.34.1.el8_10.x86_64

kernel-uek-devel-5.15.0-304.171.4.el8uek.x86_64

kernel-4.18.0-553.34.1.el8_10.x86_64

2) List the grub order of the Kernels using grubby command as shown below. In below command it will show the ordering of the kernel, starting line with 0 and then increment. As you can see in below output boot order 0 is for UEK kernel 5.15.x and boot order 1 is for RHCK kernel 4.18.x

#sudo grubby --info=ALL | grep title | nl -v 0


0  title="Oracle Linux Server (5.15.0-304.171.4.el8uek.x86_64 with Unbreakable Enterprise Kernel) 8.10"

1  title="Oracle Linux Server (4.18.0-553.34.1.el8_10.x86_64) 8.10"

title="Oracle Linux Server 8 (0-rescue-b5bf925c42f4075a28da8441ac55fcdf) "

3) List default bootup kernel using grubby command as follows. As you can see default bootup kernel is UEK7 kernel 5.15.

#sudo grubby --default-kernel

/boot/vmlinuz-5.15.0-304.171.4.el8uek.x86_64

4) Change the default kernel to RHCK kernel using grubby command and order number corresponding to RHCK kernel from above step (2). In this case RHCK kernel boot order is 1.

# sudo grub2-set-default 1

5)  Verify that the default kernel changed to RHCK kernel.

sudo grubby --default-kernel

/boot/vmlinuz-4.18.0-553.34.1.el8_10.x86_64

6) Now reboot the Node using reboot command.

#sudo reboot -n


7) After the reboot log back into the node and check the default kernel as follows. You should see default kernel as RHCK kernel.

#sudo grubby --default-kernel

/boot/vmlinuz-4.18.0-553.34.1.el8_10.x86_64

8) Check whether the currently active kernel is RHCK kernel using uname command as follows:

#uname -r

4.18.0-553.34.1.el8_10.x86_64

9) Now remove kernel-uek* packages to uninstall UEK kernel as follows:

#sudo dnf -y remove kernel-uek*

10) Backup /etc/sysconfig/kernel file. And update the file to change below DEFAULTKERNEL line

From

DEFAULTKERNEL=kernel-core

To

DEFAULTKERNEL=kernel

11) Reboot the VM again and log back in.


- - - 

Keywords added for Search:

uninstallation

LINUX: How to Connect to Remote Host via Alias Name Using SSH Config File

Following steps for Connecting to Remote Host via Alias Name Using SSH Config File.

All below steps have to be executed on Linux host from which you want to connect to remote server using alias name

NOTE: Please note that below steps can also be applied on MacBook Mac OS terminal as well.

1) create config file inside .ssh folder of user home.

mkdir ~/.ssh/config
2) Edit the ~/.ssh/config file as follows:
Host <alias name>
    HostName <IP/hostname>
    User <username>
    ProxyCommand nc -X connect -x <proxy> %h %p
    ServerAliveInterval <internal>
  • <alias name> with the alias name you want to use to server you want to connect for e.g. testmachine
  • <IP/hostname> with the hostname/ip of remote server for e.g. 10.10.10.10
  • <Username> with the username of the remote server for e.g. appuser
  • <proxy> replace it with the proxy details if any. If no proxy you can remove this line.
  • <internal> with the ServerAliveInterval in seconds. You can skip this flag as well.

There may be other additional SSH settings as well you can place inside config file. Above are just few examples.

3) Now connect to the remote server using alias name as follows. Replace <alias name> with the alias name you set in config file.
ssh <alias name>