gregs

*nix

Upgrading to Lenny

by gregs on Mar.09, 2010, under *nix, MySQL, apache, debian, linode

It's been while since I attended to my VPS, I decided to spend some time last night upgrading my distribution from Etch to Lenny. This is normally a moment where your heart sinks as quite a few things do tend to go belly up, but I am happy to report that I only came across some minor issues and these were resolved in minutes as opposed to hours.

  1. MySQL : failed to start, complaining about:
    CODE:
    1. /etc/init.d/mysql: ERROR: Using expire_logs_days without log_bin crashes
    2. the server. See README.Debian.gz

    Commenting out the expire_logs_days in the my.cnf file allowed me to restart MySQL.

  2. After the upgrade of Apache, my virtual hosts weren't working. A quick search via Google pointed me to this post - a quick edit of all of my host files and it was all working again.
  3. the php-mysql connector somehow hadn't been upgraded/installed so a quick
    CODE:
    1. apt-get install php5-mysql

    fixed that problem.

  4. OpenBD : the only thing that remains broken was my tomcat5.5 Open BD install. Tomcat was working fine but Open BD refused to start up complaining about :
    CODE:
    1. javax.servlet.ServletException: Open BlueDragon Engine Failed to initialise tags: java.awt.Color

    Since I am not really using it, it's not that important, but at some stage I'd like to get it working again. If you have any suggestions, please leave a comment.

Leave a Comment more...

gnumake: *** No rule to make target `all’

by gregs on Apr.06, 2009, under *nix, mac, os x

I was using MacPorts to install ICU and Jam. After running the installer for the first time I got the following error message:

CODE:
  1. sudo port install icu jam
  2. Error: Target org.macports.build returned: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_devel_icu/work/icu/source" && gnumake all " returned error 127
  3. Command output: sh: gnumake: command not found

Oops forgot to install XCode (you always forget to install something on a new machine :)). Quickly ran the XCode installer, however when I ran the command again I got a new error:

CODE:
  1. sudo port install icu jam
  2. --->  Building icu
  3. Error: Target org.macports.build returned: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_devel_icu/work/icu/source" && gnumake all " returned error 2
  4. Command output: gnumake: *** No rule to make target `all'.  Stop.

Turns out you need to do a cleanup before attempting to run the command again:

CODE:
  1. sudo port clean --work icu
  2. --->  Cleaning icu
  3. sudo port clean --work jam
  4. --->  Cleaning jam
  5. sudo port install icu jam
  6. --->  Fetching icu
  7. --->  Verifying checksum(s) for icu
  8. --->  Extracting icu
  9. --->  Configuring icu
  10. --->  Building icu
  11. --->  Staging icu into destroot
  12. --->  Installing icu @4.0_0
  13. --->  Activating icu @4.0_0
  14. --->  Cleaning icu
  15. --->  Fetching jam
  16. --->  Attempting to fetch jam-2.5.tar from http://distfiles.macports.org/jam/2.5
  17. --->  Verifying checksum(s) for jam
  18. --->  Extracting jam
  19. --->  Applying patches to jam
  20. --->  Configuring jam
  21. --->  Building jam
  22. --->  Staging jam into destroot
  23. --->  Installing jam @2.5_1
  24. --->  Activating jam @2.5_1
  25. --->  Cleaning jam

Time to continue the Mapnik install.

2 Comments more...

cat to clipboard

by gregs on Mar.07, 2009, under *nix

Neat!

CODE:
  1. cat id_rsa.pub | pbcopy

Leave a Comment more...

VMWare and keyboard input

by gregs on Jul.09, 2008, under *nix, mac, os x, vmware

This morning I fired my Windows XP VM on my mac and my keyboard input simply stopped working. After a couple of VM reboots, which had no effect, I did some googling. The first result suggested typing a few commands to determine what had disabled it:

CODE:
  1. $ ioreg -l -w 0 | grep SecureInput
  2. |   "IOConsoleUsers" = ({"kCGSSessionSecureInputPID"=177,"kCGSSessionLoginwindowSafeLogin"=No,"kCGSSessionAuditIDKey"=0,"kCGSessionLoginDoneKey"=Yes,"kCGSSessionSystemSafeBoot"=No,"kCGSSessionOnConsoleKey"=Yes,"kCGSSessionUserIDKey"=501,"kSCSecuritySessionID"=11622192,"kCGSSessionUserNameKey"="gregstewart","kCGSSessionGroupIDKey"=20,"kCGSSessionConsoleSetKey"=0,"kCGSSessionIDKey"=256,"kCGSessionLongUserNameKey"="User"})
  3. $ ps auxwwww | grep 177
  4. user 177   7.8  9.2   652520 192788   ??  S    10:51pm  59:09.22 /Applications/Firefox.app/Contents/MacOS/firefox-bin -psn_0_110619
  5. user 1155   0.0  0.0   599820    464 s001  S+   10:44am   0:00.00 grep 177

According to the post the application that was blocking it was FireFox. "kCGSSessionSecureInputPID"=177 is the info you need to look for, where in my case 177 was the number I needed to use in the next command. Incredulous as I was, I closed FireFox and hey presto keyboard input was working again.

Hopefully this post will help others.

1 Comment more...


More *nix command line fun

by gregs on Sep.11, 2007, under *nix

I don't know how often I have tried to start up a process and forgotten that it runs as root, forcing me to type the command in again prefixing it with sudo. That was until today, if you suffer from the same level of forgetfulness then sudo!! is for you.

CODE:
  1. my-computer:~ user$ /usr/local/apache2/bin/apachectl start
  2. (13)Permission denied: make_sock: could not bind to address [::]:80
  3. no listening sockets available, shutting down
  4. Unable to open logs
  5. my-computer:~ user$ sudo !!
  6. sudo /usr/local/apache2/bin/apachectl start
  7. my-computer:~ user$

Leave a Comment more...

VI pattern matching

by gregs on Jun.29, 2006, under *nix

Editing documents using vi is something of pain, especially when they are long and you know the bit you are after is buried somewhere in the middle. There is a similar to way to the Find command in GUI editors that allows you to jump to that section:

CODE:
  1. /yourPattern

Simply substitute 'yourPattern' for the string you are looking for and after hitting return, the cursor will jump to the first found match. If you wish to see the next one, then simply type '/' (without the quotation marks) and hit return again.

Leave a Comment more...

locate

by gregs on Oct.27, 2005, under *nix

I used to rely on whereis and find to locate programs and files on my debian box, but these weren't being very helpful when I tried to find a file I new existed on the system. I stumbled across the utility locate after a quick google search. And it did locate that elusive file for me. But only once I had updated it's database (which it kindly informed was 8 days out of date). To update the locate database, simply log on as root and type:

CODE:
  1. udpatedb

UPDATE

If you are trying to do something similar on your Mac, the command can be found here (so you might to use the full path):

CODE:
  1. /usr/libexec/locate.updatedb

Leave a Comment more...

Basic vi editing

by gregs on Oct.19, 2000, under *nix

This document will introduce some of the basic vi editing concepts. First off what is vi? Well it's the built-in text editor that you find on most Unix boxes (including Linux). You start it up by typing the following command:

CODE:
  1. vi myFileName

myFileName is either an existing file or a new file that you wish to create. OK so far so good. A word of warning I found navigating around text initially a real pain. How do you enter text? Well hit the i key, which stands for... you guessed it insert. You are know in insert mode and can insert text into that file. To stop entering text press CTRL+[

Next let's delete some text that you have entered. There are two ways of doing this. If you want to delete just portions of the text, e.g. a word, first make sure that you are not in the Insert mode (CTRL+[), move to the first letter of the word you wish to delete and pressn x. This should have deleted the first letter. Keep pressing x until you have completely removed the word you wanted to delete.

What if you want to delete a complete line type dd. This removes the entire line and places it into the buffer. I guess this command is similar to the cut command you would use under windows. So can you paste it back in? Of course you can. Just press p at the appropriate location and the line should reappear.

Next I will show you how to quit the editor without saving. To do this make sure again you are in no editing mode (CTRL+[) and type: :q!. This should take you back to the command prompt or shell. To quit and save, type: :wq!. Again make sure that you are not in edit mode first.

Well that's about the extent of my knowledge on vi editing as it is all I need to know. However if I get stuck or should you want to learn more about vi editing then I can seriously recommend this book: Learning the vi Editor from O'Reilly & Associates, Inc. As with most books from O'Reilly it's clear, concise and very informative.

Leave a Comment more...

Command line FTP

by gregs on Oct.18, 2000, under *nix

This little article will introduce you to the wonderful and archaic way of accessing FTP sites using the command line. Please note that you can use these commands both under Unix and DOS.

Establishing a connection
When connecting to an FTP server from the command line, open a DOS prompt (select Start/Run and for Win9x type command or for NT type cmd) window. There you can now type:

ftp ftp.mysite.com

Should you need to connect to an FTP server on a diffrent port other than the default port you need to connect using the following set of commands:

ftp. You should now see the following prompt: ftp>. There type: open ftp.mysite.com 1234, where 1234 is the number of the port you are trying to connect to.

In either case you will be asked to login, so supply your username and password at the relevant prompts, right now let's move on to the interesting bits.

Some useful commands
Before we get into downloading and uploading files here are some useful commands:

  • Type ?, to obtain a list of all availbale commands.
  • Type bin, to change to binary mode, this is usually used for anything other than text files upload and downloads.
  • Type ascii, to change back to ASCII mode.
  • Type hash, this while uploading and downloading gives you an incremental row of hashes marking the progress of either your upload or download.

Moving around remotely
Right now that you have logged on you need to know where you in are in the directory and tree and how to navigate, and this is where a little bit of Unix comes in handy. In order tpo find out where you are type pwd this stands for print working directory. To find out what is located in the directory you are currently in, type ls. This gives you a list of files and sub-directories, but not in a very legible format. So try typing ls -l. This gives you a better idea of what is what and if memory serves me well also a list of permissions on each item listed. Should that list get to long, i.e. rattle past you on the screen at the speed of light, type ls -l |more. You can now peruse the directory listing at your leisure as it will stop when it fills the screen. To bring up the rest, just press the space bar. You can change directories by typing cd. If you need to step through several directories and know the path, you can type this cd directpry1/subdirectory/etc. To backtrack out of a directory type cd .. and to backtrack several directories type cd ../..

Moving around localy
Right know you kow how to move around on the FTP server, but how do you get around your local machine? First of all to find out where you are, you can type lcd. This is the same as the pwd command and it gives your current path. Unfortunately I am not aware of a method for listing the contents of your local directory (so fire up explorer or whatever and take a peak). To change local directories you type lcd DirectoryName, to move back you type lcd ... And that's all I know.

Uploading files
The command used to upload a file is put, so you would type something like this put MyFile.FileExtension. Pretty straightforward right? However there are a few more things you need to now. FTP distinguishes between Binary files and ASCII files, and if you happen to upload a file in ASCII format that should actually be in Binary the result might be less than successful. By default it is set to ASCII, so to change it to Binary, type Bin. You see a message informing you of the mode change. The next yo can do is use the hash command. THis displays a incremental row of hashes, symbolising the upload process. Why do you want to do this? Well you may well upload a huge file at one stage or another and by default the screen just sits there and gives you no indication of progress. For all you know it may well be hanging. So by using the hash command you can keep an eye on things and see how things are progressing.
Now you now how to upload single files, but how do you upload multiple files I hear you cry! To do this you use the mput command (multiple put?). The following example uploads all files with the extension "html".
mput *.html
[Using this command put *.html will only grab the first html file in the directory]. Be careful when using mput *.* cause this tries to upload the entire contents of the directory, including subdirectories (only it creates files, rather than recreating the directory and it's content and structure.

Downloading files
The concept is very similar than that of uploading files. You can again use the hash command to track progress. To download a file you use the getcommand, e.g. get MyFile.FileExtension. Similarly to download several files in one go type mget *.html, which in this case will download all the files with the extension html.

Deleting files and directories
To a delete a file, type the following command del FileName.FileExtension. To delete multiple files, type del *.FileExtension. To delete a directory, you can use the rm command, but you have to make sure that the directory is empty. You type rm DirectoryName.

Well that's about it. Hope you found this introduction useful

Leave a Comment more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!