Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) by gbr-app-1.alpinelinux.org (Postfix) with ESMTPS id 53A7A2264D2 for <~alpine/apk-tools@lists.alpinelinux.org>; Tue, 7 Jan 2025 10:48:54 +0000 (UTC) Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-53e3a227b82so14032562e87.0 for <~alpine/apk-tools@lists.alpinelinux.org>; Tue, 07 Jan 2025 02:48:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736246933; x=1736851733; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NLHGJGoprn7O5Fy5GW+asoaATINbLO9vWcgU3v6m6lk=; b=vrX4cW3CnFlnLeSJZpVoBIcMiExJlNLr/uYTkouqk+K43o6qiVXT6oGaSyRQRcTmTk 00fcSvm030rP/+g8WNQcDx4+m+OJnpZwot01CB7KmWYX1OMYoIw95E4coRT7MChr0/vf WOUsJX4w4jZEnPAKyD6BfB75TG0dMJesiOgPYULCvBJlJkgM5W9GRBZ/VGENxDL6+NNV OFL2ORF6FEE5AeJecvxrt72E8CbEN6V7roffxFoda2BvVTRvFqfgxLMsprEhvrjZG7sJ Ya926wXJpv/Z0vMfWaT5Kmt+yEJN+i9jgvrBLEy5DLZryr1dQkWNuGtVI6vTOaIQhlB/ Cawg== X-Gm-Message-State: AOJu0YxevUVjsVRu5rs6SsXkHkFkRWOtD3px3MN32lUaxVNd4WdQVW/F prar1j6w26s2K8ftf1CrpuavM6D9EZxxSKATjj44HbTbztWhK6wIczqzng== X-Gm-Gg: ASbGncspS81JVIITGRM5W/R0Y8D1D0sQLvgWhaClgaylE1ld2eGPKpGu4rPLHecoCL3 fg91aoXTydOLK2fVeBiWlrrcQ92VpwWkbIiPJqJBdpPkBuyeSnFd08Z/oHYtCrrIECrWgkXAtre C4rf08fBrI19MS/roofn94b7hH9L9bR76vcYU0KWxS1Nrq43E+sNhfdQhgiZxUoogDlNFqnMaWi ER7aV9nNZeTNPoGMNDEn2ucbD4glyw1a7VuwaHIydDBV3/m5T1BKBTrgoA5/fO+vDj5PqJ8oPzD LaLnV2sA18wGNuAnv/svGKQlOcc= X-Google-Smtp-Source: AGHT+IE/i/sFHrhXr1qDcGf/r1/Ir6mkYYKzEQG0G9FvXfus1Hrf//xgRrE3xCbv82b8bVD8KucRpQ== X-Received: by 2002:a05:6512:68e:b0:540:3566:5397 with SMTP id 2adb3069b0e04-54229530300mr20013705e87.22.1736246932983; Tue, 07 Jan 2025 02:48:52 -0800 (PST) Received: from onyx.my.domain (n7lgym3rd5pndky2eok-1.v6.elisa-mobile.fi. [2001:999:708:543a:3cc6:c67:d0c6:78d4]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-542238138c3sm5102575e87.140.2025.01.07.02.48.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 02:48:52 -0800 (PST) Date: Tue, 7 Jan 2025 12:48:50 +0200 From: Timo Teras To: Arjan Bouter Cc: ~alpine/apk-tools@lists.alpinelinux.org Subject: Re: apk rebuild database? Message-ID: <20250107124850.22a1b88e@onyx.my.domain> In-Reply-To: <00284195-411C-4364-8D42-66F51B7E53E8@primeraholten.nl> References: <20250106185651.69029a37@tonberry> <20250107104248.46cd4cee@onyx.my.domain> <00284195-411C-4364-8D42-66F51B7E53E8@primeraholten.nl> X-Mailer: Claws Mail 4.3.0 (GTK 3.24.43; x86_64-alpine-linux-musl) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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. > > 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. > > 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? > > As for the cause, an empty battery in my laptop during an update. > One of these I-m-sure-it's-plugged-in moments... > > Thanks for the help, > Arjan > > > Timo Teras schreef op 7 januari 2025 08:42:48 UTC: > >On Mon, 6 Jan 2025 18:56:51 +0100 > >Arjan Bouter wrote: > > > >> when I try to use apk to update, add or remove applications I get > >> the following error: > >> > >> ERROR: Unable to read database state: package file format error > >> ERROR: Failed to open apk database: package file format error > >> > >> Strace shows a bit more info: > >> > >> read(7, "C:Q1DAq8+0eVL2Ce+rsHzYHUPCmuEy8="..., 131072) = 131072 > >> close(7) = 0 > >> munmap(0x7f5d4fdd3000, 135168) = 0 > >> writev(2, [{iov_base="", iov_len=0}, {iov_base="ERROR: ", > >> iov_len=7}], 2) = 7 writev(2, [{iov_base="Unable to read database > >> state: p"..., iov_len=56}, {iov_base=NULL, iov_len=0}], 2) = 56 > >> writev(2, [{iov_base="", iov_len=0}, {iov_base="\n", iov_len=1}], > >> 2) = 1 > >> > >> Is there a way to recreate the database state file? > > > >Generally only by reinstalling the system. Any idea how it went to > >this state? Maybe its possible to fix it manually. > > > >Timo > >