I found O'Reilly "Running Linux" was a very good introduction for a computer-literate newbie, but that was 2nd Edition - I have no idea what the new one is like. O'Reilly does a pile of other good stuff such as "Learning the bash Shell" for in-depth coverage and "Linux in a Nutshell" when you know the background and just need the syntax etc. details.
Didn't find your answer? Ask the community — no account required.
D
Dennis Lee Bieber
On Sat, 16 Jun 2018 14:58:13 +0100, RobH declaimed the following:
If you are seeing files on the RPi, in /mnt/CCTV/PiZero, but are not seeing them on the NAS itself, the only conclusion I can draw is the NAS is NOT MOUNTED at /mnt/CCTV/PiZero
What does
df -a
report?
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
R
RobH
No, as I rebooted the PiZero and forgot I had to remount it again. There are 0 byte files on the NAS box bot no files on the Pizero machine. So to me it is like that the line
camera.start_recording(NASname)
is doing its job partly, and not writing to the sd card first. df -a //192.168.0.22/CCTV/PiZero/ 942639428 3187324 939452104 1% /mnt/CCTV/PiZero
On Sat, 16 Jun 2018 15:23:25 +0100, RobH declaimed the following:
Which is the same permission error that the shutil.copyfile() was producing. This tells me that there is nothing wrong with the script itself. The problem appears to be on the NAS side -- since it IS accepting operations that provide a file name, but then refuses to accept the actual file data.
Restore the script to the version using RAMname for the capture, and with the .copyfile() back in place. When it dies do the following and cut&paste the results into a message:
ls -l /run/shm
cp /run/shm/*.h264 /mnt/CCTV/PiZero
rm -f /run/shm/*.h264
{Note: the last line is going to clean out old files from /run/shm -- cp & rm together produce the effect of
mv -f /run/shm/*.h264 /mnt/CCTV/PiZero }
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
D
Dennis Lee Bieber
On Sat, 16 Jun 2018 16:32:51 +0100, RobH declaimed the following:
The whole purpose of this exercise was to STOP writing to the SD card at all.
The version of the script using RAMname for the capture is supposed to store the file IN RAM, and then use copyfile() to move it from RAM to the NAS (followed by .unlink() to delete the copy left in RAM).
With the capture specified as NASname, the file should never be on the RPi physically (not in RAM, not in SD card), but is supposed to go directly to the NAS.
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
T
The Natural Philosopher
Depends on the user permissions the script is running at....
?It is hard to imagine a more stupid decision or more dangerous way of
making decisions than by putting those decisions in the hands of people
who pay no price for being wrong.?
Thomas Sowell
A
Andy Burns
I am assuming it is running as "pi" ...
T
The Natural Philosopher
I am not...:-)
Truth welcomes investigation because truth knows investigation will lead
to converts. It is deception that uses all the other techniques.
M
mm0fmf
+1
R
RobH
pi@raspberrypi:~/Downloads $ 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 13] Permission denied: '/mnt/CCTV/PiZero/2018-06-16_19.57.21.h264'
pi@raspberrypi:~/Downloads $ mv -f /run/shm/*.h264 /mnt/CCTV/PiZero mv: preserving times for '/mnt/CCTV/PiZero/2018-06-16_19.57.21.h264': Operation not permitted mv: preserving permissions for ?/mnt/CCTV/PiZero/2018-06-16_19.57.21.h264?: Input/output error
R
RobH
Yes it is AFAIK
R
RobH
Ignore the above as it is corrected below
After the permission denied again I went to my NAS box and changed the permissions for a windows share, as it was previously set for a Unix share.
Now pi@raspberrypi:~/Downloads $ cp /run/shm/*.h264 /mnt/CCTV/PiZero cp: cannot stat '/run/shm/*.h264': No such file or directory
R
RobH
pi@raspberrypi:~/Downloads $ ls -l total 4
-rw-rw-rw- 1 pi pi 1117 Jun 16 16:53 intruder.py
D
Dennis Lee Bieber
On Sat, 16 Jun 2018 20:25:23 +0100, RobH declaimed the following:
Well, if you either rebooted or ran that "rm" command, there would not be any files in RAM to be copied.
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
J
Jean-Pierre Kuypers
In article (Dans l'article) , mm0fmf
Using the command "id" would help:
DESCRIPTION The id utility displays the user and group names and numeric IDs, of the calling process, to the standard output. If the real and effective IDs are different, both are displayed, otherwise only the real ID is displayed.
Jean-Pierre Kuypers
R
RobH
Like this, you mean?
pi@raspberrypi:~ $ id uid=1000(pi) gid=1000(pi) groups=1000(pi),4(adm),20(dialout),24(cdrom),27(sudo),29(audio),44(video),46(plugdev),60(games),100(users),101(input),108(netdev),997(gpio),998(i2c),999(spi)
R
RobH
Apologies for late reply as I have been away for a week on holiday.
Yes that is what I did actually, as something happened , can't recall what exactly, but maybe a lock up or not running???
All the directories on the Pi Zero, permissions are set to 775, and owned by pi:pi
It seems that the permission problem is with writing the actual file, and not access to the NAS box.
What would be the next thing I should do
D
Dennis Lee Bieber
On Sat, 23 Jun 2018 18:23:21 +0100, RobH declaimed the following:
Not having any NAS myself -- I'm out of my realm... Everything that follows is hypothetical.
If the NAS is capable of NFS besides CIFS/SMB (based on
formatting link
CIFS itself is considered obsolete... but other sites suggest that one install cifs-utils rather than smbfs
formatting link
) -- defining the share as NFS /on the NAS/ and changing the mount command(s) on the RPi to mount as nfs instead of cifs might improve the behavior.
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
R
RobH
Ok, I was getting permission denied with everything on the /mnt/CCTV/PiZero folder.
I removed all the existing files from the PiZero /mnt/CCTV/Pizero folder as they were all write protected, and had to reboot for the folder to show 0 files.
When I do ls -l I get total 4 drwxrwxrwxrwx 2 pi:pi 4096 June 24 18.47 PiZero
Then because of a reboot, I have to: pi@raspberrypi:~ $ sudo mount -t cifs -o username=root,password=2Sm4k5 //192.168.0.22/CCTV/PiZero/ /mnt/CCTV/PiZero
And now:
pi@raspberrypi:/mnt/CCTV $ ls -l total 0 drwxrwxr-x 2 root nogroup 0 Jun 24 18:55 PiZero
When I try to remove it: pi@raspberrypi:/mnt/CCTV $ sudo rm -r PiZero rm: cannot remove 'PiZero': Device or resource busy pi@raspberrypi:/mnt/CCTV $
So for some reason as soon as the PIZero directory is mounted, it becomes owned by root, as above with sudo mount.
If I remove -o I get:
pi@raspberrypi:~ $ mount -t cifs -o username=root,password=2Sm4k5 //192.168.0.22/CCTV/PiZero/ /mnt/CCTV/PiZero mount: only root can use "--options" option pi@raspberrypi:~ $ mount -t cifs username=root,password=2Sm4k5 //192.168.0.22/CCTV/PiZero/ /mnt/CCTV/PiZero mount: only root can use "--types" option
Now I am between the devil and the deep blue sea
Before I mount the PiZero directory it is owned by pi:pi, but after I mount the PiZero directory it is owned by root
I have also tried echo "hello" > /mnt/CCTV/test.txt , but nothing is created on the said directory, although the file is created on the actual PiZero CCTV directory
pi@raspberrypi:~ $ cd /mnt/CCTV pi@raspberrypi:/mnt/CCTV $ ls PiZero test.txt pi@raspberrypi:/mnt/CCTV $
A
Andy Burns
if you did "ls -la" you'd probably have found that . and .. were two of the mystery three directory entries.
**** = oops
can you not put a suitable entry in /etc/fstab, so that PiZero gets automatically mounted, with consistent rights?
try unmounting it first (or instead) "umount /mnt/CCTV/PiZero"
nothing on the Pi, or nothing on the NAS?
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.