Moving and Upgrading Bugzilla

I had to migrate and upgrade a Bugzilla installation to a newer machine with Ubuntu LTS installed. Fortunately, Bugzilla has documented the steps in Moving Bugzilla Between Machines, but unfortunately the documentation does not seem to be uptodate.

First I had to make sure the latest update to the LTS was installed:

sudo apt update
sudo apt upgrade
sudo apt dist-upgrade

This resulted in

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.4 LTS
Release: 16.04
Codename: xenial

Next, I following the Quick Start installation guide

$ sudo apt-get install git
[sudo] password for herbert:
Reading package lists... Done
Building dependency tree
Reading state information... Done
git is already the newest version (1:2.7.4-0ubuntu1.3).

The next recommended step brought up the error message

Package apache2-mpm-prefork is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package ‘apache2-mpm-prefork’ has no installation candidate

and I had to remove the package apache2-mpm-prefork from the command

sudo apt-get install apache2 mysql-server libappconfig-perl libdate-calc-perl libtemplate-perl libmime-perl build-essential libdatetime-timezone-perl libdatetime-perl libemail-sender-perl libemail-mime-perl libemail-mime-modifier-perl libdbi-perl libdbd-mysql-perl libcgi-pm-perl libmath-random-isaac-perl libmath-random-isaac-xs-perl libapache2-mod-perl2 libapache2-mod-perl2-dev libchart-perl libxml-perl libxml-twig-perl perlmagick libgd-graph-perl libtemplate-plugin-gd-perl libsoap-lite-perl libhtml-scrubber-perl libjson-rpc-perl libdaemon-generic-perl libtheschwartz-perl libtest-taint-perl libauthen-radius-perl libfile-slurp-perl libencode-detect-perl libmodule-build-perl libnet-ldap-perl libauthen-sasl-perl libtemplate-perl-doc libfile-mimeinfo-perl libhtml-formattext-withlinks-perl libfile-which-perl libgd-dev libmysqlclient-dev lynx-cur graphviz python-sphinx rst2pdf

I cloned Bugzilla into /var/www using git

/var/www$ sudo git clone --branch release-5.0-stable bugzilla

and edited the MySql config files as recommended

/etc/mysql/mysql.conf.d$ sudo nano mysqld.cnf

max_allowed_packet = 100M
ft_min_word_len = 2

Create a bugs user account and run mysql "GRANT ALL PRIVILEGES ...." to create the bugs database

Next, I created a backup of the original Bugzilla database, and proceded according to the Moving… documentation.

/var/www/bugzilla$ sudo ./

Check setup brought up warnings about missing Perl modules.

/var/www/bugzilla$ sudo /usr/bin/perl --all
ERROR: Using requires that you install "make".

Solve this error by installing make:

$ sudo apt-get install make

The next run of Check Setup raised another error message:

/var/www/bugzilla$ sudo ./

DBD::mysql::db do failed: Cannot change column 'setter_id': used in a foreign key constraint 'fk_flags_setter_id_profiles_userid' [for Statement "ALTER TABLE flags CHANGE COLUMN
setter_id setter_id mediumint NOT NULL"] at Bugzilla/ line 742.
Bugzilla::DB::bz_alter_column_raw(Bugzilla::DB::Mysql=HASH(0xc89c6dc), "flags", "setter_id", HASH(0xca65fc0), HASH(0xe69a248), undef) called at Bugzilla/ line 701
Bugzilla::DB::bz_alter_column(Bugzilla::DB::Mysql=HASH(0xc89c6dc), "flags", "setter_id", HASH(0xca65fc0)) called at Bugzilla/Install/ line 626
Bugzilla::Install::DB::update_table_definitions(HASH(0x97e6884)) called at ./ line 172

I found a couple of forums regarding this error (Mozilla Support, SO), and the problems seems to be caused by newer MySql versions refusing to change or delete a column which is referenced by a foreign key constraint.
I removed the constraint directly from the mysql prompt:

use bugs;
alter table `flags` drop foreign key `fk_flags_setter_id_profiles_userid` ;

After this, the Check Setup script completed without errors.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: