Pages

Monday, October 13, 2014

Single User Mode for Centos/Rhel 7

Single user mode is the one of the Run level in the Linux operating system, Linux operating system has 6 run levels that are used for different requirement or situation. Single user mode mainly used for doing administrative task such as cleaning the file system, Managing the quotas, Recovering the file system and also recover the lost root password. In this mode services won’t start, none of the users are allowed to login except root and also system won’t ask for password to login.

Step 1: While booting you might see the splash screen like below, grub is counting the time to boot the default operating system as mentioned in /etc/grub2.cfg; this time press any key to interrupt the auto boot.

Step 2: It will list operating systems (in my case only CentOS installed) that you have installed on the machine, In below that you might find some information about booting the OS and editing the parameters of menu. If you want to enter into single user mode; select the operating system and press “e” edit arguments of kernel.


Step 3: Once you have pressed, you should see the information about the selected operating system. It gives you the information about the hard disk and partition where the OS installed, location of the kernel, language, video output, keyboard type, keyboard table, crash kernel and initrd (Initial ram disk).
To enter into single user mode; Go to second last line (Starts with linux 16 or linuxefi) using up and down arrow then  modify the ro argument.



Step 5: Modify it to “rw init=/sysroot/bin/sh”. Once done, press “Ctrl+x”

Now you should be in command line mode with root privileges (without entering password). Now you can start to troubleshoot your system or can do maintenance of your system.



You are in Single user mode .chroot to access your system.

chroot /sysroot

Saturday, October 11, 2014

CentOS 7 network install on VMWare Workstation network problem


If we install Centos  7 on Vmware workstation 10 , you can see that the network is not detected. Its because that the v7 3.10 kernel no longer supports the Ethernet Controller device. So once we install the Centos 7Os in Vmware workstation there will not be Network inside the Vm.

I found at https://access.redhat.com/discussions/722093 that its a Bug and can be fixed by editing the vmx file of Vmware Workstation.

I added the following line to my .vmx file:

CODE: SELECT ALL
ethernet0.virtualDev = "e1000"

Friday, October 10, 2014

Webmaster tool error regarding BlogID and PostID with Google Blogger

If In the rich snippets tool of google webmaster tools user get an error related to blogid and post id. Given below are some examples:

Error: Page contains property "blogid" which is not part of the schema.
Error: Page contains property "postid" which is not part of the schema.

For fixing this errors you can delete these codes from your blog template.

For deleting this codes follow the above steps:
Make backup of your template.
Go into your template code.
search for below codes and delete them from the entire template and save the template..

<meta expr:content='data:blog.blogId' itemprop='blogId'/>
<meta expr:content='data:post.id' itemprop='postId'/>

After deleting these codes from your blog template you can check your structured data in rich snippets tool. If you still get the same error then try deleting all the codes given above from your blogger template. You can re check this here Rich Snippet testing tool.

Thursday, October 9, 2014

Creating Centos-7 Image for Openstack


Download the Centos-7 Minimal ISO from the centos ISO repo

http://isoredirect.centos.org/centos/7/isos/x86_64/

Setting up the KVM environment to create the custom images.

yum install kvm qemu-kvm python-virtinst libvirt libvirt-python virt-manager libguestfs-tools

Script for starting the KVM installation  cat createcentos7.sh
=============
IMAGE=Centos7.qcow2
VIRTIO_ISO=/root/virtio-win-0.1-81.iso
ISO=/ISO/CentOS-7.0-1406-x86_64-Minimal.iso

KVM=/usr/libexec/qemu-kvm
if [ ! -f "$KVM" ]; then
    KVM=/usr/bin/kvm
fi

qemu-img create -f qcow2 -o preallocation=metadata $IMAGE 8G

$KVM -m 2048 -smp 2 -cdrom $ISO -drive file=$VIRTIO_ISO,index=3,media=cdrom  -drive file=$IMAGE,if=virtio,boot=off -boot d -vga std -k en-us -vnc 192.168.2.10:4 -usbdevice tablet
=============
using any VNC client connect to 192.168.2.10:4  and do the rest of configuration.

Complete the installation do the following configurations after starting the image in openstack


cat <<EOF >/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
BOOTPROTO="dhcp"
ONBOOT="yes"
TYPE="Ethernet"
PERSISTENT_DHCLIENT=1
EOF

cat <<EOF > /etc/sysconfig/network
NETWORKING=yes
NOZEROCONF=yes
EOF
yum update -y

yum -y install https://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-2.noarch.rpm -y

yum install cloud-init

yum history new
yum clean all
truncate -c -s 0 /var/log/yum.log
rm -rf /var/lib/yum/*
rm -rf /var/lib/random-seed
rm -rf /root/install.log
rm -rf /root/install.log.syslog
rm -rf /root/anaconda-ks.cfg
rm -rf /var/log/anaconda*


Now save the Vm as a snapshot and use it again :)

Wednesday, October 8, 2014

List installed Python Modules.

First install the python-pip package and use "pip freeze" command to display the Modules.

[root@ceph01-server ~]# python --version
Python 2.6.6
[root@ceph01-server ~]# pip freeze
Cheetah==2.4.1
Markdown==2.0.1
PyYAML==3.10
Pygments==1.1.1
argparse==1.2.1
backports.ssl-match-hostname==3.4.0.2
boto==2.32.1
ceph-deploy==1.5.17
chardet==2.0.1
cloud-init==0.7.4
configobj==4.6.0
distribute==0.7.3
heat-cfntools==1.2.6
iniparse==0.3.1
jsonpatch==1.2
jsonpointer==1.0
ordereddict==1.1
policycoreutils-default-encoding==0.1
prettytable==0.7.2
psutil==0.6.1
pycurl==7.19.0
pygpgme==0.1
requests==1.1.0
setools==1.0
six==1.7.3
urlgrabber==3.9.1
urllib3==1.5
yum-metadata-parser==1.1.2
[root@ceph01-server ~]#

Resuming Download in Linux

wget -c Resume Unfinished Downloads

This small command can save your time and money while downloading big files so I found it useful to share with you .I was downloading a file with wget command and it was 98% downloaded and my computer turned off unexpectedly. It was a very huge file and downloading it from the beginning was a painful job. So I came  across a wget command that can be used for resuming unfinished downloads.

I found this command after reading wget manual, you can add wget -c or wget --continue to resume unfinished download.

wget -c url

Webmaster Tools errot "Warning: Missing required field "updated"" with Google Blogger

When you check your blog hosted with Blogger for Google Authorship with Rich snippet testing tool mostly you get two common warning and error messages 'Warning: Missing required field "updated".' and 'Warning: Missing required hCard "author".

Warning: Missing required field "updated"

Note: Before making any changes to the template please take the backup. Link given below will help you.

Go to Blogger Dashboard › Select Blog › Click on Template › Proceed › Edit HTML

Now press Ctrl+F to find the code timestamp-link   or  published   like below

<a class='timestamp-link' expr:href='data:post.url' rel='bookmark' title='permanent link'><abbr class='published' expr:title='data:post.timestampISO8601'><data:post.timestamp/></abbr></a>

Now care fully change it to the code below

<a class='timestamp-link' expr:href='data:post.url' rel='bookmark' title='permanent link'><abbr class='updated published' expr:title='data:post.timestampISO8601'><data:post.timestamp/></abbr></a>

Now have a smile!


You can re check this here Rich Snippet testing tool.