Friday 30 August 2019

update to kernel 5.2 on linux centos7

Note: Take a snapshot  before doing kernel update.

1. Install binaries required to compile Kernel

yum install gcc ncurses-devel make bc bison flex elfutils-libelf-devel openssl-devel grub2 -y

2. Download the latest kernel from https://kernel.org and extract it

curl -O https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.2.11.tar.xz

tar -xf linux-5.2.11.tar.xz


3. Copy the current Kernel configuration (.config) from the /boot to /root/linux-5.2.11

cp /boot/config-3.10.0-862.el7.x86_64 /root/linux-5.2.11

make menuconfig

save and exit





4. Make kernel and install

make
make install

5. Reboot

Thursday 22 August 2019

Linux root password hack

linux root password hack(Centos7, Redhat 7, Debian)

1. press any key to hold on to grub screen

2. press "e" to edit the grub file

3.a  add "rd.break" at end of the kernal line
3.b add init=/bin/bash   for debian of the linux line

4. press Ctrl+X

5a. mount -o remount,rw sysroot
5b. mount -o remount,rw / (for debian)

6.  chroot sysroot

7. passwd

8. touch /.autorelabel

9. reboot


Why   mount -o remount,rw sysroot ?
- When system boots in the single user mode the file system are in read-only mode. we cannot change the password in read only mode because these changes needs to be written in /etc/shadow file.

Why touch /.autorelabel?
- Relabel the filesystem for SElinux automatically.