Thursday, January 2, 2014

Linux Kdump

Why Kdump
Kdump is utility which really helps in determine the cause of kernel crashes, system hangs, or system reboots.

About Kdump

Kdump is the Linux kernel crash-dump mechanism. Redhat recommends that to enable the Kdump feature. In the event of a system crash, Kdump creates a memory image (vmcore) that can help in determining the cause of the crash. Enabling Kdump requires to reserve a portion of system memory for exclusive use by Kdump. This memory is unavailable for other uses.

Kdump uses kexec to boot into a second kernel whenever the system crashes. kexec is a fast-boot mechanism which allows a Linux kernel to boot from inside the context of a kernel that is already running without passing through the bootloader stage. & the system kernel's memory image is preserved across the reboot and is accessible to the dump-capture kernel.

We can use common commands, such as cp and scp, to copy the memory image to a dump file on the local disk, or across the network to a remote system.

Architectures Support:

Kdump and kexec are currently supported on the x86, x86_64, ppc64, ia64,and s390x architectures.

How to configure Kdump ?

Prerequisites

For dumping cores to a network target, access to a server over NFS or ssh is required.

Whether dumping locally or to a network target, a device or directory with enough free disk space is needed to hold the core. See the "Sizing Local Dump Targets" section below for more information on how much space will be needed.

For configuring kdump on a system running a Xen kernel, it is required to have a regular kernel of the same version as the running Xen kernel installed on the system. (If the system is 32-bit with more then 4GB of RAM, kernel-pae should be installed alongside kernel-xeninstead of kernel.)

Configuring kdump on the Command Line:

To configure the amount of memory that is reserved for the kdump kernel on x86, AMD64, and Intel 64 architectures, open the /boot/grub/grub.conf file as root and add the crashkernel=<size>M@16M parameter to the list of kernel options

Different way to Configuring the Target Type

Edit the /etc/kdump.conf  & make appropriate change as per the production environment.

To change the local directory in which the core dump is to be saved, remove the hash sign (“#”) from the beginning of the #path /var/crash line, and replace the value with a desired directory path. Optionally, if you wish to write the file to a different partition, follow the same procedure with the #ext3 /dev/sda4

To write the dump directly to a device, remove the hash sign (“#”) from the beginning of the #raw /dev/sda5 line, and replace the value with a desired device name. For example:

To store the dump to a remote machine using the NFS protocol, remove the hash sign (#) from the beginning of the #net my.server.com:/export/tmp line, and replace the value with a valid hostname and directory path. For example:
To store the dump to a remote machine using the SSH protocol, remove the hash sign (#) from the beginning of the #net user@my.server.com line, and replace the value with a valid username and hostname. For example:
Enabling the Service

To start the kdump daemon at boot time, type the following at a shell prompt as root:
This will enable the service for runlevels 2, 3, 4, and 5. Similarly, typing chkconfig kdump off will disable it for all runlevels. To start the service in the current session, use the following command as root:
Testing the Configuration

To test the configuration, reboot the system with kdump enabled, and as root, make sure that the service is running:


Then type the following commands at a shell prompt as root: 


This will force the Linux kernel to crash, and the YYYY-MM-DD-HH:MM/vmcore file will be copied to the location you have selected in the configuration (that is, to /var/crash/ by default).

Analyzing the Core Dump

To analyze the vmcore dump file, you must have the crash and kernel-debuginfo packages installed. To do so, type the following at a shell prompt as root:
  ~]# yum install --enablerepo=rhel-debuginfo crash kernel-debuginfo


To start the utility, type the command in the following form at a shell prompt:
crash /var/crash/timestamp/vmcore /usr/lib/debug/lib/modules/kernel/vmlinux

Example: Running the crash utility



Example:  Displaying the kernel stack trace



To display a status of processes in the system, type the ps command at the interactive prompt. You can use ps pid to display the status of the selected process.

Example : Displaying status of processes in the system


Example: Displaying information about open files of the current context

How do I upload a large dump file to Red Hat Support Services?
In some cases, it might be necessary to send a kernel crash dump file to Red Hat Global Support Services for analysis. However, the dump file can be very large, even after being filtered. Since files larger than 250 MB cannot be uploaded directly through the Red Hat Customer Portal when opening a new support case, an FT P server is provided by Red Hat for uploading large files.

The FTP server's address is dropbox.redhat.com and the files are to be uploaded in the /incom ing/ directory. Your FTP client needs to be set into passive mode; if your firewall does not allow this mode, you may use the origin- dropbox.redhat.com server using active mode.

Make sure that the uploaded files are compressed using a program such as gzip and properly and descriptively named. Using your support case number in the file name is recommended. After successfully uploading all necessary files, provide the engineer in charge of your support case with the exact file name and its SHA1 or MD5 checksum.

Wednesday, December 25, 2013

KVM Virsh Console Access to Linux VM – RHEL 6

The console command within virsh is an excellent feature to have working for your virtual environments. For example, it can be really handy to watch a machine boot without launching a GUI tool ie. virt-manager. I personally find virsh console access a quicker way to configure networking settings which may not be able to be achieved via SSH, other than using virt-manager.

Step 1: Configure Serial Terminal
On your new RHEL 6 virtual machine, you’ll need to configure ttyS0. This serial interface is how “virsh console” gains access to your virtual machine.

Log into your virtual machine…

Create new ttyS0 config file.

Step 2: Allow login into ttyS0
By default RHEL 6 will not allow a user to login via ttyS0 unless we modify security.

Step 3: Start ttyS0
Make ttyS0 available, from your terminal execute the following command.

Step 3: Test Virsh Console
From your KVM server, connect to the console of your virtual machine.

Wednesday, December 18, 2013

Fedora 20 Heisenbug Post Installation Guide

Fedora 20 Post Installation Guide

Fedora 20 also known as 20 Heisenbug is the latest version of Fedora distro. It comes with many new features and software updates. Note: Almost every command shown here requires root privileges. So make sure you are logged in as root. Run su command to login as root.

Rpmfusion Repo
 
RPM Fusion Repository includes variety of applications which are not included in the main distro. Like mp3 codec, multimedia player for playing DVDs and many more.
It is recommended that you install RPM Fusion repo because most of the following packages require you to install RPM Fusion otherwise it may not work
   
#yum localinstall --nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-20.noarch.rpm
#yum localinstall --nogpgcheck http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-20.noarch.rpm

Livna Repo
 
Some packages require you to install Livna Repo. Simply run he following commands to add and enable livna repo on your system.

#rpm -ivh http://rpm.livna.org/livna-release.rpm
#rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-livna

MP3 playback Rythmbox

Rythmbox is likely that it will be installed by default. If not installed then you can install it very easily.

#yum install rhythmbox

The default installation of rhytmbox wont allow you to play mp3. To play mp3 you need to add the codes
#yum install gstreamer-plugins-good gstreamer-plugins-bad gstreamer-plugins-ugly

Amarok

Amarok is the default audio player for KDE. It can also be installed on Gnome.

#yum install amarok phonon-backend-gstreamer

Audacious

Audacious is a winamp like audio player

#yum install audacious audacious-plugins

XMMS

XMMS is another winamp like audio player. And its one of my favorite. Its better than audacious in my eyes

#yum install xmms xmms-mp3
Banshee
Banshee allows you to import CDs, sync your music collection to an iPod, play music directly from an iPod, create playlists with songs from your library, and create audio and MP3 CDs from your music library.

#yum install banshee banshee-community-extensions

Video and DVD Playback
 

VLC player
VLC player is the best video player for Linux. It is capable of playing almost every video format.

#yum install vlc

XINE
 
Xine is another video player for Linux. It is very much like vlc player

#yum install xine xine-lib xine-lib-extras-freeworld

Mplayer with SM Player GUI
 
Mplayer is a VLC player like player for Linux. It is capable of playing almost all video and audio formats.

#yum install mplayer smplayer

Totem
Totem is the default video player for Fedora.

#yum install totem-xine xine-lib xine-lib-extras-freeworld

K9Copy

K9Copy is a free, open source DVD backup and DVD authoring program for Linux

#yum install k9copy

libdvdcss

libdvdcss is a free and open source software library for accessing and unscrambling DVDs encrypted with the Content Scramble System (CSS). libdvdcss is part of the VideoLAN project and is used by VLC media player and other DVD player software such as Ogle, xine-based players, and MPlayer.

#yum install libdvdcss

Adobe Flash Player Add the Adobe repo
   
#rpm -ivh http://linuxdownload.adobe.com/adobe-release/adobe-release-i386-1.0-1.noarch.rpm
#rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux
#yum install flash-plugin

Install Flash Player
#yum install flash-plugin
Acrobat Reader
Add adobe YUM Repo
   
#rpm -ivh http://linuxdownload.adobe.com/adobe-release/adobe-release-i386-1.0-1.noarch.rpm
#rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux
Install Adobe reader
#yum install AdobeReader_enu
Google Chrome
Add Google YUM Repo
#vi /etc/yum.repos.d/google.repo
And paste the following
Fedora 32-bit

[google-chrome]
name=google-chrome - 32-bit
baseurl=http://dl.google.com/linux/chrome/rpm/stable/i386
enabled=1
gpgcheck=1
gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub
Fedora 64-bit

[google-chrome]
name=google-chrome - 64-bit
baseurl=http://dl.google.com/linux/chrome/rpm/stable/x86_64
enabled=1
gpgcheck=1
gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub
Save the file using “:wq“.
Install Google Chrome

#yum install google-chrome-stable

Other Applications Filezilla
 
Filezilla is a FTP client and its one of the best

#yum install filezilla
7z or p7zip

#yum install p7zip

Unrar

Unrar utility for extracting, testing and viewing the contents of archives created with the RAR archiver version 1.50 and above.
#yum install unrar

Transmission bittorrent client
 
Transmission is a lightweight bittorrent client for Linux platform.
#yum install transmission

Wine
 
Wine is a is a compatibility layer capable of running Windows applications on Linux. It can run many windows applications even some games in Linux.
#yum install wine

Gparted
 
GParted is a free partition editor for graphically managing your disk partitions.
#yum install gparted

Gimp
Gimp is the most advanced Image Editor for Linux. This gimp has lot of useful features useful.
#yum install gimp yum install gimp-data-extras gimpfx-foundry gimp-lqr-plugin gimp-resynthesizer gnome-xcf-thumbnailer

Eclipse IDE
 
Eclipse is a multi-language Integrated development environment (IDE)
#yum install eclipse

Yum Extender : yumex
Yum Extender (yumex) is a GUI for the yum package manager. If you do not like installing everything from the terminal you can add a GUI installer.
Follow This Article to install Yum Extender (yumex) on Fedora 20

Skype Installation Dependencies:-
#yum install alsa-lib.i686 libXv.i686 libXScrnSaver.i686 qt.i686 qt-x11.i686 pulseaudio-libs.i686 pulseaudio-libs-glib2.i686 alsa-plugins-pulseaudio.i686 qtwebkit.i686 -y

#wget http://download.skype.com/linux/skype-4.2.0.11-fedora.i586.rpm

#yum localinstall skype-4.2.0.11-fedora.i586.rpm

Gnome Extension Installation
https://extensions.gnome.org/local/

Using "Gnome Link" create a account. List of extension.

Tuesday, December 3, 2013

Use google-authenticator for Fedora Login

Install Google Authenticator for Fedora

If you set up 2-step verification using SMS text message or Voice call and also want to be able to generate codes using the Android, iPhone or a Blackberry, you can use the Google Authenticator app to receive codes even if you don’t have an Internet connection or mobile service.
Prerequisite :-
Android Phone.
Barcode scanner.
Google Authenticator App on Phone.
On Laptop as Follow.
[root@localhost rajat]# yum install google-authenticator -y
Loaded plugins: langpacks, presto, refresh-packagekit
Resolving Dependencies
--> Running transaction check
---> Package google-authenticator-1.0-0.gita096a62.fc19.1.x86_64 will be installed
--> Finished Dependency Resolution

Dependencies Resolved


================================================================================================================

 Package                      Arch           Version                                       Repository      Size
================================================================================================================
Installing:
 google-authenticator         x86_64        1.0-0.gita096a62.fc19.1           fedora          33 k

Transaction Summary

================================================================================================================
Install  1 Package

Total download size: 28 k

Installed size: 56 k
Downloading Packages:
google-authenticator-1.0-0.gita096a62.fc19.1.x86_64.rpm                       |  33 kB  00:00:07
Running Transaction Check
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : google-authenticator-1.0-0.gita096a62.fc19.1.x86_64                               1/1
  Verifying  : google-authenticator-1.0-0.gita096a62.fc19.1.x86_64                               1/1

Installed:

  google-authenticator-1.0-0.gita096a62.fc19.1.x86_64


Complete!

Add line to following file:- 

#vi /etc/pam.d/gdm-password

auth         required        pam_google_authenticator.so


:wq

Save and close CTRL+D  (Become as normal user.)




once you type your password next screen you get which is google-authenticator