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

Support UKI layout #55

Open
pointlessone opened this issue Oct 5, 2024 · 8 comments · May be fixed by #56
Open

Support UKI layout #55

pointlessone opened this issue Oct 5, 2024 · 8 comments · May be fixed by #56

Comments

@pointlessone
Copy link

I'm not sure if this should be fixed here or in installkernel. I'd love some input on that from the maintainers.

So, basically, in efistub layout installkernel puts kernel into ${efi_root}/EFI/Gentoo/ (where Gentoo part can be configured), but in uki layout it puts kernel into ${efi_root}/EFI/Linux/ (where Linux is hardcoded). So eclean-kernel can find some kernel dirs (e.g. with --list-kernels) but not kernels themselves. It also refuses to remove those dirs because it doesn't find any kernels.

@mgorny
Copy link
Member

mgorny commented Oct 5, 2024

CC @Nowa-Ammerlaan

@Nowa-Ammerlaan
Copy link
Contributor

Please try eclean-kernel --layout blspec.

Cleaning UKIs should work (it does for me), the only limitation is that eclean-kernel can only use one layout at the time. There is some auto-detection in place to guess which one you want to use, but it does not always get it right.

@pointlessone
Copy link
Author

It doesn't seem to work for me:

# eclean-kernel --layout blspec --list-kernels -D
DEBUG:root:Sorter: <ecleankernel.sort.VersionSort object at 0xffffb1bc3ce0>
DEBUG:root:Layout failed: <class 'ecleankernel.layout.blspec.BlSpecLayout'>; exception: /etc/machine-id not found
usage: eclean-kernel [-h] [-V] [-A] [-l] [-p] [--read-kernel-version KERNEL_PATH] [-b BOOTLOADER] [-L LAYOUT] [-r ROOT] [-a] [-d] [-n NUM] [-s SORT_ORDER] [-D] [-M] [--no-bootloader-update] [--no-kernel-install]
                     [-x EXCLUDE]
eclean-kernel: error: Invalid layout: blspec

I'm not sure what the issue is but I can confirm that I don't have that file.

@Nowa-Ammerlaan
Copy link
Contributor

What version is this? It works fine on my end:

eclean-kernel -aA --layout blspec
Preserving currently running kernel (6.10.12-gentoo-dist)
Legend:
[-] file being removed
[x] file does not exist (anymore)
[+] file being kept (used by other kernels)

@pointlessone
Copy link
Author

eclean-kernel 2.99.8

@Nowa-Ammerlaan
Copy link
Contributor

I suppose this is the problem:

        # TODO: according to bootctl(1), we should fall back to IMAGE_ID=
        # and then ID= from os-release
        for path in ("etc/kernel/entry-token", "etc/machine-id"):
            try:
                with open(root / path) as f:
                    self.kernel_id = f.read().strip()
                break
            except FileNotFoundError:
                pass
        else:
            raise LayoutNotFound("/etc/machine-id not found")

@pointlessone
Copy link
Author

Yeah, I don't have any of those files. So there seem to be some discrepancy between blspec and uki layout in installkernel or somewhere else.

Nowa-Ammerlaan added a commit to Nowa-Ammerlaan/eclean-kernel that referenced this issue Oct 5, 2024
OpenRC machines are not guaranteed to have the machine-id

Closes: projg2#55
Signed-off-by: Andrew Ammerlaan <[email protected]>
Nowa-Ammerlaan added a commit to Nowa-Ammerlaan/eclean-kernel that referenced this issue Oct 5, 2024
OpenRC machines are not guaranteed to have the machine-id

Closes: projg2#55
Signed-off-by: Andrew Ammerlaan <[email protected]>
Nowa-Ammerlaan added a commit to Nowa-Ammerlaan/eclean-kernel that referenced this issue Oct 5, 2024
OpenRC machines are not guaranteed to have the machine-id

Closes: projg2#55
Signed-off-by: Andrew Ammerlaan <[email protected]>
@Nowa-Ammerlaan
Copy link
Contributor

Please let me know if this patch resolves your problem: #56

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 a pull request may close this issue.

3 participants