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

Elemental-register is called without inheriting /etc/profile variables and settings #722

Closed
davidcassany opened this issue Mar 10, 2023 · 0 comments · Fixed by #723
Closed
Assignees
Labels
kind/bug Something isn't working

Comments

@davidcassany
Copy link
Contributor

davidcassany commented Mar 10, 2023

What steps did you take and what happened:

It has been noted that /etc/sysconfig/proxy is not taken into accound when calling elemental-register from the cloud-config setup as part of the network.after yip stage.

What did you expect to happen:

The proxy been taken into account for the elemental-register call, otherwise the registration just fails and the process is stuck trying to register in the foreground of cos-setup-network.service.

Anything else you would like to add:

This is happening because /etc/sysconfig/proxy is loaded as part of the /etc/profile which is not being loaded on the shell executing the commands defined in network.after stage.

Within the network.after I did few trials with the following commands:

env
systemd-cat -t elemental_test env
bash -cl env

Only the last one is including the variables and setup defined in /etc/profile.

Within this experiments I also noted elemental-register is executed in the foreground and it does not end until it registers (keeps trying on failures). This is bad, as this means the network.after stage is stuck with this command and anything after it is not executed. This also means cos-setup-network service is stuck in activating state. I realized that because the testing commands I added in network.after in iso-config where not executed as before those the same stage from /system/oem is executed and got stuck there. We should be careful to not add blocking commands in yip stages.

I believe the solution is to mimic the same approach as with elemental-system-agent. Wrap elemental-register in a unit file (called with bash --login -c elemental-register ...) and simply start the service as part of the cloud-init setup. Also we could consider calling elemental-register on every boot and just enable the service by default, but I'd do that on a second interation as this might require some small tweaks in elemental-register code to handle this case appropriately.

Environment:

  • Elemental release version (use cat /etc/os-release): Staging
  • Rancher version:
  • Kubernetes version (use kubectl version):
  • Cloud provider or hardware configuration:
@davidcassany davidcassany converted this from a draft issue Mar 10, 2023
@davidcassany davidcassany added the kind/bug Something isn't working label Mar 10, 2023
@davidcassany davidcassany moved this from 🗳️ To Do to 🏃🏼‍♂️ In Progress in Elemental Mar 10, 2023
@davidcassany davidcassany self-assigned this Mar 10, 2023
@github-project-automation github-project-automation bot moved this from 🏃🏼‍♂️ In Progress to ✅ Done in Elemental Mar 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant