Thursday, January 15, 2009

Not enough server storage is available to process this command

Web service in windows was not running and error it was returning when restarting from Plesk control panel was that, "One or more dependencies failed to start".

I am no windows expert, but I knew about the existence of HTTP SSL as a dependency for Web service. So tried restarting HTTP SSL which returned with the error,

Not enough server storage is available to process this command
which meant, either the harddrive is full or the memory usage is high. Hardrive was 90% free :-P which meant to me, it's memory. So aligned the usage as per the memory usage and killed the killer DLL exe, "svchost.exe" and that brought the web services back to normal.

I didnt investigate further, but I hope the server is not compromised :-(

Saturday, January 10, 2009

How to start apache with debug level enabled and showing all the configurations it reads

How to start apache with debug level enabled and showing all the configurations it reads, there by showing each virtual host configurations.

httpd -e debug -k start -S -t

location of httpd may differ. It can be /usr/sbin/httpd or /usr/local/apache/bin/httpd . You know the control panels!! :D

Enjoy!!

Saturday, December 27, 2008

Renaming multiple files in Linux or unix boxes

I thought it was simple to do this. But I couldn't get rename command to work. I tried several methods found in google, quoted below, but at last it was the for loop and the regexes which came to help.


To rename all the files in a folder to .bak extension

for i in `ls -l | awk '{print $9}'`; do mv $i $i.bak; done

Simpler,

for i in `ls -1A` do mv $i $i.bak ; done

rename 's/\.bak$//' *.bak

Is said to remove the .bak extensions , though it didnt work for me.

To change all upper case file name to lowercase try this

rename 'y/A-Z/a-z/' *

Below command did help me to remove the .bak extensions on a series of files in a folder.

for f in *.bak ; do mv "$f" "${f%.bak}"; done

Wednesday, December 24, 2008

Recovering from corrupted RPM database

When accessing the yum command, the error we got was similar to this.

error: rpmdb: damaged header #67 retrieved -- skipping.
Traceback (most recent call last):
File "/usr/bin/yum", line 29, in ?
yummain.main(sys.argv[1:])
File "/usr/share/yum-cli/yummain.py", line 82, in main
base.getOptionsConfig(args)
File "/usr/share/yum-cli/cli.py", line 206, in getOptionsConfig
errorlevel=opts.errorlevel)
File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 132, in doConfigSetup
self.conf = config.readMainConfig(startupconf)
File "/usr/lib/python2.4/site-packages/yum/config.py", line 598, in readMainConfig
yumvars['releasever'] = _getsysver(startupconf.installroot, startupconf.distroverpkg)
File "/usr/lib/python2.4/site-packages/yum/config.py", line 667, in _getsysver
hdr = idx.next()
StopIteration

Solution is straight enough, to repair the RPM database. So how do we repair the RPM database. The straight forward method is to, remove the /var/lib/rpm/__db* and the run

rpm --rebuilddb
I believe I discussed this issue earlier in this blog itself. But that didn't fix in the first go and had to reissue the command again. And that time it did fix it.

Another solution to fix the issue is using the db_dump and db_load from the db4-utils package. This process involve re-building master package metadata file /var/lib/rpm/Packages

mv Packages Packages-BAKUP
db_dump Packages-BAKUP | db_load Packages
rpm -qa
rpm --rebuilddb

/usr/lib/rpm/rpmdb_verify Packages

That should fix it. Check out http://people.redhat.com/berrange/notes/rpmrecovery.html for yet another solution. Complicated and may not need it.

Saturday, December 20, 2008

Default Plesk Page on Windows machines

Issue was that the domain name was not in the Inetmgr (IIS configuration :-P)

D:\Program Files\SWsoft\Plesk\admin\bin>websrvmng.exe --reconfigure-vhost --vhos
t-name=domainname.com
The system cannot find the file specified. (COM Error 80070002) at add(photo.vis
imaker.com, 219.220.243.241, D:\inetpub\vhosts\domainname.com.com\httpdocs\photo)

resulted in the above error.

Solution was to create a photo folder and run it again. It did fix the issue.

Thursday, December 11, 2008

Resetting Hypervm Slave password - remote_authentication_failed

HyperVMs pass had to be reset on a slave server due to the "remote_authentication_failed" error when accessing the slave node in the slave server.

If you are receiving this error, and when you can't reset the password on the slave server from hypervm, you can manually do this on the slave server using the following commands:

lphp.exe ../bin/common/resetpassword.php slave 'put_your_pass_here'


Now there will be situations where, you still not be able to do it. In this situation, get the slave password from the master node, by logging to shell and then entering these commands there

ls -l /usr/bin/hypervmdb

Make sure that it is having 755 permissions. Or else give it.

echo "select nname, realpass from pserver" | hypervmdb

It will show you a output similar to

nname realpass
localhost ~password1
66.14.29.130 !pass2
9.212.25.156 !pass3
23.1.142.215 +pass4
141.22.16.203 !pass5
212.121.45.109 pass6

Take the pass from that list and reset the password using the command I mentioned above (ofcourse in slave). It should work.

Tuesday, September 23, 2008

Finding spammers in the Plesk server having mailenable as mail server

Yup. Finding spammers in the Plesk server having mailenable as mail server is a easy(?) task, if you know what you are doing. I am never a good windows admin, but I understand something. Often now a days, I find windows permissions to be more cumbersome than Linux, making me using the Sysinternal's (now Microsoft's) swiss knife tools every time.

So here the issue was that, my client was not able to identify the spammer. I enabled Debugging (which was off) and then logging level was increased.

regedit and went to the below location to add a debug logging level.

[HKEY_LOCAL_MACHINE\SOFTWARE\Mail Enable\Mail Enable\Connectors\SMTP]
"Debug Logging Level"=dword:0000000a

And finally disabled the admin user of the default domain in mailenable. They were sending 1 email per 10 secs and that that details logging helped. Confirmed from mailenable.msc -> System -> localhost -> Connectors -> SMTP -> queue

Sunday, September 21, 2008

cPanel postgresql update sql statements

A Update statement from a postgresql db user created from the cpanel interface will result in an error similar to below.

Warning: pg_query() [function.pg-query]: Query failed: ERROR: permission denied for relation listing in /home/username/public_html/pg_error.php on line 4

The only solutions (may be due to security aspects) available now, if you dont want to login as postgresql user and give the user more permissions is to use the cpanel username and password to update the database.

Wednesday, August 20, 2008

Plesk Windows 2003 - One website asking for password

This post is actually associated with the last post I made. But instead of editing the last post, I decided to go with a new post, since the issue happened before. After I change the password of an account, website on accessing on a browser, keeps on asking for username and password. It can be fixed by executing the following command from the cd %plesk_bin% directory.

websrvmng --update-anon-password --domain-name=domainname.com

Plesk Windows 2003 - 530 FTP user cannot login

Plesk Windows 2003 - 530 User username cannot log in. A plesk user after a server move was not able to log in.

My first attempt was to change the password which resulted in the error as below

Error: Unable to activate/deactivate domain: User or role 'username2' does not exist in this database.


As you can see that didn't fix the issue. Now I went on to change the username which resulted in the below error

Error: Unable to update hosting preferences: Unable to rename FTP user: ftpmng --rename-user failed: User "username1" doesn't exist


So that put me in the track. Before entering to the plesk database and manually updating it on, I gave it a try to use the following command (which worked!) and saved me from further hassles.

"%plesk_bin%\ftpmng.exe" --reconfigure-all

Tuesday, August 19, 2008

IIS 6.0 ASP or ASP.NET 404 Page Not found error

First of all, before telling about the issue, let me apologize to the blogger god for blogging about Windows issues too, on a Unix only blog. I currently support a windows client as well. It is a learning process and I must say that I am enjoying that too.

Okay the issue was this

I am moving a domain from a Plesk 7.6 installed server to Plesk 8.4 installed server - a relatively new one. Everything except the domain contents are moving. I didn't try to fix at the source. Instead I tarred the httpdocs and moved to the new server and extracted it there. And there began the permission issue, as expected.

Issues
--------

* Permission issue was making the website to ask for the password. Ran the Plesk permission fix from the Plesk reconfigurator and it did fix the issue.

* Once that permission was fixed, came another issue which was returning 404 on a asp page which is actually there. I asked the Sergey's google, but it was saying many things but all answers were addressing the serverwide issues, like Allowing the ASP in Web Service Extension and so on, which was already enabled.

My issue was domain specific. So had to do something with the IIS and the website in specific. Made sure that it had permissions for all users, just as any other website. So not any permission issue. And after two hours of scratching, I found that it was because there was nothing configured to process the files with .asp extension.

Steps to follow is this

1. Start -> Run -> inetmgr
2. Websites -> domain.com -> Right Click permissions
3. Home Directory --> Application Settings --> Configuration
3. Add -> Executable -> C:\WINDOWS\System32\inetsrv\asp.dll and LIMIT the verbs to GET,HEAD,POST,TRACE.

And voila that fixed the issue. Now some database connectivity is missing. Let me go back and work on that.

Thursday, June 19, 2008

cPanel compiling apache - No method to auto repair package system

My friends who use cPanel as their control panel, let me advise you first and foremost, don't use WHM to do sysadmin tasks. It will mess up the system once in a while and will leave you in dark. Similar situation happened with my friend, who was trying to compile PHP enabling the experimental PDO support through WHM. It messed up and all he could see was


!! No method to auto repair package system !!

!! Please visit http://www.cpanel.net/support/could_not_ensurepkgs.htm for help with this error. !!

!! Restoring original working apache !!


Apache stopped working. Examined a bit around 15 minutes to find out the solution. I was blindly looking around the httpd.conf and other similar configuration. But it was when I ran /scripts/easyapache, I could sniff the issue.

cPanel was not able to update the packages and problem lied in the yum updating the PDO package.A "ps -auxww | grep yum" told me the same. Process was having the status of T (or stopped). I continued the process by passing the signal 18 to it and everything and niffy after that "kill -18 PID"

Friday, May 02, 2008

SFTP and the Received message too long 1534226287 in a VPS

One of my clients, whom I act as a trainer and an admin, had an issue recently regarding the sftp. He created a vps (Lxlabs' HyperVM) named testvm with vpsid 120. The main hardware node IP be 192.168.0.1 . And the VPS IP be 192.168.0.101. He was trying to sftp testvm@192.168.0.1.

sftp testvm@192.168.0.1 was failing giving the message "Received message too long 1534226287" ;

It was a bit confusing for me, since it was a VPS and the shell assigned was /usr/bin/lxopenvz and I was not sure of the proper rc file it reads before switching the control to the vps. All I know was the shell is not verifying whether the $TERM is dump or not. And 1534226287 was translated to [roo (Decimal --> HEX --> ASCII)

So it was PS1 which is polluting the sftp stream. Spent 1 hour or so figuring out how to make it check the value of $TERM. And it was then I thought of trying the sftp root@192.168.0.101 (the VPS IP) and that worked. haha..

Client only needed to sftp to the VPS. He was not specific about sftping to root@VPS_IP or testvm@HN_IP. Spent one hour for just because of my absent mindedness. I should be more smart :-P

Monday, January 21, 2008

CyberQuiz aka IT quiz

Quizzing again.. A few information on IT industry in quiz format.

What is Wikiality.com

It is an Internet Encyclopedia dedicated to the Honorable Professor Dr. Stephen T Colbert, D.F.A and his creation truthiness

With which cyber major has Mayo Clinic set up a collaborative research facility "The Medical Imaging Informatics Innovation Centre (MI3C)" to improve the quality of patient care ?

IBM

What is 'Stevenote' ?

The colloquial term used for the keynote speeches by Steve Jobs, generally given at Apple events

Name the former CTO of the One Laptop Per Child Foundation who has started a new company called Pixel Qi to commercialize the technology for low priced laptops for poor children


Mary Lou Jepsen

With whom is Google jointly developing televisions that display internet content such as photos and videos


Panasonic

Who developed Postscript in 1985


Adobe

What 'spider' term is used for "the use of a table or structured list of URLs for Web sites (or words that hyperlink to Web sites) in order to help locate them ?

Arachnotaxis

The BlackBerry Pearl 8100 won the first BlackBerry to do way with what ?

A trackwheel. It was replaced by a miniature trackball.

What does Wikipedia define as "the act of taking a task traditionally performed by an employee or contractor and outsourcing it to an undefined generally large group of people in the form if an open call"

Crowdsourcing

In the context off spam what is spinging

Pinging from a splog to make recipients think that content of interest has been updated though that may not be the case.

Thursday, January 17, 2008

Where all standard deletion fails...

Long time, since I updated the blog eh ? A good..a bit challenging one, till I remembered the command, debugfs.

Issue

Location : One of my clients' VPS.
Concern : One of his vps clients is not restarting properly. Stucks at initializing the vzquota. Error message when doing 'vzctl start 738' is below


Starting VE ...
Initializing quota ...
vzquota : (error) quota check : lstat `photos.friendster.comphotos6968532886961_494183449s.jpg': No such file or directory
vzquota init failed [1]


Diagnosis

I couldn't find any files with the name photos.friendster.comphotos6968532886961_494183449s.jpg inside the vps, or when looking at /vz/private/738. Then did a

find . -name "*494183449s.jpg" inside the /vz/private/738. It returned me location as ./.trash/lsm/photos.friendster.comphotos6968532886961_494183449s.jpg

/me so happy. Ran
rm -f ./.trash/lsm/photos.friendster.comphotos6968532886961_494183449s.jpg
worked fine. But the problem persisted . Reason was though it didnt give any errors, it actually didnt delete the file. Ran a ls -l inside the directory lsm which showed output where it was question marks everywhere except for the name. AFAIK, name of a file is also stored in the directory info in the FS.

[root@vpsit lsm]# ls -l
total 0
?--------- ? ? ? ? ? photos.friendster.comphotos6968532886961_494183449s.jpg


So how can I fix this and make the vps start ? "rm -f filename" was not working.. neither a bigger command, "find . -exec rm -rf {} \;" nor even rm -rf /.trash or rm -rf /.trash/lsm. The directory delete was not working, since it was not empty. Tried unlink also.

[root@vpsit lsm]# find . -exec rm -f {} \;
rm: cannot remove `.' or `..'
find: ./photos.friendster.comphotos6968532886961_494183449s.jpg: No such file or directory


Then tried to turn off quota for vps ..so executed the vzquota off command and got the o/p as below

vzquota off 738
vzquota : (error) Can't open quota file for id 738, maybe you need to reinitialize quota: No such file or directory


So didnt want to initialize the quota by command, since it wont work for sure, just as in case when it starts the vps.

Temporary fix: turn off disk_quota parameter in /etc/sysconfig/vz and started the vps. Turned on the parameter later.

Permanent fix: you can't use fsck to fix this, on a live server. Not when you have to run the fsck in / itself. So fsck was not an option here. So next choice went to debugfs

here is what I did with debugfs

debugfs -w /dev/hda1
cd /vz/private/738/.trash/
unlink lsm


gone..and the issue is fixed. I dont see a proper solution anywhere in web for this ???? question marked cases of file deletion and hence this post.

I am tired of freelancing. Need to find some salaried job..Till next time..cya..

Monday, December 10, 2007

hypervm errors. Zend error

Failed loading /usr/local/lxlabs/ext/lib/Zend/lib/Optimizer-2.5.7/php-5.2.x/ZendOptimizer.so: /usr/local/lxlabs/ext/lib/Zend/lib/Optimizer-2.5.7/php-5.2.x/ZendOptimizer.so: cannot restore segment prot after reloc: Permission denied

Okay that was the message which I got during the hypervm stop. And the solution..

Simplest solution was to disable selinux. But proper solution can be using chcon to change the context

chcon -t texrel_shlib_t /usr/local/lxlabs/ext/lib/Zend/lib/Optimizer-2.5.7/php-5.2.x/ZendOptimizer.so
chcon "user_u:object_r:httpd_sys_content_t" /usr/local/lxlabs/ext/lib/Zend/lib/Optimizer-2.5.7/php-5.2.x/ZendOptimizer.so

should fix it.. I havent confirmed but hopefully proper solution will work.

Tuesday, December 04, 2007

Technical Quiz a.k.a Cyber Quiz

I am hereby starting a series of Quizing sessions to test yours and improving my knowledge, which I left updating since the last 3 years. These quizzes are not compiled by me, instead took from various sources, online and print. At a time the number of questions, wont exceed a max of 20.

So there you go, hovering the mouse over the Answer will give you the answers

  1. What is Google's open operating system for mobile phones called ?


    Answer

  2. Which telecom major is the biggest stakeholder in Symbian Ltd?

    Answer

  3. What is 'zoo' in context of security ?

    Answer

  4. Nigel Clifford is the CEO of .... ?

    Answer

  5. Who has Peter Dengate Thrush replaced as the Chairman of ICANN ?

    Answer

  6. What was founded in July 1990 by Mitch Kapor, John Gilmore, and John Perry Barlow ?

    Answer

  7. The graphics Processing Unit used in Nintendo's Wii video fame console is called ... ?

    Answer

  8. What in the context of Linux is "bash"

    Answer

  9. The maximum packet length of IP, including the IP header is ........................ bytes

    Answer

  10. What is 'Wardriving' ?

    Answer

Sunday, November 25, 2007

Multiline search and replace using sed

I had to code in to remove a host entry from hosts.cfg file of nagios. Here is a bit of superb code to do so..

sed '/#/{:a;N;/\}/!ba;/212.217.202.112/s/#.*\}//;}' hosts.cfg

That will remove the entire block starting with "# '212.217.202.112' host definition" and ending in "}"

Obfuscated code eh ? Not so..learn about registers in sed!!

Sunday, May 20, 2007

How to remove the mails from exim mail queue based on certain keywords ( cPanel specific )

How to remove the mails from exim mail queue based on certain keywords, especially in a cPanel. Below command will help in that and is for cPanel server. Matter of seconds for a seasoned admin, but posting so that I can copy and paste in future.

find /var/spool/exim/input -type f | xargs grep -l 'search_keywords' | xargs rm -frv

Wednesday, May 02, 2007

mod_rewrite and REQUEST_URI

Yesterday I did a forum move , a SMF forum. We had to move the forum URL from http://www.domain.com/forum to http://www.domain.com along with moving the servers, but still not losing the links spidered by Google. So things had to be achieved by mod_rewrite and the below rewrite rule helped.

RewriteEngine on
RewriteCond %{REQUEST_URI} ^/forum/(.*)$ [NC]
RewriteRule ^forum/(.*)$ /$1 [R=301,L]

What this will do is redirect

http://www.domain.com/forum/index.php?PHPSESSID=0aj813j131434061699fb61eef295f
to
http://www.domain.com/index.php?PHPSESSID=0aj813j131434061699fb61eef295f

Praise the mod_rewrite authors !!!