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

[Elastic Agent] - RPM / DEB not working, Agent can't enroll to fleet - shows message: "Usage: /etc/init.d/elastic-agent {start|stop|status|restart|force-reload}" #22744

Closed
EricDavisX opened this issue Nov 24, 2020 · 16 comments · Fixed by #23038
Assignees
Labels
bug impact:high Short-term priority; add to current release, or definitely next. v7.10.2 v7.11.0

Comments

@EricDavisX
Copy link
Contributor

EricDavisX commented Nov 24, 2020

On enrolling the .deb 7.11-SNAPSHOT package agent, we are getting the following message
"Usage: /etc/init.d/elastic-agent {start|stop|status|restart|force-reload}"
and are unable to enroll the .deb agent using the following steps on Linux Debian 9 with .deb or a Centos8 with .rpm instance (verified on both, but deb example is given below:

Steps followed:

Download the "elastic-agent-7.11.0-amd64.deb" package artifact page.
Agent: https://snapshots.elastic.co/7.11.0-2a00e604/downloads/beats/elastic-agent/elastic-agent-7.11.0-SNAPSHOT-amd64.deb

place the agent package on home/zeus location on Debian 9 Linux machine.

Run the command to get the root/admin permission: sudo su root

sudo dpkg -i elastic-agent-7.11.0-SNAPSHOT-amd64.deb

sudo elastic-agent enroll https://df36b1e2a07749b8842cecf42ae7358a.us-central1.gcp.foundit.no:9243 SG5ZdS1IVUI2UFEzTEg4aEgyWGI6VEUzbnB6QjRRYWF0aW1Bbkg5XzBCUQ==

Observe "Usage: /etc/init.d/elastic-agent {start|stop|status|restart|force-reload}" message is displayed.

Execute sudo /etc/init.d/elastic-agent start
and observe that .deb agent is not displayed in UI.

screenshot
unnamed

@elasticmachine
Copy link
Collaborator

Pinging @elastic/ingest-management (Team:Ingest Management)

@EricDavisX
Copy link
Contributor Author

thank you @dikshachauhan-qasource @rahulgupta-qasource for bringing this issue, I logged it so it could be tracked more immediately and we can clean up the other test issue where it was first noted, #22549 (comment)

@EricDavisX
Copy link
Contributor Author

if anything is changing / changed in our intended usage from 7.10 to 7.11 please do let us know and we can track updates to the Docs too, this page: https://www.elastic.co/guide/en/fleet/current/elastic-agent-installation.html

@EricDavisX
Copy link
Contributor Author

I verified the same on a known working good Centos8 image - the .rpm install shows the same as .deb example.

@blakerouse
Copy link
Contributor

This looks to be a machine configuration issue and not with elastic-agent itself.

I think the issue is your machine as /etc/init.d in the PATH environment variable. That should never be in your PATH. Remove /etc/init.d from your PATH environment variable then the /usr/bin/elastic-agent should be picked up.

@EricDavisX
Copy link
Contributor Author

I'm seeing a separate error on a RHEL7 image:

[zeus@mainqa-atlcolo-10-0-7-174 elastic-agent-7.10.0-linux-x86_64]$ sudo ./elastic-agent install -f --kibana-url=https://asdf.eastus2.azure.elastic-cloud.com:443 --enrollment-token=asdf==
The Elastic Agent is currently in BETA and should not be used in production

Error: failed to install service (elastic-agent): exit status 1

And I can confirm a separate, different RHEL7 image works. : /

Note: we got the .rpm / .deb tests added back in to e2e-testing, here:
elastic/e2e-testing#439
... and there, I'm seeing a failure. Tho the code and centos/debian (public) images were working prior to the install feature refactor. It may yet be that all of them have /etc/init.d in PATH. We can cross that off the list and open individual tickets if needed, thanks for the report in Blake. I'll reply back with more details.

@EricDavisX
Copy link
Contributor Author

oh I'm sorry - I got confused again on what I was tracing. The above note is mis-leading... I was testing on RHEL7 with .tar.gz package and found a case that didn't work and shouldn't have tied that to this issue.
...I'll log the above RHEL7 issue separately. : /

To clarify:
I checked the $PATH on the centos docker container that the e2e-testing system uses and it didn't have .init.d in the $PATH at all. So, it seems a separate issue from this / that problem. See screenshot:
centos-docker-e2e-testing-container

I also tested the Centos8 image I said I had tested, adn find the same problem exists as tested in 7.10.1:
Agent- rpm-deploy-7 10 1

@blakerouse do you want a separate issue for the e2e-testing container scenario? Maybe not until we can figure out the issue? I am glad that we keep finding things and fixing them for .deb/.rpm it is hard going tho. Maybe using the e2e-testing repo test (that is currently marked and being merged as 'skipped') will allow a super quick way to test and iterate over this.

@blakerouse
Copy link
Contributor

@EricDavisX can you provide the output of which elastic-agent?

@EricDavisX
Copy link
Contributor Author

@blakerouse sure:
[zeus@mainqa-atlcolo-10-0-7-165 ~]$ which elastic-agent
/usr/bin/elastic-agent

@blakerouse
Copy link
Contributor

@EricDavisX Then what is the output of cat /usr/bin/elastic-agent?

@EricDavisX
Copy link
Contributor Author

EricDavisX commented Dec 2, 2020

looks like codez. does this look right to you for version 10.0.1:
elastic-agent-file.txt

@blakerouse
Copy link
Contributor

Okay something is wrong with the RPM package then. That is the file that should be placed in /etc/init.d and a smaller simple wrapper should be installed in /usr/bin/elastic-agent.

I never ran into this issue in my testing, something must have changed in the package.yml that broke this.

@ph ph added the v7.11.0 label Dec 9, 2020
@ph
Copy link
Contributor

ph commented Dec 9, 2020

@blakerouse Did you investige it?

@blakerouse
Copy link
Contributor

@ph Yes, seems the package building is copying the wrong file to the /usr/bin/elastic-agent file. Still investigating why, because the packages.yml looks correct.

@blakerouse
Copy link
Contributor

I think I figured it out. Happens that I made the files the same name, so when the package is build the /etc/init.d script overwrites the /usr/bin script. Then when the package is installed the overwritten file place it both paths.

I have a fix I am testing now, should be a simple fix, if I am correct.

@ghost
Copy link

ghost commented Jan 12, 2021

Hi @EricDavisX

We have performed regression testing for Linux deb/rpm on 7.10.2 BC1 Kibana cloud build. Build details is as follows:

Platform: Staging
Version: 7.10.2
Commit: a0b7936
Build number: 36136
Artifact: https://staging.elastic.co/7.10.2-e6b2b8c2/summary-7.10.2.html

We have execute test cases under test plan execution :

Please let us know if anything else is required to be covered.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug impact:high Short-term priority; add to current release, or definitely next. v7.10.2 v7.11.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants