Bug #84488 InnoDB: Failed to create check sector file
Submitted: 12 Jan 2017 13:47 Modified: 2 Feb 2017 15:05
Reporter: lou shuai (OCA) Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:5.7.15-5.7.17 OS:Linux
Assigned to: CPU Architecture:Any
Tags: check sector, initialize data, innodb

[12 Jan 2017 13:47] lou shuai
Description:
When initialize data with mysqld, i got the following error in the error file.

017-01-12T16:09:27.675591+08:00 0 [ERROR] InnoDB: Failed to create check sector file, errno:13 Please confirm O_DIRECT is supported and remove the file /u01/linzx/mysql_5.7_3307/check_sector_size if it exists. 

How to repeat:
bin/mysqld --defaults-file=my.cnf --initialize-insecure

and my.cnf like below:

[mysqld]
user               = mysql
port               = 5715
socket             = /tmp/mysql_sandbox5715.sock
basedir            = /home/vagrant/sandbox/5.7.15
datadir            = /home/vagrant/sandboxes/msb_5_7_15/mydata
tmpdir             = /tmp
lower_case_table_names = 0
pid-file           = /home/vagrant/sandboxes/msb_5_7_15/mydata/mysql_sandbox5715.pid
bind-address       = 127.0.0.1

log-error=msandbox.err
innodb_data_home_dir = /home/vagrant/sandboxes/msb_5_7_15/mydata
innodb_flush_method=O_DIRECT

But when i modify innodb_data_home_dir to /home/vagrant/sandboxes/msb_5_7_15/mydata/
The error disappear!!

Suggested fix:
I check the error is print at os_fusionio_get_sector_size function,
which use dir_end = strrchr(path, OS_PATH_SEPARATOR);
to get the directory path, which will erase the data from  /home/vagrant/sandboxes/msb_5_7_15/mydata, so use /home/vagrant/sandboxes/msb_5_7_15 directory to generate check file.
[12 Jan 2017 14:27] MySQL Verification Team
Hi!

Thank you for your bug report. However, this is not a bug. As report claims, this is a problem with Unix permissions system. Make sure that you start server as root and that all directories used by the server are owned by user under which server runs, which is usually user 'mysql'. Hopefully, you have configured system so it can run that way. Then, problems will disappear.
[13 Jan 2017 0:48] lou shuai
hi,  Sinisa Milivojevic

I know root can resolve the problem, but root is not the point!

I do have the permission for the directory /home/vagrant/sandboxes/msb_5_7_15/mydata,
and i set innodb_data_home_dir to /home/vagrant/sandboxes/msb_5_7_15/mydata,  but the innodb make test in /home/vagrant/sandboxes/msb_5_7_15, i do not think this is the permisssion problem. and when i set innodb_data_home_dir to /home/vagrant/sandboxes/msb_5_7_15/mydata/ , just add a slash at the end, the problem disappear.
[13 Jan 2017 14:15] MySQL Verification Team
Exactly.

You are supposed to add slash, that is how directories are differentiated from the files.

Also, what you have is permission problems, as you get error 13, which means only one thing on any POSIX system.

Our manual has all the instructions on starting the server and on the permissions of the directories and files, that will make server work properly.
[2 Feb 2017 11:01] Christian Schneider
I totally agree with Mr.Left,

it is definetly NOT a permission problem!!!
I just stumbled over the same problem this morning
when my MySQL server did not want to start anymore.

Someone changed the way you give the path 
for the setting innodb_data_home_dir.

In my "old" setups (MySQL 5.5.54-0ubuntu0.14.04.1) 
the path is given without a slash at the end!

Now you HAVE TO add the slash to hit the wanted/right directory...

This behaviour is very strange and in complete contrast 
to the other settings where you have to give a directory path,
like basedir, datadir and lc-messages-dir...

Very weird...

Kind regards

    Christian
[2 Feb 2017 15:03] MySQL Verification Team
There is a duplicate bug to this one, in which it was decided to document this behavior much better in the new manual, so keep track of the new manual changes.
[2 Feb 2017 15:05] MySQL Verification Team
This is a duplicate of the bug #84605, so keep your eye on that bug, where our Documentation team will announce a change in manual that will explain why a slash is mandatory.