• Home
  • Help
  • Search
  • Login
  • Register
Pages: [1]
Author Topic: Gentoo on the plug - nice home server finally finished  (Read 4129 times)
moshiach
Guest
« on: April 20, 2009, 12:54:35 PM »

I'll be writing up a much more detailed document for this as I build my second system, but getting Gentoo (not the included gentoo images that is) running on the plug from a usb drive was a pice of cake (although compilation times are crazy.) and I now have a total replacement for my power hungry DHCP/DNS/ Squeezecenter/Samba server/Mysql/NTP computer.

First pass instructions which will be updated later:  You can find good instructions here but I will warn you that it assumes some knowledge of gentoo and how it works.
Tftpboot into kernel uImage.2009.0319 with the "normal" filesystem included on the cd or in Distribution 1.1.  Forget Ubuntu and the newest kernel for now.
Once you are at the -sh-3.12- prompt set the current date with date MMDDHHMMYY    (This is important)
Setup your usb drive/SD card (you might need a different kernel for the SD drive)  I suggest keeping the USB drive as ext2 instead of ext3 or at least partitioning it into swap, boot and root and make boot ext2.
Get the latest stage3-arm5tel from one of the gentoo mirrors.
mkdir /mnt/usb
tar xvjpf stage3-arm5tel* -C /mnt/usb
mount -t proc proc /mnt/usb/proc
mount -o bind /dev /mnt/usb/dev
cp /etc/resolv.conf /mnt/usb/etc/resolv.conf
chroot /mnt/usb /bin/bash
env-update && source /etc/profile  (might complain about selinux)

at this point you are now in the Gentoo fs on your USB drive.   There are some things that need to be configured (hostname, net,etc) and some packages that need to be installed (go get some tea....from china) plus the kernel sources which I will detail as soon as I have my 2nd plug working.

The hardest part was getting squeezecenter to work.  The packages in gentoo won't compile properly (mostly it's the support packages from dev-perl) so I downloaded the latest squeezecenter-noCPAN and used that.

Great device.  I've had it running my system for hte last 72 hours and had only one strange reboot this morning at 8:25 that I can't track a reason down for.  I've decided to have a cron job reboot hte server every 2 days at 5:20 in the morning.
Logged

Rabeeh Khoury
Administrator
Full Member
*****

Karma: 5
Posts: 218


View Profile
« Reply #1 on: April 20, 2009, 01:12:22 PM »

Great news. Feel free to post on the wiki any important information you need.
Why to reboot every 2 days? I have the device stable for weeks.
Logged

moshiach
Guest
« Reply #2 on: April 20, 2009, 02:07:27 PM »

The reboot every 2 days is just to figure out why it might be rebooting by itself after 72 hours.  I came in this morning and found it had rebooted and not fully booted properly.  The line in "last reboot"  just says :
reboot   system boot  2.6.30-rc1       Mon Apr 20 08:26          (02:24)
reboot   system boot  2.6.30-rc1       Mon Jul 10 10:18         (17450+21:07

And strangely enough the reboot reset the hwclock to a date in the past.

From /var/log/message:
Apr 20 08:25:43 src@tyr.midgaard.home shutdown[4889]: shutting down for system reboot
3693-Apr 20 08:25:32 src@tyr.midgaard.home dnsmasq[3682]: DHCPACK(eth0) 192.168.1.56 00:0f:1f:12:45:9e PGARDNER1
3694:Apr 20 08:25:43 src@tyr.midgaard.home shutdown[4889]: shutting down for system reboot
3695-Apr 20 08:25:43 src@tyr.midgaard.home init: Switching to runlevel: 6
3696-Apr 20 08:25:50 src@tyr.midgaard.home xinetd[4651]: Exiting...
3697-Apr 20 08:25:53 src@tyr.midgaard.home nmbd[4349]: [2009/04/20 08:25:53, 0] nmbd/nmbd.c:terminate(58)
3698-Apr 20 08:25:53 src@tyr.midgaard.home nmbd[4349]:   Got SIGTERM: going down...
3699-Apr 20 08:25:54 src@tyr.midgaard.home rsyncd[4278]: rsync error: received SIGINT, SIGTERM, or SIGHUP (code 20) at rsync.c(544) [receiver=3.0.5]
3700-Apr 20 08:25:55 src@tyr.midgaard.home ntpd[2898]: ntpd exiting on signal 15
3701-Apr 20 08:25:58 src@tyr.midgaard.home dnsmasq[3682]: DHCPRELEASE(eth0) 192.168.1.32 00:09:6e:06:23:7e
3702-Apr 20 08:26:01 src@tyr.midgaard.home sshd[3967]: Received signal 15; terminating.
3703-Apr 20 08:26:02 src@tyr.midgaard.home syslog-ng[3897]: Termination requested via signal, terminating;
3704-Apr 20 08:26:02 src@tyr.midgaard.home syslog-ng[3897]: syslog-ng shutting down; version='2.1.3'

No power outage, the kernel just decided to reboot.


Logged

karurosu
Global Moderator
Full Member
*****

Karma: 0
Posts: 116



View Profile WWW
« Reply #3 on: April 20, 2009, 03:39:14 PM »

Hi, nice work.
I am curious, what do think its needed to boot from SD?
Additionally, would it be better to have the boot and config on the NAND and mount the SD at /etc (also, get another big USB and mount it under /home)?
Logged

moshiach
Guest
« Reply #4 on: April 20, 2009, 04:02:21 PM »

I can't speak to SD, I don't use it myself.  But I understand that the burrent Uboot might not support it.

I boot my kernel from nand and use the usb for my rootfs.  I've found the usb system through uboot to be unstable .
Logged

dattaway
Jr. Member
**

Karma: 5
Posts: 91



View Profile WWW
« Reply #5 on: April 20, 2009, 04:28:41 PM »

Thanks for the writeup!  I'm waiting for my plug.

I run gentoo on an ARM9 embedded board and it runs nice, especially with distcc and a USB hard drive swap.  I tried flash swap for fun to see if I could destroy it, but it ran flawlessly for a few months (although very very slow.)  I'm thinking power supply noise might have something to do with the problems I'm reading.
Logged

Rabeeh Khoury
Administrator
Full Member
*****

Karma: 5
Posts: 218


View Profile
« Reply #6 on: April 20, 2009, 09:59:24 PM »

Can you please provide full log of the from the serial console?
Execute 'dmest -n 8' to get the serial console getting all kernel messages.
Logged

moshiach
Guest
« Reply #7 on: April 20, 2009, 10:44:12 PM »

I've set dmesg to level 8.  Unfortunately of course the dmesg output from the crash is gone and I';m left with just what got piped into mysql (I log everything to mysql)  And of course that just shows that the system was rebooted, with nothing obvious before that.  I've just rebooted and here is the log from the console from a successful boot.
Code:
Linux version 2.6.30-rc1 (root@netboot) (gcc version 4.1.2 (Gentoo 4.1.2 p1.3))
#1 PREEMPT Thu Apr 16 01:58:07 PDT 2009
CPU: Feroceon 88FR131 [56251311] revision 1 (ARMv5TE), cr=00053177
CPU: VIVT data cache, VIVT instruction cache
Machine: Marvell SheevaPlug Reference Board
Memory policy: ECC disabled, Data cache writeback
On node 0 totalpages: 131072
free_area_init_node: node 0, pgdat c049ad88, node_mem_map c055e000
  Normal zone: 1024 pages used for memmap
  Normal zone: 0 pages reserved
  Normal zone: 130048 pages, LIFO batch:31
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 130048
Kernel command line: console=ttyS0,115200 mtdparts=orion_nand:0x100000@0x00000(u
Boot)ro,0x500000@0x100000(uImage),-(rootfs) root=/dev/sda2 rw rootdelay=10 ip=19
2.168.1.6:192.168.1.2:192.168.1.1:255.255.255.0:Tyr:eth0:none
NR_IRQS:114
PID hash table entries: 2048 (order: 11, 8192 bytes)
Console: colour dummy device 80x30
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
Memory: 256MB 256MB = 512MB total
Memory: 514048KB available (4280K code, 934K data, 116K init, 0K highmem)
SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Calibrating delay loop... 1192.75 BogoMIPS (lpj=5963776)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
net_namespace: 520 bytes
NET: Registered protocol family 16
Kirkwood: MV88F6281-A0, TCLK=200000000.
Feroceon L2: Enabling L2
Feroceon L2: Cache support initialised.
initial MPP regs: 01111111 11113322 00001111 00100000 00000000 00000000 00000000
  final MPP regs: 01111111 11113322 00001111 00000000 00000000 00000000 00000000
bio: create slab <bio-0> at 0
SCSI subsystem initialized
libata version 3.00 loaded.
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
cfg80211: Using static regulatory domain info
cfg80211: Regulatory domain: US
(start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
(2402000 KHz - 2472000 KHz @ 40000 KHz), (600 mBi, 2700 mBm)
(5170000 KHz - 5190000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
(5190000 KHz - 5210000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
(5210000 KHz - 5230000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
(5230000 KHz - 5330000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
(5735000 KHz - 5835000 KHz @ 40000 KHz), (600 mBi, 3000 mBm)
NET: Registered protocol family 2
IP route cache hash table entries: 16384 (order: 4, 65536 bytes)
Switched to high resolution mode on CPU 0
TCP established hash table entries: 65536 (order: 7, 524288 bytes)
TCP bind hash table entries: 65536 (order: 6, 262144 bytes)
TCP: Hash tables configured (established 65536 bind 65536)
TCP reno registered
NET: Registered protocol family 1
cfg80211: Calling CRDA for country: US
NTFS driver 2.1.29 [Flags: R/O].
JFFS2 version 2.2. (NAND) 2001-2006 Red Hat, Inc.
msgmni has been set to 1004
alg: No test for stdrng (krng)
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered (default)
Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
serial8250.0: ttyS0 at MMIO 0xf1012000 (irq = 33) is a 16550A
console [ttyS0] enabled
loop: module loaded
Driver 'sd' needs updating - please use bus_type methods
MV-643xx 10/100/1000 ethernet driver version 1.4
mv643xx_eth smi: probed
net eth0: port 0 with MAC address 00:50:43:01:c1:a4
libertas_sdio: Libertas SDIO driver
libertas_sdio: Copyright Pierre Ossman
NAND device: Manufacturer ID: 0xad, Chip ID: 0xdc (Hynix NAND 512MiB 3,3V 8-bit)
Scanning device for bad blocks
Bad eraseblock 938 at 0x000007540000
Bad eraseblock 3528 at 0x00001b900000
3 cmdlinepart partitions found on MTD device orion_nand
Creating 3 MTD partitions on "orion_nand":
0x000000000000-0x000000100000 : "uBoot"
0x000000100000-0x000000600000 : "uImage"
0x000000600000-0x000020000000 : "rootfs"
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
orion-ehci orion-ehci.0: Marvell Orion EHCI
orion-ehci orion-ehci.0: new USB bus registered, assigned bus number 1
orion-ehci orion-ehci.0: irq 19, io mem 0xf1050000
orion-ehci orion-ehci.0: USB 2.0 started, EHCI 1.00
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
usbcore: registered new interface driver ums-datafab
usbcore: registered new interface driver ums-freecom
usbcore: registered new interface driver ums-jumpshot
usbcore: registered new interface driver ums-sddr09
usbcore: registered new interface driver ums-sddr55
mice: PS/2 mouse device common for all mice
rtc-mv rtc-mv: rtc core: registered rtc-mv as rtc0
i2c /dev entries driver
mmc0: mvsdio driver initialized, lacking card detect (fall back to polling)
Registered led device: plug:green:health
mv_xor_shared mv_xor_shared.0: Marvell shared XOR driver
mv_xor_shared mv_xor_shared.1: Marvell shared XOR driver
mv_xor mv_xor.0: Marvell XOR: ( xor cpy )
mv_xor mv_xor.1: Marvell XOR: ( xor fill cpy )
mv_xor mv_xor.2: Marvell XOR: ( xor cpy )
mv_xor mv_xor.3: Marvell XOR: ( xor fill cpy )
usbcore: registered new interface driver usbhid
usbhid: v2.6:USB HID core driver
oprofile: using timer interrupt.
TCP cubic registered
NET: Registered protocol family 17
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
lib80211: common routines for IEEE802.11 drivers
lib80211_crypt: registered algorithm 'NULL'
rtc-mv rtc-mv: setting system clock to 2009-04-21 05:34:35 UTC (1240292075)
usb 1-1: new high speed USB device using orion-ehci and address 2
usb 1-1: configuration #1 chosen from 1 choice
scsi0 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 2
usb-storage: waiting for device to settle before scanning
input: Western Digital My Book as /devices/platform/orion-ehci.0/usb1/1-1/1-1:1.
1/input/input0
generic-usb 0003:1058:1102.0001: input: USB HID v1.11 Device [Western Digital My
 Book] on usb-orion-ehci.0-1/input1
IP-Config: Complete:
     device=eth0, addr=192.168.1.6, mask=255.255.255.0, gw=192.168.1.1,
     host=Tyr, domain=, nis-domain=(none),
     bootserver=192.168.1.2, rootserver=192.168.1.2, rootpath=
Waiting 10sec before mounting root device...
eth0: link up, 1000 Mb/s, full duplex, flow control disabled
scsi 0:0:0:0: Direct-Access     WD       My Book          1025 PQ: 0 ANSI: 4
usb-storage: device scan complete
usb-storage: device scan complete
sd 0:0:0:0: [sda] 976773168 512-byte hardware sectors: (500 GB/465 GiB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Mode Sense: 10 00 00 00
sd 0:0:0:0: [sda] Assuming drive cache: write through
sd 0:0:0:0: [sda] Assuming drive cache: write through
 sda: sda1 sda2
sd 0:0:0:0: [sda] Attached SCSI disk
VFS: Mounted root (ext2 filesystem) on device 8:2.
Freeing init memory: 116K
sd 0:0:0:0: Attached scsi generic sg0 type 0
uncorrectable error : <3>end_request: I/O error, dev mtdblock0, sector 0
Buffer I/O error on device mtdblock0, logical block 0
uncorrectable error : <3>uncorrectable error : <3>end_request: I/O error, dev mt
dblock0, sector 8
Buffer I/O error on device mtdblock0, logical block 1
uncorrectable error : <3>end_request: I/O error, dev mtdblock0, sector 16
Buffer I/O error on device mtdblock0, logical block 2
uncorrectable error : <3>end_request: I/O error, dev mtdblock0, sector 24
Buffer I/O error on device mtdblock0, logical block 3
uncorrectable error : <3>end_request: I/O error, dev mtdblock0, sector 0
Buffer I/O error on device mtdblock0, logical block 0
Adding 1060248k swap on /dev/sda1.  Priority:-1 extents:1 across:1060248k

Nothing unusual in there except the Buffer I/O on mtd0 (uBoot image).  No core dump was made, it's like the system just said screw it, I'm going to reboot.  And just to really screw you up I'm going to set the date to July 10th, 1961.  Go figure. 
Logged

Rabeeh Khoury
Administrator
Full Member
*****

Karma: 5
Posts: 218


View Profile
« Reply #8 on: April 21, 2009, 12:48:27 AM »

If you get a kernel panic then it never gets to be logged neither in /var/log/messages, or mysql.
the kernel simply prints the panic message on the serial port and reboots.

thats why you need a serial port hooked all the time with highest level of debug messages to be directly printed on the serial console.
i know it's a pain since you might need to wait 2 days.

withregards /dev/mtd0, the main problem is that u-boot generates 4 bit ECC and linux supports 1 bit ECC. Look at rshitrit's email about that -
http://openplug.org/plugforum/index.php?topic=117.msg654#msg654
Logged

moshiach
Guest
« Reply #9 on: April 21, 2009, 08:00:26 AM »

I've got a the sheeva plugged into my brand spanking new usb terminal server slug (I'm so proud that I finally found a use for that POS) so I'll let you know if I get another crash.
Logged

Pages: [1]
Print
Jump to: