Forum Discussion
Azure DevOps Build Pipeline - Installing Applications
I have a Azure Devops Build Pipeline running on a Ubuntu Hosted Agent which requires "unzip" to be installed.
When running the pipeline, I am getting this error which suggests unzip is not installed.
line 23: unzip: command not found
I have tried to install unzip using, but get an error about permissions.
apt-get install -y unzip
Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
I have tried again with sudo, but then get an error about sudo not being installed.
sudo apt-get install -y unzip
line 19: sudo: command not found
So how do I install a package such as unzip (or sudo) as part of the Pipeline Build?
- Jacob_PetersonCopper Contributor
This is the task that I use:
- bash: sudo apt-get install zip unzip -f displayName: Install Zip Tool
- CyberShrimpCopper Contributor
2023-09-08T22:32:30.9947564Z ##[section]Starting: Install Zip Tool 2023-09-08T22:32:31.0143316Z ============================================================================== 2023-09-08T22:32:31.0143752Z Task : Bash 2023-09-08T22:32:31.0143952Z Description : Run a Bash script on macOS, Linux, or Windows 2023-09-08T22:32:31.0144044Z Version : 3.227.0 2023-09-08T22:32:31.0144234Z Author : Microsoft Corporation 2023-09-08T22:32:31.0144430Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/bash 2023-09-08T22:32:31.0144543Z ============================================================================== 2023-09-08T22:32:31.5826412Z Generating script. 2023-09-08T22:32:31.5828586Z Script contents: 2023-09-08T22:32:31.6006674Z sudo apt-get install zip unzip -f 2023-09-08T22:32:31.6009214Z ========================== Starting Command Output =========================== 2023-09-08T22:32:31.6010693Z [command]/bin/bash /__w/_temp/37beef07-93ec-4aa8-8d78-2078d6c10632.sh 2023-09-08T22:32:31.6011007Z /__w/_temp/37beef07-93ec-4aa8-8d78-2078d6c10632.sh: line 1: sudo: command not found 2023-09-08T22:32:31.6047632Z ##[error]Bash exited with code '127'. 2023-09-08T22:32:31.6109598Z ##[section]Finishing: Install Zip Tool
- Jacob_PetersonCopper Contributor
See whether below article can help:
https://itslinuxfoss.com/fix-could-not-open-lock-file-dpkg-error/