Although Sheevaplug has appeared to be not particularly reliable piece of hardware (this claim is based on personal experience and numerous reports of other users), it is a great fun as well, so I gave it next (the last one) chance and have bought another new plug to replace the broken one.
I planned to use SDHC card with Debian which worked seamessly with my previous plug computer, so I follow the procedure described below.
Connect PC to Sheevaplug with USB-miniUSB cable
Turn on the plug computer.
Run cu:
cu -s 115200 -l /dev/ttyUSB0
press any key. In response to boot loader prompt type:
Marvel>> version U-Boot 1.1.4 (Dec 27 2009 - 22:03:21) Marvell version: 3.4.27
The u-boot boot loader have to be upgraded before installing Debian
(cf.
http://www.cyrius.com/debian/kirkwood/sheevaplug/uboot-upgrade.html
).
Copy the U-Boot binary u-boot.kwb
to a USB stick formated with the FAT filesystem.
Plug the USB stick into a plug computer, connect the serial console and type the following commands:
usb start fatload usb 0:1 0x0800000 u-boot.kwb nand erase 0x0 0x60000 nand write 0x0800000 0x0 0x60000
Regardless of how U-Boot was installed, one have to restart the machine to load the new version of U-Boot:
reset
Boot the system (cf.
http://www.cyrius.com/debian/kirkwood/sheevaplug/unpack.html
).
Configure the boot loader now. First of all, one has to change a setting so the device will boot the kernel which is used by Debian:
setenv mainlineLinux yes setenv arcNumber 2097 saveenv reset
Restart the device so the changes will take effect. Now configure the machine to boot:
setenv bootargs_console console=ttyS0,115200 setenv bootargs_root 'root=/dev/mmcblk0p2' setenv bootcmd_mmc 'mmc init; ext2load mmc 0:1 0x00800000 /uImage; ext2load mmc 0:1 0x01100000 /uInitrd' setenv bootcmd 'setenv bootargs $(bootargs_console) $(bootargs_root); run bootcmd_mmc; bootm 0x00800000 0x01100000' saveenv
At this point SheevaPlug is ready to boot Debian automatically from SD card.
So, I inserted
my SDHC card with Debian 5.0 installed some 2 years ago and tried to connect via ssh
.
ssh -l <user> 192.168.1.88 Linux neptune.pinkaccordions.org 2.6.30-5-kirkwood #1 Wed Jan 12 15:27:07 UTC 2011 armv5tel
System is up and running so it seems reusing SDHC card with old Debian installation was sucessfull, but shortly I discovered there were problems...
System clock is terribly fast and
there are problems communicating with USB port. Upon consulting google I have discovered
kernel upgrade is recommended (cf.
http://www.cyrius.com/debian/kirkwood/sheevaplug/boot.html
and
http://www.cyrius.com/journal/debian/kirkwood/sheevaplug/
):
apt-get update apt-get dist-upgrade flash-kernel
First command generated lots of 404 errors because Lenny is not supported anymore (I was not aware of that).
I decided not to upgrade
to Lenny
and fixed /etc/apt/sources.list
instead
(cf.
http://superuser.com/questions/404806/did-debian-lenny-repositories-vanish
):
deb http://archive.debian.org/debian/ lenny main non-free contrib deb-src http://archive.debian.org/debian/ lenny main non-free contrib # Volatile: deb http://archive.debian.org/debian-volatile lenny/volatile main contrib non-free deb-src http://archive.debian.org/debian-volatile lenny/volatile main contrib non-free # Backports: deb http://archive.debian.org/debian-backports lenny-backports main contrib non-free # Previously announced security updates: deb http://archive.debian.org/debian-security lenny/updates main
Then, apt-get dist-upgrade
and flash-kernel
was completed
without errors.
After reboot, system works fine. I plan to upgrade it to Squeeze in the nearest future.
The moral from the story is: with God's and Google help one has not to be an expert to cope with running Linux.
Uruchomiłem na Szewie #2 serwer WWW,
dostępny pod adresem
pinkaccordions.homelinux.org
(darmowa domena z serwisu
dyndys.com -- w moim przypadku konieczność, bo mam
tzw. zmienne IP). Jak już jest serwer, to trzeba robić -- w sposób
systematyczny, a nie ad hoc -- kopie zapasowe na wypadek gdyby, np. karta padła
(co podobno nie jest takie rzadkie...). Po konsultacji z tym co w tym temacie
proponują inni postanowiłem robić to za pomocą rsync
a, uruchamianego z zewnętrznego
komputera.
W tym celu trzeba zainstalować rsync na obu komputerach źródłowym i tym, na którym będzie tworzona kopia:
apt-get install rsync
Teraz należy skonfigurować rsync
po stronie
źródła (czyli tego komputera, z którego mają być
kopiowane dane) modyfikując /etc/rsyncd.conf
.
Zawartość pliku /etc/rsyncd.conf
w moim przypadku wygląda następująco:
## http://encodable.com/tech/blog/2005/10/13/Secure_Remote_Backups_via_rsync uid = 0 gid = 0 hosts allow = ***** transfer logging = no read only = yes [wholefs] path = / comment whole root fs [pinkaccordions] path = /var/www_pinkaccordions/ comment pinkaccordions www
Można sprawdzić czy działa (neptune
jest zadeklarowany w /etc/hosts
):
rsync neptune::wholefs/
Tworzenie kopii realizuje skrypt
rsync_neptune.sh
uruchamiany po stronie przeznaczenia:
#!/bin/bash SOURCE=neptune::wholefs/ EXCLUDE=/root/.rsync/backup_exclude.lst DESTDIR=/backup/neptune/rootfs echo "=== Syncing ${SOURCE} at `date` ===" rsync -av --exclude-from=${EXCLUDE} --delete ${SOURCE} ${DESTDIR}
Plik $EXCLUDE
zawiera te katalogi, które nie powinny
-- z oczywistych względów -- być kopiowane (zawartości katalogów
/proc
, /sys
oraz /tmp
):
## Exclude - /proc/* - /sys/* - /tmp/*
Skrypt rsync_neptune.sh
jest zaś uruchamiany
poprzez cron
a:
0 4 * * 7 /root/bin/rsync_neptune.sh >> /root/logs/RSync/RSync.log 2>&1
Idea jest taka: kopia całego rootfs
z karty SDHC
ma być wykonywana na dysk USB raz w tygodniu (z innego komputera, konkretnie Szewy #1).
W razie potrzeby (awarii karty SDHC) kopia ta może być
szybko przeniesiona na inną kartę SDHC... Można też kopiować bezpośrednio
na kartę SDHC wsadzoną na zicher w czytnik kart, ale nie widzę sensu podłączania
czytnika wyłącznie i tylko po to, żeby w razie awarii, mieć kopię karty
od razu a nie po 3 minutach.
Zatem:
#!/bin/bash EXCLUDE=/root/.rsync/backup_exclude.lst SOURCE=/public/sheeva/backup/neptune/rootfs/ DESTDIR=/media/sd_backup # http://www.cyberciti.biz/tips/shell-root-user-check-script.html # Make sure only root can run our script if [ "$(id -u)" != "0" ]; then echo "This script must be run as root" 1>&2 ; exit 1 fi ## sprawdz czy karta jest w czytniku i jest zamontowana if [ -d "$DESTDIR" ] ; then echo "** OK: $DESTDIR!" else echo "** ERROR: $DESTDIR not mounted!"; exit 1; fi rsync -av --exclude-from=${EXCLUDE} --delete ${SOURCE} ${DESTDIR}
No i tu porażka:
rsync: readlink_stat("/media/sd_backup/etc/shadow") failed: Input/output error (5) rsync: readlink_stat("/media/sd_backup/etc/resolv.conf") failed: Input/output error (5) rsync: recv_generator: failed to stat "/media/sd_backup/etc/resolv.conf": Input/output error (5) rsync: recv_generator: failed to stat "/media/sd_backup/etc/shadow": Input/output error (5) rsync: recv_generator: failed to stat "/media/sd_backup/etc/network/run/ifstate": Input/output error (5) rsync: recv_generator: failed to stat "/media/sd_backup/var/lib/urandom/random-seed": Input/output error (5) rsync: recv_generator: failed to stat "/media/sd_backup/var/log/lastlog": Input/output error (5) rsync: recv_generator: failed to stat "/media/sd_backup/var/run/dhclient.eth0.pid": Input/output error (5) rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1058) [sender=3.0.5]
Trefne pliki (w liczbie sześciu, jak widać) mają długość 0 bajtów,
a próba np. ls -li /media/sd_backup/etc/shadow
powoduje
komunikat I/O error
. Usunąć tego też się nie da
(rm -f
nie daje rady)...
Wobec powyższego, sformatowałem partycję i wykonałem kopię za
pomocą następującego polecenia wykorzystując tar
a:
tar cf - . | (cd /media/sd_backup/; tar xvpf - ) 2> ../../tar.log
Po wsadzeniu kopii zamiast oryginału do Szewy, system wydaje się działać.
Czemu rsync
zawiódł nie wiem (na razie)...
Dopisane 27 maja 2010 (po południu):
Log tara
(2> ../../tar.log
) zawierał masę wpisów:
implausibly old time stamp 1960-04-13 04:17:36. Data jest absurdalna. Żeby było śmieszniej
w systemie była inna (w przód 2028 rok -- licznik się przekręcił tar
owi?).
Pliki z błędnym czasem modyfikacji były głównie
w katalogach /dev/
/var/
oraz /etc/
; wygląda jakby w czasie
inicjalizacji, przed uruchomieniem ntpdate
,,fabryczny'' zegar
Szewy wskazywał coś dziwacznego.
Czasy poprawiłem touch
em. Zrobiłem rsync
na dysk, a potem z dysku
na kartę zapasową. Tym razem błędów nie było...
Dopisane 10 Kwietnia 2011:
Poprawiłem skrypt rsync_neptune.sh
na
możliwą okoliczność wykonania kopii z uszkodzonych danych.
W nowej wersji tworzone są trzy kopie
z dwutygodniowym horyzontem czasowym:
#!/bin/bash # rsync_neptune.sh (wersja poprawiona) SOURCE=neptune::wholefs/ EXCLUDE=/root/.rsync/backup_exclude.lst DESTDIR=/public/sheeva/backup/neptune/rootfs COPYDIR=/public/sheeva/backup/neptune ### Zachowaj stara kopie pod inna nazwa: cp -f ${COPYDIR}/1week.tar.gz ${COPYDIR}/2week.tar.gz ### Zachowaj stare dane (sprzed tygodnia): tar -zcPf ${COPYDIR}/1week.tar.gz ${DESTDIR} echo "=== Syncing ${SOURCE} at `date` ===" rsync -av --exclude-from=${EXCLUDE} --delete ${SOURCE} ${DESTDIR}
Powinienem w ciągu dwóch tygodni się połapać, że coś jest nie tak, np. z kartą.