November 20, 2009

Centos 5.4 mysql-server install problem

I ran into a problem installing mysql-server on Centos 5.4. I did the usual

[root@myserver]# yum install mysql-server

The installation works, but this error appears when trying to start mysqld

[root@myserver]# service mysqld start
Initializing MySQL database: Installing MySQL system tables…
ERROR: 1004 Can’t create file ‘/tmp/#sql30e0_1_0.frm’ (errno: 13)
091119 20:43:10 [ERROR] Aborting

091119 20:43:10 [Note] /usr/libexec/mysqld: Shutdown complete

Installation of system tables failed!

Examine the logs in /var/lib/mysql for more information.
You can try to start the mysqld daemon with:
/usr/libexec/mysqld –skip-grant &
and use the command line tool
/usr/bin/mysql to connect to the mysql
database and look at the grant tables:

shell> /usr/bin/mysql -u root mysql
mysql> show tables

Try ‘mysqld –help’ if you have problems with paths. Using –log
gives you a log in /var/lib/mysql that may be helpful.

The latest information about MySQL is available on the web at

http://www.mysql.com

Please consult the MySQL manual section: ‘Problems running mysql_install_db’,
and the manual section that describes problems on your OS.
Another information source is the MySQL email archive.
Please check all of the above before mailing us!
And if you do mail us, you MUST use the /usr/bin/mysqlbug script!
[FAILED]

The problem was with SELinux. Issuing

[root@myserver]# sestatus

shows SELinux is enabled and in enforcing mode.

[root@myserver]# sestatus
SELinux status: enabled
SELinuxfs mount: /selinux
Current mode: enforcing
Mode from config file: enforcing
Policy version: 21
Policy from config file: targeted

Disabling SELinux enforcing temporarily allowed the install to proceed.

First we take out the old mysql-server install (the tables weren’t written to correctly):

[root@myserver]# yum remove mysql-server

Make sure mysqld is not running:

[root@myserver]# service mysqld stop

Then we move the corrupt mysql tables out of the way:

[root@myserver]# mv /var/lib/mysql/* /home/some-where-safe/

Next, we set SELinux to permissive mode:

[root@myserver]# setenforce 0

and check that it is so

[root@myserver]# sestatus
SELinux status: enabled
SELinuxfs mount: /selinux
Current mode: permissive
Mode from config file: enforcing
Policy version: 21
Policy from config file: targeted

Now we reinstall mysql-server

[root@myserver]# yum install mysql-server

and start it:

[root@melstar mysql]# service mysqld start
Initializing MySQL database: Installing MySQL system tables…
OK
Filling help tables…
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password ‘new-password’
/usr/bin/mysqladmin -u root -h melstar.theplanet.host password ‘new-password’

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

The latest information about MySQL is available on the web at

http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com
[ OK ]
Starting MySQL: [ OK ]

The initialisation proceeded correctly, so we can re-enable SELinux enforcing mode.

[root@myserver]# setenforce 1

and then move on to securing and configuring mysql.

April 30, 2009

Id “x” respawning too fast

Testing an openvz container (Debian Lenny), noticed this in the logs:

Apr 29 15:53:10 shadow init: Id “1″ respawning too fast: disabled for 5 minutes
Apr 29 15:53:10 shadow init: Id “2″ respawning too fast: disabled for 5 minutes
Apr 29 15:53:10 shadow init: Id “3″ respawning too fast: disabled for 5 minutes
Apr 29 15:53:11 shadow init: Id “4″ respawning too fast: disabled for 5 minutes
Apr 29 15:53:11 shadow init: Id “5″ respawning too fast: disabled for 5 minutes
Apr 29 15:53:11 shadow init: Id “6″ respawning too fast: disabled for 5 minutes

I followed the Debian template creation guide at openvz.org

but forgot this step:

sed -i -e '/getty/d' /etc/inittab

as a casual look at /etc/inittab shows:

# /etc/inittab: init(8) configuration.
# $Id: inittab,v 1.91 2002/01/25 13:35:21 miquels Exp $

# /sbin/getty invocations for the runlevels.
#
# The “id” field MUST be the same as the last
# characters of the device (after “tty”).
#
# Format:
# <id>:<runlevels>:<action>:<process>
#
# Note that on most Debian systems tty7 is used by the X Window System,
# so if you want to add more getty’s go ahead but skip tty7 if you run X.
#
1:2345:respawn:/sbin/getty 38400 tty1
2:23:respawn:/sbin/getty 38400 tty2
3:23:respawn:/sbin/getty 38400 tty3
4:23:respawn:/sbin/getty 38400 tty4
5:23:respawn:/sbin/getty 38400 tty5
6:23:respawn:/sbin/getty 38400 tty6

So, the virtual was trying to respawn ttys (which aren’t needed on a virtual), and unable to do so.

Deleting the offending lines in /etc/innittab gets rid of the problem (I ran sed -i -e '/getty/d' /etc/inittab from inside the virtual, as I should have done in the first place).

On a side note, Lenny does not use syslog but rather rsyslog, so the instruction to

Disable sync() for syslog

Turn off doing sync() on every write for syslog’s log files, to improve I/O performance:

sed -i -e ’s@\([[:space:]]\)\(/var/log/\)@\1-\2@’ /etc/syslog.conf

in the Debian template creation guide at openvz.org isn’t strictly necessary[1], since rsyslog doesn’t do a sync() on every write by default.

From http://www.rsyslog.com/doc-v3compatibility.html

Output File Syncing

Rsyslogd tries to keep as compatible to stock syslogd as possible. As such, it retained stock syslogd’s default of syncing every file write if not specified otherwise (by placing a dash in front of the output file name). While this was a useful feature in past days where hardware was much less reliable and UPS seldom, this no longer is useful in today’s worl. Instead, the syncing is a high performace hit. With it, rsyslogd writes files around 50 *times* slower than without it. It also affects overall system performance due to the high IO activity. In rsyslog v3, syncing has been turned off by default. This is done via a specific configuration directive “$ActionFileEnableSync on/off” which is off by default. So even if rsyslogd finds sync selector lines, it ignores them by default. In order to enable file syncing, the administrator must specify “$ActionFileEnableSync on” at the top of rsyslog.conf. This ensures that syncing only happens in some installations where the administrator actually wanted that (performance-intense) feature. In the fast majority of cases (if not all), this dramatically increases rsyslogd performance without any negative effects.


[1] Running this command does nothing on a new Lenny install since /etc/syslog.conf does not exist.

August 9, 2008

Pidgin 2.4.3 Debian Lenny

Ok, I know pidgin binaries are available for Lenny, but let’s build Pidgin 2.4.3 from source anyway… Lenny will be the new “stable” soonish (September?) and the Pidgin team don’t provide Debian binaries for stable.

(This will probably work on etch. I posted build instructions here for Pidgin 2.4.1 a while back. The configure script in that case was more lenient with respect to dependencies than the current 2.4.3 configure script.)

Before you build

Required stuff (For a minimal install.)

apt-get install gettext libglib2.0-dev libgtk2.0-dev libxml2-dev libxml-perl libperl-dev

We need this if we’re going to use MSN or Google talk since they need ssl (Pidgin uses the gnutls ssl libraries)

apt-get install libgnutls-dev

Optional Stuff (Probably a good idea to install these.)

Spell checking
apt-get install libgtkspell-dev

X Screen Saver extension (needed for determining idle time from mouse and keyboard use)
apt-get install libxss-dev

Startup notification (visual feedback of startup)
apt-get install libstartup-notification0-dev

Sound support
apt-get install libgstreamer0.10-dev

More optional stuff (Install these if you need them.)

Tcl/Tk support (if you need tcl/tk scripting)
apt-get install tcl-dev tk-dev

Meanwhile support (Lotus Sametime support)
apt-get install libmeanwhile-dev

Avahi support (for Bonjour)
apt-get install libavahi-glib-dev

D-bus support (message bus support)
apt-get install libdbus-glib-1-dev

NetworkManager support (A D-Bus service providing connection management and selection of best available connection).
apt-get install network-manager-dev

Build and Install

Download the source package from http://downloads.sourceforge.net/pidgin/pidgin-2.4.3.tar.bz2

Unpack pidgin
tar jxvf pidgin-2.4.3.tar.bz2

Configure

cd pidgin-2.4.3
./configure

You can pass the following options to configure if you want to disable things you don’t need

--disable-gtkui compile without GTK+ user interface
--disable-consoleui compile without console user interface
--disable-screensaver compile without X screensaver extension
--disable-sm compile without X session management support
--disable-startup-notification compile without startup notification support
--disable-gtkspell compile without GtkSpell automatic spell checking
--disable-gstreamer compile without GStreamer audio support
--disable-meanwhile compile without meanwhile
--disable-avahi compile without avahi
--disable-nm compile without NetworkManager support

(To see all available options ./configure --help)

Build and install

make
su
make install

Pidgin is then at /usr/local/bin/pidgin

(Actually I do the whole install as root.)

Caveats

  1. It’s a good idea to uninstall any previous version of pidgin, if you installed binaries, do an apt-get remove --purge pidgin
  2. Keep the source/build tree! Tar and gzip it, then put it somewhere safe. In the future you might want to upgrade pidgin. To do it cleanly, issue a make uninstall from the build directory. Apparently, make uninstall needs to know which options were passed to ./configure to uninstall pidgin properly.

    Alternatively, note down the options you passed to ./configure, download the old source tarball, unpack and run ./configure with the options you used to build, then do a make uninstall.

  3. You might need to run ldconfig after install if you get this error when you try to run pidgin
    pidgin: error while loading shared libraries: libpurple.so.0: cannot open shared object file: No such file or directory
  4. This might work on Ubuntu, I haven’t tried it.
  5. I doubt anyone will need this informaton until Lenny becomes stable. If you aren’t comfortable building from source, use a binary.
  6. Substitute sudo for su if that’s your thing.

I did the final build with

./configure --disable-meanwhile --disable-avahi --disable-dbus

but built it with these enabled while testing dependencies.

December 16, 2007

keepass debian etch

1. KeePassX depends on the Qt libraries so fetch the necessary dependencies first

apt-get install libqt4-core libqt4-gui libpng3

2. Get the debian package from http://www.keepassx.org/downloads

3. Install it

dpkg -i KeePassX-0.2.2.deb

October 25, 2007

Pidgin debian etch

We need these to build it

apt-get install gettext libglib2.0-dev libgtk2.0-dev libxml2-dev

perl-xml libraries may also be needed

apt-get install libxml-perl

To build it with ssl (needed for msn and google talk), we need the gnutls development headers

apt-get install libgnutls-dev

Get the source

http://superb-east.dl.sourceforge.net/sourceforge/pidgin/pidgin-2.3.1.tar.bz2

Build it

tar jxvf pidgin-2.3.1.tar.bz2
cd pidgin-2.3.1
./configure --enable-gnutls=yes
make
make install

pidgin is at /usr/local/bin/pidgin