Bug #83981 Can't start MySQL in IPv6 at boot time (the binding interface is not up)
Submitted: 28 Nov 2016 8:38 Modified: 7 Dec 2016 9:55
Reporter: Duy Nguyen Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.5.43 OS:Ubuntu (12.04)
Assigned to: MySQL Verification Team CPU Architecture:Any

[28 Nov 2016 8:38] Duy Nguyen
Description:
MySQL server in IPv6 does not start properly at boot time with error message as:
* The server quit without updating PID file (/mysql/data/my.pid).

- Error log:
161127 21:12:35 [ERROR] Can't start server: Bind on TCP/IP port: Cannot assign requested address
161127 21:12:35 [ERROR] Do you already have another mysqld server running on port: 3306 ?
161127 21:12:35 [ERROR] Aborting

161127 21:12:35  InnoDB: Starting shutdown...
161127 21:12:35  InnoDB: Shutdown completed; log sequence number 5233305
161127 21:12:35 [Note] /opt/accedian/skylight/mysql/bin/mysqld: Shutdown complete

161127 21:12:35 mysqld_safe mysqld from pid file /mysql/data/sd-mysql.pid ended

But after booting, we can start MySQL normally.

Seems that if the network is not up yet, the issue happens.

Note: The same system, but work well with IPv4

syslog:
Nov 27 21:12:32 visionems kernel: [    2.263397] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
Nov 27 21:12:32 visionems kernel: [    2.823025] r8169 0000:04:00.0 eth0: link down
Nov 27 21:12:32 visionems kernel: [    2.823047] r8169 0000:04:00.0 eth0: link down
Nov 27 21:12:32 visionems kernel: [    2.823061] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
Nov 27 21:12:33 visionems kernel: [    3.298590] r8169 0000:04:00.0 eth0: link down
Nov 27 21:12:33 visionems kernel: [    3.298607] r8169 0000:04:00.0 eth0: link down
Nov 27 21:12:33 visionems kernel: [    3.298632] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not readyv 27 21:12:35 visionems kernel: [    5.294573] r8169 0000:04:00.0 eth0: link up

How to repeat:
Pre-condition:
- my.cnf:
 bind-address=localhost
- /etc/hosts:
 <ip> localhost
   where: <ip> is the ip address on the interface we want MySQL to run.
- interface eth0 with ipv6

Steps:
- Start MySQL and make it to be able to auto-start at booting time with update-rc.d command.
- Reboot system.
[29 Nov 2016 3:47] Duy Nguyen
Seems like the issue comes from the IPv6 feature (Duplicate Address Detection - https://www.agwa.name/blog/post/beware_the_ipv6_dad_race_condition).

But I wonder if mysql can wait with this condition until the the address is available?
[30 Nov 2016 11:33] MySQL Verification Team
Hi,

Thank you for your report but I don't see how this is MySQL bug. Your ipv6 interface is not up and MySQL fails to bind to non-existing interface - as expected. This is related to your network configuration and init scripts that are trying to start mysql before your network is up.

best regards
Bogdan Kecman
[7 Dec 2016 9:55] Duy Nguyen
Hi Bogdan,

Thanks for your time.

Agree that it should be the issue from system. Just thinking about waiting for sometimes if the interface has not up yet (as you see, DAD feature is trying do its job as fast as possible, but sometimes, not fast enough, :D ).

Best regards,
Duy Nguyen