Bug #47769 InnoDB: Unable to lock ./ibdata1, error: 45
Submitted: 1 Oct 2009 17:41 Modified: 2 Oct 2009 10:57
Reporter: Eugene Buldakov Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Errors Severity:S1 (Critical)
Version:5.0.51a OS:FreeBSD
Assigned to: CPU Architecture:Any

[1 Oct 2009 17:41] Eugene Buldakov
Description:
FreeBSD 6.1-RELEASE #0

Database is located on the remote storage that mount via NFS. During mysql startup the following entries appear in the .err  file:

091002 02:54:16  mysqld started
InnoDB: Unable to lock ./ibdata1, error: 45
091002  2:54:17  InnoDB: Retrying to lock the first data file
InnoDB: Unable to lock ./ibdata1, error: 45

As result - mysql couldn't start. 

Also I wasn't able to find description of the '45' error code here: http://dev.mysql.com/doc/refman/5.0/en/operating-system-error-codes.html

How to repeat:
1) place DB on remote storage;
2) mount it via nfs;
3) run mysql.
[2 Oct 2009 5:07] Sveta Smirnova
Thank you for the report.

But version 5.0.51a is old and many bugs were fixed since. Please upgrade to current version 5.0.86, try with it and if problem still exists send us full error log file.
[2 Oct 2009 10:57] Eugene Buldakov
Thank you for advise but I was able determine root of the issue. It isn't related to mysql at all but to NFS. 

errno 45 for FreeBSD is EOPNOTSUPP (Operation not supported).
NFS doesn't provide locking mechanism.

So, lockd and statd had to be enabled in the /etc/rc.conf:

rpc_lockd_enable="NO" # Run NFS rpc.lockd needed for
client/server.
rpc_statd_enable="NO" # Run NFS rpc.statd needed for
client/server.

Also these options should be enabled from both sides (client/server).