Raspberry Pi: Kernel Panic – Part II

So, after the yesterday experiences – Using more SDRAM to system and less in GPU – the kernel panic still happens.

Had seen a lot of people talking about heavy processes, and i think it must be connected, because system running idle hasn’t any problems.

So, as for today i’ve tryed a different approach: after reading some things about the interrupts in excess for such a machine – about 8000 getted with vmstat – and some saying it’s normal, and it’s related to the NIC driver from Broadcom which is using about 20% of resources, and while a new driver does’t appear, i’ve tryed a firmware update.

So, we’ve got a new kernel as i can see, and possible some more things. The upgrade firmware is quite easy to do, just follow the instructions where: https://github.com/Hexxeh/rpi-update

So at this point:

edurao@raspberrypi:~$ vmstat
procs ———–memory———- —swap– —–io—- -system– —-cpu—-
r b swpd free buff cache si so bi bo in cs us sy id wa
0 0 0 90272 40652 44264 0 0 0 0 402 142 17 3 79 1
edurao@raspberrypi:~$ uname -a
Linux raspberrypi 3.1.9+ #101 PREEMPT Mon Jun 4 17:19:44 BST 2012 armv6l GNU/Linux

Until now system looks stable, in this 3 hours… let’s see if it handles our stuff.

We’ve some heavy processes running using about 30% CPU, and since they’re threaded i think this could be the potential problem with the kernel panic  interrupt fatality, but it’s kind of a wild guess…

top – 13:47:12 up 3:11, 1 user, load average: 0.28, 0.25, 0.27
Tasks: 63 total, 1 running, 62 sleeping, 0 stopped, 0 zombie
Cpu(s): 19.8%us, 3.3%sy, 0.0%ni, 74.6%id, 1.0%wa, 0.0%hi, 1.3%si, 0.0%st
Mem: 223048k total, 132824k used, 90224k free, 40692k buffers
Swap: 0k total, 0k used, 0k free, 44264k cached

Will update these random thoughts with more news when some stability is achieved

Playing around with a Raspberry Pi: Kernel Panic & Memory

Well, after some day to day usage in a project, system seems to be not responding after about a day. At most, we think that, but since we hadn’t any TV with HDMI nearby to try to see if output give’s something, we had think that system was down.

So, some things appeared to check:

– System Logs – nothink special, in one day complainting about a fail with NTP server, and system had loose time.

– Kernel Logs – some debug messages but nothing special

– Network – a message which indicates a fail to renew the dhcp lease was a bit suspicious.

– Power supply not enough stabled – had bought a PSU in a retail store nearby (Jumbo) from about 3.99€ which don’t had the lead, but outputs 5V 1000mA in a USB format. So used my micro usb data cable to powered the system, but had strange feeling that some fluctuations in voltage can cause an inpredictable behaviour.

Pinging it from the network given ping timeout, but i had the feeling that was not it: LNK light blinked when i pinged it.

Yesterday we’re working on the project and after some Git’ting to raspberry and put in production new thinks system hanged! WoW… so i had remembered that i have a old TV CRT in our guests bedroom, so we’ve had to try it now i thinked, and after connected the raspberry Pi to TV, the results we’re obvious:

IMG_20120608_225844

The message was in there – “white” and clear – kernel panic – not syncing: Fatal exception in interrupt

So it was a kernel problem…. system hanged out.  No network, so SSH to the Pi or http over it would not work of course.

So i’d think about power, and the arduino connected to the Pi’s USB port, feeding up through there.

After some Googling catched this, and Power comes in out way. Power and resources….

So disconnected Arduino and will test this all night. Wasn’t passed much time, and about 2 AM GMT before going to bed, i had seen the system is irresponsive…. So the Arduino was not the issue.

So to debug the power question, and to see the voltage being supplied to the circuit we only had to put the two voltimeter leads in holes TP1 and TP2 and red the value.

IMG_20120609_105953

So by this nothing weird.. 4.93V. Turning up our “heavy” process this turns down to 4.91V.. meh..

One other question referred was the system hanged with some heavy processes: people using torrents and other stuff complaining about it.

So, there’s a way to give the Pi more RAM taking it from the GPU. So if you don’t want 3D stuff and neat video processing, you can do this as the say. I believe this must be affecting it. A 700MHz CPU and 256 Mb SDRAM should be enought to a lot of things. It’s not a top performance device, but it has a lot to give away, specially with a 35$ price.

So in /boot there’re a couple of files:

pi@raspberrypi:/boot$ ls -lar

total 30076
-rwxr-xr-x 1 root root 2029700 Jun 9 11:10 start.elf
-rwxr-xr-x 1 root root 314691 Apr 19 08:58 loader.bin
-rwxr-xr-x 1 root root 3890436 Apr 19 08:58 kernel.img
-rwxr-xr-x 1 root root 16412020 Apr 19 08:58 kernel_emergency.img
-rwxr-xr-x 1 root root 26 Apr 19 08:58 issue.txt
-rwxr-xr-x 1 root root 124 Apr 19 08:58 cmdline.txt
-rwxr-xr-x 1 root root 273 Apr 19 08:58 boot.rc
-rwxr-xr-x 1 root root 16528 Apr 19 08:58 bootcode.bin
-rwxr-xr-x 1 root root 2029700 Apr 19 08:58 arm224_start.elf
-rwxr-xr-x 1 root root 2029700 Apr 19 08:58 arm192_start.elf
-rwxr-xr-x 1 root root 2029700 Apr 19 08:58 arm128_start.elf
drwxr-xr-x 23 root root 4096 May 6 2011 ..
drwxr-xr-x 2 root root 1024 Jan 1 1970 .

Just copy arm224_start.elf to start.elf and reboot. I’d made a backup from the original, but seems that start.elf is arm192_start.elf:

pi@raspberrypi:/boot$ sudo cp /boot/start.elf /boot/start.elf.orig

pi@raspberrypi:/boot$ sudo cp /boot/arm224_start.elf /boot/start.elf

pi@raspberrypi:/boot$ sudo reboot

 

And that’s it…. now let’s see if this solves our hangups.

Notes:: Raspberry Pi SDCard Resize

This is a note in my log, very handy if in future we need to resize the SDCard for use in any Raspberry Pi or other similar device.

In my case i have a Samsung SDHC 8GB class 6, so you need to use this adapted to yours:

samsung_8gb_sdhc_card

Source for the cheat is:  http://elinux.org/RPi_Easy_SD_Card_Setup

It’s not a very difficult task, and if you have any Ubuntu at your computer you can do this easily.

You only have to determine wher’s the card mounted in your pc, and to do that, after inserting the card in the reader, at a terminal just issue the command “df” which will give you the filesystem mount points. From there you can see where is the card. In my netbook it was mounted at /dev/sdb so i will you that below.

 

  • Use parted to examine the card
$ sudo parted /dev/sdb
(parted) unit chs
(parted) print
Disk /dev/sdb: 121535,3,31
Sector size (logical/physical): 512B/512B
BIOS cylinder,head,sector geometry: 121536,4,32.  Each cylinder is 65.5kB.
Partition Table: msdos

Number  Start      End         Type     File system     Flags
 1      16,0,0     1215,3,31   primary  fat32           lba
 2      1232,0,0   26671,3,31  primary  ext4
 3      26688,0,0  29743,3,31  primary  linux-swap(v1)
This shows how my SD card was formatted after writing the image. Notice that nothing uses the card from end of ‘cylinder’ 29743 to the card’s maximum at 121535.
Partition 1 is the boot partition: we’ll leave that alone. Partition 2 is the root partition, which we’ll grow to fill most of the card. Partition 3 is the swap space, which needs to be moved to the end of the card. Note that on some other versions of linux (and some other versions of hardware) use /sde not /sdb.
  • Move the swap partition (you’ll have to adjust the numbers so that the end of partition 3 is at the end cylinder/head/sector of the card)
  • to calculate the number to use in the following command do:- (Maximum - (Partition 3 End - Partition 3 Start) ) - 1 = Partition 3 New Start so in this example (121535 - ( 29743 - 26688)) -1 = 118479
(parted) move 3 118479,0,0
  • Now grow the root partition. This involves removing the partition, re-creating it, then using resize2fs to grow the filesystem to fill the partition. It won’t destroy any data.
(parted) rm 2
(parted) mkpart primary 1232,0,0 118478,3,31
(parted) quit
Note that the starting address of the new partition is identical to its original value, and the ending address is immediately before the start of the swap partition.
  • Now clean and resize the root partition. As before, some users may need to use /sde2 instead.
$ sudo e2fsck -f /dev/sdb2
(allow it to add lost-and-found)
$ sudo resize2fs /dev/sdb2
  • Then put the card in the RPi and boot. You end up with a 7Gb partition to use.
pi@raspberrypi:~$ df -h
Filesystem            Size  Used Avail Use% Mounted on
tmpfs                  94M  4.0K   94M   1% /lib/init/rw
udev                   10M  168K  9.9M   2% /dev
tmpfs                  94M     0   94M   0% /dev/shm
rootfs                7.1G  1.3G  5.4G  20% /
/dev/mmcblk0p1         75M   28M   48M  37% /boot