Shuttle kd20 - bricked

christiaan
Posts: 16
Joined: Sat Sep 13, 2014 8:25 am

Re: Shuttle kd20 - bricked

Post by christiaan » Mon Sep 15, 2014 6:51 pm

wicked wrote:
christiaan wrote:...to create a partition on the disk. FYI the only thing I've got going on right now is the KD20 not booting up and hanging with just a blue light. And when I remove the disk it boots from the nand.
So I still have a long way ahead I guess, I've had trouble opening up the case otherwise I might have the stuff laying around to fix a serial cable.
and your disk has ms-dos or gpt partition table ?
ms-dos, its just a 160 GB drive for testing so I don't need gpt for now.

wicked
Posts: 79
Joined: Tue May 21, 2013 10:49 pm

Re: Shuttle kd20 - bricked

Post by wicked » Mon Sep 15, 2014 7:00 pm

christiaan wrote:
wicked wrote:
christiaan wrote:...to create a partition on the disk. FYI the only thing I've got going on right now is the KD20 not booting up and hanging with just a blue light. And when I remove the disk it boots from the nand.
So I still have a long way ahead I guess, I've had trouble opening up the case otherwise I might have the stuff laying around to fix a serial cable.
and your disk has ms-dos or gpt partition table ?
ms-dos, its just a 160 GB drive for testing so I don't need gpt for now.
well, so Ive re-done the procedure, added those three command afterwards but no progress :/
Any ideas why ?

Mijzelf
Posts: 6203
Joined: Mon Jun 16, 2008 10:45 am

Re: Shuttle kd20 - bricked

Post by Mijzelf » Mon Sep 15, 2014 7:21 pm

wicked, you write you edited /etc/rc. As far as I can find it's never called.

But to be honest, it's not clear to me how the boot procedure works. Initrd is loaded, and /linuxrc is executed.

Normally I'd expect it to mount the 'real rootfs', the ubifs in flash, in this case, and call switch_root, pivot_root or chroot to get that rootfs active, and in most cases /sbin/init in the new rootfs is called.

Another approach (seen in IomegaEMC and ZyXEL) is to keep the initrd, and mount the main part of the firmware on /usr, or something like that.

In this case /linuxrc seems to have as main function to update the firmware. And the script ends with:

Code: Select all

echo "End of InitRD -- transfer to /sbin/init" 1>&2
umount /proc
umount /sys
# End of file
So apparently /sbin/init is expected to be called when /linuxrc ends. /sbin/init is a symlink to busybox, and the busybox init a light version of SystemV Init. There is no /etc/inittab, so it's perfectly possible that /etc/rc will be called. But I still can't find the ubifs being invoked anywhere.

What I *do* see, is that some network related modules are loaded, mii.ko and gmac.ko. But those modules are not available in initrd, only in the real rootfs!
BTW, I think the bootscripts are sloppy. It's hard to read, no functions are used, and it seems the same actions are repeated over and over.

In your case I would mount a partition early in /linuxrc, and redirect stderr and stdout:

Code: Select all

mkdir -p /log
mount /dev/sda1 /log
exec >>/log/logfile 2>&1
set -x
echo "=== START of boot ==="
and maybe repeat that in /etc/rc.

wicked
Posts: 79
Joined: Tue May 21, 2013 10:49 pm

Re: Shuttle kd20 - bricked

Post by wicked » Mon Sep 15, 2014 7:31 pm

Mijzelf wrote: In your case I would mount a partition early in /linuxrc, and redirect stderr and stdout:

Code: Select all

mkdir -p /log
mount /dev/sda1 /log
exec >>/log/logfile 2>&1
set -x
echo "=== START of boot ==="
and maybe repeat that in /etc/rc.
ok, so this goes to /rclinux and /etc/rc
but how can I create ext2 partition after the whole procedure?
fdisk says:

Code: Select all

/dev/sdb contains GPT signatures, indicating that it has a GPT table.  However, it does not have a valid fake msdos partition table, as it should.  Perhaps it was corrupted -- possibly by a program that doesn't understand GPT partition tables.  Or perhaps you deleted the GPT table, and are now using an msdos partition table.  Is this a GPT partition table?

Mijzelf
Posts: 6203
Joined: Mon Jun 16, 2008 10:45 am

Re: Shuttle kd20 - bricked

Post by Mijzelf » Mon Sep 15, 2014 7:48 pm

Is that a >2TB disk? If not, just press 'no', create a new, empty partition table ('a', when I remember well, press 'm' for help), and create a new partition. But make sure it start well beyond 32MiB.

If yes, you can also press 'no', and hope fdisk will just ignore the beyond 2TB part. Or use parted to create the partition.

wicked
Posts: 79
Joined: Tue May 21, 2013 10:49 pm

Re: Shuttle kd20 - bricked

Post by wicked » Mon Sep 15, 2014 8:06 pm

Mijzelf wrote:Is that a >2TB disk? If not, just press 'no', create a new, empty partition table ('a', when I remember well, press 'm' for help), and create a new partition. But make sure it start well beyond 32MiB.

If yes, you can also press 'no', and hope fdisk will just ignore the beyond 2TB part. Or use parted to create the partition.
arrgh this is really annoying ;)
no, the disk is not >2TB.
This is my whole procedure, maybe Ive messed something:

Code: Select all

tail, mount and make changes as described (add logging to rclinux and stuff)
127  umount initrd.d
  128  sudo umount initrd.d
  129  gzip initrd
  130  mkimage -A ARM -O Linux -T RAMDisk -C gzip -a 61000000 -e 61000000 -d initrd.gz rdimg.gz.new
  131  history
  132  zcat Iomega-HMNHD-CE-1st-32M.img.gz | dd of=/dev/sdb bs=1M
  133  dd if=uImage of=/dev/sdb bs=512 seek=1290
  134  dd if=rdimg.gz.new of=/dev/sdb bs=512 seek=16674
  135  dd if=/dev/sdb of=sth bs=446 count=1
  136  sudo fdisk /dev/sdb #here write new msdos partition table (o and then w)
  138  dd if=sth of=/dev/sdb
  142  sudo fdisk /dev/sdb #here make partition, set type to 83, first sector at 65536
  143 sudo mke2fs /dev/sdb1
 144 sudo fdflush /dev/sdb1
disconnet the disk, put it on the nas
Nas without the disk: powerbutton constantly blinking, no ip from dhcp
Nas with prepared disk: powerbutton constantly lit, the nas does not get ip from dhcp, does not write anything to /dev/sda1 (/dev/sdb1 on my live distro). Ive observed that the NIC in the nas blinks for 10-15 secs and then goes off for 4 secs and the whole thing repeats itself. Maybe the nas is in looped reebot?

Mijzelf
Posts: 6203
Joined: Mon Jun 16, 2008 10:45 am

Re: Shuttle kd20 - bricked

Post by Mijzelf » Tue Sep 16, 2014 7:24 am

Nothing on sda1? So it's probably not mounted. Maybe it needs /proc, and/or a type specification:

Code: Select all

mount -t proc proc /proc
mkdir -p /log
mount -t ext2 /dev/sda1 /log
exec >>/log/logfile 2>&1
set -x
echo "=== START of boot ==="
BTW, does the initrd have a /dev/sda1? Else you have to create one.

Your command sequence looks fine to me.
Maybe the nas is in looped reebot?
Perfectly possible. The unchanged initrd has as ultimate goal to boot the ubifs rootfs. If that is damaged, it will fail. Who knows what init will do?

wicked
Posts: 79
Joined: Tue May 21, 2013 10:49 pm

Re: Shuttle kd20 - bricked

Post by wicked » Tue Sep 16, 2014 7:14 pm

Mijzelf wrote:BTW, does the initrd have a /dev/sda1? Else you have to create one.
what do you mean ? what initrd ? within the gzipped rdimg ?

Mijzelf
Posts: 6203
Joined: Mon Jun 16, 2008 10:45 am

Re: Shuttle kd20 - bricked

Post by Mijzelf » Tue Sep 16, 2014 7:37 pm

Yes. Initrd stands for 'Initial Ramdrive', and I guess rdimg for 'Ramdrive Image'.

Initrd a common name for a (simple) filesystem which is loaded in memory by the bootloader, together with the Linux kernel. The purpose is in most cases to provide scripts and tools to mount the real rootfs. (Very handy when the real rootfs is complicated, a raid array, an logical volume, an NFS share, a layered filesystem, ...)

wicked
Posts: 79
Joined: Tue May 21, 2013 10:49 pm

Re: Shuttle kd20 - bricked

Post by wicked » Thu Sep 18, 2014 5:29 am

ok so you mean mounting /dev/sda1 in some stript within rdimg.gz (for example linuxrc). Done that, however it did not help.

Mijzelf
Posts: 6203
Joined: Mon Jun 16, 2008 10:45 am

Re: Shuttle kd20 - bricked

Post by Mijzelf » Thu Sep 18, 2014 5:46 pm

In that case I'm out of ideas. I guess it's something simple, but that is hard to debug.

Post Reply