elastic/elastic-agent

Inspect command failed for mac agent installed at custom path using `--base-path` and `--unprivileged` flags.

amolnater-qasource opened this issue · 6 comments

Kibana Build details:

VERSION: 8.14.0 BC3
BUILD: 73762
COMMIT: 2a492e1625f24336f3259b2b8df62b2b18127e81

Artifact Link: https://staging.elastic.co/8.14.0-7c638435/downloads/beats/elastic-agent/elastic-agent-8.14.0-darwin-aarch64.tar.gz

Preconditions:

  1. 8.14.0-BC3 Kibana cloud environment should be available.

Steps to reproduce:

  1. Run agent install command with --base-path and --unprivileged.
  2. Observe agent is installed successfully.
  3. Run sudo elastic-agent inspect command and observe an error.

Expected Result:
Inspect command shouldn't fail for mac agent installed at custom path using --base-path and --unprivileged flags.

Screenshot:
image
image
image

Working fine for agent installed without unprivileged flag and installed at same location:
image

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

Secondary review for this ticket is Done

@amolnater-qasource
I just tested the inspect command on my branch including the fix for #4655 and the command runs correctly.
This was kind of expected as elastic-agent inspect has some code paths in common with elastic-agent uninstall where the fix for #4655 has been implemented.

This should be retested on the next BC that should include #4700 (backport on 8.14 branch of the fix for #4655) but I expect this to work just with that fix

Just an observation: the correct way to run a command for an elastic agent running as unprivileged is
sudo -u elastic-agent-user elastic-agent ... in the case of inspect for example:

➜  Agent sudo -u elastic-agent-user elastic-agent inspect
agent:                                                                                                                                 
  download:                                              
    sourceURI: https://artifacts.elastic.co/downloads/                                                                                 
  features: null                                        
  headers: null                                  
  id: f1fbdcc3-914c-4c6a-97eb-d0cc9735f98a                                                                                             
  logging:                            
    level: info                                                                                                                        
  monitoring:                                    
    enabled: true                                                                                                                      
    http:                                        
      buffer: null                                                                                                                     
      enabled: false                                                                                                                   
      host: localhost                                                                                                                  
      port: 6791                              
    logs: true                                                    
    metrics: true                   
    namespace: default                           
    pprof: null                                   
    use_output: default                          
  protection:                                                                                                                          
    enabled: false                         
...

Just an observation: the correct way to run a command for an elastic agent running as unprivileged is
sudo -u elastic-agent-user elastic-agent ...

@pchila Would you mind adding this recommendation to #4705? I'm trying to use that issue as a single place to capture all prerequisites required for successfully running Agent in unprivileged mode. Thanks!

Hi Team,

We have revalidated this issue on latest 8.14.0 BC4 kibana cloud environment and found it fixed:

Observations:

  • Inspect command runs successfully for mac agent installed at custom path using --base-path and --unprivileged flags.
    • sudo -u elastic-agent-user elastic-agent inspect

Screenshot:
image

Build details:
VERSION: 8.14.0 BC4
BUILD: 73836
COMMIT: 23ed1207772b3ae958cb05bc4cdbe39b83507707
Artifact Link: https://artifacts.elastic.co/downloads/beats/elastic-agent/elastic-agent-8.13.4-darwin-aarch64.tar.gz

Hence, we are closing and marking this issue as QA:Validated.

Thanks!