Archive for the ‘Ubuntu’ Category

Enabling Stubborn InnoDB Tables in MySQL on Ubuntu

Friday, May 16th, 2008

So I’m on Ubuntu 8.04 64bit and MySQL 5.0.51a. Today I decided I wanted to use InnoDB tables. But MySQL Administrator told me that InnoDB is not enabled currently.

So I first went into /etc/mysql/my.cnf and removed the skip-innodb variable, and added a few other performance oriented settings for using InnoDB tables and restarted MySQL. But alas it still wouldn’t work.

When I tried to create a table MySQL told me “Warning: Using storage engine MyISAM for table …”

and my log had all of this weird stuff in it:

mysqld[22162]: 080516 13:30:21 [Warning] Changed limits: max_open_files: 1024  max_connections: 100  table_cache: 457
mysqld[22162]: InnoDB: Error: data file /var/lib/mysql/ibdata1 is of a different size
mysqld[22162]: InnoDB: 640 pages (rounded down to MB)
mysqld[22162]: InnoDB: than specified in the .cnf file 128000 pages!
mysqld[22162]: InnoDB: Could not open or create data files.
mysqld[22162]: InnoDB: If you tried to add new data files, and it failed here,
mysqld[22162]: InnoDB: you should now edit innodb_data_file_path in my.cnf back
mysqld[22162]: InnoDB: to what it was, and remove the new ibdata files InnoDB created
mysqld[22162]: InnoDB: in this failed attempt. InnoDB only wrote those files full of
mysqld[22162]: InnoDB: zeros, but did not yet use them in any way. But be careful: do not
mysqld[22162]: InnoDB: remove old data files which contain your precious data!

So I tried restarting MySQL again and saw these weird log messages:

mysqld[22396]: 080516 13:37:19 [Warning] Changed limits: max_open_files: 1024  max_connections: 100  table_cache: 457
mysqld[22396]: InnoDB: Error: log file /var/lib/mysql/ib_logfile0 is of different size 0 5242880 bytes
mysqld[22396]: InnoDB: than specified in the .cnf file 0 524288000 bytes!

Finally out of desperation I tried following the advice in the log files above “… and remove the new ibdata files InnoDB created in this failed attempt”.

So I went into /var/lib/mysql and deleted these three files: ibdata1, ib_logfile0, and ib_logfile1. Then I restarted MySQL. It failed to start :-( but I restarted again and everything worked!

Yay! I can now use InnoDB files like a professional.

Linux – How to Kill an Uninterruptible Process

Tuesday, May 6th, 2008

sudo kill -STOP [PID]

worked for me. I’m not sure why.

How to Restart MySQL in Ubuntu

Friday, April 25th, 2008

sudo /etc/init.d/mysql restart

How to unrar a file split up into lots of little rar files

Wednesday, March 26th, 2008

At least in Ubuntu with fileroller, just double click on the first one, ending with .r00 and extract it and it will use all the other files as needed.

Fixing – PIL IOError: decoder jpeg not available

Thursday, November 8th, 2007

So you get PIL (the Python Imaging Library) all installed on your new system and you’re feeling proud of yourself. But then you go to do some tasks involving JPEG’s and you get this horriffic error:

IOError: decoder jpeg not available

Here’s how I re-installed PIL correctly. But before you try to reinstall it, make sure you’ve removed every ounce of PIL from your system. Somehow the reinstall didn’t work until I removed both the PIL site-packages install AND the temporary installation folder i.e., where the tar file unpacked to.

My sucessful re-installation of PIL on Ubuntu 7.04:

First remove your last install!
$ sudo rm -rf /usr/lib/python2.5/site-packages/PIL
$ sudo rm /usr/lib/python2.5/site-packages/PIL.pth
$ sudo rm ~/Imaging-1.1.6

Make sure you install at the libraries for both JPEG support and FreeType2:
$ sudo aptitude install libjpeg libjpeg-dev
$ sudo aptitude install libfreetype6 libfreetype6-dev

Get PIL again and do the install:
$ wget http://effbot.org/media/downloads/Imaging-1.1.6.tar.gz
$ gunzip Imaging-1.1.6.tar.gz
$ tar xvf Imaging-1.1.6.tar
$ cd Imaging-1.1.6/
$ python setup.py build_ext -i

Run the included test to make sure everything now works:
$ python selftest.py

If everything worked do the real install:
$ sudo python setup.py install

If my instructions still don’t help you, in your downloaded PIL archive you can also take a look at the included README file and read the comments in the included setup.py file for more setup instructions.