Saturday, February 26, 2022

[SOLVED] yum lock issue on amazon linux ec2

Issue

I am using this shell commands on an amazon linux server (ami id- ami-0a887e401f7654935)launched by aws datapipeline.

#!/bin/bash

sudo yum install -y amazon-linux-extras
sudo amazon-linux-extras enable python3.8
sudo yum install -y python3.8
pip3.8 install --user pipenv
echo "PATH=$HOME/.local/bin:$PATH" >> ~/.bashrc
source ~/.bashrc
aws s3 cp s3://bucketname/datapipeline/scriptfolder/ /home/ec2-user/ --recursive
mkdir -p /home/ec2-user/input
cd /home/ec2-user/
pipenv install --ignore-pipfile
echo "installation done"
pipenv run python3 main.py

Everytime I am running after few minutes getting below error.

errorMsg :    Memory :  46 M RSS (262 MB VSZ)
    Started: Tue Mar 16 01:47:44 2021 - 00:01 ago
    State  : Running, pid: 3746
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: yum
    Memory : 139 M RSS (430 MB VSZ)
    Started: Tue Mar 16 01:47:44 2021 - 00:03 ago
    State  : Running, pid: 3746

I tried with adding this rm -f /var/run/yum.pid after last echo command but it's giving me same error. Could you please help?


Solution

Get running PID for yum and kill the the PID if it is running;

ps aux|grep yum

and then

kill -9 PID



Answered By - Muhammad Laique Sario
Answer Checked By - Mary Flores (WPSolving Volunteer)