Copying configuraiton and rules from QNAP install to Raspberry PI 4 install
-
I have made good progress setting up a new Raspberry PI 4 with the latest OS (64bit) and latest Reactor images in Docker. However I am not able to copy my configuraiton files (.yml) and reactor reactions over. I am not yet that confident with linux commands, so I have tired to drag and drop the files from a USB drive to the working folders in my new Raspberry PI. I am getting a popup in the GUI stating 'The file operation was completed with errors.' and Errors occured: "rule-xxxxxx.json: Error opening file "/home/pi/reactor/....................................json":Permission denied.
I suspect it's something to do with permissions?
Is there an easier way to copy my configuration over??
-
Where are the files currently?
What user are you logging on as when you're copying the files?There's sort of a million ways to solve this.
You can SCP them over
SFTP them over
Copy them as the correct user (which is the fundamental issue.So what user are you working as and what user owns the /home/pi/reactor folder?
ls -l /home/pi
Will be a good start
Do you have SSH access to the Pi?
C
-
I suspect the files on the QNAP have root as the owner. That often happens with docker containers, and if you're just logged in as the pi user trying to copy the files, you'll get those messages. Drag and drop isn't going to get you there. I don't have a QNAP NAS, but if you can
ssh
into it, do that (log in as yourself). Then...- Bring yourself up to root
sudo su -
. - Navigate (using
cd
) to the directory above yourconfig
,storage
, andlogs
on the QNAP NAS. - Make an archive file:
tar cvf ../reactorconfig.tar .
This will create the archive file in the directory above your current directory. - Copy the archive file to the Pi (e.g. into
/home/pi
) - Log in on the Pi as
pi
- Become root on the Pi:
sudo su -
- Go to the directory you created for the Reactor work files (using
cd
) - Untar the archive file:
tar xvf /home/pi/reactorconfig.tar
- Make your future life easier by making
pi
the owner of the files (esp. the config files):chown -R pi .
- Exit the root privilege level:
exit
(you are now userpi
again) - Try starting the docker container (using
docker-compose
is highly recommended, see install instructions).
- Bring yourself up to root
-
Thanks for the prompt responses guys. I might have to concede on this one and start my reactions again!
On another note. I have installed / configured docker-compose (or at least I thought I had). I don't seem to be able to use it to stop reactor:
pi@raspberrypi:~ $ docker stop reactor
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/reactor/stop": dial unix /var/run/docker.sock: connect: permission denied
pi@raspberrypi:~ $ cd reactor
pi@raspberrypi:~/reactor $ docker stop reactor
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/reactor/stop": dial unix /var/run/docker.sock: connect: permission denied
pi@raspberrypi:~/reactor $ dir
config docker-compose.yml logs storage
pi@raspberrypi:~/reactor $ ^C
pi@raspberrypi:~/reactor $ sudo docker stop reactor
reactor
pi@raspberrypi:~/reactor $ docker-compose down
ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running?If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
pi@raspberrypi:~/reactor $ -
-
I suspect the files on the QNAP have root as the owner. That often happens with docker containers, and if you're just logged in as the pi user trying to copy the files, you'll get those messages. Drag and drop isn't going to get you there. I don't have a QNAP NAS, but if you can
ssh
into it, do that (log in as yourself). Then...- Bring yourself up to root
sudo su -
. - Navigate (using
cd
) to the directory above yourconfig
,storage
, andlogs
on the QNAP NAS. - Make an archive file:
tar cvf ../reactorconfig.tar .
This will create the archive file in the directory above your current directory. - Copy the archive file to the Pi (e.g. into
/home/pi
) - Log in on the Pi as
pi
- Become root on the Pi:
sudo su -
- Go to the directory you created for the Reactor work files (using
cd
) - Untar the archive file:
tar xvf /home/pi/reactorconfig.tar
- Make your future life easier by making
pi
the owner of the files (esp. the config files):chown -R pi .
- Exit the root privilege level:
exit
(you are now userpi
again) - Try starting the docker container (using
docker-compose
is highly recommended, see install instructions).
@toggledbits thanks for the methodology. I manged to copy the files from a usb stick to the relevant folders using the sudo cp command. Feeling pretty pleased as I am now up an running on my raspberry pi.
- Bring yourself up to root
-
Just add the
pi
user to thedocker
group on the Pi, and you won't have tosudo
to use thedocker
ordocker-compose
commands.# Run this command as user `pi`: sudo usermod -a -G docker pi
Going forward, you should do everything related to the process (container) via
docker-compose
. You should rarely need or use thedocker
command itself. -
Just add the
pi
user to thedocker
group on the Pi, and you won't have tosudo
to use thedocker
ordocker-compose
commands.# Run this command as user `pi`: sudo usermod -a -G docker pi
Going forward, you should do everything related to the process (container) via
docker-compose
. You should rarely need or use thedocker
command itself.@toggledbits something is not working quite right with my docker install (docker-compose). Not sure where to start!
-
Can you post your compose file? Also, I assume you ran the
docker-compose
command while in the same directory as the compose file? Did you start it withdocker-compose
? If not, you're probably going to get errors like this trying to stop it withdocker-compose
... the two commands are not interchangeable (for start/stop). -
Sorry @toggledbits . I tied it again after a good break and it appears to work fine. I honestly don't know what was going wrong but things seem to now be in order:
pi@raspberrypi:~ $ cd reactor
pi@raspberrypi:~/reactor $ ls
config docker-compose.yml logs storage
pi@raspberrypi:~/reactor $ docker-compose down
Stopping reactor ... done
Removing reactor ... done
Removing network reactor_default
pi@raspberrypi:~/reactor $ docker-compose pull
Pulling reactor ... done
pi@raspberrypi:~/reactor $ docker-compose up -d
Creating network "reactor_default" with the default driver
Creating reactor ... donedocker-compose.yml below FYI:
Multi-System Reactor template docker-compose.yml (version 22160)
Change the lines indicated by "DO"...
version: '3'
services:
reactor:
container_name: reactor
environment:
# DO change the TZ: line to set your local time zone.
# See valid TZ list: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
TZ: GB
#
# DO NOT change this path. Your directory location is in "source" below.
REACTOR_DATA_PREFIX: /var/reactor# DO change the image below to the one you are using (e.g. armv7l or aarch64 for RPi 4) image: toggledbits/reactor:latest-aarch64 restart: "always" expose: - 8111 ports: - 8111:8111 volumes: # DO change the /home/username/reactor below to the directory you created for # your local data; DO NOT change the /var/reactor part - /home/pi/reactor:/var/reactor - /etc/localtime:/etc/localtime:ro tmpfs: /tmp