annotation
Launch Raspberry Pi with full graphics support on microSD, which remains forever in read-only mode after installing the system. The absence of any data recording on flash memory increases the reliability of the device, bringing it closer to the industrial class of products. Step-by-step instruction. A small theater of engineering absurdity to entertain the audience.
/etc/lightdm/lightdm.conf
:...
xserver-command=X -s 0 -dpms -nocursor
...
-nocursor
. ~/.config/lxsession/LXDE/autostart
. , cron(8)
718 xscreensaver-command -deactivate
( , ;-)~/.config/lxsession/LXDE/autostart
feh '@' . . .. , lxpanel
, pcmanfm
, xscreensaver
, DPMS .apt-get
autostart
, , X-, , . , .UPD
Jaromir unclutter , . , .
Spider55 LightDM noDM. , .
noatime
, microSD. , /sys/block/mmcblk0/stat
282612 , 96, read-only? , 3000:1, 5:1.UPD:
gattopazzo83 Flash Media Kit - ( ). 100,000 , SLC- microSD. read-only, , («» - «» ;-)
UPD:
doga, «» SD- RPi. doga mmc-utils, SD-, Raspbian . - , , , .SD-:udevadm info -a -n /dev/mmcblk0
«»CID
CSD
, (name
), (serial
), (date
), (hwrev, fwrev, oemid, manfid
). www.sdcard.org «» (Simplified Specifications), . Part 1 Simplified, Physical Layer Simplified Specification.stat
, kernel.org. , .
- , lsmmc.c.
« » RPi SD cards Embedded Linux, .
— — , mmc-utils , .
UPD:
st1373 I2C- DS3231 ( ). : RTC ( ) Raspberry Pi.
.root
,sudo
. , ,sudo
, -. , * * , ? -, 0.33, , … : ,root
sudo bash
, .
raspi-config
pi
. , Debian — . .apt-key update
apt-get update
apt-get install --no-install-recommends tightvncserver xtightvncviewer xserver-xorg xinit lxde-core lxappearance lightdm feh xprintidle policykit-1 busybox-syslogd ntpdate watchdog unionfs-fuse
dpkg --purge rsyslog
apt-get remove --purge wolfram-engine triggerhappy cron anacron logrotate dphys-swapfile fake-hwclock
apt-get autoremove --purge
tightvncserver, xtightvncviewer, xprintidle feh
, .xserver-xorg xinit lxde-core lxappearance lightdm policykit-1
.raspi-config
, pi
. sudo
, pi
, pi
. pu
«» . (default shell) ( /usr/sbin/nologin
), /usr/local/bin/pu
. , SSH, . Sauron et al.adduser --home /home/pu --shell /usr/local/bin/pu --uid 990 --gecos "RPi p-u" --gid 1000 pu
mkdir -p /home/pu/.config/lxsession/LXDE
cp -p /etc/xdg/lxsession/LXDE/desktop.conf /home/pu/.config/lxsession/LXDE/desktop.conf
touch /home/pu/.config/lxsession/LXDE/autostart
chown -R pu:pi /home/pu
sed -i 's/^#\?xserver-command=.*$/xserver-command=X -s 0 -dpms -nocursor/' /etc/lightdm/lightdm.conf
sed -i 's/^#\?autologin-user=.*$/autologin-user=pu/' /etc/lightdm/lightdm.conf
/etc/lightdm/lightdm.conf
, , :...
xserver-command=X -s 0 -dpms -nocursor
...
autologin-user=pu
...
modprobe bcm2835_wdt
echo "bcm2835_wdt " | sudo tee -a /etc/modules
[Install]
/lib/systemd/system/watchdog.service
:[Install]
WantedBy=multi-user.target
systemctl enable watchdog.service
watchdog(8)
watchdog.conf(5)
/boot/cmdline.txt
logo.nologo fastboot noswap
. :logo.nologo dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait fastboot noswap
mount_unionfs
- /usr/local/bin
. +x (chmod
755 555). .orig
.rw
, ():#!/bin/sh
DIR=$1
ROOT_MOUNT=$(awk '$2=="/" {print substr($4,1,2)}' < /etc/fstab)
if [ $ROOT_MOUNT = "rw" ]; then
/bin/mount --bind ${DIR}.orig ${DIR}
else
/bin/mount -t tmpfs ramdisk ${DIR}.rw
/usr/bin/unionfs-fuse -o cow,allow_other,suid,dev,nonempty ${DIR}.rw=RW:${DIR}.orig=RO ${DIR}
fi
insserv -r bootlogs
insserv -r alsa-utils
rm -rf /var/lib/dhcp/
ln -s /tmp /var/lib/dhcp
/home
- , /etc
/var
/home
. UnionFS ( .orig
.rw
):
cp -al /etc /etc.orig
mv /var /var.orig
mv /home /home.orig
mkdir /etc.rw /var /var.rw /home /home.rw
fstab(5)
proc /proc proc defaults 0 0
/dev/mmcblk0p1 /boot vfat ro 0 2
/dev/mmcblk0p2 / ext4 ro 0 1
mount_unionfs /etc fuse defaults 0 0
mount_unionfs /var fuse defaults 0 0
mount_unionfs /home fuse defaults 0 0
none /tmp tmpfs defaults 0 0
.bash_history
, - .. , , (, /var.orig
var
).root
. , read-only read-write :mount -o rw,remount /
fstab(5)
, mount_unionfs
, ** /var.orig
( /home.orig
). /var
, , apt-get
, ? apt-get
. , ;)UPD: OverlayFS
ValdikSS OverlayFS, Linux 2014, ,initramfs
. art_gl : Raspbian with Read-only Root.
, Domoticz, , OverlayFS. Sauron Domoticz.
UPD: SquashFS
Vooon, Vcoderlab, av_in et al SquashFS. , «»union mount
, . , SquashFS by-design read-only, .. firmware-, () , . , , . , IoT . , , SquashFS, - ? , , community- SquashFS, .. Raspberry Pi. , OpenELEC.
UPD: F2FS
nlykl F2FS aka «Flash-Friendly File System», HOWTO: Replace the micro SD card's ext4 root partition by f2fs on the Raspberry PI. DISCLAIMER: . . F2FS -.
UPD:
ilmarin77 : Network booting. . , , , , ( ) . USB-Ethernet LAN9514 0..70°C
UPD: USB-
ilmarin77 USB: How to boot from a USB Mass Storage Device on a Raspberry Pi 3. SSD, USB, , microSD, USB 2.0 (- 30-40/, ). , . , read-only microSD, SSD , . USB- , microSD, .
UPD: (watchdog)
homecreatesystemd
, , . . .
UPD:?
. , - , S.M.A.R.T HDD SSD. SanDisk, , , EXTCSD. - , Linux . , ,smartd(8)
.
« Linux- SD- /» , , (.. uptime , 10 ). , ( sudo root):uptime cat /sys/block/mmcblk0/stat | awk '{printf "Uptime read: %.3fMiB (%.1f%% I/Os merged) written: %.3f MiB (%.1f%% I/Os merged)\n", $3*512/1048576, $2/$1*100, $7*512/1048576, $6/$5*100}'
, , , «» . , Meklon -, openELEC / KODI. 6 72 66. / 1:1, SquashFS ( SD- ). / 5:1 10:1, . , 10 — , .
, : 512 , , erase- . Optimizations for Cheap Flash Media Arnd Bergmann (, .) «» , .. 32, erase- 4..8. «» , 512erase-, ..64,stat
. 6/, microSD- .
, .
Make Raspbian System Read-Only
blog.pi3g.com/2014/04/make-raspbian-system-read-only
()
How to make RaspberryPi truly read-only, reliable and trouble-free
k3a.me/how-to-make-raspberrypi-truly-read-only-reliable-and-trouble-free
( )
Protect your Raspberry PI SD card, use Read-Only filesystem
hallard.me/raspberry-pi-read-only
( sisaenkov, , )
Stopping SD Card Corruption on Raspberry Pi’s Raspbian
ideaheap.com/2013/07/stopping-sd-card-corruption-on-a-raspberry-pi
( )
Raspberry Pi — VNC localhost
habrahabr.ru/post/212661
RTC ( ) Raspberry Pi
raspberrypi.ru/blog/598.html
( I2C- DS3231)
How to boot from a USB Mass Storage Device on a Raspberry Pi 3
www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/msd.md
Network booting
www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/net.md
ECIO(TM), a powerful USB programmable single chip computer based on PICmicro microcontroller technology
www.matrixtsl.com/product.php?Prod=ECIO28P
Easy Raspberry Pi Based Screensaver/Slideshow for Exhibitions/Store Front
www.instructables.com/id/Easy-Raspberry-Pi-Based-ScreensaverSlideshow-for-E
( 6)
Flash memory card design (2013)
wiki.linaro.org/WorkingGroups/KernelArchived/Projects/FlashCardSurvey
( , ? FAT; ; 2013)
Optimizing Linux with cheap flash drives, Arnd Bergmann, 2011
lwn.net/Articles/428584
( )
Optimizations for Cheap Flash Media, Arnd Bergmann, 2011
free-electrons.com/blog/elce-2011-videos
( , , )
SD Association, Simplified Specifications, Part 1 Simplified: Physical Layer Simplified Specification
www.sdcard.org/downloads/pls/index.html
Block layer statistics in /sys/block/<dev>/stat
www.kernel.org/doc/Documentation/block/stat.txt
( SD- :cat /sys/block/mmcblk0/stat
uptime
)
Source: https://habr.com/ru/post/400011/
All Articles