Showing posts with label RHEL. Show all posts
Showing posts with label RHEL. Show all posts

Monday, May 8, 2017

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

Hello Friends,

In this post, I would explain to you how to resolve one of the most intreseting issue on linux servers "Kernel Panic". I think the linux lovers much awaited such issue while they are working on Unix troubleshooting part.

As everyone knows Kernel are most importent part of any operating system and if it is crashed that's means your system crashed.

Normally kernel panic occur when you upgrade the server or upgrade the packages on the server. Here, you can find one of the Kernel panic issue as describe below.

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
Pid: 1, comm: swapper Not tainted 2.6.32-502.el6.x86_64 #1
Call Trace:
 [<ffffffff815292bc>] ? panic+0xa7/0x16f
 [<ffffffff81c2b432>] ? mount_block_root+0x216/0x2cb
 [<ffffffff81002930>] ? bstat+0x2b0/0x980
 [<ffffffff81c2b53d>] ? mount_root+0x56/0x5a
 [<ffffffff81c2b6b1>] ? prepare_namespace+0x170/0x1a9
 [<ffffffff81c2a92a>] ? kernel_init+0x2e1/0x2f7
 [<ffffffff8100c20a>] ? child_rip+0xa/0x20
 [<ffffffff81c2a649>] ? kernel_init+0x0/0x2f7
 [<ffffffff8100c200>] ? child_rip+0x0/0x20


Solution : Normally this issue occur while you upgrade your server using yum and after reboot server is not boot due to kernel panic problem. This problem occur while kernel version has not been changed properly.

You can boot your linux server in grup mode and check the kernel and initrd paramtere. Match both the parameter if they are using same kernel version. During upgrade the initrd version normally not changed so you can manually change the correct kernel version entry in this file.

Once you modified the initrd files boot the server and make a same changes in grub.conf file too, otherwise once you take a reboot or shutdown the machine same kerenl panic error will occur.

[root@localhost]# vi /etc/grub.conf

#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS 6 (2.6.32-504.el6.x86_64)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-504.el6.x86_64 ro root=/dev/mapper/vstorage-root rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=vstorage/root  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
        initrd /initramfs-2.6.32-504.el6.x86_64.img

In above example, the default value 0 identifies the first title option to be used as default, the corresponding kernel version in title option line as 2.6.32-504.el6.x86_64 and the initramfs image file as initramfs-2.6.32-504.el6.x86_64.img. 

Before changing thing please take a backup of grub.conf file. now you can rename the kernel version in the initrd line and matched the same version at both the line and reboot the server, after reboot your linux machine will boot normally.

Hope your kernel panic issue will be resolved after reading this post. Please let me know if you are still facing this issue, I would try to help you.

Monday, March 6, 2017

How to configure YUM Server in Red hat linux 6

In this post, We will get know how to install or configure the Yum server on Red Hat Linux 6 operating system.

As you know their are several ways using which we can install the packages or rpm on the server. Please find the below step by step method to install the packages using YUM.

1. In the initial step please install the cd in cdrom and open a terminal for mount the cd in /mnt directory.

#mount –o loop /dev/cdrom /mnt

Here, we mount the CD of ISO in /mnt direcoty. You must enough space on /mnt folder before mounting this ISO.

2. Now in second step we will create a directory where we make a YUM repository.

#mkdir /rhel6

In this directory we will install all the YUM configuration files.

3. Now we will copy all the files from mount folder to newly created folder.

#cp –rvf /mn/* /rhel6

4. In this step, we will install the required packages which is required for create a repo on the server.

#cd /rhel6/Packages 
#rpm –ivh python*
#rpm –ivh createrepo*

These above packages is required for repostiory creation in YUM server.

5. Now move back again repodata directory and create a new repo for repository installation.

#createrepo  –v /rhel6/Packages

This is install all the packages on /rhel6 directory which is used for YUM configuration.

6. In this step we will create a new repo files in this directory.

#cd /etc/yum.repos.d/
#rm –rf *
#vi ss.repo

[Packages]
baseurl=file:///rhel6/Packages 
gpgcheck=0
enable=1

In this step if any exsiting repo if you found please remove it and create a new repo.

7. In the final step we will clean the repo and check the list of all rpm's using below commands.

#yum clean all
#yum list

Hope, using this post, you can easily install and configured the packages on the Red Hat Operating system. Please comment on the post if you encouter any issue.

Friday, February 3, 2017

How to Shrink or reduce size of LVM partitons in RHEL/CentOS

LVM (Logical Volume Manager) is a tool for logical volume management which includes allocating disks, striping, mirroring and resizing logical volumes.With LVM, a hard drive or set of hard drives is allocated to one or more physical volumes.

LVM allows users to create partitions from more than one disk and allows them to extend the filesystem size online within few seconds.

In this post, we will see how we can shrink the size of an LVM partition without losing data.

On my linux virtual machine, the VG name is “rootvg” and LV name is “Vibhor” which has 60 GB size. I want to reduce the LV size to 4GB. Please note down the following points before proceeding with the shrinking of filesystem.

  • Make sure the current disk usage of the filesystem is less than the size to which you are going to reduce the logical volume.
  • Always take a backup of filesystem data before doing any size change in LVM as a simple mistake in command can cause filesystem corruption and hence loss of data.

Now, please find the below steps which we need to follow for reduce or shrink the partition size.

Umount the filesystem:

We will check the file system through fsck command but before running fsck on the filesystem, it should be unmounted.You can unmount the filesystem “/vibhor” as follows.

#umount /Vibhor

Performing filesystem check:
Before proceeding with reducing filesystem, “fsck” should be done in order to avoid inconsistency of filesystem data.
#e2fsck –f /dev/mapper/rootvg/rootvg_vibhor

Resizing filesystem:

Now, we will reducing the size of the Logical Volume, but before we need to reduce the filesystem in it. The command “resize2fs” can be used for this as follows.

#resize2fs –p /dev/mapper/rootvg/rootvg_vibhor 4G

This will decrease or shrink the filesystem size to 4GB.

Reducing the LV size:

After reduce or shrink the filesystem, we can reducing the LV as given below.

#lvreduce –L 4G /dev/mapper/rootvg/rootvg_vibhor

This will reduce the logical volume size to 4 GB. Now I will mount the filesystem again and check it using the command “df –h”. the file system has reduced to 4 GB without losing any data.

#mount /Vibhor
#df –h

This output will show you the reduce filesystem size.

Thursday, February 2, 2017

How to stop USB Mass Storage device in RHEL/CentOS

Hello Friends,

I’d like to disable all USB devices connected to our Red Hat Linux based workstations. I’d like to disable USB flash or hard drives, which users can use with physical access to a system to quickly copy sensitive data from it.

How do I disable USB device support under RHEL/CentOS workstation operating systems. The USB storage drive automatically detects USB flash or hard drives. You can easily force and disable USB storage devices under any Linux distribution.

The modprobe program used for automatic kernel module loading and can be configured to not load the USB storage driver upon demand. This will prevent the modprobe program from loading the usb-storage module, but will not prevent root (or another program) from using the insmod program to load the module manually.


In linux it’s even more easily done, by unloading the usb_storage module:

for disable the usb storage run the below command :-

# modprobe -r usb_storage

for enable the usb storage run the below command :-

# modprobe -i usb_storage

##############################################################################

The easiest way to disable usb storage device in linux is create following file And add following line inside the file

# touch /etc/modprobe.d/no-usb


install usb-storage /bin/true

##############################################################################