Install OpenWrt on Shuttle OMNINAS KD20

Hi Daniel,

Got it fixed, though not by this method. Just didn't stick. For reference:
fdisk /dev/sda (in my case sda and sdb)
o (create dos partitiontable
d (delete all)
n (new partition)
p (primary)
1 (first partition)
ENTER (twice: first and last block definition)
t (change file type)
fd (set to Linux raid autodetect)
w (write config)

(steps can be found at: https://www.linuxbabe.com/linux-server/linux-software-raid-1-setup )

I assume mdadm has been installed (or otherwise install via GUI / CLI)
mdadm --examine /dev/sda /dev/sdb

create RAID1
mdadm --create /dev/md0 --level=mirror --raid-devices=2 /dev/sda1 /dev/sdb1

check with:
cat /proc/mdstat
mdadm --detail /dev/md0
mdadm --examine /dev/sda1 /dev/sdb1

make filesystem:
mkfs.ext4 /dev/md0

create mountpoint
mkdir /mnt/raid1
mount /dev/md0 /mnt/raid1

check:
df -h /mnt/raid1

Again: courtesy of https://www.linuxbabe.com/linux-server/linux-software-raid-1-setup

To make it stick after a reboot:
mdadm --detail --scan --verbose

This will give the devices and UUID
ARRAY /dev/md0 level=raid1 num-devices=2 metadata=1.2 name=OpenWrt:0 UUID=e99573a9: 2a6df929:89b60e0c:901ad80e
devices=/dev/sda1,/dev/sdb1

Then to make it stick:
cd /etc/mdadm/
vi mdadm.conf

copy both lines ('ARRAY...' and 'devices...')

vi /etc/config/mdadm
copy UUID (instead of the UUID in the file)
uncomment 'list devices /dev/sda1' (and sdb1)

Then the permanent mount: found it on https://openwrt.org/docs/guide-user/storage/usb-drives

Thanks a lot for helping, awesome that it works on an old NAS.

If I may add something: the wiki you created contains the typo in respect to the ubidetach (missing '--dev-path' in front of '/dev/mtd4').

Now starting to get syncthing up and running :slight_smile:

1 Like

Thanks for reporting the error in the wiki page, this can indeed be very confusing for users not yet familiar with UBI. I've fixed it now.

2 Likes

@daniel Do the instructions on https://openwrt.org/toh/shuttle/kd20 still work for 19.07.8?
If yes, I will update https://openwrt.org/toh/hwdata/shuttle/shuttle_omninas_kd20 accordingly.

got my KD20 succesfully upgraded to 21.02rc4 from NAND with ubifs-sysupgrade , but failed to load the entire kernel because in the uboot env is just 0x30000 (3.145.728 Bytes) given as loadsize, after change it to like 0x40000) it works without issues. (setenv load nand read.e 0x60500000 840000 400000)

shouldnt sysupgrade do that with fw_setenv beforehand?

Yeah, makes sense to increase that before, but difficult to do with sysupgrade on the already running system. Is 19.07 working alright? So we could ship updated sysupgrade by updating base-files on 19.07...

Hello all, I signed up just to ask about this device as I just found mine which has been in storage for many years. It appears it still works and is on a very outdated firmware, of Current Firmware Version : 2.35.20140102

I am a novice user and definitely don't want to open the device and have to rescue it if I screw something up. Is it a better idea to just attempt to download the oldest archived OEM firmware from web.archive.org listed in the Wiki? (I believe 2.38)

I would much rather a slow or poor experience that at least works without having to worry about doing a special rescue process on the motherboard. Is it still a difficult task to get this completed?

Also, when you upgrade to OpenWRT do you lose the data on the 2 drives?
edit: just checked the data, it's not needed anyways - happy to wipe it

Thanks again

It has been a while that I've tried anything on that device, I still got it and it worked ok with OpenWrt (the SATA driver crashed occasionally when writing very large files in software RAID-1 mode, hardware RAID is not supported by the SATA driver used in OpenWrt). Depending on what you are planning to use it for, you may be better off with the stock firmware, but be aware that also that will not work well with most recent clients as the version of Samba which comes with the stock firmware is very outdated and e.g. Windows 10/11 will not even connect to it.
The data on the drivers will remain readable with OpenWrt, the stock firmware uses XFS with ACLs and that works well also with OpenWrt.

As mentioned in the Wiki, if you want to switch to OpenWrt, be sure to start with the lede-oxnas-kd20-factory.tar.gz file, from there you can update at least up to 19.07.x (21.02.x may work as well, but I haven't tried that yet, I can try in about 1 week from now when I'm somewhere near the device).

Just tried and verified: Both 21.02.2 and current snapshots (and hence also the upcoming OpenWrt 22.03.0 release) seem to work fine on Shuttle KD20. :whale:
I haven't tested things extensively and there is an angry looking stack dump in the bootlog which complains about something being wrong with Message-Signaled-Interrupts on the PCIe bus affecting the XHCI/USB 3.0 controller...
Quick test showed that device plugged into the USB port works fine (USB 2.0 storage device, only read test performed with hdparm)

Hey,
I could really use some help.
I bricked the KD20, I followed the instruction but changed the sysupgrade & ubinized for the newer versions 21.02.3. That seems to be very wrong:
The sysupgrade did not complete. After "Writing from to kernel" nothing happened so I rebooted.

Now the device does not fully boot: The led blinks and eventually turns red.
I tried this sata uboot fix, and the kd20 now performs differently: I'd assume that the uboot did something.

However here ends my expertise. How do I connect to that netconsole?
Sorry, I'm a complete noob and I hoped that this would just work. I spend the better part of today trying different approaches and learning more about linux that ever before..
In https://github.com/kref/u-boot-oxnas/wiki/uboot-for-sata it states "the default ip address is 192.168.0.100."
Pinging it does not work, is that the IP of the NAS, or should I set my ethernet to that address?
I don't really understand what to do from now on. I think the nas is booting from the sata drive, but I cannot figure out how to connect to it, and where to go from there.

Any input would be appreciated.

Yes, you have to use the old version linked in the instructions first, directly using newer builds doesn't work due to image size restrictions of the stock firmware.

I don't know if what ever you loaded via SATA has netconsole support. I'd open the device and connect to the 3.3V TTL level serial console as that's the best way to see what's really going on at that point imho.

1 Like

Thanks for the quick response!

I'll try to do this. So far I have not found out how to properly open the device. But I'll try again later today.

So, I got it open and connected a raspberry.

I can now send data, found out that the ram is at 0x60000000.
(I can upload the ubinized.bin there)

Where do I put it now? I tried to put it in 0x01000000, which I think should be the ubi partition.
Booting that said "Bad Magic Number"

I restarted and it stated:

### Booting image at 6050000
 ...
Load Address 60008000
Checksum: Bad Data

What can I transfer and where should I put it?

OK I found a very easy way to fix it:

  1. Decrypt the lede openwrt firmware and put the files in the root of the tftp server
  2. Connect nas via tty, setup tftp server
  3. Start kd20, send something via tty during start and then a "0" for sending commands
  4. set the server ip to your machine (connect the nas to your machine)
  5. send the command "run load3 loadr3 ramboot boot"
  6. Now you can proceed with the guide on openwrt

In the default error state it might also work to setup a tftp server & dhcp server with said files, as the KD20 will try to fetch those files in case it can't boot the kernel. Opening & setting up the tty might not be required if everything would be setup correctly, but the tty definitely helps a lot!

Edit: 21.02.3 bricked the nas again using the systemupgrade program.
I'll stay on 19.x for now..

Hello @daniel,

I'm currently on 19.07.5.

How do I properly upgrade from here?

There are systemupgrade files for ubifs and squashfs, should I upgrade them both? Are they both accepted by luci or would you recommend to use the sysupgrade command (do both work there) or should I rather use the tar workaround from 19.07.5? (+ the ubinized squashfs?)

Last time I used only the squashfs sysupgrade for 21.02.3 with the sysupgrade command. That resulted in a bad kernel that could not boot anymore.

I'd like to upgrade to the last 19.x release or maybe the 21x release that was reported to work. Main reason is that in 19.07.5 the fan does not seem to work by default and thermals are not implemented.

Thanks in advance!

The issue with booting 21.02 is explained in the following post. A change to the default uboot environment is needed to make 21.02 work. I've done this over serial and it fixes the issue. Not sure if this can be done from the command line.

Hi. first, sorry im noob, and not not native english.
I make a mistake, seems same mistake robo (user) do.

now, Im stuck on same linux terminal with limited commands, and I donĀ“t know what should I do.
please help me and be nice :frowning: explain me like a child. please.

what have you done, and what fails ?

did you follow the wiki in the post you're linking to ?

Hi Frolic.
well, the original firmware for OMNINAS KD20 canĀ“t create sub directory and others tools. So, I decided install a new firmware from OpenWrt (I do this kind of bussines on linksys routers and all ok)
so, from KD20 web page I upload the firmware lede-17.01.4-oxnas-kd20-factory.tar now im stuck.
I read the post, but, really im dizzy. sorry.

Simply follow the manual steps done via ssh from https://openwrt.org/toh/shuttle/kd20?

I had already seen this before, I don't have any of those actions from the command line, for example, there is no "git" command.
I imagine that I could put a firmware and execute "sysupgrade" (that command is there) but there is no wget nor the fstab works, I don't know how to mount a pendrive to compile it. sorry for bothering you.