Have a look in /var/log/syslog and see if you can find some indication of why. If the filesystem is mounting read-only, the last thing in that file will be whatever happened when it was still read-write, since the system cannot log there otherwise. Which may or may not be helpful...
The kernel's own log is in memory, however, and does not require a ...
I guess your image is OpenELEC as @Lawrence said that. OpenELEC uses squashfs compressed image filesystem so you can't edit without uncompressing.
To uncompress it, convert your sd-card content into image with dd command in another computer which runs linux.
dd if=/dev/mmcblk0 of=/tmp/openelec.img
Then install squashfs-tools to get compress/uncompress ...
Linux kernel is caching disk operations. That means data is written not in real time, but when it is "time to do it".
There could be two reasons of behaviour you described:
1. Your SD card (or disk) is not fast enough to receive all the data you are producing.
2. Once in 30-40 seconds kernel is 'flushing' it's disk buffers, which unluckily freezes all disk ...
I suspect your issue is that you are mounting the vfat filesystem so that it is only accessible to the root user.
The vfat filesystem (being a very simple filesystem dating from the ancient days of DOS) has no concept of users and groups, but all files in UNIX systems must have an owner and group. To work around this, the Linux vfat driver defaults to ...
Turns out it was some sort of OS glitch or incompatibility. I ran the following commands overnight and it fixed the problem
sudo umount /dev/sda1 # /dev/sda1 is the name of my external drive partition
sudo fsck -Cy /dev/sda1
Since it seems that your /etc/fstab is missing, you may want to fill it in with the necessary information. You'll need to manually mount the root and boot partitions first:
sudo mount -o remount,rw /dev/mmcblk0p1 /boot
sudo mount -o remount,rw /dev/mmcblk0p2 /
And then create a new /etc/fstab
sudo echo -e "proc /proc proc ...
I just installed OpenElec on a Pi 3, and it puts the partition that is normally mounted as /boot on other distributions as /flash.
OpenELEC:~ # df | grep p1
/dev/mmcblk0p1 524008 151736 372272 29% /flash
As you say, it is mounted by default as read-only.
OpenELEC:~ # mount | grep flash
/dev/mmcblk0p1 on /flash type vfat (ro,noatime,fmask=...
You can do this very easily with a shell script:
echo "$now $*" >> $LOGFILE
while true ; do
writelog "Exited with status $?"
If you really want to use python:
import time, subprocess
SSDs have wear levelling technology and quote their expected life usually having at least 60Tb of writes before failure. If my calculations are correct and using your 1Mb per minute estimate that should give you around 120 years before failure.
This is most likely because something (by the looks of that command it is the BASH shell and SFTP-Server) is/are accessing the root filesystem. During boot nothing is accessing anything in / yet, so it can be set to read-only.
However, once boot-up is complete, some software may want a lock on the filesystem or some files are being changed within. Obviously,...
If you still can not unmount or remount your device after stopping all services and processes with open files, then there may be a swap file or swap partition keeping your device busy. This will not show up with fuser or lsof. Turn off swapping with:
sudo swapoff -a
You could check beforehand and show a summary of any swap partitions or swap files with:
If the pi is working properly, SD card corruption should never happen regardless of whether the card is rw or ro (at least until the card is worn out, which would take quite a long time). The exception would be pulling the plug suddenly on a busy system, in which case a rw filesystem will be more vulnerable. Since you have decided to do that regularly, ...
This could be a problem with your SD card. I've had a Scandisk cards suddenly die. When it died it went into read only mode "to protect your data from loss". It's plausible your SD card has done the same.
If it's an old RPI (using a regular SD card) then double check the read/write switch on the SD card.
Try placing the card into another machine. If ...
Thank you @JOAN for clearing things up.
need to send 1st byte as command, and then shift out another 8 bits to get my return data. here are two functions that are working for me
address = 0x80 | regAddr
resp = self.spi.xfer2([address,0x00])
Assuming you are no longer talking about logs in particular.
Have a look at /proc/diskstats. If you cat /proc/diskstats you will see statistics for various devices.
Each device has 11 entries as follows.
Name units description
---- ----- -----------
read I/Os requests number of read I/Os processed
Assuming we're talking about the hardware UART here, although that is not the default behaviour for the Pi 3 where
the PL011 UART is connected to the BT module, while the mini UART is used for Linux console output..
see here and here for how to fix that.
As for the hardware buffer: a minor problem - no official datasheet is available for the Pi 3's ...
It looks like you have the mount permissions as read/write for root but only read for anyone else. I think you would need to set the permissions on /media/HDD to be writeable for the walter user or the users group.
sudo chown -R root:users /media/HDD will set the group permissions to users (I presume this exists?) or sudo chown -R walter:users /media/HDD ...
Try connecting the wire to another Pin like Pin 11. Then run one of these:
from gpiozero import Button
from time import sleep
button = Button(17) # The 11th Pin is GPIO 17
# Your code here
import RPi.GPIO as GPIO
from time import sleep
butPin = 17
The only check I know if is fsck, and its underlings e2fsck and fsck.vfat. A recent answer here provided a step-by-step procedure for this.
Oh - wait... there's another utility that may be useful for checking the speed: It's called agnostics, and is available through RPi's apt repository:
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get ...
Using openssl and public private keys,
You could get the pi serial number and encrypt it with a private key, place it on the sd card along with the public key.
If you decrypt the file with the public key and the serial numbers don't match then you stop it running.
The serial numbers may not be unique but it's a good place to start.
this little write-lock slider on the edge of every SD card
This is just a piece of plastic designed to push a switch in the card reader. This switch is not there in a Raspberry (more precisely, it's not connected electrically), so the lock slider has no effect.
You can still make an SD card practically write-protected by mounting the root FS read-only or ...
Check if you have UAS errors (e.g. sudo dmegs | grep uas): some USB3 storage devices perform better if you disable UAS and use them as good old mass storage. To do so, edit /boot/cmdline.txt and add the text usb-storage.quirks=<VID>:<PID>:u (idVendor / idProduct of the USB device in question) to the kernel command line.
If not, find out where the ...
I'm pretty sure this is a caching problem.
f = open("test.txt","w")
opens the text file for writing and sends the data abc to it, but this data is not immediately written to disk. It remains in a cache in RAM until
More data is sent to the file, so the cache gets full and is flushed to disk
The code explicitly forces to write the ...
Your root filesystem on your SDCard partition #2 (/dev/mmcblk0p2 - device 179,2) is in need of a fsck and the system can't run that automatically.
You'll need a new SDCard, a copy of plain Raspbian and a USB SDCard reader. Or you'll need a laptop running Ubuntu or Mint that has an SDCard reader.
If doing it on a new SDCard, get Raspbian written to the new ...
You can mount your root fs read only, and switch between RO and RW.
For switching : I have 2 scripts in /usr/local/bin:
/usr/local/bin/rw with inside
mount / -o rw,remount
mount / -o ro,remount
You then make them executable :
sudo chmod +x /usr/local/bin/ro /usr/local/bin/rw
Then you also have to change some ...
You can certainly read multiple bytes using read.
The comments about FIFO are misleading, even though they are important to ensure high speed troughput, are inaccessable.
The kernel drivers almost certainly provide buffering, but again this is inaccessable. (In the 1970s I wrote my own drivers which used a 256 character circular buffer.)
The following ...
I have also asked this question Why is the green LED (ACT) blinking without SD card activity also at the Raspberry Pi Forum and received this answer:
by rpdom » Wed Feb 22, 2017 8:02 pm
From what I understand, the Pi sends a "status" request to the card every few seconds to check that it is still there and working. That will cause the LED to flash,...
Yes there are logs, most should be under /var/log.
Use the command ls /var/log -lrt to get a reverse time ordered list of files in that directory.
You can tune some logging with the file /etc/rsyslog.conf. If you want to disable as much logging as possible add a line with *.* ~ just after the #### RULES #### comment block.
Not all logging may be ...