Raspberry Pi

From Holyheads Wiki
(Difference between revisions)
Jump to: navigation, search
m (Collection of stuff to check - things I might) try sometime)
(Multiple 1-wire buses)
 
(54 intermediate revisions by one user not shown)
Line 107: Line 107:
 
: A: Try adjusting the PAM settings in <code>/etc/pam.d/common-password</code>:
 
: A: Try adjusting the PAM settings in <code>/etc/pam.d/common-password</code>:
 
:* remove the 'obscure' setting for pam_unix.so, and add your desired minimum length (e.g. minlen=2)
 
:* remove the 'obscure' setting for pam_unix.so, and add your desired minimum length (e.g. minlen=2)
 
+
::<code>password        [success=1 default=ignore]      pam_unix.so sha512 minlen=2</code>
  password        [success=1 default=ignore]      pam_unix.so sha512 minlen=2
+
  
 
::!! This is not recommended if your box is connected to the internet or if it contains private data noone should know !!<br>
 
::!! This is not recommended if your box is connected to the internet or if it contains private data noone should know !!<br>
Line 115: Line 114:
 
* Q: How to configure static IP?
 
* Q: How to configure static IP?
 
: A: In /etc/network/interfaces:
 
: A: In /etc/network/interfaces:
 
+
::<code>iface eth0 inet static<br>address 192.168.0.31<br>netmask 255.255.255.0<br>gateway 192.168.0.1</code>
  iface eth0 inet static
+
    address 192.168.0.31
+
    netmask 255.255.255.0
+
    gateway 192.168.0.1
+
  
 
* Q: How to read core temperature, etc?
 
* Q: How to read core temperature, etc?
 
: A: [http://elinux.org/RPI_vcgencmd_usage vcgencmd]:
 
: A: [http://elinux.org/RPI_vcgencmd_usage vcgencmd]:
 
+
::<code>vcgencmd measure_temp<br>vcgencmd measure_clock arm</code>
  vcgencmd measure_temp
+
  vcgencmd measure_clock arm
+
  
 
* External USB HDD spin down
 
* External USB HDD spin down
 
** hdparm does not work with my WD Elements (SG_IO: bad host status: 0x7)
 
** hdparm does not work with my WD Elements (SG_IO: bad host status: 0x7)
 
** hd-idle works:
 
** hd-idle works:
 
+
::<code>hd-idle -a sda -i 600</code>
hd-idle -a sda -i 600
+
 
+
 
:: for details, see for example http://blog.is-a-geek.org/festplatten-in-den-standby-modus-versetzen-unter-ubuntu-desktopserver-mit-hd-idle (German)
 
:: for details, see for example http://blog.is-a-geek.org/festplatten-in-den-standby-modus-versetzen-unter-ubuntu-desktopserver-mit-hd-idle (German)
  
 
* Q: How to avoid update of a certain package?
 
* Q: How to avoid update of a certain package?
 
: A: Put package on hold ([http://debiananwenderhandbuch.de/dpkg.html] (German)):
 
: A: Put package on hold ([http://debiananwenderhandbuch.de/dpkg.html] (German)):
 
+
::<code>echo <packagename> "hold" | dpkg --set-selections</code>
echo <packagename> "hold" | dpkg --set-selections
+
  
 
* [[wikipedia:Raspcontrol]] with nginx
 
* [[wikipedia:Raspcontrol]] with nginx
Line 150: Line 140:
 
:* http://unix.stackexchange.com/questions/86391/how-to-get-total-number-of-bytes-sectors-blocks-written-to-disk-since-booting
 
:* http://unix.stackexchange.com/questions/86391/how-to-get-total-number-of-bytes-sectors-blocks-written-to-disk-since-booting
 
:* http://serverfault.com/questions/238033/measuring-total-bytes-written-under-linux
 
:* http://serverfault.com/questions/238033/measuring-total-bytes-written-under-linux
 +
 +
* Q: How to reduce number of ext-fs checks?
 +
: A: <code>tune2fs -c 60  /dev/sda1</code> Change maximum mount count to 60
 +
: A: <code>tune2fs -i 12m  /dev/sda1</code> Change check interval to 12 months
 +
: fore more details: http://wiki.ubuntuusers.de/Dateisystemcheck (German)
 +
 +
* Q: Fix smsc95xx 1-1.1:1.0: eth0: kevent 2 may have been dropped
 +
: A: http://wood1978.techarea.org/~wood/wordpress/2013/04/03/fix-smsc95xx-1-1-11-0-eth0-kevent-2-may-have-been-dropped-on-raspberry-pi-with-arch-linux
 +
::Modifying the sysctl.conf values reduced the kevent-2 messages; I did not yet set smsc95xx.turbo_mode=N
  
 
===Overclocking===
 
===Overclocking===
Line 176: Line 175:
 
* [http://www.roylongbottom.org.uk/Raspberry%20Pi%20Stress%20Tests.htm Raspberry Pi Stress Tests]
 
* [http://www.roylongbottom.org.uk/Raspberry%20Pi%20Stress%20Tests.htm Raspberry Pi Stress Tests]
  
===My SD card data recovery procedure===
+
===SD card issues===
  
After my (Turbo-overclocked) Raspberry fried my 8 GB SD card, I had not hoped to to be able to recover any data, but I tried anyway. The card was only 1 week old, I have not written that much data too it (<4 GB, mainly the Raspbian image).
+
After my (Turbo-overclocked) Raspberry fried my 8 GB SD card, I had not hoped to to be able to recover any data, but I tried anyway. The card was only 1 week old, I have not written that much data too it (<4 GB, mainly the Raspbian image). I could still use this card for some time (see below), but finally I got a corrupted file system and could no longer repair it. That's when I re-installed Raspbian on a new SD card.
  
 +
Maybe I should try [http://www.raspipress.com/2013/05/install-and-run-raspbian-from-a-usb-flash-drive/ running from USB] sometime?
 +
 +
====Recovery====
 
* Creating a binary image of the SD card with my PC using [http://sourceforge.net/projects/win32diskimager/ Win32 Disk Imager] resulted in IO errors at about 17%.
 
* Creating a binary image of the SD card with my PC using [http://sourceforge.net/projects/win32diskimager/ Win32 Disk Imager] resulted in IO errors at about 17%.
 
* The partition table of my SD card was still ok. I hoped to at least recover some text data of my ext4 partition, and thus I created an image using <code>dd conv=sync,noerror if=/dev/sdb2 of=rasp-image.img bs=1M</code> on my Linux machine (option <code>conv=noerror</code> ignores any errors, sync pads read-errors with zeros). The resulting image could not be mounted using a loop device.  
 
* The partition table of my SD card was still ok. I hoped to at least recover some text data of my ext4 partition, and thus I created an image using <code>dd conv=sync,noerror if=/dev/sdb2 of=rasp-image.img bs=1M</code> on my Linux machine (option <code>conv=noerror</code> ignores any errors, sync pads read-errors with zeros). The resulting image could not be mounted using a loop device.  
Line 200: Line 202:
 
  [...]
 
  [...]
 
  /dev/sdb3        15288320    15353855      32768  83  Linux</code>
 
  /dev/sdb3        15288320    15353855      32768  83  Linux</code>
Byte-offset of sdb3: 7827619840 = 15288320 * 512
+
:Byte-offset of sdb3: 7827619840 = 15288320 * 512
  
 
* Mount partition to /dev/loopN partition for repair, etc.
 
* Mount partition to /dev/loopN partition for repair, etc.
<code>losetup -o 7827619840 --find --show  /dev/sdb</code>
+
:<code>losetup -o 7827619840 --find --show  /dev/sdb</code>
--show prints the used /dev/loopN device
+
:--show prints the used /dev/loopN device
  
 
* Directly mount partition using loop device:
 
* Directly mount partition using loop device:
<code>mount -o loop,offset=7827619840 /dev/sdb /mnt</code>
+
:<code>mount -o loop,offset=7827619840 /dev/sdb /mnt</code>
 
* http://www.garloff.de/kurt/linux/ddrescue/
 
* http://www.garloff.de/kurt/linux/ddrescue/
 
* http://softwarebakery.com/shrinking-images-on-linux
 
* http://softwarebakery.com/shrinking-images-on-linux
Line 224: Line 226:
 
** http://raspberrywebserver.com/cgiscripting/rpi-temperature-logger/
 
** http://raspberrywebserver.com/cgiscripting/rpi-temperature-logger/
 
** http://elinux.org/RPi_Low-level_peripherals
 
** http://elinux.org/RPi_Low-level_peripherals
 
+
** http://www.sdyoung.com/home/using-1-wire-ds18b20par-sensors-in-parasitic-mode-on-raspi-with-custom-gpio-pin/ (German)
 
* I have two DS18B20 and log temperatures using rrdtool.
 
* I have two DS18B20 and log temperatures using rrdtool.
  
Line 235: Line 237:
 
** A: I have the impression that this is connected to electrical problems (e.g. timing, voltage) on my 1-wire when there's a lot of IO (USB, ethernet). Using 3 sensors works almost all the time (without overclocking), but using 4 or more sensors (2 connected star topologies, very bad for 1-wire [http://www.maximintegrated.com/en/app-notes/index.mvp/id/148 GUIDELINES FOR RELIABLE LONG LINE 1-WIRE NETWORKS]), almost always fails to read values on most of the sensors.
 
** A: I have the impression that this is connected to electrical problems (e.g. timing, voltage) on my 1-wire when there's a lot of IO (USB, ethernet). Using 3 sensors works almost all the time (without overclocking), but using 4 or more sensors (2 connected star topologies, very bad for 1-wire [http://www.maximintegrated.com/en/app-notes/index.mvp/id/148 GUIDELINES FOR RELIABLE LONG LINE 1-WIRE NETWORKS]), almost always fails to read values on most of the sensors.
 
** A:'''Implement multiple 1-wire interfaces''' (see below), using 1 for each star-topology solved the problem. Reading 2x3 works perfect!
 
** A:'''Implement multiple 1-wire interfaces''' (see below), using 1 for each star-topology solved the problem. Reading 2x3 works perfect!
 +
** A: If not adding new devices, disabling 1-wire search after module-loading resolves the device-disconnect issue. Simply put
 +
::<code>wire search_count=5</code>
 +
:: in your <code>/etc/modules</code> (I'm not using DTB) to allow only 5 (initial) searches.
  
 
====Multiple 1-wire buses====
 
====Multiple 1-wire buses====
:* Inspired and guided by http://www.raspberrypi.org/forums/viewtopic.php?p=513312#p513312, I've patched <code>arch/arm/mach-bcm2708/bcm2708.c</code> (patch file http://holyhead.de/RaspberryPi/bcm2708-multiple_w-1.patch-3.12.21.txt).
+
:* [https://www.raspberrypi.org/forums/viewtopic.php?t=156734 multiple w1 buses with device trees]:
:* I've cross-compiled the kernel on a linux-VM, using the instructions of http://elinux.org/RPi_Kernel_Compilation (compiling on the RaspberryPi takes 6 hours [http://wiki.gentoo.org/wiki/Raspberry_Pi_Kernel_Compilation] or much more [http://elinux.org/RPi_Kernel_Compilation]).
+
Add the following to /boot/config.txt:
 +
 
 +
  dtoverlay=w1-gpio,gpiopin=4
 +
  dtoverlay=w1-gpio,gpiopin=22
 +
 
 +
:* OBSOLETE! Inspired and guided by http://www.raspberrypi.org/forums/viewtopic.php?p=513312#p513312, I've patched my 3.12.y kernel <code>arch/arm/mach-bcm2708/bcm2708.c</code> (patch file http://holyhead.de/RaspberryPi/bcm2708-multiple_w-1.patch-3.12.21.txt). Applying this patch to newer kernel versions is straight forward. (Currently I'm running 4.1.10 without device tree.)
 +
::* Note: Some kernel versions ago, device trees were introduced for Raspbian, see for example http://www.raspberrypi.org/documentation/configuration/device-tree.md<BR>So far, I don't know if this works with device trees.
 +
:* OBSOLETE! I've cross-compiled the kernel on a linux-VM, using the instructions of http://elinux.org/RPi_Kernel_Compilation (compiling on the RaspberryPi takes 6 hours [http://wiki.gentoo.org/wiki/Raspberry_Pi_Kernel_Compilation] or much more [http://elinux.org/RPi_Kernel_Compilation]).
  
 
====Some 1-wire internals====
 
====Some 1-wire internals====
Line 259: Line 271:
 
:* http://www.gtkdb.de/index_36_2087.html
 
:* http://www.gtkdb.de/index_36_2087.html
  
* [https://plus.google.com/app/basic/stream/z135w1kg5tntcbg2e22qwnardxmuyza0t?cbp=1hhdiwvrjjn2m&sview=28&cid=5&soc-app=115&soc-platform=1&spath=/app/basic/s/%2523RaspberryPi/related&sparm=cbp%3Db6cpwp8slhsr%26sview%3D28%26cid%3D5%26soc-app%3D115%26soc-platform%3D1%26sro%3D%2523Kernel,%2523Linux%26sri%3D0%26spath%3D/app/basic/s/%252523Kernel/related%26sparm%3Dcbp%253D1fdm6sprr41b4%2526sview%253D27%2526sro%253D%252523Linux,%252523Android%2526sri%253D0%2526spath%253D/app/basic/112174725442947365645/posts%2526sparm%253Dcbp%25253D3twl29l874fg%252526sview%25253D25|Linux 3.15.x kernel for Raspberry Pi]
+
* extract kernel config from image:
 +
::<code>scripts/extract-ikconfig kernel-image</code>
 +
::*(extract-ikconfig is part of the kernel sources)
 +
::*newer kernels may store their config in a module: modules/4.*/kernel/kernel/configs.ko
 +
 
 +
===Device Trees===
 +
 
 +
:* http://www.raspberrypi.org/documentation/configuration/device-tree.md
 +
:* https://www.kernel.org/doc/Documentation/devicetree/bindings/gpio/gpio.txt
 +
 
 +
:* http://www.raspberrypi.org/forums/viewtopic.php?f=29&t=97216
 +
:* http://raspberrypi.stackexchange.com/questions/27073/firmware-3-18-x-breaks-i2c-spi-audio-lirc-1-wire-e-g-dev-i2c-1-no-such-f
 +
:* http://www.forum-raspberrypi.de/Thread-tutorial-geraetetreiber-und-device-tree-dt (German)
 +
 
 +
:* http://xillybus.com/tutorials/device-tree-zynq-1
  
 
===What about updates?===
 
===What about updates?===
Line 268: Line 294:
 
* <code>rpi-update</code> - update kernel and modules
 
* <code>rpi-update</code> - update kernel and modules
 
::use <code>SKIP_KERNEL=1 rpi-update</code> to update the RPi firmware, but keep the current kernel
 
::use <code>SKIP_KERNEL=1 rpi-update</code> to update the RPi firmware, but keep the current kernel
 +
::set <code>SKIP_REPODELETE=1</code> to keep downloaded files (by default: <code>/root/.rpi-firmware</code>)
  
 
Kernel Sources
 
Kernel Sources
 
* https://github.com/notro/rpi-source gets the source data from https://github.com/Hexxeh/rpi-firmware and https://github.com/raspberrypi/linux/
 
* https://github.com/notro/rpi-source gets the source data from https://github.com/Hexxeh/rpi-firmware and https://github.com/raspberrypi/linux/
  
==Todo and Miscellaneous==
+
===Hints for reading Kernel Panics===
  
===Attach a LCD display===
+
* http://ptgmedia.pearsoncmg.com/images/013147751X/downloads/013147751X_book.pdf
 +
: p290:
 +
export CONFIG_DEBUG_INFO=1
 +
make kernel/sysctl.o
 +
objdump -d -S kernel/sysctl.o > kernel/sysctl.dump
  
* http://www.pro-linux.de/artikel/2/1624/5,die-anzeige-hardware-und-software.html (German)
+
or, with my in cross-compiling setup:
 +
 
 +
DOMAKE drivers/w1/slave/w1_therm.o
 +
${CCPREFIX}objdump -d -S w1_therm.o
 +
 
 +
* http://www.opensourceforu.com/2011/01/understanding-a-kernel-oops/
 +
 
 +
* http://www.lowlevel.eu/wiki/ARM-OS-Dev_Teil_2_%E2%80%93_Assembler_101
 +
 
 +
==Attaching a LCD display (HD44780 controller)==
 +
 
 +
===Wiring and Specs===
 +
 
 +
* Specs
 +
** ftp://imall.iteadstudio.com/IM120424018_EONE_2004_Characters_LCD/SPE_IM120424018_EONE_2004_Characters_LCD.pdf
 +
** http://www.adafruit.com/datasheets/HD44780.pdf
  
 
* http://www.schnatterente.net/technik/raspberry-pi-32-zeichen-hitachi-hd44780-display (German)
 
* http://www.schnatterente.net/technik/raspberry-pi-32-zeichen-hitachi-hd44780-display (German)
 +
 +
*  http://www.pro-linux.de/artikel/2/1624/5,die-anzeige-hardware-und-software.html
 +
 +
* https://learn.adafruit.com/drive-a-16x2-lcd-directly-with-a-raspberry-pi/wiring
 +
 +
* https://github.com/perryflynn/raspberrypi-misc/tree/master/charlcd_4x20_cmd
 +
 +
* http://obrazki.elektroda.pl/5028699400_1384164963.jpg
 +
 +
===Misc===
  
 
* http://www.makerspaceuk.com/lcd-temp-sensor/
 
* http://www.makerspaceuk.com/lcd-temp-sensor/
Line 284: Line 340:
 
* http://anwendungsentwickler.ws/blog/kategorien/raspberry-pi/4x20-lcd-screen-mit-dem-raspberry-pi.html (German)
 
* http://anwendungsentwickler.ws/blog/kategorien/raspberry-pi/4x20-lcd-screen-mit-dem-raspberry-pi.html (German)
  
====LCDProc hints====
+
==Controlling the display==
 +
 
 +
* Python [https://pypi.python.org/pypi/RPi.GPIO RPi.GPIO]
 +
 
 +
===LCDProc hints===
 +
 
 +
* Pi & GPIO powered HD44780 LCD: http://www.boeeerb.co.uk/pi-lcd/
 +
 
 +
* https://metacpan.org/pod/Net::LCDproc
 +
 
 +
* http://www.raspberrypi.org/forums/viewtopic.php?f=35&t=63412
  
 
* http://lcdproc.sourceforge.net/docs/current-user.html
 
* http://lcdproc.sourceforge.net/docs/current-user.html
Line 292: Line 358:
 
* http://tuxgraphics.org/electronics/200504/article375.shtml
 
* http://tuxgraphics.org/electronics/200504/article375.shtml
  
===Collection of stuff to check - things I might) try sometime===
+
==Todo and Miscellaneous==
 +
 
 +
===OpenELEC===
 +
 
 +
* http://wiki.openelec.tv/index.php/Guide_to_add_your_own_remote
 +
 
 +
===Lirc===
 +
* http://powerpi.de/jede-infrarot-fernbedienung-am-raspberry-pi-2-nutzen-so-installierst-du-guenstig-einen-ir-empfaenger-teil-1/ (German)
 +
 
 +
===Backports===
 +
 
 +
* https://gist.github.com/martijnvermaat/7864115
 +
* http://superuser.com/questions/644586/how-to-upgrade-to-latest-git-on-debian-7
 +
 
 +
===Collection of misc stuff to check - things I might) try sometime===
  
 
* http://www.raspipress.com/2013/05/install-and-run-raspbian-from-a-usb-flash-drive/
 
* http://www.raspipress.com/2013/05/install-and-run-raspbian-from-a-usb-flash-drive/
 +
 +
* [http://en.wikipedia.org/wiki/F2FS f2fs]
 +
:* [http://www.raspberrypi.org/forums/viewtopic.php?f=31&t=65330 F2fs, Ext4, FAT USB Benchmark]
 +
:* [http://forum.xda-developers.com/showthread.php?t=2697069 File System Performance: F2FS vs EXT4]
  
 
* https://github.com/yuraa/Raspberry-Pi-Heartbeat
 
* https://github.com/yuraa/Raspberry-Pi-Heartbeat
Line 305: Line 389:
 
* NAS/Samba
 
* NAS/Samba
 
:* try adjusting 'socket options' in (/etc/samba/smb.conf) to increase NAS performance: some websites recommend to disable the 'socket options', some recommend to set:
 
:* try adjusting 'socket options' in (/etc/samba/smb.conf) to increase NAS performance: some websites recommend to disable the 'socket options', some recommend to set:
 
+
:<code>socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=65536 SO_SNDBUF=65536</code>
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=65536 SO_SNDBUF=65536
+
  
 
* http://linuxtortures.blogspot.fr/2012/06/cross-compiling-and-cross-debugging-c.html
 
* http://linuxtortures.blogspot.fr/2012/06/cross-compiling-and-cross-debugging-c.html
Line 315: Line 398:
  
 
* http://iqjar.com/jar/sending-emails-from-the-raspberry-pi/
 
* http://iqjar.com/jar/sending-emails-from-the-raspberry-pi/
 +
* https://wiki.archlinux.org/index.php/SSMTP
  
 
==Some links (aka bookmark lists)==
 
==Some links (aka bookmark lists)==
Line 331: Line 415:
 
* http://www.forum-raspberrypi.de/ /(German)
 
* http://www.forum-raspberrypi.de/ /(German)
 
* http://raspberrycenter.de/ (German)
 
* http://raspberrycenter.de/ (German)
 +
* http://archlinuxarm.org/forum/viewforum.php?f=31&sid=57987232ca9177c35eb3ef7fdf6b3341
  
 
* [[wikipedia:Raspberry_Pi Raspberry Pi in Wikipedia]]
 
* [[wikipedia:Raspberry_Pi Raspberry Pi in Wikipedia]]
Line 338: Line 423:
 
* [http://www.raspberrypi.org/downloads New Out Of Box Software (Recommended)]
 
* [http://www.raspberrypi.org/downloads New Out Of Box Software (Recommended)]
 
* [http://elinux.org/R-Pi_Hub R-Pi_Hub]
 
* [http://elinux.org/R-Pi_Hub R-Pi_Hub]
 +
* [https://github.com/prasmussen/gdrive Google Drive CLI]
  
 
Manuals
 
Manuals

Latest revision as of 13:52, 20 February 2020

Contents

[edit] Cookbook

My collection of hints, tips and tricks (supporting my memory and maybe also helping others).

[edit] External USB drives

  • Install ntfs-3g if you need write access to ntfs file systems
  • How to increase performance?

[edit] udevil

  • example for manual mounting:
udevil mount /dev/sda1
  • my build-steps (maybe there's a simpler way, but this worked...):
    • download 0.4.3/udevil_0.4.3-1_all.deb from https://github.com/IgnorantGuru/udevil/tree/pkg, e.g. using wget
    • extract deb-package via ar vx udevil_0.4.3-1_all.deb
    • extract data archive tar xzvf data.tar.gz
    • change to tar usr/share/devil/src
    • untar tar xvfJ udevil-current.tar.xz
    • cd udevil-0.4.3
    • mv distros/debian
    • execute dpkg-buildpackage
    • If all required packages are installed, this results in udevil_0.4.3-1_armhf.deb. If the build fails due to missing packages, install the missing packages, and re-do the dpkg-buildpackage step
    • Install via sudo dpkg -i udevil_0.4.3-1_armhf.deb

[edit] Samba server / NAS

  • Slow disc performance?
    • see 'Slow USB drives' above
    • use Raspbian, etc without GUI to get as much CPU power for file-transfer as possible (OpenELEC or RaspBMC constantly use about 10-20% CPU load when idle, use top to check!)
  • I don't need sound:
root@pi ~ # cat /etc/modprobe.d/snd-blacklist.conf 
# I don't need sound
blacklist snd
blacklist snd_pcm
blacklist snd_soc_core
blacklist snd_soc_bcm2708_i2s

[edit] Trying to reduce number of disk writes (SD card)

I'm using RRD with a cron job (currently observing pi's temperature and frequency). I hope that my SD card has proper wear-leveling (and currently my 8 GB card is less than half full), so that the frequent writing should not be a problem. But still, I want to reduce the number of writes to the SD card (in order to not bust it's lifetime).

Here's what I've done:

  • Edit /etc/default/cron and set EXTRA_OPTS="-L 0" to disable logging (I don't need these)
  • Avoid entries like pam_unix(cron:session): session closed for user pi in /var/log/auth.log
    • Edit /etc/pam.d/cron and comment the line @include common-session-noninteractive ([1])
or
$local_fs_orig  +mountall +mountall-bootclean +mountoverflowtmp +umountfs
# we need the sym-link data in /var/log and /var/spool to be available
$local_fs       $local_fs_orig +persist-ramdisk
/etc/init.d/persist-ramdisk depends on $local_fs_orig, and the other init-scripts keep their dependency to $local_fs. This ensures that /var/log and /var/spool are ok when starting & stopping other init scripts.
  • set RAMTMP to yes in /etc/default/tmpfs to get tempfs based /tmp

Before changing /tmp:

But still, iostat shows quite some data written to the SD card, according to iotop its jbd2, the ::journaling part of ext4 (pi is 'idle', only some services run, and the ext4 partition is mounted with noatime).
I need to do more digging...

After changing /tmp:

It looks like the unwanted writes to SD are gone. I'll watch it for some time...

[edit] Useful stuff and Q&A

  • Q: Does Raspberry support WOL?
A: No: the Ethernet chip is connected via USB (http://www.raspberrypi.org/forum/viewtopic.php?f=53&t=39714)
  • Q: The new password is to short, or too simple
A: Try adjusting the PAM settings in /etc/pam.d/common-password:
  • remove the 'obscure' setting for pam_unix.so, and add your desired minimum length (e.g. minlen=2)
password [success=1 default=ignore] pam_unix.so sha512 minlen=2
!! This is not recommended if your box is connected to the internet or if it contains private data noone should know !!
But it's nice for testing (if you cannot or do not want to use auto-login.)
  • Q: How to configure static IP?
A: In /etc/network/interfaces:
iface eth0 inet static
address 192.168.0.31
netmask 255.255.255.0
gateway 192.168.0.1
  • Q: How to read core temperature, etc?
A: vcgencmd:
vcgencmd measure_temp
vcgencmd measure_clock arm
  • External USB HDD spin down
    • hdparm does not work with my WD Elements (SG_IO: bad host status: 0x7)
    • hd-idle works:
hd-idle -a sda -i 600
for details, see for example http://blog.is-a-geek.org/festplatten-in-den-standby-modus-versetzen-unter-ubuntu-desktopserver-mit-hd-idle (German)
  • Q: How to avoid update of a certain package?
A: Put package on hold ([2] (German)):
echo <packagename> "hold" | dpkg --set-selections
  • Q: How many bytes are written to my (SD) disc?
A: Use iostat http://www.mybinarylife.net/2012/08/linux-iostat-command.html
A: Use iotop http://guichaz.free.fr/iotop/
A: Raw data of the kernel can be found in files /proc/diskstats and /sys/block/DEVNAME/stat https://www.kernel.org/doc/Documentation/iostats.txt
  • Q: How to reduce number of ext-fs checks?
A: tune2fs -c 60 /dev/sda1 Change maximum mount count to 60
A: tune2fs -i 12m /dev/sda1 Change check interval to 12 months
fore more details: http://wiki.ubuntuusers.de/Dateisystemcheck (German)
  • Q: Fix smsc95xx 1-1.1:1.0: eth0: kevent 2 may have been dropped
A: http://wood1978.techarea.org/~wood/wordpress/2013/04/03/fix-smsc95xx-1-1-11-0-eth0-kevent-2-may-have-been-dropped-on-raspberry-pi-with-arch-linux
Modifying the sysctl.conf values reduced the kevent-2 messages; I did not yet set smsc95xx.turbo_mode=N

[edit] Overclocking

  • I only set overclocking via raspi-config
Luckily, I could recover all my data, see below.
  • Medium: Raspberry is stable. I've observed two file system corruption which might be related to overclocking (see [3] and its links).
  • Underclocking to 600 MHz
echo "600000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
Raspberry was stable for some hours, but it got frozen later on. I don't now if really related to underclocking. As the temperature did not drop significantly (stayed around 45°C), and the Raspberry CPU has no sleep modes either (for power saving), I did not retry.

[edit] Stress test and benchmarks

[edit] SD card issues

After my (Turbo-overclocked) Raspberry fried my 8 GB SD card, I had not hoped to to be able to recover any data, but I tried anyway. The card was only 1 week old, I have not written that much data too it (<4 GB, mainly the Raspbian image). I could still use this card for some time (see below), but finally I got a corrupted file system and could no longer repair it. That's when I re-installed Raspbian on a new SD card.

Maybe I should try running from USB sometime?

[edit] Recovery

  • Creating a binary image of the SD card with my PC using Win32 Disk Imager resulted in IO errors at about 17%.
  • The partition table of my SD card was still ok. I hoped to at least recover some text data of my ext4 partition, and thus I created an image using dd conv=sync,noerror if=/dev/sdb2 of=rasp-image.img bs=1M on my Linux machine (option conv=noerror ignores any errors, sync pads read-errors with zeros). The resulting image could not be mounted using a loop device.
  • Fortunately, fsck.ext4 raspberry-image.bin was able to repair the image, which I then could successfully mount on my Linux machine using mount -o loop rasp-image.img /mnt, and at a first glance, everything looked ok. So, I was at least able to get to my data.
  • On a later 'event', I dd-ed the repaired image back to the Raspberry, and could boot again.
  • On another a later 'event', I just fsck-ed the /dev/sdb2 using Linux, and could boot again... but I did not have luck this time - some files were gone.
  • I was just about to return the SD card, but for curiosity, I tried what happens if I re-install the (original) Raspbian image. To my surprise, Win32 Disk Imager did not report any error. And even more surprising, after writing the image, I was able to create an image of the whole disk without error. It looks like the card remapped some spare sectors.
  • My Raspberry successfully booted from this new image. I then used raspi-config to expand the root-fs (I've done this on my first installation as well). With Linux I was able to dd my repaired image to the repaired SD. The card booted as if nothing had happened...
  • But after some weeks, my Raspberry fried the SD card again, and some weeks later again ... And finally I could not get my pi to boot with this card. However, I can still read the data linux. Moving data to a new card... (easier said than done if the new card is slightly smaller... but, see below for resizing... and sometimes a fresh install is even less painful).

[edit] Reminders: dd, dd_rescue, losetup, mount and others

  • Example partition table printed by fdisk:

/dev/sdb: 7861 MB, 7861174272 bytes, 15353856 sectors
Units = Sektoren of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Gerät  boot.     Anfang        Ende     Blöcke   Id  System
[...]
/dev/sdb3        15288320    15353855       32768   83  Linux
Byte-offset of sdb3: 7827619840 = 15288320 * 512
  • Mount partition to /dev/loopN partition for repair, etc.
losetup -o 7827619840 --find --show /dev/sdb
--show prints the used /dev/loopN device
  • Directly mount partition using loop device:
mount -o loop,offset=7827619840 /dev/sdb /mnt

[edit] Some 1-Wire Stuff

[edit] Temperature Sensor DS1820

  • When copying data via samba, I frequently get read-errors (CRC errors), or device-disconnects (/sys/bus/w1/devices/<id>/w1_slave temporarily not available).
    • Q: Is this due to overclocking with using dynamic governor?
    • A: No - also occurs without overclocking (but less frequent?)
    • Q: Or is this due to voltage-problems?
    • A: No - also occurs without over-voltage
    • Q: Or something else?
    • A: I have the impression that this is connected to electrical problems (e.g. timing, voltage) on my 1-wire when there's a lot of IO (USB, ethernet). Using 3 sensors works almost all the time (without overclocking), but using 4 or more sensors (2 connected star topologies, very bad for 1-wire GUIDELINES FOR RELIABLE LONG LINE 1-WIRE NETWORKS), almost always fails to read values on most of the sensors.
    • A:Implement multiple 1-wire interfaces (see below), using 1 for each star-topology solved the problem. Reading 2x3 works perfect!
    • A: If not adding new devices, disabling 1-wire search after module-loading resolves the device-disconnect issue. Simply put
wire search_count=5
in your /etc/modules (I'm not using DTB) to allow only 5 (initial) searches.

[edit] Multiple 1-wire buses

Add the following to /boot/config.txt:

 dtoverlay=w1-gpio,gpiopin=4
 dtoverlay=w1-gpio,gpiopin=22

[edit] Some 1-wire internals

[edit] Compiling own kernel

  • Some hints on cross-compiling:
  • extract kernel config from image:
scripts/extract-ikconfig kernel-image
  • (extract-ikconfig is part of the kernel sources)
  • newer kernels may store their config in a module: modules/4.*/kernel/kernel/configs.ko

[edit] Device Trees

[edit] What about updates?

As I always forget this

  • apt-get update - update package lists
  • apt-get upgrade - upgrade installed packages
  • rpi-update - update kernel and modules
use SKIP_KERNEL=1 rpi-update to update the RPi firmware, but keep the current kernel
set SKIP_REPODELETE=1 to keep downloaded files (by default: /root/.rpi-firmware)

Kernel Sources

[edit] Hints for reading Kernel Panics

p290:
export CONFIG_DEBUG_INFO=1
make kernel/sysctl.o
objdump -d -S kernel/sysctl.o > kernel/sysctl.dump

or, with my in cross-compiling setup:

DOMAKE drivers/w1/slave/w1_therm.o
${CCPREFIX}objdump -d -S w1_therm.o 

[edit] Attaching a LCD display (HD44780 controller)

[edit] Wiring and Specs

[edit] Misc

[edit] Controlling the display

[edit] LCDProc hints

[edit] Todo and Miscellaneous

[edit] OpenELEC

[edit] Lirc

[edit] Backports

[edit] Collection of misc stuff to check - things I might) try sometime

  • NAS/Samba
  • try adjusting 'socket options' in (/etc/samba/smb.conf) to increase NAS performance: some websites recommend to disable the 'socket options', some recommend to set:
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=65536 SO_SNDBUF=65536

[edit] Things done

[edit] Some links (aka bookmark lists)

Project sites

Blogs, forums, etc

Miscellaneous

Manuals

Personal tools