Archive for the ‘Tips, Tricks, Guides’ Category

Dec
27
2009

Linux: Determining IP information for eth0… failed

When setting up a workstation to connect to internet, you may come across a message
Determining IP information for eth0… failed

The above error message basically means that eth0 i.e your network interface card is not setup correctly.

Some of the commands that can come handy in troubleshooting where the error lies are listed below

$ dmesg | grep eth0
(displays information about the ethernet controller card, mac address etc.)

$ cat /etc/sysconfig/network(displays the network settings)
NETWORKING=yes
HOSTNAME=localhost.localdomain
GATEWAY=192.168.122.1

$ cat /etc/sysconfig/network-scripts/ifcfp-eth0

$ ifconfig eth0 down (to down the nic)
$ ifconfig eth0 up (to start the nic)
$ netstat -rn (display kernel routing IP table)
$ cat ifcfg-eth0 (eth0 configuration settings)
DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=00:16:18:33:B3:CF
ONBOOT=yes

$ service network restart (restart the network settings)

$ ping -c4 google.ca(to check if the internet connection works)

$ traceroute google.ca (to check how the IP navigation path is set)

Refer Red Hat linux 5 configure network article for additional info

  • Share/Save/Bookmark
Dec
03
2009

Ubuntu: How to check if a software is installed in ubuntu?

Command used to check if a particular software is installed in Ubuntu or not

$ dpkg-query -s firefox

This is the equivalent of “rpm -qa firefox” in RedHat/CentOS

  • Share/Save/Bookmark
Nov
10
2009

Query string limit in GET data and Size limit in POST Data

RFC 2616 – Section 3 states:

“Servers should be cautious about depending on URI lengths above 255 bytes because some older client or proxy implementations may not properly support these lengths.”

Different browser agents support different URI length acceptance. In addition, servers too play a role in accepting/denying URI’s over certain length which may either truncate the URI or may give lengthy URI message indications.

It is always advisable to rely on shorter URI’s and to post data when more field sets are to be transferred across web pages.

POST data too has its limit. In this case, it is the size of the data which is controlled by the server settings.

Some interesting discussions:

Limit on query string GET URL parameters

  • Share/Save/Bookmark
Aug
16
2009

Premature end of script headers: apache error

Apache errors and the approach to solve it

Premature end of script headers
500 Internal Server Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers.

Some troubleshooting tips:

i) Check /var/log/apache2/error.log (in ubuntu, check the respective apache error log location for the messages)

ii) Check if the content type of the page is correctly set for the html content output.

print “Content-type: text/html\n\n”;

iii) Check if a valid permission has been given for the file to get executed. The file need permission 755 for it to be executed on the server.

iv) Check if the configuration path, inclusion path are set correctly in the referenced programs

  • Share/Save/Bookmark
Aug
15
2009

Permission denied: exec of failed in Apache Server

Apache Permission Denied Error can be caused due to one of many configuration mistakes listed below

Check the apache configuration settings

i) The first is the reference to folder where cgi or perl files will reside and its execute permission settings

 <ScriptAlias /cgi-bin/ /usr/local/cgi-bin/>
 <Directory "/usr/local/cgi-bin">
     AllowOverride None
     Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
     Order allow,deny
     Allow from all
 </Directory>

ii) The second is the proper add handlers that are set for the file execution

AddHandler cgi-script .cgi .pl
<Files ~ "\.pl$">
    Options +ExecCGI
</Files>
<Files ~ "\.cgi$">
   Options +ExecCGI
</Files>

Check the apache error log for any messages (/var/log/apache2/error.log).

  • Share/Save/Bookmark
Aug
14
2009

Ubuntu: Change menu order in GRUB loader

GRUB stands for GRand Unified Bootloader. This is to enable the listing of multiple operating systems so the users could choose the OS of their choice.

To change the menu order we need to edit a file called menu.lst

# vi /boot/grub/menu.lst

Look for a line “default 0“. This is the option to indicate that the first menu on the list should be loaded by default. In order for you to set the default menu content in the GRUB loader that needs to get started you can set this parameter.

This is of the form “default <ID>” where ID = N -1. If there are 4 list items in the menu and if you want to load the 4th item by default, you need to set this configuration setting to “default 3″.

Another option for you is to have the menu list with the entry “savedefault = true“. This would enable the last used menu entry to get loaded during the next boot.

  • Share/Save/Bookmark
Aug
13
2009

Mount, Read, Write, Access USB Flash Drive in Ubuntu

How to access USB Flash Drive?

To know the drives and their partition you need to execute
# fdisk -l

Another option is to list the last 5 entries from /dev to know what devices got attached
$ ls -ltr /dev | tail

And another option is to use the lsusb command.

USB Flash drive will normally be listed down as /dev/sdb1
(more…)

  • Share/Save/Bookmark
Aug
12
2009

su vs. sudo

The help pages state …

su – run a shell with substitute user and group id’s
sudo – execute a command as another user (or root)

When ‘sudo‘ is used with a command, the command gets executed with privileges set for the user and the group she belongs to. If a password is required and if it is given initially, the session will be valid depending on the time set for each session and the user needn’t have to type the password within that duration. /etc/sudoers is the location where permission settings for sudoers are being set.
(more…)

  • Share/Save/Bookmark
Aug
08
2009

How to hide Apache version, Modules loaded, PHP Version?

It is often advisable not to disclose information than is necessary when web request are made to Apache server.

By default, Apache displays the version of the server, modules loaded in the server and the version of PHP if PHP is configured with Apache.

In httpd.conf file, set the following directives.

ServerSignature Off
ServerTokens ProductOnly

By default, ServerSignature is set to Off and ServerTokens is set to Full in most Linux distros.

  • Share/Save/Bookmark
Aug
06
2009

How to burn ISO image from Ubuntu Command Line?

First list down the CD/DVD devices connected to your machine and find the device name. Some of the tools that comes handy in an Ubuntu machine are ‘wodim’, ‘genisoimage’

Wodim stands for Write Data to Optical Disk Media. If you don’t have the software installed in your Ubuntu release do an apt-get

$ apt-get install wodim

To know more about wodim and its parameter definition try man on wodim

To list the CD/DVD devices on the machine, issue

$ wodim –devices

wodim: Overview of accessible drives (2 found) :
————————————————————————-
0 dev=’/dev/scd0′ rwrw– : ‘HL-DT-ST’ ‘CD-RW GCE-8481B’
1 dev=’/dev/scd1′ rwrw– : ‘HL-DT-ST’ ‘DVD-ROM GDR8161B’

Our read-write CD device is in /dev/scd0. So our command for burning the .iso image

$ wodim dev=/dev/scd0 driveropts=burnfree -v -data ubuntu8desktop.iso

To burn audio files

$ wodim dev=/dev/scd0 driveropts=burnfree -v -audio one.wav two.wav three.wav

Further read
i) ubuntu guide http://ubuntuguide.org/wiki/Ubuntu:Feisty/CDDVDBurning

ii) ubuntu site https://help.ubuntu.com/community/CdDvd/Burning

  • Share/Save/Bookmark