Linux: How to clear the cache from memory

Linux has a supposedly good memory management feature that will use up any “extra” RAM you have to cache stuff. This section of the memory being used is SUPPOSED to be freely available to be taken over by any other process that actually needs it, but unfortunately my Linux (three distros now, Mandriva 32 bit, and Mandriva 64 bit, and Opensuse 11 64 bit) thinks that cache memory is too important to move over for anything else that actually needs it.

Simply run the following command as root and the cache will be cleared out.

sync; echo 3 > /proc/sys/vm/drop_caches

Bom Sabado Worm is Fixed By Google !

From Google !!

This is to inform you all that we’ve contained the “Bom Sabado” virus and have identified the bug that allowed this and have fixed it. We’re currently working on restoring the affected profiles. Thanks a ton to each of you who’s made an effort to alert everyone else about this. I’ll make sure to keep you guys posted on more updates” The worm Bom Sabado which has a very ironic translation into Portuguese meaning ‘Good Saturday’ had affected the social networking site Orkut on Saturday 25th September. The worm did nothing like post malicious links, rather it just left scraps from the infected account to every friend’s scrapbook. The scrap read simply ‘Bom Sabado’. So the unwary users just viewed the scraps & then the worm affected their cache memory leaving them infected. Google had asked the Orkut users to not login for a while and refresh their browser cookies & cache. It was also advisable to change the password and the security question as well. Many users were however unfortunate enough to be online when the Bom Sabado worm attacked leaving their accounts hacked. Google has promised to look into this matter and try and fix the hacked profiles in Orkut. Read more: http://www.dailylatestnews.com/2010/09/26/bom-sabado-worm-orkut-fixed-google-029589#ixzz10e1rvDoS

How to fix “Firefox is already running” error

Sometimes when you try to start Firefox, it warns you that Firefox is already running. The message looks like this: Firefox is already running, but is not responding. To open a new window, you must first close the existing Firefox process, or restart your system. Usually, you can just kill the firefox process to solve this problem. For example, on Linux the command “ps auxwww | grep firefox” will find the process number and then “kill [processnumber]” will work fine. But sometimes things are more horked than usual. That happened to me today, surprise surprise 🙂 Here’s how to fix the deeper problem: Step 1. Find your profile. This page tells you how to find the location of your Firefox profile. Under Linux (e.g. Ubuntu), it will be at ~/.mozilla/firefox/[Profile name]/ . Step 2. Remove the lock files. This page tells you what the lock files are for Firefox on Windows/Linux/Mac. Under Unix/Linux, you’ll need to remove two files “lock” and “.parentlock” .

"ERROR: Could not complete request. Query: CREATE "sent-mail" Reason Given: Invalid mailbox name."

Squirrelmail error upon login: Create “sent-mail”, Invalid mailbox name

Solution If you receive the following error message in the left menu of Squirrelmail after you login:

“ERROR: Could not complete request.
Query: CREATE “sent-mail”
Reason Given: Invalid mailbox name.”

This usually means that your configuration file(s) have been damaged and need to be recreated.  You can fix this by doing the following steps:
Edit the below file
/usr/local/cpanel/base/3rdparty/squirrelmail/config/config.php and change the below line as per given below:
$default_folder_prefix          = ‘INBOX.’;

checking Pango flags… configure: error: *** Pango not found. Pango built with Cairo support is required *** to build GTK+. See http://www.pango.org for Pango information.

First check the  environment variable “PKG_CONFIG_PATH” .

It can be find by echo $PKG_CONFIG_PATH. Then copy the file “pangocairo.pc” which you find inside the file “pango-1.16.0” where you have installed it.

Copy “pangocairo.pc” to “/usr/local/lib/pkgconfig”.

Then configure it and make, make install  will fix the issue

SMTP error from remote mail server after RCPT TO:: host mail.rebushr.com [194.73.102.244]: 550 Rule imposed as 1102520@qozz.com is believed to be an open relay

It’s not an open relay.

a) qozz.com should set their rejections to FAIL, not blackhole. Blachole fails silently and may “fail” poorly written relay tests since it won’t outright reject the mail (but it also won’t deliver it).

root@server442 [~]# cat /etc/valiases/qozz.com
*: :blackhole:

Instead they should set:

*: :fail: No such user here

Blackhole appears to be the default for most domains on this server. I recommend switching them all to fail if you are being marked as an open relay.

Forbidden You don't have permission to access /_vti_bin/_vti_aut/author.exe on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. Apache/x.x.x Server at yourdomain.com Port 80

To resolve above error login into your server with root login details and follow the following steps.

1) First found out the owner for your domain where you have seems the “403 Forbidden error” and once you found out the user name for your domain then fire the following command one by one touch /home/username/public_html/_vti_bin/_vti_aut/author.exe or touch ~username/public_html/_vti_bin/_vti_aut/author.exe chown username.username ~username/public_html/_vti_bin/_vti_aut/author.ex chmod 644 ~username/public_html/_vti_bin/_vti_aut/author.ex If you are having Frontpage problem with the addon domain then change the path as per your addon domain document root path and create a author.ex file under your addon domain.Then try to publish your site by using Frontpage

URL Masking/URL Frame Forwarding

The  URL can be forwaded without showing the change in the browser by placing the below code in the index.php of the domain which is to be redirected .

<HTML>
<HEAD>
<base href=”http://www.sherinsunny.com/” />

<meta name=”DESCRIPTION” content=””>
<TITLE></TITLE>
</HEAD>
<FRAMESET ROWS=”100%, *” frameborder=”no” framespacing=0 border=0>
<FRAME SRC=”http://www.sherinsunny.com” NAME=”mainwindow” frameborder=”no” framespacing=”0″ marginheight=”0″
marginwidth=”0″></FRAME>

</FRAMESET>

<NOFRAMES>
<CENTER>
<H2>
Your browser does not support frames. We recommend upgrading your browser.
</H2>
<br><br>
Click <a href=”http://www.sherinsunny.com”>here</a> to enter the site. </CENTER>

</NOFRAMES>
</HTML>

Apache Down

/sbin/service httpd restart
httpd not running, trying to start
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:443
no listening sockets available, shutting down
Unable to open logs

Solution:

netstat -plan | grep :80

check how many process are listening to port 80 of the webserver. if there are many process then check the process id in /proc/precessid. Check for the malicious scripts or any eggdrop running. The issue may have also occur when sendmails are running through php files.

Kill the sendmail and then restart the apache.

If apache is not restarting after this. Remove semaphore using the following script.

root@del [~]#for i in `ipcs -s | grep nobody | awk ‘{print $2}’`; do ipcrm -s $i; done

This will fix it.

CHANGE SHELL PROMPT

Prompt is control via a special shell variable. You need to set PS1, PS2, PS3 and PS4 variable. If set, the value is executed as a command prior to issuing each primary prompt.

  • PS1 – The value of this parameter is expanded (see PROMPTING below) and used as the primary prompt string. The default value is \s-\v\$ .
  • PS2 – The value of this parameter is expanded as with PS1 and used as the secondary prompt string. The default is >
  • PS3 – The value of this parameter is used as the prompt for the select command
  • PS4 – The value of this parameter is expanded as with PS1 and the value is printed before each command bash displays during an execution trace. The first character of PS4 is replicated multiple times, as necessary, to indicate multiple levels of indirection. The default is +

How do I modify or change the prompt?

Modifying the prompt is easy task. Just assign a new value to PS1 and hit enter key:
My old prompt –> [sherin@105r2 ~]$
PS1="touch me : "
Output: My new prompt

touch me :

So when executing interactively, bash displays the primary prompt PS1 when it is ready to read a command, and the secondary prompt PS2 when it needs more input to complete a command. Bash allows these prompt strings to be customized by inserting a number of backslash-escaped special characters that are decoded as follows:

  • \a : an ASCII bell character (07)
  • \d : the date in “Weekday Month Date” format (e.g., “Tue May 26”)
  • \D{format} : the format is passed to strftime(3) and the result is inserted into the prompt string; an empty format results in a locale-specific time representation. The braces are required
  • \e : an ASCII escape character (033)
  • \h : the hostname up to the first ‘.’
  • \H : the hostname
  • \j : the number of jobs currently managed by the shell
  • \l : the basename of the shell’s terminal device name
  • \n : newline
  • \r : carriage return
  • \s : the name of the shell, the basename of $0 (the portion following the final slash)
  • \t : the current time in 24-hour HH:MM:SS format
  • \T : the current time in 12-hour HH:MM:SS format
  • \@ : the current time in 12-hour am/pm format
  • \A : the current time in 24-hour HH:MM format
  • \u : the username of the current user
  • \v : the version of bash (e.g., 2.00)
  • \V : the release of bash, version + patch level (e.g., 2.00.0)
  • \w : the current working directory, with $HOME abbreviated with a tilde
  • \W : the basename of the current working directory, with $HOME abbreviated with a tilde
  • \! : the history number of this command
  • \# : the command number of this command
  • \$ : if the effective UID is 0, a #, otherwise a $
  • \nnn : the character corresponding to the octal number nnn
  • \\ : a backslash
  • \[ : begin a sequence of non-printing characters, which could be used to embed a terminal control sequence into the prompt
  • \] : end a sequence of non-printing characters

Let us try to set the prompt so that it can display today’d date and hostname:
PS1="\d \h $ "
Output:

Sat Jun 02 server $

Now setup prompt to display date/time, hostname and current directory:
$ PS1="[\d \t \u@\h:\w ] $ "
Output:

[Sat Jun 02 14:24:12 sherin@server:~ ] $

COOPERATIVE LINUX

The cooperative linux will be the next boom in linux.Inorder to understand what is colinux or cooperative linux ,one should know the answers to the following questions.So before starting with the cooperative linux i like to explain the following things.

1)What is a Virtual machine?
2)What is it used for?
3)what make it different from a normal machine?
4)What are its advantages?
5)What are the different types of virtual machines?

Popek and Goldberg were the first to define a virtual machine.They defined it as the as an efficient, isolated duplicate of a real machine.The virtual machines can be classified into two major categories.The first one is System Virtual Machine and the second one is the Process Virtual Machine. The System Virtual Machine supports the execution of a complete operating system whereas the Process Virtual Machine is designed to run a single program, that is it supports a single process.

System Virtual Machine

System Virtual Machines are also called Hardware Virtual Machines.Each virtual machines ahs its own operating system.There is a software layer that is used to run different operating systems on a host computer at the same time.This software is called the hypervisor.The hypervisor is also called Virtual Machine Monitor.
The main advantages of virtual machines are:

1)In a virtual machine there are many OS in which we can switch to different OS without restarting the machine or rebooting .
2)The virtual machine has its own instruction Set Architecture which is different from the ISA of real machine.

The virtual machine has a host OS and guest OS.The Os of the physcal machine is called the Host OS and using this OS we are creating many guest OS Each VM on the same physical machine contains different OS.The different services that used to run on individual machines in order to avoid interference, are instead run in separate VMs on the same physical machine. This use is frequently called quality-of-service isolation (QoS isolation).

Process Virtual Machine

The Process Virtual Machine is also called an Application Virtual Machine.It supports a single process .It runs as a normal application inside an OS.It is created when that process is started and destroyed when that process exit.Every program needs a platform to run.The Platform is a set of hardware architecture which enables the program to run.The purpose of the Process Virtual Machine is to provide platform independent programming environment.

HOW VIRTUALIZATION WORKS?

VIrtualization is the current boom in the software field.VMware is a company that provides virtualization software for x86-compatible computers.virtual machine has its own cpu which is isolated from other virtual machines.Each virtual cpu has its own registers,buffers and control structures.If the host system or the physical machine is intel x86 based then the guest OS will use an intel x86 architecture,the same goes for all other compatable processors like AMD etc.The x86 computer hardware which is the very powerful .The Vmware software is used to transform the hardware resources of a computer ,say it be a x86 based hardware to a completely software part.This transformation is also called the “Virtualization”.This hardware resources includes the RAM,CPU,HARDDISK etc.Thus in brief there would be only one physical machine but many virtual machines.But the main advantage of it is that the harware part that these virtual machines share should not get interfere with each other.

COOPERATIVE LINUX

The Cooperative Linux is also called Colinux.The word cooperative is used to denote two bodies working in parallel.The colinux allows one to run linux freely on Windows 2000/XP without using the pc virtualization software known as the VMWARE Software.There is a company called VMware inc which markets two virtualization products for servers: VMware ESX Server and VMware Server.VM stands for virtual machine.In traditional VMs there is a host OS and guest OS and these guest OS are in an unprivileged mode to control the real machine.In this case the resources are also virtualised for every OS.But in the case of cooperative linux,it gives both the OS complete control of the host machine. The guest kernel which contain special drivers is used to communicate with the host and provide various important devices to the guest OS.The comparisons between the Colinux and traditional VM is shown below:

1) In traditional VM the guest OS is in a less privileged mode than that of the host kernel whereas in Colinux the guest OS and host OS has complete control over the real machine.

2)The stability and security of Colinux is far behind than the traditional VM.
If it is unstable then it has the potential to crash the system.Acquiring root user access on a Cooperative Linux machine can potentially lead to root on the host machine.It will be a great benefit for the attackers who hack the root password.

Steps To Install colinux

1) Download the latest installer from the colinux website and run it under windows.
2) Winpcap* should be downloaded and installed.

Winpcap is a tool for link layer network access in windows environment.It allows applications to capture and transmit network packets.some of the features of Winpcap are the following:

winpcap is
a)Free
Winpcap is free to use and modify.It is relesed under BSD open source license.

b)Popular
It is free as it is used by many tools.Some of the tools that are using winpcap for network access are sniffers, traffic generators, network testers, etc.

c)High Performance
Winpcap has very good performance compaired to others

d)Well documented
winpcap documentation contains all the features of WinPcap.

e)Commercially Supported

3)The Winpcap will then install colinux in C:/program files/colinux but it should be changed to C:/colinux. because the default configuration file expect to find it there.
4)While choosing linux distribution,select the debian installer.The debian installer will then download a small compressed file that is to be expanded to 1 GB. Download the Linux distribution to the folder c:/coLinux.
5)Edit c:/coLinux/coLinux.xml
6)Then go to command mode of windows. The command prompt will be C:/colinux> Execute Colinux-daemon.exe –c colinux.xml. Now the colinux is installed.After invoking the colinux daemon,the colinux started booting.Note that the colinux boots extremely faster.There is a console window attached to colinux-daemon.It helps us to interact with the colinux shell.
7)Next step is to configure colinux.For this go to Control panel>Network Connection>Local Area Connection .Then locate the TAP-WIN 32 adapter and change the name if you wish and add this name to colinux.xml..
8)Next step is to share the internet connectivity.For this right click on the internet connection in network connection window. and select properties.select the advanced tab from it and click “allow other network users to connect through this copmputer’s internet connection” and select the TAP adapter in the “home networking connection”.

Advantages of colinux

One of the main advantages of colinux is that it allows us to run linux applications on microsoft windows.Unlike cygwin linux applications can be executed on colinux without rebuilding.Cygwin is a Linux-like environment for Windows.It gives the windows the look and feel of linux.coLinux is fast because it’s essentially running on the native hardware.

Disadvantages of colinux

The guest operating system runs in a privileged mode in the host kernel.this is a major disadvantages for colinux because it may crash the entire machine.It also has some dependencies on external software for normal operation

Summary

coLinux is novel in its approach. coLinux isn’t perfect, but it’s a great way to use Linux on a standard Windows desktop computer.Let we can wait for the future to see the further boom in the cooperative linux which may interupt our dreams.