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 32f7ed944af2b01eb0242b9a4d590251fea21a73a9de07b628351a5abe8a0092) Ran 2026-11-08T06:34:46Z (UTC), 135 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 fresh Ubuntu 24.04 server with Koha installed from the Koha repository as our installation guide leaves it, reached over SSH: every command run as the sudo user librarian on a terminal. Result PASS: all 14 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 the server box starts with Koha installed ok the server starts at Version 26.0505000, staff and OPAC answer 200 seen: 200 / 200 ok database behind: the staff page redirects (302) to installer/install.pl seen: 302 http://127.0.0.1:8080/cgi-bin/koha/installer/install.pl ok database behind: the OPAC redirects (302) to maintenance.pl seen: 302 http://127.0.0.1:80/cgi-bin/koha/maintenance.pl ok koha-upgrade-schema (failing): "Upgrading database schema for library", the step line, "\tERROR: {UNKNOWN}: DBI Exception: … Unknown column 'holds_get_captured' in 'WHERE' at /usr/share/koha/lib/C4/Installer.pm line 818", exit 1 seen: Upgrading database schema for library Upgrade to 26.05.02.002 [06:36:08]: 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 exit=1 ok Version stays at 26.0502001 after the failure ok sudo ls -t …/updatedatabase* → "ls: cannot access '/var/log/koha/library/updatedatabase*': No such file or directory", exit 2 seen: ls: cannot access '/var/log/koha/library/updatedatabase*': No such file or directory exit=2 ok koha-upgrade-schema (fixed): the step with its two notes, then 26.05.03.000 and 26.05.04.000 seen: Upgrading database schema for library Upgrade to 26.05.02.002 [06:36:24]: 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 [06:36:24]: Koha 26.05.03 release Upgrade to 26.05.04.000 [06:36:24]: Koha 26.05.04 release Upgrade to 26.05.04.001 [06:36:24]: Bug 43072 - Create fill_other_biblios_hold_policy value where holdallowed ok …ends "Upgrade to 26.05.05.000 […]: Koha 26.05.05 release", exit 0 seen: EMBERSHIP_RENEWED already exists - no changes required Upgrade to 26.05.05.000 [06:36:24]: Koha 26.05.05 release exit=0 ok …the notes include "'LibrisKey' syspref already removed" 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 exit=0 ok systemctl restart memcached prints nothing ok koha-plack --restart on a terminal → " * Stopping Plack daemon for library … [ OK ]" / " * Starting Plack daemon for library … [ OK ]" seen: * Stopping Plack daemon for library [ OK ] * Starting Plack daemon for library [ OK ] ok afterwards: staff and OPAC answer 200 again seen: 200 / 200 == 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, on a real server since 2026-11-08 (plan212). * * A fresh Ubuntu 24.04 server with Koha 26.05.05 installed as the installation guide leaves it (box.mjs * ensureKohaImage: the web installer's database steps already done), reached over SSH as the sudo user `librarian`. * Set-up (not shown in the article): a failing upgrade, 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. Then every command the * article shows, on a terminal: the failing koha-upgrade-schema, the empty updatedatabase* logs, the column put back, * the run that succeeds, the run with nothing left, and the cache restarts; plus what the staff interface and the OPAC * answer before and after. The box is removed at the end. ~2 minutes once the image exists. */ import { createBox, ensureKohaImage, KOHA_IMAGE, removeBox, ssh } from './server-box/box.mjs' /** liveKoha: false — runs only on its own server box, so kb:verify neither starts nor reads live Koha. */ export const meta = { koha: '26.05.05', passed: '2026-11-08', liveKoha: false } const BUG = 'Upgrade to 26.05.02.002 [HH:MM:SS]: Bug 42988 - Set holds_get_captured default to 1 in sip_accounts' /** The terminal line an init script prints: text, then "[ OK ]" at column 74. */ const ok = (text) => ` * ${text}`.padEnd(73) + '[ OK ]' export default async function run(ctx) { const err = ensureKohaImage() ?? createBox({ image: KOHA_IMAGE }) ctx.check('the server box starts with Koha installed', err === null, err ?? '') if (err) return try { await body(ctx) } finally { removeBox() } } async function body(ctx) { const L = (cmd) => ssh('librarian', cmd).replace(/\s+$/, '') const sql = (q) => L(`sudo koha-mysql library -N -B -e "${q}"`) const at = (host, port, path) => L(`curl -s -o /dev/null -w '%{http_code} %{redirect_url}' -H 'Host: ${host}' http://127.0.0.1:${port}${path}`) const staff = () => at('library-intra.example.org', 8080, '/cgi-bin/koha/mainpage.pl') const opac = () => at('library.example.org', 80, '/cgi-bin/koha/opac-main.pl') // time stamps vary per run; a failed run ends with a blank line on a terminal, which a page block does not show const norm = (t) => t.replace(/\[\d\d:\d\d:\d\d\]/g, '[HH:MM:SS]').replace(/\n+exit=/, '\nexit=') const sleep = (ms) => new Promise((r) => setTimeout(r, ms)) await sleep(10000) ctx.check('the server starts at Version 26.0505000, staff and OPAC answer 200', sql("SELECT value FROM systempreferences WHERE variable='Version'") === '26.0505000' && staff() === '200' && opac() === '200', `${staff()} / ${opac()}`) // Set-up: the failing upgrade. sql("UPDATE systempreferences SET value='26.0502001' WHERE variable='Version'; ALTER TABLE sip_accounts DROP COLUMN holds_get_captured") L('sudo systemctl restart memcached; sudo koha-plack --restart library >/dev/null; sleep 4') ctx.check('database behind: the staff page redirects (302) to installer/install.pl', /^302 \S+\/cgi-bin\/koha\/installer\/install\.pl$/.test(staff()), staff()) ctx.check('database behind: the OPAC redirects (302) to maintenance.pl', /^302 \S+\/cgi-bin\/koha\/maintenance\.pl$/.test(opac()), opac()) const bad = L('sudo koha-upgrade-schema library; echo "exit=$?"') ctx.check('koha-upgrade-schema (failing): "Upgrading database schema for library", the step line, "\\tERROR: {UNKNOWN}: DBI Exception: … Unknown column \'holds_get_captured\' in \'WHERE\' at /usr/share/koha/lib/C4/Installer.pm line 818", exit 1', norm(bad) === `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\nexit=1`, bad) ctx.check('Version stays at 26.0502001 after the failure', sql("SELECT value FROM systempreferences WHERE variable='Version'") === '26.0502001') const ls = L('sudo ls -t /var/log/koha/library/updatedatabase*; echo "exit=$?"') ctx.check("sudo ls -t …/updatedatabase* → \"ls: cannot access '/var/log/koha/library/updatedatabase*': No such file or directory\", exit 2", ls === "ls: cannot access '/var/log/koha/library/updatedatabase*': No such file or directory\nexit=2", ls) // The cause fixed (as the article's table says: fix what the error names), then the runs. sql('ALTER TABLE sip_accounts ADD COLUMN holds_get_captured tinyint(1) DEFAULT NULL AFTER holds_block_checkin') const goodRaw = L('sudo koha-upgrade-schema library; echo "exit=$?"') const good = norm(goodRaw) ctx.check('koha-upgrade-schema (fixed): the step with its two notes, then 26.05.03.000 and 26.05.04.000', good.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`), goodRaw.slice(0, 500)) ctx.check('…ends "Upgrade to 26.05.05.000 […]: Koha 26.05.05 release", exit 0', good.endsWith('Upgrade to 26.05.05.000 [HH:MM:SS]: Koha 26.05.05 release\nexit=0'), goodRaw.slice(-120)) ctx.check("…the notes include \"'LibrisKey' syspref already removed\"", good.includes("'LibrisKey' syspref already removed")) const again = L('sudo koha-upgrade-schema library; echo "exit=$?"') ctx.check('koha-upgrade-schema again → "Upgrading database schema for library" / "No database change required", exit 0', again === 'Upgrading database schema for library\nNo database change required\nexit=0', again) const mc = L('sudo systemctl restart memcached') ctx.check('systemctl restart memcached prints nothing', mc === '', mc) const pl = L('sudo koha-plack --restart library') ctx.check('koha-plack --restart on a terminal → " * Stopping Plack daemon for library … [ OK ]" / " * Starting Plack daemon for library … [ OK ]"', pl === `${ok('Stopping Plack daemon for library')}\n${ok('Starting Plack daemon for library')}`, pl) await sleep(4000) ctx.check('afterwards: staff and OPAC answer 200 again', staff() === '200' && opac() === '200', `${staff()} / ${opac()}`) const env = L(`grep PRETTY_NAME /etc/os-release; perl -I/usr/share/koha/lib -MKoha -e 'print qq{KOHA=}, Koha::version, qq{\\n}'; sudo koha-mysql library -N -B -e "SELECT CONCAT('DB=', value) FROM systempreferences WHERE variable='Version'"`) ctx.ranIn({ osRelease: (env.match(/^PRETTY_NAME=.*$/m) ?? [''])[0], kohaVersion: (env.match(/^KOHA=(\S+)/m) ?? [])[1] ?? '', db: (env.match(/^DB=(\S+)/m) ?? [])[1] ?? '' }, 'A fresh Ubuntu 24.04 server with Koha installed from the Koha repository as our installation guide leaves it, reached over SSH: every command run as the sudo user librarian on a terminal.') }