Received: from mout01.posteo.de (mout01.posteo.de [185.67.36.65]) by gbr-app-1.alpinelinux.org (Postfix) with ESMTPS id E55702263C9 for <~alpine/apk-tools@lists.alpinelinux.org>; Tue, 7 Jan 2025 12:30:30 +0000 (UTC) Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 56B64240027 for <~alpine/apk-tools@lists.alpinelinux.org>; Tue, 7 Jan 2025 13:30:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1736253029; bh=qvgg/033WO0lbGTZvNFTYPsY3UojrPvDzswRVhxP/Cs=; h=Mime-Version:Content-Transfer-Encoding:Content-Type:Date: Message-Id:Cc:Subject:From:To:From; b=h1URl2pKYBCg96lRKarNYBZTRdFHoAdYZsg78rGggg1u6/An/3lSVtbcP+gtNXVnz 4RbHwxbVWNL3JE4QuZev/fe2Iya23doPph4JiVYgkiLiR2rtFaH0GC/s/VjB8ERjOq P37J4qgivmCcj4wF8S14QWRDQXcJg7td+EkM4nYiYymXlywpt+byFNngDFPFfR643+ phBpj6ToJAUeX4bEnlZQj/ftYISeEBF+6m6BwdIwQrHPpeEGP25JKeANOsoTnoCx3t KTORvj6Yr0JYRdwqb54yEYxGSNObNNVIe/apHwexAt9YUt3IPgALdv3v+KD7EdKOi4 8Z/KHAj1gZUOw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4YS9PJ20JKz6trs; Tue, 7 Jan 2025 13:30:28 +0100 (CET) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Tue, 07 Jan 2025 12:30:28 +0000 Message-Id: Cc: <~alpine/apk-tools@lists.alpinelinux.org> Subject: Re: apk rebuild database? From: "Sertonix" To: "Arjan Bouter" , "Timo Teras" References: <20250106185651.69029a37@tonberry> <20250107104248.46cd4cee@onyx.my.domain> <00284195-411C-4364-8D42-66F51B7E53E8@primeraholten.nl> <20250107124850.22a1b88e@onyx.my.domain> <928D45B5-52EF-47A6-8F70-2F762E692AA3@primeraholten.nl> In-Reply-To: <928D45B5-52EF-47A6-8F70-2F762E692AA3@primeraholten.nl> Would you mind sharing the contents of /etc/apk/world? > It should, but doesn't. > That would be too easy. > > 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.conf > > > Timo Teras schreef op 7 januari 2025 10:48:50 UTC: > >Hi, > > > >You can also just wipe the database, and reinstall everything. > >Something like: > > > >mv /lib/apk/db /lib/apk/db.backup > >mkdir /lib/apk/db > >apk fix > > > >Which should reinstall everything you had, unless you have packages > >that are no longer available in the repositories. > > > >Timo > > > >On Tue, 07 Jan 2025 10:32:28 +0000 > >Arjan Bouter wrote: > > > >> Not what I wanted to hear, lol. > >>=20 > >> after a bit of digging it looks like apk fails to read scripts.tar. > >> 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. > >>=20 > >> from the looks of it, there is nothing strange about the contents of > >> scripts.tar. 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. > >> One of these I-m-sure-it's-plugged-in moments... > >>=20 > >> Thanks for the help, > >> Arjan > >>=20 > >>=20 > >> Timo Teras schreef op 7 januari 2025 08:42:48 UTC: > >> >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"..., 131072) =3D 131072 > >> >> 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 data= base > >> >> state: p"..., 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. Any idea how it went to > >> >this state? Maybe its possible to fix it manually. > >> > > >> >Timo > >> > =20 > >