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

Fails to build core-image, fails to load plugin #19

Closed
mks-h opened this issue Jan 29, 2024 · 6 comments
Closed

Fails to build core-image, fails to load plugin #19

mks-h opened this issue Jan 29, 2024 · 6 comments

Comments

@mks-h
Copy link
Member

mks-h commented Jan 29, 2024

I'm running it on Fedora 39 to build the core-image recipe, but Vib panics when trying to load new plugin. The /home/mks/Projects/Vanilla-OS/core-image/plugins/fsguard.so path it looks for doesn't exist, there's no plugins folder.

Logs
Building recipe Vanilla Core
Downloading source: https://github.com/Vanilla-OS/ABRoot/releases/download/continuous/abroot-man.tar.gz
Source is tar: https://github.com/Vanilla-OS/ABRoot/releases/download/continuous/abroot-man.tar.gz
Moving source: abroot-manpage
Downloading source: https://github.com/Vanilla-OS/ABRoot/releases/download/continuous/abrootv2.tar.gz
Source is tar: https://github.com/Vanilla-OS/ABRoot/releases/download/continuous/abrootv2.tar.gz
Moving source: abroot
Downloading source: https://github.com/Vanilla-OS/base-files.git
Source is git: https://github.com/Vanilla-OS/base-files.git
Using a commit: latest
Cloning repository: https://github.com/Vanilla-OS/base-files.git
Checking out branch: main
Reset branch 'main'
Your branch is up to date with 'origin/main'.
Resetting to commit: 50ca80bae14786d28c41b44b7a485494a6651205
HEAD is now at 50ca80b feat: fix os-release links
Moving source: base-files
Downloading source: https://github.com/89luca89/distrobox/archive/refs/tags/1.6.0.1.tar.gz
Source is tar: https://github.com/89luca89/distrobox/archive/refs/tags/1.6.0.1.tar.gz
Moving source: distrobox
Downloading source: https://github.com/Vanilla-OS/apx/releases/download/continuous/apx-man.tar.gz
Source is tar: https://github.com/Vanilla-OS/apx/releases/download/continuous/apx-man.tar.gz
Moving source: apx-manpage
Downloading source: https://github.com/Vanilla-OS/apx/releases/download/continuous/apx.tar.gz
Source is tar: https://github.com/Vanilla-OS/apx/releases/download/continuous/apx.tar.gz
Moving source: apx
Downloading source: https://github.com/Vanilla-OS/vanilla-apx-configs.git
Source is git: https://github.com/Vanilla-OS/vanilla-apx-configs.git
Using a commit: latest
Cloning repository: https://github.com/Vanilla-OS/vanilla-apx-configs.git
Checking out branch: main
Reset branch 'main'
Your branch is up to date with 'origin/main'.
Resetting to commit: 81ad159cf428fd19ec2c60f04125383609b2a488
HEAD is now at 81ad159 feat[close #1]: Adapt pkgmanagers to model 2
Moving source: apx-stacks
Downloading source: https://github.com/Vanilla-OS/Ikaros/releases/download/continuous/ikaros-man.tar.gz
Source is tar: https://github.com/Vanilla-OS/Ikaros/releases/download/continuous/ikaros-man.tar.gz
Moving source: ikaros-manpage
Downloading source: https://github.com/Vanilla-OS/Ikaros/releases/download/continuous/ikaros.tar.gz
Source is tar: https://github.com/Vanilla-OS/Ikaros/releases/download/continuous/ikaros.tar.gz
Moving source: ikaros
Downloading source: https://github.com/Vanilla-OS/fswarn/releases/download/v1.0-1/fswarn.tar.xz
Source is tar: https://github.com/Vanilla-OS/fswarn/releases/download/v1.0-1/fswarn.tar.xz
Moving source: fswarn
Loading new plugin
panic: plugin.Open("/home/mks/Projects/Vanilla-OS/core-image/plugins/fsguard.so"): realpath failed

goroutine 1 [running]:
github.com/vanilla-os/vib/core.LoadPlugin({0xc000014c04, 0x7}, {0x9c0be0, 0xc000025410}, 0xc0000d4d00)
	/home/mks/Projects/Vanilla-OS/Vib/core/plugins.go:25 +0x3d9
github.com/vanilla-os/vib/core.BuildModule(0x9c0be0?, {0x9c0be0, 0xc000025410})
	/home/mks/Projects/Vanilla-OS/Vib/core/build.go:272 +0x410
github.com/vanilla-os/vib/core.BuildModules(0xae75c0?, {0xc0000df200?, 0x1c, 0x13?})
	/home/mks/Projects/Vanilla-OS/Vib/core/build.go:186 +0x106
github.com/vanilla-os/vib/core.BuildRecipe({_, _})
	/home/mks/Projects/Vanilla-OS/Vib/core/build.go:25 +0xc6
github.com/vanilla-os/vib/cmd.buildCommand(0xc0000d4100?, {0xc00003c2c0?, 0x4?, 0xa2e27a?})
	/home/mks/Projects/Vanilla-OS/Vib/cmd/build.go:27 +0x65
github.com/spf13/cobra.(*Command).execute(0xc000004300, {0xc00003c280, 0x1, 0x1})
	/home/mks/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:940 +0x87c
github.com/spf13/cobra.(*Command).ExecuteC(0xd7b660)
	/home/mks/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068 +0x3a5
github.com/spf13/cobra.(*Command).Execute(...)
	/home/mks/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:992
github.com/vanilla-os/vib/cmd.Execute(...)
	/home/mks/Projects/Vanilla-OS/Vib/cmd/root.go:19
main.main()
	/home/mks/Projects/Vanilla-OS/Vib/main.go:12 +0x1b
@mirkobrombin
Copy link
Member

mirkobrombin commented Jan 29, 2024

Our images use custom plugins for fsguard, you need to add it in the plugins folder (create a plugins folder in the root of the core-image project), in this case download and drop this library into that folder https://github.com/Vanilla-OS/vib-fsguard/releases/tag/v1.2-1

@mks-h
Copy link
Member Author

mks-h commented Jan 29, 2024

The downloaded one didn't work because the plugin was built with a different version of package internal/goarch. I tried building it from source using the command from GitHub actions, but it failed with the same issue.

@mks-h
Copy link
Member Author

mks-h commented Jan 29, 2024

Just in case, I'm on Fedora 39 with go version go1.21.6 linux/amd64, although it shouldn't make a difference considering that I compile both the library and the binary on the same machine.

The error message:
Loading new plugin
panic: plugin.Open("/home/mks/Projects/Vanilla-OS/core-image/plugins/fsguard"): plugin was built with a different version of package internal/goarch

goroutine 1 [running]:
github.com/vanilla-os/vib/core.LoadPlugin({0xc000014c04, 0x7}, {0x9c0be0, 0xc000025410}, 0xc0000d4d00)
	/home/mks/Projects/Vanilla-OS/Vib/core/plugins.go:25 +0x3d9
github.com/vanilla-os/vib/core.BuildModule(0x9c0be0?, {0x9c0be0, 0xc000025410})
	/home/mks/Projects/Vanilla-OS/Vib/core/build.go:272 +0x410
github.com/vanilla-os/vib/core.BuildModules(0xae75c0?, {0xc0000df200?, 0x1c, 0x13?})
	/home/mks/Projects/Vanilla-OS/Vib/core/build.go:186 +0x106
github.com/vanilla-os/vib/core.BuildRecipe({_, _})
	/home/mks/Projects/Vanilla-OS/Vib/core/build.go:25 +0xc6
github.com/vanilla-os/vib/cmd.buildCommand(0xc0000d4100?, {0xc00003c2c0?, 0x4?, 0xa2e27a?})
	/home/mks/Projects/Vanilla-OS/Vib/cmd/build.go:27 +0x65
github.com/spf13/cobra.(*Command).execute(0xc000004300, {0xc00003c280, 0x1, 0x1})
	/home/mks/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:940 +0x87c
github.com/spf13/cobra.(*Command).ExecuteC(0xd7b660)
	/home/mks/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068 +0x3a5
github.com/spf13/cobra.(*Command).Execute(...)
	/home/mks/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:992
github.com/vanilla-os/vib/cmd.Execute(...)
	/home/mks/Projects/Vanilla-OS/Vib/cmd/root.go:19
main.main()
	/home/mks/Projects/Vanilla-OS/Vib/main.go:12 +0x1b

@mks-h
Copy link
Member Author

mks-h commented Jan 29, 2024

It seems like I found a solution golang/go#27751 (comment)

@mks-h
Copy link
Member Author

mks-h commented Jan 29, 2024

OK, so the trick was to build both the binary and the library with -trimpath argument, and to build the library with the same version of github.com/vanilla-os/vib/api as the binary has (run go mod tidy after changing the version).

@axtloss
Copy link
Member

axtloss commented Apr 6, 2024

The best place to "fix" this is to add an extra step to the workflow file in https://github.com/Vanilla-OS/vib-plugin which automatically checks which version of the api the latest vib release uses and then just change that in the go.mod before building the plugin

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

No branches or pull requests

3 participants