Hello to everyone.
I am connected from my laptop to my Raspberry Pi 4 B with ssh.
My RPi has Ubuntu 18.04.
I have install lxd fron snap.
I have a python script which does :
command = 'sudo lxc file push myip.py' + ' ' + svcname +'/root/' #
p = os.system('echo %s|sudo -S %s' % (sudoPassword, command)) # Push to the container the .py file which install the libraries
command = 'sudo lxc file push ' + svcname + '.py' + ' ' +svcname + '/root/'
p = os.system('echo %s|sudo -S %s' % (sudoPassword, command)) # Push to the container the Service class
print("=== Push files to the container ok. Ready to start downloading libraries ===")
print("")
# Install the libraries for the Service and for the communucation with the service
commandsToSvcConatiner=['lxc','exec',svcname,'apt','update']
subprocess.run(commandsToSvcConatiner)
commandsToSvcConatiner=['lxc','exec',svcname,'--','apt','upgrade','-y']
subprocess.run(commandsToSvcConatiner)
commandsToSvcConatiner=['lxc','exec',svcname,'--','apt','install','python3-pip','-y']
subprocess.run(commandsToSvcConatiner)
commandsToSvcConatiner=['lxc','exec',svcname,'pip3','install','Pyro4']
subprocess.run(commandsToSvcConatiner)
Files are pushed to the container.
When the code reaches the apt update and it is going to execute to the container i receive this error.
=== Push files to the container ok. Ready to start downloading libraries ===
Error: Unable to read the configuration file: open /home/ubuntu/.config/lxc/config.yml: permission denied
Error: Unable to read the configuration file: open /home/ubuntu/.config/lxc/config.yml: permission denied
Error: Unable to read the configuration file: open /home/ubuntu/.config/lxc/config.yml: permission denied
Error: Unable to read the configuration file: open /home/ubuntu/.config/lxc/config.yml: permission denied
The same code on my laptop runs perfectly. Updates and upgrades to the container are done perfectly. Also pip3 is installed properly.
I have type my sudo password so i can’t understand why it says permission denied.
Thanks in advance for the help.