E: List directory /var/lib/apt/lists/partial is missing. - Acquire (13: Permission denied) while running apt-get command in pre/post deployment script in Azure App Service

Dhirendra KUMAR 0 Reputation points
2023-09-27T09:29:10.36+00:00

I need to run apt-get command to install dependencies for Python3-saml library for SAML authentication.

I am getting Following error:

E: List directory /var/lib/apt/lists/partial is missing. - Acquire (13: Permission denied) while running apt-get command in pre/post deployment script in Azure App Service

sudo is also not available to elevate the task. Any suggestions?

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,931 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Pramod Valavala 20,656 Reputation points Microsoft Employee Moderator
    2023-09-27T19:52:51.0033333+00:00

    @Dhirendra KUMAR The Azure App Service environment is sandboxed and prevents any changes from deployment scripts to be made. If you really need a custom environment and dependencies for running your application, you should consider running your application as a custom container.

    Since you are using a container, if required, you have a few other services where you can host your application as well

    0 comments No comments

  2. Dhirendra KUMAR 0 Reputation points
    2023-09-28T08:23:35.91+00:00

    Running the apt-get install using startup command did the trick for me.

    However, it is installing the dependencies every time the app starts (after deployment/change in app configuration/manual restart) and takes ~10 minutes to install all dependencies and get the application ready/accessible.

    For reference:

    https://learn.microsoft.com/en-us/answers/questions/1282899/how-does-startup-commands-work-on-an-azure-app-ser


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.