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

Tuesday, 12 August 2014

what is a defunct process

A process marked <defunct> is partly dead, waiting to be fully destroyed by its parent.
Sometimes the process args will be unavailable; when this happens, ps will instead print the executable name in brackets.


Thursday, 7 August 2014

force uninstall an rpm package

How to uninstall an rpm package forcefully if the respective  package installed locations are deleted by mistake?

rpm -e  httpd  --nodeps --noscripts 

reference: http://www.linuxquestions.org/questions/linux-general-1/force-uninstall-by-rpm-103840/

Friday, 23 November 2012

zip command in linux

The following examples illustrate typical uses of the command zip for packaging a set of files into an "archive" file, also called "zip file". The command uses the standard zip file format. The archive files can therefore be used to tranfer files and directories between commonly used operating systems.
zip archivefile1 doc1 doc2 doc3
This command creates a file "archivefile1.zip" which contains a copy of the files doc1, doc2, and doc3, located in the current directory.

zip archivefile1 *
This command creates a file "archivefile1.zip" which contains a copy of all files in the current directory in compressed form. However, files whose name starts with a "." are not included. The extension ".zip" is added by the program.

zip archivefile1 .* *
This version includes the files that start with a dot. But subdirectories are still not included.

zip -r archivefile1 .
This copies the current directory, including all subdirectories into the archive file.

zip -r archivefile2 papers
This copies the directory "papers", located in the current directory, into "archivefile2.zip".

zip -r archivefile3 /home/joe/papers
This copies the directory "/home/joe/papers" into "archivefile3.zip". Since in this case the absolute path is given, it doesn't matter what the current directory is, except that the zip file will be created there.
The command unzip extracts the files from the zip file.
unzip archivefile1.zip 

This writes the files extracted from "archivefile1.zip" to the current directory. 

Thanks to all Linux related Websites.

Thursday, 27 September 2012

How to Repair Linux File System?

My ESX VM Linux Server haulted at single user mode ( init 1 ) , after doing a restart as a result of  file system check up failure ( fsck process).

So, how to trouble shoot it?

You will see a black screen with the following information as given below:

"This is the key: the filesystem is corrupted, probably due to an unclean shutdown. It needs to be repaired. Try entering the root password, which should

give you a '#' prompt.
Type: fsck -A -y "

My Approach to it to trouble shoot  File System corruption issue:

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

1.Before executing fsck, unmount all filesystems to make sure  that  no disk i/o happens.Then do fsck, then remount or just say "init 6".
2.Tips on mounting:
a.mount -o rw /  to freshly mount a disk onto / with read and write permissions to  root filesystem.
b.mount -o remount,rw  /  to  unmount,remount the disk onto / with read adn write permissions to root user or system admin.

RHEL6.2X64_Shalni: Disk name :  /dev/sda1:

So, user command :  e2fsck -f /dev/sda1  is  ok

Is shalini's machine having /dev/sda3. let me check:

e2fsck -f /dev/sda3


Reference :

So how the hell you are gonna Surviving a Filesystem Failures? Most of time fsck (front end to ext2/ext3 utility) can fix the problem, first simply run

e2fsck - to check a Linux ext2/ext3 file system (assuming /home [/dev/sda3 partition] filesystem for demo purpose), first unmount /dev/sda3 then type

following command :
# e2fsck -f /dev/sda3
Where,

    -f : Force checking even if the file system seems clean.

Please note that If the superblock is not found, e2fsck will terminate with a fatal error. However Linux maintains multiple redundant copies of the

superblock in every file system, so you can use -b {alternative-superblock} option to get rid of this problem. The location of the backup superblock is

dependent on the filesystem's blocksize:

    For filesystems with 1k blocksizes, a backup superblock can be found at block 8193
    For filesystems with 2k blocksizes, at block 16384
    For 4k blocksizes, at block 32768.

Tip you can also try any one of the following command(s) to determine alternative-superblock locations:
# mke2fs -n /dev/sda3
OR
# dumpe2fs /dev/sda3|grep -i superblock
To repair file system by alternative-superblock use command as follows:
# e2fsck -f -b 8193 /dev/sda3

However it is highly recommended that you make backup before you run fsck command on system, use dd command to create a backup (provided that you have spare

space under /disk2)
# dd if=/dev/sda2 of=/disk2/backup-sda2.img

Links:
http://www.cyberciti.biz/tips/surviving-a-linux-filesystem-failures.html
http://www.cyberciti.biz/tips/understanding-unixlinux-filesystem-superblock.html


First of all, list all the super blocks of /dev/sda1:

Following command displays primary and backup superblock location on /dev/sda3:
# dumpe2fs /dev/sda1 | grep -i superblock

Learned that, backup superblock is at 8193,24577,40961,57345,73729,204801,221185,401489:

So, let me try with alternative superblock to recognize the filesystem which ext3 written on /dev/sda1:

Command to load alternative superblock : e2fsck -f -b 8193 /dev/sda1 -  Linux

File system is fixed now on inodes,userdata,file metadata etc..


Big problem that confused me:
Now, On VMWare Linux :  how to repair /dev/mapper/VolGroup-lv_root :
check for all mount points using cat /proc/mounts


Steps I followed from Murthy Sir:

1.In single user mode # vi /etc/fstab
2.Renamed 1 2 flags  to 0 0  for logical volume which mounted on /.This tells init to ignore "FileSystem Check and FileSystem Backup".
3.use # sync  command  to flush the buffers to hard disk.
4.Then reboot using, init 6  command.
5.If it ignores Filesystem checks and comes up, it is ok to work.
6.After Linux comes up, Again check whether all filesystems are ok leaving /.
7.How to check?
8.Again vi /etc/fstab,change  0  0  to  1  2 for  /dev/mapper/VolGroup-lv_root.
9.do  sync
10.init 6

Now, your linux ios ready for working in runlevel 5.
++++++++++++++++++++++++++++++++++++++++++++++++++++

While checking hostname on linux:
1.Make sure that /etc/hosts will have last  entry of IP as the latest entry.
<IP> <FQDN> <HostName>.

2.vi /etc/sysconfig/network.
Makure Sure,
NETWORK=yes
HOSTNAME=RHEL62X64

3."Sync"
4.init 6 -> reboots to runlevel 5.

++++++++++++++++++++++++++++++++++++++++++++++++++++


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Wednesday, 3 March 2010

dns or dhcp problem

It should be the problem with your network configuration.. Try this and see:

/etc/init.d/xsupplicant restart
/etc/init.d/networking restart

Wow!! It worked

setting monitor diisplay resolution

Resolution : 1680 * 1050@60HZ

1)Ctrl-Alt-F1 ( To reset ubuntu boot settings).
2)Copy the latest xorg.conf file to /etc/x11/
3)/etc/init.d/gdm restart
4)/etc/init.d/X11 common restart or ./startx
5)Ctrl-Alt-F7 (back to GUI login)
6)Ctrl-Alt-backspace (back to command line prompt)
7)Ctrl-Alt-F5 (command line login prompt)


Thursday, 25 February 2010

top and renice

To prioritize a process in linux, we can either execute renice command directly from the shell or from the top command.

$renice 19 $PID sets the low priority to the $PID process , bigger the number lower the priority.

$same can be achieved through the top command
press r -> asks for PID: <enter $PID> -> asks for the NICE value : <enter a number > -> negative increases the priority of the process.

Thursday, 28 January 2010

Enable remote desktop for Ubuntu

On your Ubuntu:

Go to System->Preferences->Remote Desktop

And apply the following settings:

Open up vnc ports on your firewall (in case they are “blocked”)

$ sudo iptables -I INPUT -p tcp --dport 5901 -j ACCEPT

$ sudo iptables -I INPUT -p tcp --dport 5900 -j ACCEPT

** 5900: Default port for VNC (display 0) and 5901: Port used for VNC display 1

On your windows:

- Get the vnc viewer client from realvnc

- In the VNC viewer connection detail window enter <your ubuntu IP>:o

Open http port without stopping iptables

How can i open http port:80 to publish my webpage with out disabling iptables in ubuntu?

sudo iptables -I INPUT -p tcp --dport 80 -j ACCEPT


PS: Stopping iptables will open all the ports of the system which is not recommended.

Monday, 30 November 2009

ulimit

There is a limit on the number of files being processed by a process in the linux,which is governed by the configuration file /etc/security/limits.conf.The limit value can be reset with out building the kernel with the following command.

ulimit -n : Using this we can increase the per user limit to any number using <ulimit -n number > in user .bashrc , to increase the number of files to pickup by a pid
and process and it is set in /etc/security/limits.conf.

Tuesday, 24 November 2009

common terminal sharing

we can share other user's terminal and work on his terminal and see what he is doing by sharing our terminal as follows:

sperumal@bash:~> kibitz lbabu
asking lbabu to type: kibitz -20798
Escape sequence is ^]

he will type kibitz -20798 from his end.

Saturday, 14 November 2009

character and block devices

We can found system's character devices and block devices from the file /proc/devices:

sriram$cat /proc/devices

Character devices:
1 mem
2 pty
3 ttyp
4 ttyS
5 cua
7 vcs
10 misc
13 input
36 netlink
124 tcpstats
128 ptm
136 pts
162 raw
180 usb
227 dump
254 megadev

Block devices:
1 ramdisk
3 ide0
8 sd
9 md
12 unnamed
14 unnamed
38 unnamed
39 unnamed
65 sd
66 sd

Tweets by @sriramperumalla