Browsing all articles tagged with troubleshoot
Mar
4

How to Remove ^M Character

There are a lot of other systems out there other than Linux, so if you have a file from, let’s say a DOS system, with extra ^M (caret M) characters at the end, you can correct it using vi. The tough part is, you will not be able to see these extra characters immediately, unless you encounter something like this:

$ ./check_summary.pl --help
-bash: ./check_summary.pl: /usr/bin/perl^M: bad interpreter: No such file or directory

(Note: check_summary is a Nagios plugin that I am currently testing.)

See the ^M character at the end? It is called the DOS line break. Unfortunately, Linux is not able to recognize these line breaks so you have to delete them. With vim. Yes, with vim, or with any editor you want, but in this post, I will show how to do it in vi.

First, open up your file where there is an extra ^M characters. While in command mode, type the following:

:%s/^V^M//g

The ^V is a CONTROL+V character and ^M is a CONTROL+M. When you type this, it will look like this:

:%s/^M//g

This command searches for ^M character (the CONTROL+V escapes a control character) the replaces it with null. After doing this, save and exit.

Another way to fix this is to use the dos2unix command like so:

$ dos2unix [file]

This might work, but I have not tried yet. Have you tried using dos2unix? Did it work? Let me know in the comments section.

Aug
17

Sudo error: Sorry, you must have a tty to run sudo

From time to time, we perform remote actions on the servers that we manage, including, but not limited to, automated file transfers. For this, rsync is used to simplify the operation and until recently, I encountered this weird error:

sudo: sorry, you must have a tty to run sudo

But where on this bloody earth did that error came from? All was going well until a new server was added to the pool of money-making machines and powerful enough to throw me off guard. This can’t be happening! I own these machines, I built them from scratch and configured them exactly the way I built the other servers! I could not be any wrong-er, the server must be leading an uprising against me!

Okay, that was an exaggeration (or paranoia). But it is true that the server has the same configuration as the rest. Except for one little line of default configuration:

Defaults requiretty

Comment out this line in visudo (must be root to edit) and everything should checkout.

Mar
30

How Tell Your Hard Drive Is About To Die

LifeHack.org writes all the tell-tale signs to know if your hard drive will soon fail and die on you. Very helpful since I have already suffered enough from hard drives that decided to just get tired and stop breathing – er… spinning.
read more

Powered by 1and1.comGlobat Webhosting Earn with Your BlogAdvertise @ PinoyTux

Search PinoyTux

Subscribe to Email Feeds

Enter Email Address:

Blog Lounge

Popular Posts

Recent Posts

Drop your Card Here

Recent Comments

Site Stats