How do I run a subprocess using local librairies on a remote server using mounted file systems?

StackOverflow https://stackoverflow.com/questions/20503182

  •  31-08-2022
  •  | 
  •  

Domanda

I am using a subprocess to run a program on another machine through a mounted network file system.

For my first step in this project I have been using sshfs mount and wget:

sys_process = subprocess.Popen(wget_exec.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  • using the command: wget works perfectly
  • using the command: /mnt/ssh_mount/wget does not execute

System libraries:

  • my remote system is: Arch Linux which is calling for libpcre.so.1
  • my local system is: Ubuntu which uses libpcre3 so libpcre.so.1 is missing

I know this because when I call the wget command through the ssh mount (/mnt/ssh_mount/bin/wget) it throws an error. I do not wish to install needed libraries to all systems using this as it defeats the purpose of trying to run something remotely.

For measure checks for permissions have been made

How do I get the command to use the local libraries?

I hope to use nfs as well which would exclude below as solutions:

I have tried (with no success) os.chdir('/mnt/ssh_mount')

Error while loading shared libraries: 'libpcre.so.0: cannot open shared object file: No such file or directory' assumes a stable mount point which would cause changes in 2 places when the environment would change (this seems wrong from a database normalization background, I would assume code/sys admin as well)

È stato utile?

Soluzione

You are not actually running the wget command on the remote machine - you are trying to run the remote machine's binary on your local system, and the command is failing due to incompatible library versions. sshfs, nfs, and other types of network mounting protocols simply mount the remote filesystem as an extension of your local one - they don't allow for remote execution. To do that, you'll need to open a remote shell using ssh tunneling and execute the Arch wget command through that.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top