简体   繁体   中英

install libraries and dependencies with .sh file python ([Errno 26] Text file busy)

I am trying to install all required files an libraries to raspberry pi with a .sh file. Here is my sh

#!/bin/sh
#installer.sh
cd /
sudo mkdir /home/pi/Scripts/rclient
sudo pip install signalr-client
sudo pip install signalrcore
sudo apt install libffi-dev
sudo pip install cffi
sudo pip install aenum
sudo pip install requests-toolbelt
sudo python2 -m pip install PyMySQL
cd /home/pi/Scripts
sudo tar xfv agent-service.tar
cd /home/pi/Desktop/service
sudo mkdir /home/pi/.config/autostart
echo "
[Desktop Entry]
Type=Application
Name=launcher.sh
Exec=/home/pi/Scripts/service/launcher.sh
" >>/home/pi/.config/autostart/service.desktop
sudo chmod +x /home/pi/Scripts/service/launcher.sh
sudo chmod +x /home/pi/Scripts/service/open_script.sh
sudo chmod +x /home/pi/Scripts/service/service
sudo mkdir /home/pi/Scripts/f

I make this file executable with: sudo chmod +x installer.sh

and call it from my python script: os.system("/home/pi/Scripts/installer.sh")

But I got [Errno 26] Text file busy error.

Is there something wrong about my .sh file? Or it is my py script? I could not understand.

Run lsof /home/pi/Scripts/installer.sh or fuser /home/pi/Scripts/installer.sh to check what process it using the file that cause it busy.

Then kill the process to release the file.

The message '[Errno 26] Text file busy' will occur when trying to update a binary program that is currently executing (or a shared library .so). Most likely, the 'tar' command.

Assuming the tar is unpacking a binary, consider removing '/home/pi/Scripts/rclient' and or other binaries (executables, shared libraries) before unpacking the tar file.

You might also consider adding 'set -x' to find out which exact line produce the error, the the problem is not with the tar. If you identify a single file, you can remove or rename it before installing the new version.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM