Koha Solutions knowledge base: run log of a live check Article https://kohasolutions.com/knowledge-base/koha-database-update-loop Check scripts/kb/live/koha-database-update-loop.mjs (SHA-256 6d9d4731f111454ca78c803098d7b01c3bb2b5892049f0c2ba4b9b0fa5aefeac) Ran 2026-11-05T14:45:41Z (UTC), 69 s Koha 26.05.05 (Koha::version 26.05.05.000, database version 26.0505000) Source https://git.koha-community.org/Koha-community/Koha/src/commit/d3fc229bc5eaea25dfe88f86149386408fe5d32d System Ubuntu 24.04.5 LTS Setup A clean Ubuntu 24.04 container booted with systemd, with koha-common from the Koha repository, MariaDB and one instance (library) made with koha-create. With the Koha schema loaded through C4::Installer as the web installer does. Result PASS: all 18 claims held Each claim is something the article says. "seen" is what the check read back when it is not just a yes/no. Changes the check made to the test server were undone afterwards, as its header describes. == Claims == ok Koha::version in the box is 26.05.05 ok koha-create --create-db library succeeds ok schema installed with C4::Installer (Version 26.0505000) ok installed: staff and OPAC answer 200 ok database behind: staff page → 302 installer/install.pl seen: 302 http://127.0.0.1/cgi-bin/koha/installer/install.pl ok database behind: OPAC → 302 maintenance.pl seen: 302 http://127.0.0.1/cgi-bin/koha/maintenance.pl ok koha-upgrade-schema (failing): "Upgrading database schema for library", the step line (no done/failed word), "\tERROR: {UNKNOWN}: DBI Exception: … Unknown column 'holds_get_captured' in 'WHERE' at /usr/share/koha/lib/C4/Installer.pm line 818" seen: Upgrading database schema for library Upgrade to 26.05.02.002 [HH:MM:SS]: Bug 42988 - Set holds_get_captured default to 1 in sip_accounts ERROR: {UNKNOWN}: DBI Exception: DBD::mysql::db do failed: Unknown column 'holds_get_captured' in 'WHERE' at /usr/share/koha/lib/C4/Installer.pm line 818 ok …exit status 1 seen: 1 ok …the ERROR line is red (ANSI 31) ok Version stays at 26.0502001 after the failure ok ls -t …/updatedatabase* → "ls: cannot access '/var/log/koha/library/updatedatabase*': No such file or directory" seen: ls: cannot access '/var/log/koha/library/updatedatabase*': No such file or directory ok koha-upgrade-schema (fixed): the step with its two notes, then 26.05.03.000 and 26.05.04.000 releases, exit 0 seen: Upgrading database schema for library Upgrade to 26.05.02.002 [HH:MM:SS]: Bug 42988 - Set holds_get_captured default to 1 in sip_accounts Set holds_get_captured to 1 for 0 sip_accounts rows where it was NULL Changed default of 'holds_get_captured' in sip_accounts to 1 Upgrade to 26.05.03.000 [HH:MM:SS]: Koha 26.05.03 release Upgrade to 26.05.04.000 [HH:MM:SS]: Koha 26.05.04 release Upgrade to 26.05.04.001 [HH:MM:SS]: Bug 43072 - Create fill_other_biblios_hold_policy value where holdallowed ok …ends "Upgrade to 26.05.05.000 […]: Koha 26.05.05 release" seen: expiry, if not defined Added default print notice template for MEMBERSHIP_EXPIRY Added default print notice template for MEMBERSHIP_RENEWED Upgrade to 26.05.05.000 [HH:MM:SS]: Koha 26.05.05 release ok …the yellow notes include "'LibrisKey' syspref already removed" (information, ANSI 33) ok koha-upgrade-schema again → "Upgrading database schema for library" / "No database change required", exit 0 seen: Upgrading database schema for library No database change required ok systemctl restart memcached prints nothing ok koha-plack --restart on Ubuntu → " * Stopping Plack daemon for library" / " ...done." / " * Starting …" / " ...done." seen: " * Stopping Plack daemon for library\n ...done.\n * Starting Plack daemon for library\n ...done." ok afterwards: staff and OPAC answer 200 again == The check that produced this log (scripts/kb/live/koha-database-update-loop.mjs) == /** * Live check for prisma/ks-kb/38-koha-database-update-loop.ts. Does NOT touch live Koha. Runs in a throwaway * `kbv-koha-ubuntu:24.04` box (Ubuntu 24.04 + systemd, koha-common 26.05.05): instance `library` made with * koha-create, its schema loaded with C4::Installer the way installer/install.pl does (load_db_schema, * load_sql_in_order, set_marcflavour_syspref, set_version_syspref). A failing upgrade is made as in * koha-web-installer-error-500: Version set back to 26.0502001 and sip_accounts.holds_get_captured dropped, which * update 26.05.02.002 needs. Removes the box. About 2 minutes. */ import { spawnSync } from 'node:child_process' export const meta = { koha: '26.05.05', passed: '2026-11-05' } const IMG = 'kbv-koha-ubuntu:24.04' const BOX = 'kbv-38-check' const ESC = /\x1b\[[0-9;]*m/g const BUG = 'Upgrade to 26.05.02.002 [HH:MM:SS]: Bug 42988 - Set holds_get_captured default to 1 in sip_accounts' const INSTALL = `use Modern::Perl; use C4::Installer; use C4::Languages; my $i = C4::Installer->new(); my $e = $i->load_db_schema(); die "schema: $e" if $e; $i->load_sql_in_order("en", C4::Languages::getAllLanguages()); $i->set_marcflavour_syspref("MARC21"); $i->set_version_syspref(); print "installed\\n";` export default async function run(ctx) { if (spawnSync('docker', ['image', 'inspect', IMG]).status !== 0) { ctx.check(`image ${IMG} present`, false) return } spawnSync('docker', ['rm', '-f', BOX]) ctx.restore('remove the Ubuntu box', () => spawnSync('docker', ['rm', '-f', BOX])) spawnSync('docker', ['run', '-d', '--name', BOX, '--hostname', 'library.example.org', '--privileged', '--cgroupns=host', '-v', '/sys/fs/cgroup:/sys/fs/cgroup:rw', IMG, '/lib/systemd/systemd']) const u = (cmd, timeout = 900000) => { const r = spawnSync('docker', ['exec', BOX, 'bash', '-c', `export DEBIAN_FRONTEND=noninteractive; ${cmd} 2>&1`], { encoding: 'utf8', timeout }) return { out: (r.stdout ?? '').replace(/\n+$/, ''), code: r.status ?? -1 } } const sql = (q) => u(`koha-mysql library -N -e "${q}"`).out const at = (host, path) => u(`curl -s -o /dev/null -w '%{http_code} %{redirect_url}' -H 'Host: ${host}' http://127.0.0.1${path}`).out const STAFF = 'library-intra.myDNSname.org' const OPAC = 'library.myDNSname.org' // the time stamp varies per run const norm = (t) => t.replace(ESC, '').replace(/\[\d\d:\d\d:\d\d\]/g, '[HH:MM:SS]').replace(/[ \t]+\n/g, '\n').replace(/\s+$/, '') u('for i in $(seq 1 60); do systemctl is-system-running --wait >/dev/null 2>&1 && break; sleep 1; done') u('apt-get update -qq >/dev/null; apt-get install -y -qq mariadb-server >/dev/null; systemctl enable --now mariadb >/dev/null; a2enmod -q rewrite cgi headers proxy_http >/dev/null') ctx.check('Koha::version in the box is 26.05.05', u('perl -I/usr/share/koha/lib -MKoha -e "print Koha::version"').out === '26.05.05.000') ctx.check('koha-create --create-db library succeeds', u('koha-create --create-db library >/dev/null').code === 0) u(`cat > /tmp/inst.pl <<'EOF'\n${INSTALL}\nEOF\nchmod 644 /tmp/inst.pl`) ctx.check('schema installed with C4::Installer (Version 26.0505000)', u('koha-shell library -c "perl /tmp/inst.pl"').out.endsWith('installed') && sql("SELECT value FROM systempreferences WHERE variable='Version'") === '26.0505000') ctx.check('installed: staff and OPAC answer 200', at(STAFF, '/cgi-bin/koha/mainpage.pl') === '200 ' && at(OPAC, '/cgi-bin/koha/opac-main.pl') === '200 ') // --- break it --- sql("UPDATE systempreferences SET value='26.0502001' WHERE variable='Version'; ALTER TABLE sip_accounts DROP COLUMN holds_get_captured") u('systemctl restart memcached; koha-plack --restart library >/dev/null; sleep 4') ctx.check('database behind: staff page → 302 installer/install.pl', at(STAFF, '/cgi-bin/koha/mainpage.pl') === '302 http://127.0.0.1/cgi-bin/koha/installer/install.pl', at(STAFF, '/cgi-bin/koha/mainpage.pl')) ctx.check('database behind: OPAC → 302 maintenance.pl', at(OPAC, '/cgi-bin/koha/opac-main.pl') === '302 http://127.0.0.1/cgi-bin/koha/maintenance.pl', at(OPAC, '/cgi-bin/koha/opac-main.pl')) const bad = u('koha-upgrade-schema library') const badOut = norm(bad.out) ctx.check('koha-upgrade-schema (failing): "Upgrading database schema for library", the step line (no done/failed word), "\\tERROR: {UNKNOWN}: DBI Exception: … Unknown column \'holds_get_captured\' in \'WHERE\' at /usr/share/koha/lib/C4/Installer.pm line 818"', badOut === `Upgrading database schema for library\n${BUG}\n\tERROR: {UNKNOWN}: DBI Exception: DBD::mysql::db do failed: Unknown column 'holds_get_captured' in 'WHERE' at /usr/share/koha/lib/C4/Installer.pm line 818`, badOut) ctx.check('…exit status 1', bad.code === 1, String(bad.code)) ctx.check('…the ERROR line is red (ANSI 31)', bad.out.includes('\x1b[31mERROR:')) ctx.check('Version stays at 26.0502001 after the failure', sql("SELECT value FROM systempreferences WHERE variable='Version'") === '26.0502001') const ls = u('ls -t /var/log/koha/library/updatedatabase*') ctx.check("ls -t …/updatedatabase* → \"ls: cannot access '/var/log/koha/library/updatedatabase*': No such file or directory\"", ls.out === "ls: cannot access '/var/log/koha/library/updatedatabase*': No such file or directory" && ls.code === 2, ls.out) // --- fixed --- sql('ALTER TABLE sip_accounts ADD COLUMN holds_get_captured tinyint(1) DEFAULT NULL AFTER holds_block_checkin') const good = u('koha-upgrade-schema library') const goodOut = norm(good.out) ctx.check('koha-upgrade-schema (fixed): the step with its two notes, then 26.05.03.000 and 26.05.04.000 releases, exit 0', good.code === 0 && goodOut.startsWith(`Upgrading database schema for library\n${BUG}\n\tSet holds_get_captured to 1 for 0 sip_accounts rows where it was NULL\n\tChanged default of 'holds_get_captured' in sip_accounts to 1\nUpgrade to 26.05.03.000 [HH:MM:SS]: Koha 26.05.03 release\nUpgrade to 26.05.04.000 [HH:MM:SS]: Koha 26.05.04 release\n`), goodOut.slice(0, 500)) ctx.check('…ends "Upgrade to 26.05.05.000 […]: Koha 26.05.05 release"', goodOut.endsWith('Upgrade to 26.05.05.000 [HH:MM:SS]: Koha 26.05.05 release'), goodOut.slice(-200)) ctx.check("…the yellow notes include \"'LibrisKey' syspref already removed\" (information, ANSI 33)", good.out.includes("\x1b[33m'LibrisKey' syspref already removed")) const again = u('koha-upgrade-schema library') ctx.check('koha-upgrade-schema again → "Upgrading database schema for library" / "No database change required", exit 0', again.out === 'Upgrading database schema for library\nNo database change required' && again.code === 0, again.out) const mc = u('systemctl restart memcached') ctx.check('systemctl restart memcached prints nothing', mc.out === '' && mc.code === 0, mc.out) const pl = u('koha-plack --restart library') ctx.check('koha-plack --restart on Ubuntu → " * Stopping Plack daemon for library" / " ...done." / " * Starting …" / " ...done."', pl.out === ' * Stopping Plack daemon for library\n ...done.\n * Starting Plack daemon for library\n ...done.', JSON.stringify(pl.out)) u('sleep 4') ctx.check('afterwards: staff and OPAC answer 200 again', at(STAFF, '/cgi-bin/koha/mainpage.pl') === '200 ' && at(OPAC, '/cgi-bin/koha/opac-main.pl') === '200 ') ctx.ranInBox(BOX, 'A clean Ubuntu 24.04 container booted with systemd, with koha-common from the Koha repository, MariaDB and one instance (library) made with koha-create. With the Koha schema loaded through C4::Installer as the web installer does.') }