mysql/upgrade_6.0_to_7.0.sh script failure on ubuntu18
Failed command:
root:~# kea-admin db-upgrade mysql -u kea -p kea -n kea -h kea
Database version reported before upgrade: mysql: [Warning] Using a password on the command line interface can be insecure.
6.0
Verifying upgrade permissions for kea
mysql: [Warning] Using a password on the command line interface can be insecure.
MySQL Version is:
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
Processing /usr/share/kea/scripts/mysql/upgrade_1.0_to_2.0.sh file...
mysql: [Warning] Using a password on the command line interface can be insecure.
This script upgrades 1.0 to 2.0. Reported version is 6.0. Skipping upgrade.
Processing /usr/share/kea/scripts/mysql/upgrade_2.0_to_3.0.sh file...
mysql: [Warning] Using a password on the command line interface can be insecure.
This script upgrades 2.0 to 3.0. Reported version is 6.0. Skipping upgrade.
Processing /usr/share/kea/scripts/mysql/upgrade_3.0_to_4.0.sh file...
mysql: [Warning] Using a password on the command line interface can be insecure.
This script upgrades 3.0 to 4.0. Reported version is 6.0. Skipping upgrade.
Processing /usr/share/kea/scripts/mysql/upgrade_4.0_to_4.1.sh file...
mysql: [Warning] Using a password on the command line interface can be insecure.
This script upgrades 4.0 to 4.1. Reported version is 6.0. Skipping upgrade.
Processing /usr/share/kea/scripts/mysql/upgrade_4.1_to_5.0.sh file...
mysql: [Warning] Using a password on the command line interface can be insecure.
This script upgrades 4.1 to 5.0. Reported version is 6.0. Skipping upgrade.
Processing /usr/share/kea/scripts/mysql/upgrade_5.0_to_5.1.sh file...
mysql: [Warning] Using a password on the command line interface can be insecure.
This script upgrades 5.0 to 5.1. Reported version is 6.0. Skipping upgrade.
Processing /usr/share/kea/scripts/mysql/upgrade_5.1_to_5.2.sh file...
mysql: [Warning] Using a password on the command line interface can be insecure.
This script upgrades 5.1 to 5.2. Reported version is 6.0. Skipping upgrade.
Processing /usr/share/kea/scripts/mysql/upgrade_5.2_to_6.0.sh file...
mysql: [Warning] Using a password on the command line interface can be insecure.
This script upgrades 5.2 to 6.0. Reported version is 6.0. Skipping upgrade.
Processing /usr/share/kea/scripts/mysql/upgrade_6.0_to_7.0.sh file...
mysql: [Warning] Using a password on the command line interface can be insecure.
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1060 (42S21) at line 3: Duplicate column name 'user_context'
Processing /usr/share/kea/scripts/mysql/upgrade_7.0_to_8.0.sh file...
mysql: [Warning] Using a password on the command line interface can be insecure.
This script upgrades 7.0 to 8.0. Reported version is 6.0. Skipping upgrade.
Processing /usr/share/kea/scripts/mysql/upgrade_8.0_to_8.1.sh file...
mysql: [Warning] Using a password on the command line interface can be insecure.
This script upgrades 8.0 to 8.1. Reported version is 6.0. Skipping upgrade.
Processing /usr/share/kea/scripts/mysql/upgrade_8.1_to_8.2.sh file...
mysql: [Warning] Using a password on the command line interface can be insecure.
This script upgrades 8.1 to 8.2. Reported version is 6.0. Skipping upgrade.
Database version reported after upgrade: mysql: [Warning] Using a password on the command line interface can be insecure.
6.0
Versions installed:
root:~# /usr/sbin/kea-dhcp4 -V
1.6.3
tarball
linked with:
log4cplus 1.1.2
OpenSSL 1.1.1 11 Sep 2018
database:
MySQL backend 8.2, library 5.7.30
PostgreSQL backend 5.1, library 100012
Memfile backend 2.1
SQL server version:
Server version: 5.6.38-log MySQL Community Server (GPL)
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Operating system:
root:~# cat /etc/os-release
NAME="Ubuntu"
VERSION="18.04.4 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.4 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
The origin of this issue is that I need to upgrade my database schema so I can make the switch from handmade Ubuntu packages (built from 1.3.0 sources using the existing Ubuntu debhelper tooling) to the 1.6 packages provided by ISC. I started out with schema 5.0, and the upgrade process did successfully get it from 5.0 -> 6.0, but I can't get past 6.0.
I did a bit of investigating, and initially tried to just fake my way through the problem by removing the offending columns (user_context from lease4 and lease6), dropping the offending table (logs), but that attempt stalled out when I ran into this error:
root:/usr/share/kea/scripts/mysql# sh -x /usr/share/kea/scripts/mysql/upgrade_6.0_to_7.0.sh
+ prefix=/usr
+ [ -e /usr/share/kea/scripts/admin-utils.sh ]
+ . /usr/share/kea/scripts/admin-utils.sh
+ db_host=kea
+ db_user=kea
+ db_name=kea
+ db_password=kea
+ mysql_version --host=kea --user=kea --password=kea kea
+ mysql_execute SELECT CONCAT_WS('.', version, minor) FROM schema_version --host=kea --user=kea --password=kea kea
+ QUERY=SELECT CONCAT_WS('.', version, minor) FROM schema_version
+ shift
+ [ 4 -gt 1 ]
+ mysql -N -B --host=kea --user=kea --password=kea kea -e SELECT CONCAT_WS('.', version, minor) FROM schema_version
mysql: [Warning] Using a password on the command line interface can be insecure.
+ retcode=0
+ return 0
+ return 0
+ VERSION=6.0
+ [ 6.0 != 6.0 ]
+ mysql --host=kea --user=kea --password=kea kea
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1062 (23000) at line 98: Duplicate entry '4' for key 'PRIMARY'
+ RESULT=1
+ exit 0
I couldn't find anything in the list of issues that looked similar to the issue I ran into; apologies if this is a repeat but as of right now, it seems I'm stuck. Any guidance would be most appreciated.