Comment 7 for bug 1969247

Revision history for this message
Andreas Hasenack (ahasenack) wrote : Re: mysql-server install crashes in LXD container on Jammy host

I'm suspecting fallocate() on zfs.

To reproduce, one can follow these steps:

rm -rf /var/lib/mysql/*
mysqld --initialize

This will produce a zero-sized file:
# ll /var/lib/mysql/ib_logfile1
-rw-r----- 1 mysql mysql 0 Apr 18 17:37 /var/lib/mysql/ib_logfile1

Attempting to start mysql now will fail with this error:
2022-04-18T17:41:30.181861Z 1 [ERROR] [MY-012963] [InnoDB] Log file ./ib_logfile1 is of different size 0 bytes than other log files 17809408 bytes!

On a working system, that file is not zero-sized.

straceing mysqld --initialize shows:
2253 openat(AT_FDCWD, "./ib_logfile1", O_RDWR|O_CREAT|O_EXCL, 0640) = 3
2253 fcntl(3, F_SETLK, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
2253 fallocate(3, FALLOC_FL_ZERO_RANGE, 0, 50331648) = 0
2253 fsync(3) = 0
2253 close(3) = 0

There have been previous bugs with zfs and fallocate():
https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1847105
https://github.com/openzfs/zfs/issues/326

I tried --innodb-extend-and-initialize and --skip-innodb-extend-and-initialize, from https://dev.mysql.com/worklog/task/?id=13782, but both ended up using fallocate().

A quick attempt with using the dir backend for lxd worked. Further investigation needs to be done.