assuming the actual folder /CCTV/PiZero exists on the NAS and the empty mount-point /mnt/CCTV/PiZero exists on the rPi.
try
sudo mount -t cifs -o //192.168.0.22/CCTV/PiZero /mnt/CCTV/PiZero
Forget running the script until you can create non-zero length files on one machine, and see the contents of them on the other machine, preferably both ways round.
Didn't find your answer? Ask the community — no account required.
My yard light won't go off any more. I block the detector wait 60 seconds...
R
RobH
That returns this:
sudo mount -t cifs -o //192.168.0.22/CCTV/PiZero /mnt/CCTV/PiZero mount: can't find /mnt/CCTV/PiZero in /etc/fstab pi@raspberrypi:~ $
I think/reckon that something should be added to the /etc/fstab file along the lines of /mnt/CCTV/PiZero or the full line from //192.168.0.22 etc
A
Ahem A Rivet's Shot
What's that -o doing in there ? Unless I'm much mistaken it's turning the //192.168.0.22/mnt/CCTV/PiZero into an option which would probably cause an error (unsupported option or somesuch) except that since mount can't see a special it goes looking in fstab for the mountpoint and fails to find it and so bombs out with that error instead.
Steve O'Hara-Smith | Directable Mirror Arrays
C:\>WIN | A better way to focus the sun
The computer obeys and wins. | licences available see
You lose and Bill collects. | http://www.sohara.org/
R
RobH
Still the same error without the-o
sudo mount -t cifs //192.168.0.22/CCTV/PiZero /mnt/CCTV/PiZero Password for root@//192.168.0.22/CCTV/PiZero: ******
pi@raspberrypi:~ $ python intruder.py Traceback (most recent call last): File "intruder.py", line 40, in shutil.copyfile(RAMname, NASname) File "/usr/lib/python2.7/shutil.py", line 83, in copyfile with open(dst, 'wb') as fdst: IOError: [Errno 2] No such file or directory: '//192.168.0.22/CCTV/PiZero/2018-06-04_17.47.17.h264'
pi@raspberrypi:~ $
A
Andy Burns
you might eventually want an entry in the /etc/fstab to it can be mounted automatically, or with a "mount -a" command, but get the mount to work manually first.
Does /CCTV/PiZero exist on the NAS, is it exported by samba or some other CIFS server?
Does /mnt/CCTV/PiZero exist on the rPI
All case sensitive.
A
Andy Burns
Forget the script until the mount works!
R
RobH
Ok will do for now then.
I have just been reading up on shutil here:
formatting link
.
A
Ahem A Rivet's Shot
That bit in the script should read /mnt/CCTV/PiZero.
-- Steve O'Hara-Smith | Directable Mirror Arrays C:\>WIN | A better way to focus the sun The computer obeys and wins. | licences available see You lose and Bill collects. |
formatting link
R
RobH
This worked fine just now:
pi@raspberrypi:~ $ sudo mount //192.168.0.22/CCTV/PiZero /mnt/CCTV/PiZero Password for root@//192.168.0.22/CCTV/PiZero: ******
I have added this in the fstab file:
192.168.0.22:/mnt/CCTV/PiZero /mnt/CCTV/PiZero
/CCTV/PiZero exists on my NAS box, and /mnt/CCTV/PiZero exist on the PiZero.
So as the mount works now, and is in the fstab file, it now points to the python script:
pi@raspberrypi:~ $ sudo mount //192.168.0.22/CCTV/PiZero /mnt/CCTV/PiZero Password for root@//192.168.0.22/CCTV/PiZero: ****** pi@raspberrypi:~ $
A
Andy Burns
hurrah :-)
^^^^ where did that creep back from?
once it's mounted you just use the local path you mounted it at
os.path.join("/mnt/CCTV/PiZero", fname)
R
RobH
Does os.path.join("/mnt/CCTV/PiZero", fname) have to be added underneath NASname= os.path.join etc.
Oh I removed the first /mnt in the fstab file, and now I have big problem. The shell is locked again.
A
Andy Burns
With python's finicky indenting, no, keep it on one line similar to your original, but without the //192.168.0.22 bit
NASname = os.path.join("/mnt/CCTV/PiZero", fname)
ctrl-C ?
R
RobH
The fstab file didn't seem to have the correct information into and consequently the PiZero failed to boot up. I then had to re flash the sd card.
Now I have successfully mounted the /mnt/CCTV/Pizero as it shows up here:
pi@raspberrypi:~ $ df -h Filesystem Size Used Avail Use% Mounted on Other information edited out /dev/sda1 7.5G 16K 7.5G 1% /media/pi/B00F-4173 //192.168.0.22/CCTV/PiZero/ 899G 3.5G 896G 1% /mnt/CCTV/PiZero pi@raspberrypi:~ $
Now the sensor has stopped working for some unknown reason, maybe a capacitor has been bent over to much whilst I was fiddling with the PiZero connections.
R
RobH
As previously, I have again successfully mounted the /mnt/CCTV/PiZero directory, and the sensor and the new camera are working just fine.
When I run pi@raspberrypi:~/Downloads $ python intruder.py, it returns this:
Traceback (most recent call last): File "intruder.py", line 37, in shutil.copyfile(RAMname, NASname) File "/usr/lib/python2.7/shutil.py", line 83, in copyfile with open(dst, 'wb') as fdst: IOError: [Errno 2] No such file or directory: '//192.168.0.22/mnt/CCTV/PiZero/2018-06-13_19.52.59.h264'
Relevant portion of code where it falls over, as above
#create base filename at time of motion trigger fname = time.strftime("%Y-%m-%d_%H.%M.%S.h264", time.localtime(triggerTime))
#capture video to RAM device first camera.start_recording(RAMname) camera.wait_recording(10) camera.stop_recording() camera.stop_preview()
#copy from RAM device to NAS device shutil.copyfile(RAMname, NASname)
D
Dennis Lee Bieber
On Wed, 13 Jun 2018 20:03:38 +0100, RobH declaimed the following:
And as you've been repeatedly told, the path in NASname is supposed to be the location in the RPi where you put the mount point. It is NOT supposed to be a reference to the remote device itself.
Presuming the mount point ON THE RPi is /mnt/CCTV/PiZero then THAT is what you want in that .join() operation. Take out the //192.168.0.22
^^^^^^^^^^ physical location path to access it ^^^^^^^^^^^
^^^^^^^^^^ physical location path to access it ^^^^^^^^^^^
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
R
RobH
Thanks and it took a while to get to sink in: Doh!
Now it's permissions problems, and I have googled how to change permissions on file and folders, but no joy as yet.
Then ran the python script and got the permissions problem again
pi@raspberrypi:~/Downloads $ python intruder.py Traceback (most recent call last): File "intruder.py", line 37, in shutil.copyfile(RAMname, NASname) File "/usr/lib/python2.7/shutil.py", line 83, in copyfile with open(dst, 'wb') as fdst: IOError: [Errno 13] Permission denied: '/mnt/CCTV/PiZero/2018-06-14_10.12.34.h264'
In PiZero's file manager the folders /CCTV and /PiZero have their read and write permission set for anyone, but the /mnt directory is not.
I tried:
pi@raspberrypi:~ $ cdmod -R a+rX /mnt
-bash: cdmod: command not found pi@raspberrypi:~ $ chmod -R a+rX /CCTV/Pizero chmod: cannot access '/CCTV/Pizero': No such file or directory pi@raspberrypi:~ $
Thanks
D
Dennis Lee Bieber
On Thu, 14 Jun 2018 12:04:01 +0100, RobH declaimed the following:
Unless you have a user named "777" those parameters are wrong.
formatting link
""" The basic syntax for using chown to change owners is
chown [options] new_owner object(s) """
^^^ ^^^^
^^^ user name ^^^^ group name
Try
chown -R pi /mnt/CCTV
Or (untried) create a new group (call it NASuser), chown the mount point to that group, and then add pi user to the new group.
That 777 looks like you are trying to set permission levels (the rwx stuff you see on the left). That command is chmod
formatting link
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
B
Björn Lundin
you should have done chmod - not chown with those params
--
M
Martin Gregorie
Rob, do yourself (and others) a favour by getting yourself a copy of "Linux in a Nutshell" if you're familiar with another OS at command-line level, or a copy of "Linux for Dummies" if you don/t have that background.
Read enough of it to understand the filing system, command shell and common utilities.
BTW, suggesting "Linux for Dummies" is not an insult - the "... for Dummies" books are well-regarded as books for beginners in computer- related subjects.
Martin | martin at
Gregorie | gregorie dot org
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required
Report Content
You are reporting this content to the moderators. They will look at it
ASAP.