anatol / booster

Fast and secure initramfs generator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Booster picks wrong .so on Gentoo

Roger-Roger-debug opened this issue · comments

Hello, I'm trying my hand on writing an ebuild to get booster running on Gentoo.

However due to Gentoo's lib layout wrong .so get picked up. /usr/lib can contain both 32 and 64 bit files. The correct place to look for libraries such as libresolv.so.2 would be /usr/lib64. I thought I could just reorder the paths at

var elfLibDir = []string{"/usr/lib", "/lib", "/usr/lib64"}

but I couldn't boot the resulting image (init not found).

I tried inspecting the image with booster unpack, which failed with mkdir gentoo/usr/lib64: file exists.
I could ls the image just fine and found out that /usr/lib64 was a symlink pointing to /lib, which in turn was a symlink linking to /usr/lib64.

What would be the correct way to point the generator to the correct lib directory? Or is my initial error, the init not being found, not related to this?

Hi @Roger-Roger-debug thank you for reporting this issue.

On many systems lib64 and lib are synonyms. That is why booster handles it by symlinking these directories together.

But it sounds like Gentoo handles the directories separately. In this case in addition to your change you also need to modify the symlinks list https://github.com/anatol/booster/blob/master/generator/generator.go#L249 and remove entries that try to alias lib64 dirs to lib. Please try the change and let me know how does it work.

Thank you for pointing me in the right direction. Gentoo indeed handles them differently, the rational is explained here. After fixing the offending symlinks I can now finally boot Gentoo.

Looking forward to see booster package in gentoo repository. Please cc me if you have a commit for the package.