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

systemd service files contain hardcoded paths #10787

Closed
tobwen opened this issue Jun 25, 2021 · 17 comments · Fixed by #11886
Closed

systemd service files contain hardcoded paths #10787

tobwen opened this issue Jun 25, 2021 · 17 comments · Fixed by #11886
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@tobwen
Copy link
Contributor

tobwen commented Jun 25, 2021

/kind bug

Description
On installation via make install, the systemd service files contain hardcoded paths even when DESTDIR or PREFIX are set.

Describe the results you received:
https://github.com/containers/podman/tree/master/contrib/systemd

Describe the results you expected:
These files should be created with the settings that the user has specified. Alternatively, it is questionable whether the data is necessary at all, as it can usually be generated from podman (at least the systemd files).

Another alternative would be to include these configuration files only as example files. In that case, however, the installation in the currently selected folders would be wrong. PREFIX/share/doc/podman/examples/ might be expected.

@openshift-ci openshift-ci bot added the kind/bug Categorizes issue or PR as related to a bug. label Jun 25, 2021
@tobwen tobwen changed the title several configs contain hardcorded paths on installation, systemd config contains hardcorded paths Jun 25, 2021
@tobwen tobwen changed the title on installation, systemd config contains hardcorded paths systemd service files contain hardcoded paths Jun 25, 2021
@rhatdan
Copy link
Member

rhatdan commented Jun 26, 2021

I would prefer to keep the fixes and have the make install modify the path based on the PREFIX value.

@rhatdan
Copy link
Member

rhatdan commented Jun 26, 2021

Interested in opening a PR?

@tobwen
Copy link
Contributor Author

tobwen commented Jun 26, 2021

I would prefer to keep the fixes and have the make install modify the path based on the PREFIX value.

But why include these only then? I mean, we've got way more configs, which are needed or optional in podman, but don't get installed by make install:

https://raw.githubusercontent.com/containers/common/main/pkg/config/containers.conf
https://raw.githubusercontent.com/containers/image/main/registries.conf
https://raw.githubusercontent.com/containers/common/main/pkg/seccomp/seccomp.json
https://raw.githubusercontent.com/containers/shortnames/main/shortnames.conf
https://raw.githubusercontent.com/containers/storage/main/storage.conf

@rhatdan
Copy link
Member

rhatdan commented Jun 27, 2021

So you want to make it more complex. In a perfect world, we should specify man installs for each of these config files in their subpackages.

@tobwen
Copy link
Contributor Author

tobwen commented Jun 27, 2021

My main problem was that make install by default installs configs with paths, which didn't match with my configuration. So there are two ways at least:

  1. fix those configurations to match to prefix
  2. don't make them default make install, like all the other configs.

"1" doesn't seem that hard to make. I'd just insert a placeholder in the contrib config and replace them using sed. I can give it a try.
"2" seems also doable. It might even use the stuff from "1". But we need to talk about #10792 first.

We could end in make install.configs or such.

@rhatdan
Copy link
Member

rhatdan commented Jun 27, 2021

Yes both seem reasonable. We probably should not install the configs with make install. I would be willing to take that as long as we add a make install.configs. Handling the PREFIX change would be nice also. Interested in opening a PR?

@tobwen
Copy link
Contributor Author

tobwen commented Jun 27, 2021

Interested in opening a PR?

Yes, but I can't start until the week after next at the earliest. And my knowledge of "go" is limited, so I can do it on Makefile and shell level only ;)

@rhatdan
Copy link
Member

rhatdan commented Jun 27, 2021

SGTM

@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

@rhatdan
Copy link
Member

rhatdan commented Jul 29, 2021

@tobwen Did you ever get a chance to look at this?

@rhatdan
Copy link
Member

rhatdan commented Jul 29, 2021

@vrothberg PTAL

@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

@rhatdan
Copy link
Member

rhatdan commented Aug 29, 2021

@tobwen are you still interested in this? Interested in opening a PR?

@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

@rhatdan
Copy link
Member

rhatdan commented Sep 29, 2021

@vrothberg PTAL

vrothberg added a commit to vrothberg/libpod that referenced this issue Sep 30, 2021
Set Podman's install path in the systemd service file.

Fixes: containers#10787
Signed-off-by: Valentin Rothberg <[email protected]>
@vrothberg
Copy link
Member

We discussed various ways to address the issue in #11788 but I am not convinced at all. IMHO, it's common to ship hard-coded (and absolute) paths in .service files and I think we're getting more problems than we'd fix by changing the current state.

@tobwen
Copy link
Contributor Author

tobwen commented Oct 1, 2021

Interested in opening a PR?

I tried, but I really can't get along with Go. Sorry :(

edsantiago added a commit to edsantiago/libpod that referenced this issue Oct 12, 2021
Don't hardcode /usr/bin/podman in unit files: instead, use
template files with a path replaced at install time.

Because 'make' can be invoked repeatedly, with different
PREFIX, do not leave the generated files behind in our
work directory: wipe them immediately after install.

To get this to work, fix a longstanding bug in podman.spec.in,
a PREFIX that should've been DESTDIR.

Side note: containers#7023 made contrib/systemd/user a symlink
to .../system but did not update paths in Makefile.
The unrelated-looking path change you see here is
a belated correction for that.

Fixes: containers#10787

Signed-off-by: Ed Santiago <[email protected]>
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 21, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
3 participants