[Koha] Upgrade errors

Tim Young Tim.Young at LightSys.org
Sat Jan 18 04:18:34 NZDT 2025


I recovered my old database (since I did not know what had changed with 
the busted install), pushed all the old koha to the side, reinstalled 
koha-common, and tried again.  It did crash and burn early on, but I 
could see what it was doing and managed to manually do the task the 
bug-fix was trying to do.  And the rest of the upgrade took.  Koha is 
now running again.

Thanks, Katrin, for your question.  That helped direct me towards where 
I needed to go.

- - -

For whatever help it might be for anyone coming behind me... (please, 
nobody leave your Koha as unpatched as this one was!)

The patch that failed the second time was: 210600016.pl 
(/usr/share/koha/intranet/cgi-bin/installer/data/mysql/db_revs/210600016.pl)

I think there may have been a foreign key constraint that caused another 
change to fail.  I eventually dropped the foreign key and deleted the 
additional_contents table.   That reset things sufficiently that the 
rest of the updates took.

Here is the mysql I ended up needing to do by hand.

     select count(*) additional_contents;
     select count(*) opac_news;
     drop table additional_contents;
     alter table additional_contents_localizations drop foreign key 
additional_contents_localizations_ibfk1;

     drop table additional_contents;


The first two lines(the select count lines) were just showing me that 
the tables had been the same previously.

I tried to drop the additional_contents table, which failed due to the 
foreign key constraint.  So I dropped the foreign key on the other 
table, then was able to drop the additional_contents table.  The 
patch 210600016 rebuilt the table and the foreign key.  I am not sure 
what caused the patch to fail the first time, but this manual patching 
allowed the rest of the koha upgrade cycle to take.

Now to see how much damage was done during the upgrade.  I see some 
recommendations not to do such massive upgrades as it might (will) lose 
data.

Thanks for the help,

- Tim

On 1/16/2025 2:47 PM, Tim Young wrote:
> Ooh. Nice.  Thanks. Yes, those files all had 2015 timestamps on them. 
> And, yes, there were a few of them.
>
> I did a bit of a search and found a lot of files from 2015.  Some of 
> them are school logo files, but most of them are from a legacy Koha 
> install.
>
> Thanks.  That gives me a good starting-point.
>
>     - Tim
>
> On 1/16/2025 2:17 PM, Katrin Fischer wrote:
>> Hi Tim,
>>
>> I am wondering about the existance of this file:
>>
>>  /usr/share/koha/intranet/cgi-bin/installer/data/mysql/atomicupdate/local_cover_images.pl 
>>
>>
>>
>> You should not have any files in the atomicupdate directory.
>>
>> Could this be from a previous update? Have you checked the contents?
>>
>> Katrin
>>
>> On 14.01.25 22:35, Tim Young wrote:
>>> I forgot to add the results of searching for that key:
>>>
>>> +--------------------+-------------------+----------------------+--------------+--------------+-----------------+----------+ 
>>>
>>>
>>> | CONSTRAINT_CATALOG | CONSTRAINT_SCHEMA | CONSTRAINT_NAME |
>>> TABLE_SCHEMA | TABLE_NAME   | CONSTRAINT_TYPE | ENFORCED |
>>> +--------------------+-------------------+----------------------+--------------+--------------+-----------------+----------+ 
>>>
>>>
>>> | def                | koha_opac         | bibliocoverimage_fk1 |
>>> koha_opac    | cover_images | FOREIGN KEY     | YES      |
>>> +--------------------+-------------------+----------------------+--------------+--------------+-----------------+----------+ 
>>>
>>>
>>>
>>> It is used with a table called "cover_images"
>>>
>>> Hopefully that helps spark someone's memory and leads me to something.
>>>
>>>     - Tim
>>>
>>> On 1/14/2025 3:19 PM, Tim Young wrote:
>>>> Well, it appears that the issue is with this file:
>>>>
>>>>  /usr/share/koha/intranet/cgi-bin/installer/data/mysql/atomicupdate/local_cover_images.pl 
>>>>
>>>>
>>>>
>>>> When I manually try to run the sql "create table", I am getting:
>>>>
>>>> ERROR 1826 (HY000): Duplicate foreign key constraint name
>>>> 'bibliocoverimage_fk1'
>>>>
>>>> The create table causing this is:
>>>>
>>>>  CREATE TABLE `biblioimages` (
>>>>     ->       `imagenumber` int(11) NOT NULL AUTO_INCREMENT,
>>>>     ->       `biblionumber` int(11) NOT NULL,
>>>>     ->       `mimetype` varchar(15) NOT NULL,
>>>>     ->       `imagefile` mediumblob NOT NULL,
>>>>     ->       `thumbnail` mediumblob NOT NULL,
>>>>     ->       PRIMARY KEY (`imagenumber`),
>>>>     ->       CONSTRAINT `bibliocoverimage_fk1` FOREIGN KEY
>>>> (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE
>>>> CASCADE ON UPDATE CASCADE
>>>>     ->       ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
>>>>
>>>> If I look for a pre-existing constraint:
>>>>
>>>> select * from INFORMATION_SCHEMA.TABLE_CONSTRAINTS where
>>>> CONSTRAINT_TYPE = 'FOREIGN KEY' and CONSTRAINT_NAME =
>>>> 'bibliocoverimage_fk1';
>>>>
>>>> I do see one there for my database.
>>>>
>>>> Any thoughts on how I should proceed?
>>>>
>>>>     - Tim
>>>>
>>>>
>>>> On 1/7/2025 3:07 PM, Tim Young wrote:
>>>>> I was helping some people do-release-upgrade from Ubuntu 18.04, to
>>>>> 22.04 and their koha was updated as well.
>>>>>
>>>>> I believe the previous version was 21.05.05-3.
>>>>>
>>>>> We upgraded the OS on the machine to 20.04, then to 22.04, and then
>>>>> upgraded Koha to 24.11.00-1.  During the package configuration
>>>>> (repeatable by doing: dpkg --configure koha-common) we get the
>>>>> following response and error:
>>>>>
>>>>> root at elearning:/var/log# dpkg --configure koha-common
>>>>> Setting up koha-common (24.11.00-1) ...
>>>>> Upgrading database schema for opac
>>>>> Can't use string ("0E0") as a HASH ref while "strict refs" in use at
>>>>> /usr/share/koha/lib/C4/Installer.pm line 757.
>>>>> dpkg: error processing package koha-common (--configure):
>>>>>  installed koha-common package post-installation script subprocess
>>>>> returned error exit status 255
>>>>> Errors were encountered while processing:
>>>>>  koha-common
>>>>>
>>>>>
>>>>> I tried looking through the log files to see if there was an
>>>>> "install log," but I did not see one.  The code looks like it is
>>>>> applying individual updates schema, and one of them is failing. I am
>>>>> not sure how to figure out which one is failing, to then figure out
>>>>> why.
>>>>>
>>>> _______________________________________________
>>>>
>>>> Koha mailing list  http://koha-community.org
>>>> Koha at lists.katipo.co.nz
>>>> Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha
>>> _______________________________________________
>>>
>>> Koha mailing list  http://koha-community.org
>>> Koha at lists.katipo.co.nz
>>> Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha
>> _______________________________________________
>>
>> Koha mailing list  http://koha-community.org
>> Koha at lists.katipo.co.nz
>> Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha


More information about the Koha mailing list