Closed hnyman closed 1 month ago
Invalid Target/Subtarget reported. mediatek/filogic and mediatek/7622
Is this from a supported device?
@Ansuel wdyt
Feel like a bug with APK but the bisect from @hnyman made me understand the problem better... I also had this error but I hoped it was caused by my downstream patch and not from that.
By the looks of it, it seems empty entry with .apk file.
it seems empty entry with .apk file.
If you refer to the "c:" field, it seems to be empty for all packages, not only for openssl.
By looking at the apk-tools sources, the field seems to be for a commit hash.
MAP('c', ADBI_PI_REPO_COMMIT),
ADB_FIELD(ADBI_PI_REPO_COMMIT, "repo-commit", scalar_hexblob),
No the error talks about entry F.
Entry can be empty... Problem is if they are apk_blob... They still needs to be allocated and properly init.
Or maybe someone in APK fkup up and entry F was dropped but never actually dropped from the schema. Can you check what should be the usage of entry F ?
Can you check what should be the usage of entry F ?
Well, looking at the apk sources for first time, it seems pretty hard to find. At least here it is said that it is about directories: https://github.com/alpinelinux/apk-tools/blob/master/src/app_convdb.c#L154
And indeed, looking at the "installed" file contents, F is about defining directories for the files to be installed (and subsequent R is then the file).
1319 m:Jo-Philipp Wich <jo@mein.io>, Hannu Nyman <hannu.nyman@iki.fi>
1320 c:
1321 D:collectd libc
1322 F:lib
1323 F:lib/apk
1324 F:lib/apk/packages
1325 R:collectd-mod-interface.list
1326 Z:Q2Vq/ENS/oHulypWu7+3ZR061rPWXZ5YhnC3PpSGryECE=
1327 F:usr
1328 F:usr/lib
1329 F:usr/lib/collectd
1330 R:interface.so
1331 a:0:0:755
1332 Z:Q29yfaitEuJplzvXaV4+bA+1A8tgnAfdujZhzjnF+u/sw=
It's in database.c that is just an app to convert the db
https://github.com/alpinelinux/apk-tools/blob/master/src/database.c
But why the format error.... strange....
I wonder if we are encountering the problem just because we are using apk from a commit in a feature branch, which has then later been merged into the mainline apk, maybe in a slightly different way or with some earlier/later fixes?
We are using the apk commit 54caa31b
(from early August) as our apk source, but that commit is not in the official apk commit history. (Apparently 7972a780
of 21 August is the same commit in the official apk history)
@aparcar refers to branch "index-trust" in his commit ef8c1adb "apk: switch to index-trust branch"
here, but there is no such branch in apk any more, as the feature has been adopted into the official apk.
Maybe we are encountering something that has already been fixed in apk? Should we bump our apk to be from the official apk mainline, and maybe something newer than the current 6 Aug 2024 commit from a feature branch?
(I will test the most recent apk commit)
EDIT: Sadly, using apk commit from 23.10.2024 didn't help.
PKG_SOURCE_DATE:=2024-10-23
PKG_SOURCE_VERSION:=cef30b61c1a4c870f23f905423d76a287c22bf02
PKG_MIRROR_HASH:=39e9e649d608977da5947c239c71660bff30fee92494dff8be9c9663d513d550
stills leads into
OpenWrt SNAPSHOT, r27913-a2aabc9a7a
-----------------------------------------------------
root@router6000:~# apk --version
apk-tools 3.0.0_pre20241023, compiled for aarch64.
root@router6000:~# apk info
ERROR: FDB format error (line 6910, entry 'F')
ERROR: Unable to read database: v2 database format error
ERROR: Failed to open apk database: v2 database format error
@hnyman ok I discovered the culprit :D
If you notice openssl adds a new line and destroy the database... Check the T entry... This is totally a fragility of APK and I will produce a patch to handle this.
Aka
Great that you figured it out. Sounds fragile also for upstream if the description text is not sanitized when it is entered into the database.
@hnyman well problem was something totally different and wasn't us adding new line char... More a too long entry getting corrupted.
If you want further reading :D https://gitlab.alpinelinux.org/alpine/apk-tools/-/merge_requests/236/diffs
Anyway with the 2 patch problem is fixed.
Great that you found the real reason.
I read your explanation. And funnily enough, I had noticed from less/hexedit that the long descriptions ended in a non-printable char instead of the dot, but as none of occurences earlier in the file seemed to cause problems, I just thought that it may be an intended end marker for the longest descriptions... Sounds like that was a wrong guess. (Apparently other chars like 0x03 etc. are handled ok, but in this case the last wrong char was newline, breaking the database encoding.)
I will apply and test with your patches. Are you committing them now to OpenWrt repo as patches for our apk?
Are you committing them now to OpenWrt repo as patches for our apk?
They are in the gigantic APK wip pr.
I have a similar problem: LuCI Master (24.298.52515~e34c268) / OpenWrt SNAPSHOT (r27931-945a335f66) root@OpenWrt:# apk verify packages.adb packages.adb: No such file or directory root@OpenWrt:# grep apk build.config grep: build.config: No such file or directory root@OpenWrt:# apk info ERROR: Unable to read database: No such file or directory ERROR: Failed to open apk database: No such file or directory root@OpenWrt:# apk --version apk-tools 3.0.0_pre20240806, compiled for armv7.
@Ansuel 's fix for this has now been merged upstream at apk:
So, might it make sense to update our apk to that upstream HEAD and avoid taking the local patch separately to our marginally older apk version.
I close this bug, as we have the fix locally as patch in the apk WIP PR, and it has been fixed upstream.
Describe the bug
I have compiled an apk enabled version of main/master snapshot r27902-6835ff8cbc (with apk-openssl) for mediatek MT6000, but using apk fails as it seems unable to read its own database of already installed packages (in the image itself).
Looking at the line number, it seems to fail on parsing package info for openssl, roughly at the middle of the 11300 lines in the file:
But apk is able to e.g. verify the package index downloaded from apracar's test site, so in general, it should be ok?
I am using apk-openssl:
The same happens also with RT3200 at the same place:
OpenWrt version
r27902-6835ff8cbc
OpenWrt release
SNAPSHOT
OpenWrt target/subtarget
mediatek/filogic and mediatek/7622
Device
GL.iNet GL-MT6000 and Belkin RT3200
Image kind
Self-built image
Steps to reproduce
No response
Actual behaviour
No response
Expected behaviour
No response
Additional info
No response
Diffconfig
No response
Terms