phreek.org


Tuesday, March 03, 2009

How to resume a Linux terminal session after hitting CTRL-S

Many times I’ve gone to hit CTRL-K, S in a JOE session to save changes to a file but missed the “K” meaning I actually sent CTRL-S to the terminal which sends a “stop flow” signal.

Previously I’ve always just disconnected the session and restarted with a fresh one meaning I lost any changes to the file since my last save so tonight I decided to find out how to recover from this. Turns out all you need to do is hit CTRL-Q and you’ll be able to see all the changes that were sent to the screen since you hit CTRL-S.

Posted by darko in • Linux
(0) Comments | (0) Trackbacks | Permalink

Friday, January 16, 2009

mysqld_safe using high or 100% CPU

Both my network monitoring servers suffered this condition over the 2wks my company takes holidays for Christmas so I returned to work to find 2 VMs consuming 6ghz of CPU between them. A quick check of top showed mysqld_safe consuming 100% CPU on both VMs for no apparent reason.

After trying the usual /etc/init.d/mysql restart with no success, Google was my friend yet again. Turns out this is a common problem with MySQL 5.0.51 on Ubuntu so the procedure to recover is:

sudo /etc/init.d/mysql stop
sudo killall -9 mysqld_safe
sudo /etc/init.d/mysql start

In my journeys through many forums and blogs, I also discovered a great tool to help with MySQL performance issues: mytop. Basically it’s like the normal *nix “top” command, except for MySQL so you can see queries etc as they run.

Posted by darko in • Linux
(0) Comments | (0) Trackbacks | Permalink

Monday, May 19, 2008

PHP+MS SQL using FreeTDS

BOFH Hunter - Chatting with MSSQL

Posted by darko in • Linux
(0) Comments | (0) Trackbacks | Permalink

Thursday, April 24, 2008

Updating permissions on all files and directories within a directory

I extracted a tarball which had applied 777 (rwx) permissions to all files and directories that it contained. I wanted to set all files to 644 and all directories to 755, but there were too many levels to do it manually so I needed to do it through a shell script. After trying various BASH “for” loops, I checked the man page for “find” and was able to do the whole lot in 2 lines:

find . * -type d -exec chmod 0755 {} +
find . * -type f -exec chmod 0644 {} 
Posted by darko in • Linux
(0) Comments | (0) Trackbacks | Permalink

Wednesday, March 12, 2008

Installing Citrix ICA Client 10.6 on Fedora 8

While I work at Head Office, my company runs Citrix Presentation Server 4.0 for branch and remote access. We also have access to Outlook Web Access for checking email from home but I prefer to use the fully-fledged Outlook client when possible, so I needed to install the ICA client on my home Linux workstation which currently runs Fedora 8. The following instructions got it working perfectly after logging in as “root”:

yum install libXp

  wget ftp://ftp.ics.com/openmotif/2.3/2.3.0/openmotif-2.3.0-1.fc6.i386.rpm
  rpm -Uvh openmotif-2.3.0-1.fc6.i386.rpm
  ln -s /usr/X11R6/lib/libXm.so.4.0.0 /usr/X11R6/lib/libXm.so.3
  ldconfig
  ln -s /usr/lib/ICAClient/npica.so /usr/lib/mozilla/plugins/

  wget -O /usr/lib/ICAClient/keystore/cacerts/Equifax_Secure_Global_eBusiness_CA-1.crt https://www.geotrust.com/resources/root_certificates/certificates/Equifax_Secure_Global_eBusiness_CA-1.cer

  rpm -ivh—nodeps ICAClient-10.6-1.i386.rpm

NB: You may need to adjust or even ignore the second “wget” command depending on who your company bought its SSL certificate through. Mine bought theirs from http://www.trustico.com.au which required me to manually install the root certificate of their upstream CA (GeoTrust).

Posted by darko in • Linux
(0) Comments | (0) Trackbacks | Permalink

Thursday, January 31, 2008

How to reinstall GRUB after overwriting your MBR

So tonight I decided to install FreeBSD 7.0RC1 and try it out. While I’m sure I chose to leave the MBR unchanged, it went ahead and overwrote my MBR with the FreeBSD boot loader.

Fortunately I always keep a copy of Trinity Rescue Kit (A Linux-based rescue CD) handy for times like these and was able to recover my Fedora 8 desktop by booting into Trinity, typing “grub” at the command prompt and then entering:

install (hd1,0)/boot/grub/stage1 d (hd0) (hd1,0)/boot/grub/stage2 p (hd1,0)/boot/grub/menu.lst

This assumes your Windows drive and partition are the first dive/partition on the first disk. I run Windows on a separate physical drive (Primary IDE or SATA 1) because Windows will only boot if it’s installed on the first physical disk in a system.

Your /boot/grub/menu.lst should be similar to (from my Fedora 8 box):

default=0
timeout=5
splashimage=(hd1,0)/boot/grub/splash.xpm.gz
hiddenmenu
title Fedora (2.6.23.14-115-fc8)
    root (hd1,0)
    kernel /boot/vmlinuz-2.6.23.14-115-fc8 ro root=LABEL=/ rhgb quiet
    initrd /boot/initrd-2.6.23.14-115.fc8.img
title Windows XP
    rootnoverify (hd0,0)
    makeactive
    chainloader +1
Posted by darko in • Linux
(0) Comments | (0) Trackbacks | Permalink

Friday, January 25, 2008

How to Enable Compiz on Fedora Core 8

These are the steps I took to enable Compiz on Fedora 8 with a GeForce FX5200 video card. They are a combination of instructions from this howto and a post somewhere on Fedora Forum

1. Open a terminal and su to root

2. Enable the Livna repository

rpm -Uvh http://rpm.livna.org/livna-release-8.rpm

2. Install Nvidia drivers

yum install kmod-nvidia xorg-x11-drv-nvidia

3. Open a terminal and type “init 3”, this will drop back to text console mode. Login as root.

4. Edit “/etc/X11/xorg.conf” with the following information:

Section “Module”
Load “dbe”
Load “extmod”

Section “Device”
Option “TripleBuffer” “true”
Option “RenderAccel” “true”

Section “Extensions”
Option “Composite” “Enable”

Section “Screen”
Option “AddARGBGLXVisuals” “true”

Section “ServerLayout”
Option “AIGLX” “true”

5. Run the following command to Install the necessary software. This will take some time and require a reboot if your kernel gets upgraded.

yum -v install emerald-themes compiz-fusion-extras emerald compiz-fusion compiz-manager compiz-fusion-extras-gnome gnome-compiz-manager libcompizconfig compiz-fusion-gnome ccsm

6. Go to System-> Preferences -> Personal -> Session. Click on the startup tab and click Add. Enter the following details:

Under the name field, type: Emerald
Under the command field type: emerald –replace

7. Reboot PC.

8. Go to System-> Preferences -> Look and Feel -> Desktop Effects. Click on ¨Enable desktop effects¨ and check on the two boxes. You should receive a message saying desktop effects have been enabled. Click “Keep settings” and you’re done.

Posted by darko in • Linux
(0) Comments | (0) Trackbacks | Permalink
Page 1 of 1 pages