Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting "sudo: command not found" error in bitbucket-pipelines

In my bitbucket-pipelines.yml file, I have this:

  - step:
      image: python:3.7.2-stretch
      name: upload to s3
      script:
        - export S3_BUCKET="elasticbeanstalk-us-east-1-133233433288"
        - export VERSION_LABEL=$(cat VERSION_LABEL)
        - sudo apt-get install -y zip # required for packaging up the application
        - pip install boto3==1.3.0 # required for upload_to_s3.py
        - zip --exclude=*.git* -r /tmp/artifact.zip . # package up the application for deployment
        - python upload_to_s3.py # run the deployment script

But when I run this pipeline in Bitbucket, I get an error, which the output:

+ sudo apt-get install -y zip
bash: sudo: command not found

Why would it not know what sudo means? Isn't this common to all Linux machines?

like image 772
CodyBugstein Avatar asked Oct 21 '25 15:10

CodyBugstein


1 Answers

The "command not found" error is printed in stderr when it does not find the binary in the folders configured in env $PATH

first you need to found out if it exists with :

find /usr/bin -name "sudo"

if you find the binary try to set the PATH variable with :

export PATH=$PATH:/usr/bin/ 

then try to run sudo again.

like image 50
Miguel Avatar answered Oct 23 '25 03:10

Miguel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!