Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

phase1: remove kmods in target packages if archive is enabled #37

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dangowrt
Copy link
Member

OPKG gets confused if kmod packages are present in both, target packages as well as kernel version specific folder.
Remove them from target packages to make opkg pick the kmods from kmod archive folder only.

I didn't test this and I'm not very familiar with buildbot. Just noticing that currently, older snapshots fail to install packages because newer-version kmods from target packages are selected instead of the ones matching the kernel version, so this should be fixed somehow...

@ynezz
Copy link
Member

ynezz commented May 31, 2024

OPKG gets confused if kmod packages are present in both, target packages as well as kernel version specific folder.

Do you've more details about the issue, ideally reproducer? I just tried following and don't see any issue.

root@OpenWrt:/# ubus call system board
{
        "kernel": "6.6.32",
        "hostname": "OpenWrt",
        "system": "ARMv8 Processor rev 4",
        "model": "Linksys E8450",
        "board_name": "linksys,e8450",
        "rootfs_type": "initramfs",
        "release": {
                "distribution": "OpenWrt",
                "version": "SNAPSHOT",
                "revision": "r26463-a1a9572f43",
                "target": "mediatek/mt7622",
                "description": "OpenWrt SNAPSHOT r26463-a1a9572f43"
        }
}
root@OpenWrt:/# opkg update 
Downloading https://downloads.openwrt.org/snapshots/targets/mediatek/mt7622/packages/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_core
Downloading https://downloads.openwrt.org/snapshots/targets/mediatek/mt7622/packages/Packages.sig
Signature check passed.
Downloading https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a53/base/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_base
Downloading https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a53/base/Packages.sig
Signature check passed.
Downloading https://downloads.openwrt.org/snapshots/targets/mediatek/mt7622/kmods/6.6.32-1-5ca3cc895cfde6fa5bcd4cac1657aceb/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_kmods
Downloading https://downloads.openwrt.org/snapshots/targets/mediatek/mt7622/kmods/6.6.32-1-5ca3cc895cfde6fa5bcd4cac1657aceb/Packages.sig
Signature check passed.
Downloading https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a53/luci/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_luci
Downloading https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a53/luci/Packages.sig
Signature check passed.
Downloading https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a53/packages/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_packages
Downloading https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a53/packages/Packages.sig
Signature check passed.
Downloading https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a53/routing/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_routing
Downloading https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a53/routing/Packages.sig
Signature check passed.
Downloading https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a53/telephony/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_telephony
Downloading https://downloads.openwrt.org/snapshots/packages/aarch64_cortex-a53/telephony/Packages.sig
Signature check passed.
root@OpenWrt:/# opkg install kmod-usb-serial
Installing kmod-usb-serial (6.6.32-r1) to root...
Downloading https://downloads.openwrt.org/snapshots/targets/mediatek/mt7622/kmods/6.6.32-1-5ca3cc895cfde6fa5bcd4cac1657aceb/kmod-usb-serial_6.6.32-r1_aarch64_cortex-a53.ipk
Installing kmod-nls-base (6.6.32-r1) to root...
Downloading https://downloads.openwrt.org/snapshots/targets/mediatek/mt7622/kmods/6.6.32-1-5ca3cc895cfde6fa5bcd4cac1657aceb/kmod-nls-base_6.6.32-r1_aarch64_cortex-a53.ipk
Installing kmod-usb-core (6.6.32-r1) to root...
Downloading https://downloads.openwrt.org/snapshots/targets/mediatek/mt7622/kmods/6.6.32-1-5ca3cc895cfde6fa5bcd4cac1657aceb/kmod-usb-core_6.6.32-r1_aarch64_cortex-a53.ipk
Configuring kmod-nls-base.
Configuring kmod-usb-core.
Configuring kmod-usb-serial.
root@OpenWrt:/# dmesg | grep usbserial
[  144.192904] usbcore: registered new interface driver usbserial_generic
[  144.192952] usbserial: USB Serial support registered for generic

@dangowrt
Copy link
Member Author

@ynezz Reproducing is easy. Install a snapshot today and try installing a kmod package or anything depending on a kmod package in a few weeks, after a kernel version bump. Despite the kmod archive feed being present, opkg well prefer the no longer matching newer kmods instead of choosing the ones from the kmod archive.

@jow-
Copy link
Contributor

jow- commented May 31, 2024

I can confirm this wrong opkg behavior and purging the kmods from the core repo will fix it. Basically, our opkg fork is broken when it has to pick a dependency with version constraints from multiple providers. Likely one of our opkg memory usage reduction patches is breaking this.

@Ansuel
Copy link
Member

Ansuel commented May 31, 2024

(this problem with kmods and dependency was one of the main reason we wants to move to apk)

@aparcar
Copy link
Member

aparcar commented Jun 1, 2024

I think we tried to tackle this issue back in 2020 and even made it working. I wonder what broke it again...

@ynezz
Copy link
Member

ynezz commented Jun 1, 2024

I've just deployed this change "manually" to https://buildbot.staging.openwrt.org

@aparcar
Copy link
Member

aparcar commented Jun 1, 2024

Long live the OPKG

phase1/master.cfg Outdated Show resolved Hide resolved
@dangowrt
Copy link
Member Author

@Ansuel Thank you! You are too fast 😜

@Ansuel
Copy link
Member

Ansuel commented Jun 12, 2024

@dangowrt ehehehe problem is that i think this needs to be manually picked for staging buildbot :(

@ynezz
Copy link
Member

ynezz commented Jun 12, 2024

Thanks, fix deployed.

@Ansuel
Copy link
Member

Ansuel commented Jun 12, 2024

Lovely find command that loves order of args...

find: paths must precede expression: `bin/targets/malta/be/packages/'
find: possible unquoted pattern after predicate `-delete'?

@ynezz can you redeploy one last time :( ?

@ynezz
Copy link
Member

ynezz commented Jun 12, 2024

@ynezz can you redeploy one last time :( ?

Done

@ynezz ynezz changed the title [RFC] phase1: remove kmods in target packages if archive is enabled phase1: remove kmods in target packages if archive is enabled Jun 12, 2024
@ynezz
Copy link
Member

ynezz commented Jun 13, 2024

Just added apk compat and printing of deleted files, deployed to staging.

@Ansuel
Copy link
Member

Ansuel commented Jun 13, 2024

@ynezz in case you miss IRC i think an intermediate commit was deployed to staging
https://buildbot.staging.openwrt.org/images/#/builders/5/builds/5

@ynezz
Copy link
Member

ynezz commented Jun 13, 2024

@ynezz in case you miss IRC i think an intermediate commit was deployed to staging https://buildbot.staging.openwrt.org/images/#/builders/5/builds/5

Yep, should be fixed. I've as well (hopefully) fixed the wrong find expression.

@Ansuel
Copy link
Member

Ansuel commented Jun 14, 2024

@ynezz I think i understood why this fail

https://buildbot.staging.openwrt.org/images/#/builders/1/builds/8/steps/59/logs/stdio

the file list is generated by the sha256sums file that is generated before the kmodclean is called (when the kmods are still in the target directory) hence rsync complain that the file can't be found.

Solution is to move the step before the checksums call so that file gets correctly deleted and are not included in the final file.

Can you check if this theory is correct and redeploy?

If it does look ugly we may have to add an additional step to remove the missing entry in the sha256sums (if we want to keep everything in order)

@Ansuel Ansuel force-pushed the fix-kmod-archive branch 2 times, most recently from fbd516a to a4d912e Compare June 14, 2024 11:43
@Ansuel
Copy link
Member

Ansuel commented Jun 14, 2024

Well it seems at the end we really need to ""fix"" the sha256sums... Alternative solution is to use a tmp directory to move the kmods.

Honestly they are both bad solution but one should be faster than moving lots of files around one extra time...

phase1/master.cfg Outdated Show resolved Hide resolved
@Ansuel
Copy link
Member

Ansuel commented Nov 5, 2024

@ynezz any idea how to handle the lint problem with this?

@Ansuel
Copy link
Member

Ansuel commented Nov 10, 2024

Just to assert the situation.

We really need to fix this:

  • kmods are placed on target packages dir
  • APK will install package from here instead of the kmods directory

TODO:

  • create sha256sums of the file in kmods (and sign it i guess)
  • correctly create a target packages index AFTER the kmods are moved to the dedicated directory

@Ansuel Ansuel force-pushed the fix-kmod-archive branch 12 times, most recently from 9b6a9f5 to cf7a98b Compare November 13, 2024 13:35
Implement custom step ShellCommandAndSetProperty, as an extension of
ShellCommand with the addition of setting a bool property that is set
True or False if the shell command succeeded or not.

Signed-off-by: Christian Marangi <[email protected]>
phase1/master.cfg Outdated Show resolved Hide resolved
phase1/master.cfg Outdated Show resolved Hide resolved
OPKG gets confused if kmod packages are present in both, target packages
as well as kernel version specific folder.
Remove them from target packages to make opkg pick the kmods from kmod
archive folder only.

We reorder the step by:
1) Move the kmods to dedicated directory
2) Index packages
3) Index kmods
4) Make checksums
5) Extract kmods sums from remote sums
6) Merge the local sums with the remote kmods-only sums

This permits to produce a better sha256sums that also reflect the hash
of the entire directory.

Co-developed-by: Christian Marangi <[email protected]>
Signed-off-by: Daniel Golle <[email protected]>
[ rework implementation, sha256sumsclean + --remove-source-files ]
Signed-off-by: Christian Marangi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants