-2

I'm updating apt and installing mysql-client at run time to a ubuntu 18.04 aws instance. My shell command are like,

        - apt-get update
        - apt-get install -y mysql-client
        - apt-get install -y unzip

But 'apt-get install -y mysql-client' hang and lock apt. Therefor 'apt-get install -y unzip' get fail. So to proceed this, I have to manually kill the process and unclock the apt from following commands.

Step 01. ps -ef | grep apt

Step 02. kill -9

Step 03. sudo dpkg --configure -a

Step 04. Yes the below message

restarts will be done for you automatically so you can avoid being asked questions on each library upgrade. │ Restart services during package upgrades without asking?

Step 05. apt-get install -y mysql-client

My question is how I implement following from shell script or is there a any way to install mysql-client at run time?

Achini
  • 61
  • 1
  • 8
  • find the solution here https://unix.stackexchange.com/questions/390415/how-do-i-kill-the-process-holding-the-apt-lock – Vijaya Varma Lanke Nov 26 '19 at 09:53
  • 1
    Stack Overflow is a site for programming and development questions. You should probably use another site on the [Stack Exchange network](https://stackexchange.com/sites) for this question. Also see [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. – jww Nov 26 '19 at 10:51

1 Answers1

0

Try to set DEBIAN_FRONTEND=noninteractive and the -q parameter to avoid apt from opening interactive prompts.

e.g: DEBIAN_FRONTEND=noninteractive apt-get install -yq mysql-client

Vi Pau
  • 337
  • 1
  • 4