Archive

Archive for the ‘Linux’ Category

How To Fix “The total number of locks exceeds the lock table size”

March 4th, 2010 Masao No comments

This usually happens when you’re doing massive queries on InnoDB tables:

ERROR 1206 (HY000): The total number of locks exceeds the lock table size

In /etc/my.cnf, do something like this:

innodb_buffer_pool_size=524288000

By default, MySQL sets innodb_buffer_pool_size to 8MB.

500 megabytes = 524 288 000 bytes

Categories: Linux, MySQL Tags:

How To Fix “Metadata file does not match checksum” YUM error

December 30th, 2009 Masao No comments
# yum install -y ImageMagick-perl
Loaded plugins: fastestmirror
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package ImageMagick-perl.i386 0:6.2.8.0-4.el5_1.1 set to be updated
filelists.xml.gz                                                             | 3.9 MB     00:09
http://apt.sw.be/redhat/el5/en/i386/rpmforge/repodata/filelists.xml.gz: [Errno -1] Metadata file does not match checksum
Trying other mirror.
filelists.xml.gz                                                             | 3.9 MB     00:29
http://ftp-stud.fht-esslingen.de/dag/redhat/el5/en/i386/rpmforge/repodata/filelists.xml.gz: [Errno -1] Metadata file does not match checksum
Trying other mirror.
filelists.xml.gz                                                             | 3.9 MB     00:12
http://fr2.rpmfind.net/linux/dag/redhat/el5/en/i386/rpmforge/repodata/filelists.xml.gz: [Errno -1] Metadata file does not match checksum
Trying other mirror.
Error: failure: repodata/filelists.xml.gz from rpmforge: [Errno 256] No more mirrors to try.

Run the following commands:

yum clean all
yum makecache
yum update

Then, it should work:

# yum install -y  ImageMagick-perl
Loaded plugins: fastestmirror
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package ImageMagick-perl.i386 0:6.2.8.0-4.el5_1.1 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package                      Arch             Version                       Repository        Size
====================================================================================================
Installing:
 ImageMagick-perl             i386             6.2.8.0-4.el5_1.1             base             145 k

Transaction Summary
====================================================================================================
Install      1 Package(s)
Update       0 Package(s)
Remove       0 Package(s)         

Total download size: 145 k
Downloading Packages:
ImageMagick-perl-6.2.8.0-4.el5_1.1.i386.rpm                                  | 145 kB     00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : ImageMagick-perl                                                             1/1 

Installed:
  ImageMagick-perl.i386 0:6.2.8.0-4.el5_1.1                                                         

Complete!
Categories: YUM Tags:

How to Install Flash Firefox Plugin for 64-bit Fedora Linux

September 13th, 2009 Masao No comments
  1. Download the plugin here.
  2. Tar -zxvf the tar.gz file.
  3. Copy that file to: /usr/lib64/mozilla/plugins
  4. Restart firefox.
  5. Check “about:plugins” in your address bar to see the Flash plugin installed

Plugin file should look like this:

/usr/lib64/mozilla/plugins/libflashplayer.so

about:plugins should look like this:

Shockwave Flash

File name: nswrapper_64_64.libflashplayer.so
Shockwave Flash 10.0 r32

Categories: Firefox, Flash, Linux Tags:

How To Determine Directory of Sourced Bash Script

September 2nd, 2009 Masao No comments

Sourcing a script can be useful for exporting variables in the current shell.

However, you can’t use “dirname $0″ to get the directory of the script.

Here’s how to get the same effect of dirname, but still allowing you to export variables.

Relative path:

DIRNAME=${BASH_ARGV[0]%/*}

Full path:

ABSDIR=$PWD/${BASH_ARGV[0]%/*}

Categories: Bash, Linux Tags:

How to Fix an Empty Bash Shell Prompt

August 21st, 2009 Masao No comments

If you bash shell prompt is empty when logging in, here’s how to fix it.

Create a ~/.bashrc file:

if [ -f /etc/bashrc ]; then
	. /etc/bashrc
fi

Create a ~/.bash_profile file:

if [ -f ~/.bashrc ]; then
	. ~/.bashrc
fi
Categories: Bash, Linux Tags:

How To Know If You Have a 64-bit Processor

August 5th, 2009 Masao No comments

If you have asked yourself, “Do I have a 64-bit processor?”, then here are several ways to find out:
uname

# uname -p
x86_64

cpuinfo

# cat /proc/cpuinfo
flags		: fpu vme de pse tsc msr pae mce cx8 apic mtrr
pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm
pbe syscall lm constant_tsc arch_perfmon pebs bts rep_good pni
dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm lahf_lm tpr_shadow
bogomips	: 4255.87
clflush size	: 64
cache_alignment	: 64
address sizes	: 36 bits physical, 48 bits virtual

The “lm” flag stands for Long Mode.

You can read more in this file:
/usr/src/kernels/#.#.#-#.#.fc11.x86_64/arch/x86/include/asm/cpufeature.h

#define X86_FEATURE_LM (1*32+29) /* Long Mode (x86-64) */

lshw

# lshw
     *-cpu
          description: CPU
          product: Intel(R) Core(TM)2 CPU          6420  @ 2.13GHz
          width: 64 bits

From the lshw manpage:

lshw is a small tool to extract detailed information on the hardware configuration of the machine. It can report exact memory configuration, firmware version, mainboard configuration, CPU version and speed, cache configuration, bus speed, etc. on DMI-capable x86 or IA-64 systems and on some PowerPC machines (PowerMac G4 is known to work).

Categories: Hardware, Linux Tags:

How to fix: error while loading shared libraries: liblwres.so.50

July 16th, 2009 Masao No comments

To fix this error:
# nslookup mydomain.com
nslookup: error while loading shared libraries: liblwres.so.50: cannot open shared object file: No such file or directory

Do this:
# ldconfig
# dig mydomain.com
; <<>> DiG 9.6.1-RedHat-9.6.1-2.fc11 <<>> mydomain.com
...

From the ldconfig manpage:

ldconfig creates the necessary links and cache to the most recent shared libraries found in the directories specified on the command line, in the file /etc/ld.so.conf, and in the trusted directories (/lib and /usr/lib). The cache is used by the run-time linker, ld.so or ld-linux.so. ldconfig checks the header and filenames of the libraries it encounters when determining which versions should have their links updated.

Categories: Linux, Troubleshooting Tags:

How to Check Disk Speed on Linux

June 26th, 2009 Masao No comments

/sbin/hdparm -tT /dev/sda

Categories: Linux Tags:

How to Fix “SSH Public Key Authentication Failed”

June 3rd, 2009 Masao 1 comment

If your SSH public key authentication is failing with errors like this:

$ ssh -vvv myhost.com
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /home/kitamura/.ssh/id_dsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply

…try these permissions on the server:

server$ chmod go-w ~/    (same as 755)
server$ chmod 700 ~/.ssh
server$ chmod 600 ~/.ssh/authorized_keys

more troubleshooting tips

Categories: Linux, SSH, Troubleshooting Tags:

How To Install CPAN Dependencies Without Interaction

May 13th, 2009 Masao No comments

How to Automatically Install CPAN Dependencies without having to answer “yes” to each question:

export PERL_MM_USE_DEFAULT=1
Categories: Linux Tags:

How to List Files of a Package Installed by YUM/RPM

May 7th, 2009 Masao No comments
# rpm -ql mysql-devel
/usr/include/mysql
/usr/include/mysql/chardefs.h
/usr/include/mysql/decimal.h
/usr/include/mysql/errmsg.h
...
Categories: Fedora, Linux, RPM, YUM Tags:

How to Monitor Multi-Core CPU Usage on Linux

April 9th, 2009 Masao No comments

Here’s how to monitor multiple cores on Linux:

# mpstat -P ALL

Example:

Monitor all CPU’s in 1 second intervals forever

# mpstat -P ALL 1

Categories: Bash, Linux, Monitoring Tags:

How to Renew Your DHCP IP Address on Linux

April 7th, 2009 Masao No comments

If Synergy fails for you with this error: “Server refused client with name XXX”, then your IP might conflict with another machine on the same network.

Here’s how to renew your IP on Linux:

### Release your current IP
$ sudo dhclient -r

### Request a new IP
$ sudo dhclient
Categories: Linux, Synergy Tags:

How to Connect Vista and Samba on Fedora 10

April 6th, 2009 Masao No comments
  1. Go through the usual setup at Samba.org or use YUM (yum install -y samba)
  2. By default, the smb.conf allows sharing of home directories.
  3. Add a Samba user (smbpasswd -a myusername)
  4. On Fedora, run SELinux Administration
  5. On the left menu, click “Boolean”.
  6. Scroll down to “samba”, and check the box next to “Allow samba to share users home directories”.
  7. Also on Fedora, make sure your Firewall allows the Samba ports 139 and 445.
  8. On Windows Vista, now map the network drive.

Sample smb.conf:

[homes]
        comment = Home Directories
        browseable = no
        writable = yes
;       valid users = %S
;       valid users = MYDOMAIN\%S
Categories: Linux, Samba, Troubleshooting, Windows Tags:

How To Get Yesterday’s Date using BASH Shell Scripting

February 17th, 2009 Masao 2 comments

The new short way:
$ date -d '1 day ago' +'%Y/%m/%d'
2009/07/21

Or the longer way:
Yesterday in epoch seconds
$ yesterday=$((`date +'%s'` - 86400))

Get default formatted yesterday's date
$ date -d "1970-01-01 $yesterday sec"
Tue Feb 17 01:27:32 PST 2009

Same thing in YY-MM-DD
$ date -d "1970-01-01 $yesterday sec" +"%Y-%m-%d"
2009-02-17

Categories: Bash, Linux Tags:

ssh_exchange_identification: Connection closed by remote host

February 5th, 2009 Masao No comments

On the destination server, remove the known_hosts file:

rm ~/.ssh/known_hosts

Also, try this in your /etc/hosts.allow file

/etc/hosts.allow:
SSHD: ALL

Categories: Linux, SSH, Troubleshooting Tags:

How to Fix a Failed Network Connection in Fedora 10

December 18th, 2008 Masao No comments
  1. Go to System -> Administration -> Network
  2. Select your “eth0″ device.
  3. Activate it.
  4. Click “Edit”.
  5. Check the box next to “Controlled by Network Manager”.
  6. Save and exit.

Your connection should now work.

Categories: Linux Tags:

How to View a Specific Page or Section of Manpage

November 30th, 2008 Masao No comments

For example, the “kill” manpage shows:

SEE ALSO
bash(1), tcsh(1), kill(2), sigvec(2), signal(7)

This is how to view section 7 of the “signal” manpage:

man 7 signal

Categories: Bash, Linux Tags:

How to keep SSH sessions alive

November 30th, 2008 Masao No comments

Edit your ssh_config file like this:

/etc/ssh/ssh_config

ServerAliveInterval 30

This will cause your SSH client to send a keep alive ping every 30 seconds to the server.

Categories: Linux, SSH Tags:

Disable auto commenting in VIM using the .vimrc file

November 25th, 2008 Masao 1 comment

Combined some tips together to figure this one out.

Put this into your .vimrc file:

au FileType * setl fo=cql

I’m using VIM version 7.1.12

Categories: Linux, VIM Tags: