Received: from primeraholten.nl (235-230-138-45.connected.by.freedominter.net [45.138.230.235]) by gbr-app-1.alpinelinux.org (Postfix) with ESMTP id 7CDF6226518 for <~alpine/apk-tools@lists.alpinelinux.org>; Tue, 7 Jan 2025 12:28:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=primeraholten.nl; s=default; t=1736252928; bh=cveYDtHX6vrKVh5aAmtHTKlXiv6AWnc9qrBJHI49UDI=; h=Date:From:To:CC:Subject:In-Reply-To:References:From; b=qM1FvAxKlf1GcGR1mVhfXpcFYF8tV3SAhgfYFbYHa0psHQC31LpefEIT95cUQsclq YCV+jTmbnJ92kjjZ9wMpD9yGFcOe8KHr0S2S2W94U4JY3E5eUMySrFFQcrL4Sm6I53 EolITu1XhR/wHQxuudN/yyHJu7og8w2hr22eblu5i7FeUovbjAriMZHtRkkU3Qeuzt YqDgNd9S240vsgVb3vYMjNCL0NKxEMzxFdEA+bRtBeI3L5KY2/WPR2z/8BLnJlkrLD 11iCZwQ1905TDUdA9CuSENwlBnHnehaqq7Ut0JvosSvyvMkMZbR3/vQ80Wpbq//aUg 31SCFbwr//C2A== Date: Tue, 07 Jan 2025 12:28:37 +0000 From: Arjan Bouter To: Timo Teras CC: ~alpine/apk-tools@lists.alpinelinux.org Subject: Re: apk rebuild database? In-Reply-To: <20250107124850.22a1b88e@onyx.my.domain> References: <20250106185651.69029a37@tonberry> <20250107104248.46cd4cee@onyx.my.domain> <00284195-411C-4364-8D42-66F51B7E53E8@primeraholten.nl> <20250107124850.22a1b88e@onyx.my.domain> Message-ID: <928D45B5-52EF-47A6-8F70-2F762E692AA3@primeraholten.nl> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary=----YMF4TPWWBJWBWKNO81YFMZOWBWWP2G Content-Transfer-Encoding: 7bit ------YMF4TPWWBJWBWKNO81YFMZOWBWWP2G Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable It should, but doesn't=2E That would be too easy=2E The error is now: unable to select packages=20 It also complains about what appears to be the contents of /etc/apk/world = which looks like /etc/resolv=2Econf Timo Teras schreef op 7 januari 2025 10:48:50 UTC: >Hi, > >You can also just wipe the database, and reinstall everything=2E >Something like: > >mv /lib/apk/db /lib/apk/db=2Ebackup >mkdir /lib/apk/db >apk fix > >Which should reinstall everything you had, unless you have packages >that are no longer available in the repositories=2E > >Timo > >On Tue, 07 Jan 2025 10:32:28 +0000 >Arjan Bouter wrote: > >> Not what I wanted to hear, lol=2E >>=20 >> after a bit of digging it looks like apk fails to read scripts=2Etar=2E >> Removing the offending entry mentioned by strace, the first entry, >> makes it complain about the next entry Renaming lets me "apk update" >> again, but apk throws "error: unabe to select packages", which makes >> sense=2E >>=20 >> from the looks of it, there is nothing strange about the contents of >> scripts=2Etar=2E Is there any way to learn why and on what it trips? >>=20 >> As for the cause, an empty battery in my laptop during an update=2E >> One of these I-m-sure-it's-plugged-in moments=2E=2E=2E >>=20 >> Thanks for the help, >> Arjan >>=20 >>=20 >> Timo Teras schreef op 7 januari 2025 08:42:48 U= TC: >> >On Mon, 6 Jan 2025 18:56:51 +0100 >> >Arjan Bouter wrote: >> > =20 >> >> when I try to use apk to update, add or remove applications I get >> >> the following error: >> >>=20 >> >> ERROR: Unable to read database state: package file format error >> >> ERROR: Failed to open apk database: package file format error >> >>=20 >> >> Strace shows a bit more info: >> >>=20 >> >> read(7, "C:Q1DAq8+0eVL2Ce+rsHzYHUPCmuEy8=3D"=2E=2E=2E, 131072) =3D 1= 31072 >> >> close(7) =3D 0 >> >> munmap(0x7f5d4fdd3000, 135168) =3D 0 >> >> writev(2, [{iov_base=3D"", iov_len=3D0}, {iov_base=3D"ERROR: ", >> >> iov_len=3D7}], 2) =3D 7 writev(2, [{iov_base=3D"Unable to read datab= ase >> >> state: p"=2E=2E=2E, iov_len=3D56}, {iov_base=3DNULL, iov_len=3D0}], = 2) =3D 56 >> >> writev(2, [{iov_base=3D"", iov_len=3D0}, {iov_base=3D"\n", iov_len= =3D1}], >> >> 2) =3D 1 >> >>=20 >> >> Is there a way to recreate the database state file? =20 >> > >> >Generally only by reinstalling the system=2E Any idea how it went to >> >this state? Maybe its possible to fix it manually=2E >> > >> >Timo >> > =20 > ------YMF4TPWWBJWBWKNO81YFMZOWBWWP2G Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
It should, but doesn't=2E
Tha= t would be too easy=2E

The error is now: unable to select packages <= br>It also complains about what appears to be the contents of /etc/apk/worl= d which looks like /etc/resolv=2Econf


Timo Teras <timo=2Eteras@iki=2Efi> schreef o= p 7 januari 2025 10:48:50 UTC:
Hi,

You can also just wipe = the database, and reinstall everything=2E
Something like:

mv /lib= /apk/db /lib/apk/db=2Ebackup
mkdir /lib/apk/db
apk fix

Which s= hould reinstall everything you had, unless you have packages
that are no= longer available in the repositories=2E

Timo

On Tue, 07 Jan = 2025 10:32:28 +0000
Arjan Bouter <arjan@primeraholten=2Enl> wrote:=

Not what I wanted to hear, lol=2E

after a bit of digging it lo= oks like apk fails to read scripts=2Etar=2E
Removing the offending entry= mentioned by strace, the first entry,
makes it complain about the next = entry Renaming lets me "apk update"
again, but apk throws "error: unabe = to select packages", which makes
sense=2E

from the looks of it, t= here is nothing strange about the contents of
scripts=2Etar=2E Is there = any way to learn why and on what it trips?

As for the cause, an empt= y battery in my laptop during an update=2E
One of these I-m-sure-it's-pl= ugged-in moments=2E=2E=2E

Thanks for the help,
Arjan


T= imo Teras <timo=2Eteras@iki=2Efi> schreef op 7 januari 2025 08:42:48 = UTC:
On Mon, 6 Jan 2025 18:56:51 +0100
Arjan Bouter <arjan@primeraho= lten=2Enl> wrote:

when I try to use apk to update, add or remove = applications I get
the following error:

ERROR: Unable to read dat= abase state: package file format error
ERROR: Failed to open apk databas= e: package file format error

Strace shows a bit more info:

re= ad(7, "C:Q1DAq8+0eVL2Ce+rsHzYHUPCmuEy8=3D"=2E=2E=2E, 131072) =3D 131072
= close(7) =3D 0
munmap(0x7f5d4fdd3000, 135= 168) =3D 0
writev(2, [{iov_base=3D"", iov_len=3D0}, {iov_base= =3D"ERROR: ",
iov_len=3D7}], 2) =3D 7 writev(2, [{iov_base=3D"Unable to = read database
state: p"=2E=2E=2E, iov_len=3D56}, {iov_base=3DNULL, iov_l= en=3D0}], 2) =3D 56
writev(2, [{iov_base=3D"", iov_len=3D0}, {iov_base= =3D"\n", iov_len=3D1}],
2) =3D 1

Is there a way to recreate the d= atabase state file?

Generally= only by reinstalling the system=2E Any idea how it went to
this state? = Maybe its possible to fix it manually=2E

Timo


------YMF4TPWWBJWBWKNO81YFMZOWBWWP2G--