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

interfaces,dirs: add ldconfig backend #14926

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

alfonsosanchezbeato
Copy link
Member

This backend will expose libraries coming from snaps to either the
rootfs or to other snaps (currently supporting only the former).

Copy link

Tue Jan 14 19:56:29 UTC 2025

Failures:

Prepare:

  • google-core:ubuntu-core-20-64:tests/main/
  • google-core:ubuntu-core-20-64:tests/core/
  • google-core:ubuntu-core-20-64:tests/main/
  • google-core:ubuntu-core-20-64:tests/main/
  • google-core:ubuntu-core-20-64:tests/main/
  • google-core:ubuntu-core-20-64:tests/main/
  • google-core:ubuntu-core-20-64:tests/main/
  • google-core:ubuntu-core-20-64:tests/main/

Restoring:

  • google-core:ubuntu-core-20-64:tests/main/
  • google-core:ubuntu-core-20-64:tests/main/
  • google-core:ubuntu-core-20-64
  • google-core:ubuntu-core-20-64:tests/core/
  • google-core:ubuntu-core-20-64:tests/core/
  • google-core:ubuntu-core-20-64
  • google-core:ubuntu-core-20-64:tests/main/
  • google-core:ubuntu-core-20-64:tests/main/
  • google-core:ubuntu-core-20-64
  • google-core:ubuntu-core-20-64:tests/main/
  • google-core:ubuntu-core-20-64:tests/main/
  • google-core:ubuntu-core-20-64
  • google-core:ubuntu-core-20-64:tests/main/
  • google-core:ubuntu-core-20-64:tests/main/
  • google-core:ubuntu-core-20-64
  • google-core:ubuntu-core-20-64:tests/main/
  • google-core:ubuntu-core-20-64:tests/main/
  • google-core:ubuntu-core-20-64
  • google-core:ubuntu-core-20-64:tests/main/
  • google-core:ubuntu-core-20-64:tests/main/
  • google-core:ubuntu-core-20-64
  • google-core:ubuntu-core-20-64:tests/main/
  • google-core:ubuntu-core-20-64:tests/main/
  • google-core:ubuntu-core-20-64

Copy link
Member

@Meulengracht Meulengracht left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks sensible to me, and clean. Thank you

Copy link
Collaborator

@pedronis pedronis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One main question.

Further usually interfaces decide to do different things depending if the slot is implicit (see the usage of the implicitSystemPermanent/ConnectedSlot helpers) but maybe here we want to do something at the backend level?

dirs/dirs.go Outdated
@@ -465,6 +466,7 @@ func SetRootDir(rootdir string) {

SnapDataDir = filepath.Join(rootdir, "/var/snap")
SnapAppArmorDir = filepath.Join(rootdir, snappyDir, "apparmor", "profiles")
SnapLdconfigDir = filepath.Join(rootdir, "etc/ld.so.conf.d")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: the style here seems to be /etc...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed

// the rootfs. For snaps, we will create files in
// /var/lib/snapd/ldconfig/ that will be used to generate a cache
// specific to each snap.
ldconfigPath := filepath.Join(dir, "snapd.conf")
Copy link
Collaborator

@pedronis pedronis Jan 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused, specification are per snap app set but here we reuse the same file? won't multiple snap stomp on each ther?

Copy link
Member Author

@alfonsosanchezbeato alfonsosanchezbeato Jan 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have changed this. However I started to re-think about this and I am not sure anymore, maybe I'm missing some piece. I created snapd.conf thinking of it as the only config file for the "system" (rootfs) snap (the implementation is not considering exporting libraries to snap yet). That is, the "snap app set" here is the rootfs. Afaiu any change in interfaces would trigger the call to Setup(), and having multiple files will help with knowing where libraries come from (this could still be done by adding comments in snapd.conf), but there is no other practical effect as the call to ldconfig will process all files in here.

My plan for the implementation for the snaps case, is to have also only one config file per snap, that will be seen in ld.so.conf.d/ but only for the mount namespace of the snap, that would be a mix of the contents of the app base and of these files generated by snapd (that will be found also in the rootfs in, maybe, /var/lib/snapd/ldconfig/).

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.

3 participants