blue-build / modules

BlueBuild standard modules used for building your Atomic Images
Apache License 2.0
22 stars 26 forks source link

fix(rpm-ostree): Optfix is not properly creating symlinks on new installs #165

Closed Oakleafknight06 closed 2 months ago

Oakleafknight06 commented 3 months ago

I run a custom image, https://github.com/Oakleafknight06/startingleaf, in which I install Mullvad VPN, which requires optfix as it installs into /opt. On my main workstation, this is working perfectly. However, on my secondary test system, the last two fresh installs I have done the symlink is not created correctly. The files are present in /usr/lib/opt/Mullvad\ VPN, but not in /opt/Mullvad\ VPN . To fix temporarily I have run sudo ln -s /usr/lib/opt/Mullvad\ VPN /opt/Mullvad\ VPN and with that mullvad works normally.

(and a sidenote, I am new to filing issues so if I dont include anything you need or any other way I don't do the correct thing let me know, I'm happy to help)

fiftydinar commented 3 months ago

I don't know how optfix functions currently to fix this issue now, but I know that we are waiting for rpm-ostree v2024.3 update to land in Fedora, which includes this function natively, which will hopefully work better.

Related issue: https://github.com/blue-build/modules/issues/112

Oakleafknight06 commented 3 months ago

I assume that fix will land sometime soon when its ready? I was a bit confused going from bluebuild docs to the mentioned issue which was merged, wasnt sure when that lands in regular fedora atomic desktops

Oakleafknight06 commented 3 months ago

Probably no need for a fix with the current system as there's a manual workaround and an upstream fix coming sometime soon

AuraHerreroRuiz commented 3 months ago

I don't know how optfix functions currently to fix this issue now, but I know that we are waiting for rpm-ostree v2024.3 update to land in Fedora, which includes this function natively, which will hopefully work better.

I'm the original writer of the work around (Well, only did the bash code for it as a script in my personal image, but some other users started using it in theirs and it was made into a module by somebody else) and how it works is that it first symlinks /opt to point to /var/opt, and then it iterates through the specified directories and creates symlinks on /var/opt/[directory] to /usr/lib/opt/[directory] before installing packages.

This makes the packages successfully install, but for some reason, these symlinks sometimes don't make it to the final image.

I've tried to look into it, but I eventually gave up as I couldn't consistently reproduce the issue consistently. Sadly, it isn't an easy fix.

I could look into it once more, but as mentioned in #112, upstream's experimental feature should work better, so if I have time I'll take a look at how to enable it by default and make a pull request.

xynydev commented 3 months ago

My current optfix version is v2024.4. Do yall's builds work fine without using optfix at all?

AuraHerreroRuiz commented 2 months ago

My current optfix version is v2024.4

I assume you mean rpm-ostree?

Do yall's builds work fine without using optfix at all?

Mine doesn't, and my rpm-ostree version is v2024.4 as well. I created a branch from main in my image and removed the optfix section I have on the rpm-ostree module and the build fails when installing the packages.

fiftydinar commented 2 months ago

Mine doesn't, and my rpm-ostree version is v2024.4 as well. I created a branch from main in my image and removed the optfix section I have on the rpm-ostree module and the build fails when installing the packages.

I believe that optfix needs to be enabled as the experimental feature in rpm-ostree

I don't know currently how to do that in build-time, but I will try to investigate.

fiftydinar commented 2 months ago

Here's how it works:

https://github.com/coreos/rpm-ostree/issues/233#issuecomment-1856720559

I think that we should go with environment variable solution (Modifying rpm-ostreed.service.d)

fiftydinar commented 2 months ago

Needs to be tested.

https://github.com/blue-build/modules/pull/191

EDIT: Environment variable approach doesn't work. It's not documented how to use optfix in "compose time" at all to try the 2nd solution, so Idk how to solve this.

AuraHerreroRuiz commented 2 months ago

It's not documented how to use optfix in "compose time"

The only mention I've found of that is in the release page:

rpm-ostree now has experimental support for installing RPMs with files in /opt and /usr/local. This can be enabled at compose time (via the opt-usrlocal-overlays switch), or client-side using https://github.com/coreos/rpm-ostree/issues/233#issuecomment-1856720559.

However, I can't find where this switch is. I've tried rpm-ostree [command] --help and searching the source code for it and no dice.

xynydev commented 2 months ago

Oh yeah, I think opt-usrlocal-overlays is in the treefile. We should try to contrib that in upstream Fedora or at least make an issue.

AuraHerreroRuiz commented 2 months ago

I think someone already did? https://github.com/coreos/fedora-coreos-tracker/issues/1681

AuraHerreroRuiz commented 2 months ago

However, I can't find where this switch is. I've tried rpm-ostree [command] --help and searching the source code for it and no dice.

Okay, I figured it out. This switch was changed to an enum named opt-usrlocal. As you said, it's on the treefile. https://coreos.github.io/rpm-ostree/treefile/#experimental-options

xynydev commented 2 months ago

This is where the treefiles are. I can make an issue there later, if someone doesn't go first.

https://gitlab.com/fedora/ostree/ci-test