Problems with NSA325 and Arch

This forum is for topics dealing with problems with software specifically in the ARMv5 repo.

Problems with NSA325 and Arch

Postby Mikeinnc » Fri Oct 12, 2018 7:40 am

So, I have an older NSA325 that has been working - well, OK, but I decided I'd like to install a better OS on it. I found the instructions at https://archlinuxarm.org/platforms/armv5/zyxel-nsa325 and followed them to the letter. I should add that this is after connecting the serial port to Putty on a Windows7 computer via a 3v3 converter, using a baud rate of 115200b/s. I've used a newly formatted 2GB USB stick, formatted as FAT, and uncompressed the following files ( 'nsa310_check_file_C0'; 'salted_md5sum_3x0'; 'usb_key_func.sh' and 'usb_key_func.sh.2') from the recommended file 'nsa325-alarm.tar.gz' directly on to the USB stick. I've also copied the file 'ArchLinuxARM-kirkwood-latest.tar.gz' as 'rootfs.tgz' on to the USB drive, again exactly as recommended. I have a brand spanking new and unused ie straight from the wrapper! Seagate 2TB 'Ironwolf' NAS HDD installed in the LH slot - the one furthest away from the buttons. I use the RH (closest to the case side) back USB slot for my USB stick. When I power up, I see all the messages on the putty screen - and so clearly, everything appears to be working. Except it isn't!

The device boots with various messages - eg Marvell U-Boot 1.1.4 etc - and soon shows 'booting the kernel. Linux version 2.6.31.3' which I guess is the embedded system. It continues with a long screed about various issues, all of which sound perfectly acceptable until it gets to '$this->bbcode_second_pass_quote('', 'W')ARNING: No valid partition on HDD or no HDD plugged in
'. OK, I'd expect that - the HDD is unformatted, as requested. It then says:

$this->bbcode_second_pass_quote('', 'B')oot from RAM disk - scsi 2:0:0:0: Direct -Access USB Flash Disk 1100 PQ: 0 ANSI: 4


It knows it is 2.00GB as its says $this->bbcode_second_pass_quote('', 's')d 2:0:0:0: [sdb] 3915776 512-byte logical blocks: (2.00GB/1.86GiB)


So far, it appears, so good. Lots more "stuff" rolls up until finally, I get:

$this->bbcode_second_pass_quote('', 'T')rying to mount /dev/sdb1
FAT: utf8 is not a recommended IO charset for FAT filesystems, filesystem will be case sensitive!
': No such file or directoryey/usb_key_func.sh (and, yes, that is exactly how the line appears - colon and all)
': No such file or directorykey/usb_key_func.sh (again - and this time, the k in key is there)
: No such file or directoryed_md5sum_3x0


and that is where it stops. For ever - well for at least a couple of hours! Try as I may, nothing will change this. I've tried another USB stick. I've reformatted using a different formatting program. I've used the other back USB slot. I've done just about anything sensible, and it just will not get past that last 'error'.

So - any assistance would really be appreciated! :)
Mikeinnc
 
Posts: 5
Joined: Fri Oct 12, 2018 6:49 am
Top

Re: Problems with NSA325 and Arch

Postby Mikeinnc » Fri Oct 12, 2018 8:40 am

I've just noticed that in the web page https://archlinuxarm.org/platforms/armv5/zyxel-nsa325 it says:

$this->bbcode_second_pass_quote('', 'T')his process will format the bare, unparitioned HDD in the left slot (sda, ide 0:1) with an ext2 boot partition, ext3 rootfs partition, and set the for the device to boot from it.


However, in the shell file usb_key_func.sh.2 it says:

$this->bbcode_second_pass_quote('', '#') stock does not know how to make ext4!
mkfs.ext4 -L "rootfs" /dev/sda2


So - which is correct? Should it be an ext4 partition or an ext3 partition? Does it matter?

Again, thanks for any assistance. :)
Mikeinnc
 
Posts: 5
Joined: Fri Oct 12, 2018 6:49 am
Top

Re: Problems with NSA325 and Arch

Postby summers » Fri Oct 12, 2018 9:26 am

That you can access the uart means you can debug almost all problems!

Anyway lets go over the install process. The important file in the boot usb is usb_key_func.sh.2 it does several things:
$this->bbcode_second_pass_code('', 'fw_setenv arcNumber 4495
fw_setenv mainlineLinux yes
fw_setenv bootargs_stock 'console=ttyS0,115200 mtdparts=nand_mtd:0x100000(uboot)
,0x80000(uboot_env),0x80000(key_store),0x80000(info),0xA00000(etc),0xA00000(kern
el_1),0x2FC0000(rootfs1),0xA00000(kernel_2),0x2FC0000(rootfs2) root=/dev/nfs rw
init=/init'
fw_setenv bootargs_linux 'console=ttyS0,115200 mtdparts=nand_mtd:0x100000(uboot)
,0x80000(uboot_env),0x80000(key_store),0x80000(info),0xA00000(etc),0xA00000(kern
el_1),0x2FC0000(rootfs1),0xA00000(kernel_2),0x2FC0000(rootfs2) root=/dev/sda2 rw
rootwait loglevel=8'
fw_setenv bootcmd_linux 'setenv bootargs $(bootargs_linux); ide reset; ext2load
ide 0:1 $(loadaddr) /uImage; bootm $(loadaddr)'
fw_setenv bootcmd_stock 'setenv bootargs $(bootargs_stock); nand read.e $(loadad
dr) $(kernel_addr) 0xA00000; bootm $(loadadr)'
fw_setenv to_stock "setenv mainlineLinux no; setenv bootcmd \'run bootcmd_stock\
'; saveenv; reset"
fw_setenv to_linux "setenv mainlineLinux yes; setenv bootcmd \'run bootcmd_linux
\'; saveenv; reset"')
This is setting up the uboot environment. Now if you can access the uart, you can interrupt it booting, and check the environment is correct, use the command
$this->bbcode_second_pass_code('', 'printenv')
To convert to arm arch you use the uboot command $this->bbcode_second_pass_code('', 'run to_linux').

Then there is setting up the HDD. This is done by:
$this->bbcode_second_pass_code('', 'fdisk /dev/sda <<EOF
o
n
p
1

+16M

n
p
2


p
w

EOF
echo " * pause for ioctl to re-sync partitions"
sleep 5
###
# make filesystems
echo "- make filesystems"
# ext2 makes u-boot happy.
mkfs.ext2 -L "boot" /dev/sda1
# stock does not know how to make ext4!
mkfs.ext4 -L "rootfs" /dev/sda2

###
# make dirs & mount
echo "- mount destination"
mkdir -p /tmp/boot
mount -t ext2 /dev/sda1 /tmp/boot
mkdir -p /tmp/rootfs
mount -t ext4 /dev/sda2 /tmp/rootfs

###
# prepare the system
# extract the rootfs
echo "- extract rootfs"
tar xzf /mnt/parnerkey/rootfs.tgz -C /tmp/rootfs/

# copy the uImage to the boot partition
echo "- prepare boot partition"
cp -aR /tmp/rootfs/boot/* /tmp/boot/

# always make sure you're sync'd!
sync
')
This does several things. It sets up two partitions on the HDD, the first 16MB long and ext2 formatted, the second the rest of the HDD and ext4 formatted.

The first partition becomes /boot, and contains the boot files. This is because stock nsa325 uboot can only read ext2 and not ext4.

The second partition becomes the root partition (/) - and contains the main arch arm set up.

Now you should be able to check this in the HDD, especially if you can plug into a desk top.

btw, installing arch arm on the nsa325 I've found perfect. It means I can do incremental backups using "rsync". Also as its always up, it has the external ssh set up - so I can log on remotely.
summers
 
Posts: 984
Joined: Sat Sep 06, 2014 12:56 pm

Re: Problems with NSA325 and Arch

Postby Mikeinnc » Fri Oct 12, 2018 11:52 pm

Thanks so much, summers, for your very helpful assistance! In fact, I'd already done a lot of what you suggested before I read your reply, as I believe you had posted something similar previously? So, I'd removed the HDD and using a SATA to USB interface, connected the HDD to a Linux 'Mint' laptop and used fdisk to set the drive up as it would (should?) have been via the commands in 'usb_key_func.sh.2'. I'd actually set the drive up before on the NSA325 using the BusyBox fdisk commands, but I wasn't happy it was correct, and the Mint environment was a lot easier and gave me greater confidence.

I'd also setup the environment variables using the block of 'fw_setenv' commands. It was a challenge typing them in manually! Luckily, I found the 'resetenv' command as I needed to do it a couple of times! Notepad++ was my friend here - enabled me to cut and paste the commands from your reply and remove inserted line breaks, before pasting the block of commands in to the terminal. Much easier! Using 'printenv' was very useful to ensure it looked to be correct.

Time to then reinsert the HDD and try a boot. I was a bit confused about your comment 'use the uboot command'. I couldn't find a command 'uboot' - and then I realised you meant the command 'run to_linux' in the interrupted interface! Yes, I'd worked that one out! :) Maybe that needs a bit more explanation?

And the great news is - it worked! :D I've booted to Arch on the HDD and am up and running.

BUT - it still doesn't answer my - and I guess, many others? - questions. Why didn't this work from the USB stick? Why did it have to be done painfully and manually? All the files on that stick are exactly what we use - what is the problem? And why the confusion between ext 3 and ext4. Yes, I've setup an ext4 partition and it's working - but why does the web page refer to ext3? What about the other two files on the USB stick? One of them appears to refer to NSA310 - is that right? It also appears to define directories for the USB stick itself - but they clearly don't work? Can these issues be corrected to save a lot of anguish in the future - or just not worth it? OK, rant over - it's working and I'm very, VERY grateful for your help. Invaluable!
Mikeinnc
 
Posts: 5
Joined: Fri Oct 12, 2018 6:49 am

Re: Problems with NSA325 and Arch

Postby Mikeinnc » Sat Oct 13, 2018 5:18 am

One other issue I have noticed, and would - again :) - appreciate if anyone can advise?

In my boot file, I see the following:

$this->bbcode_second_pass_code('', '[ 15.702633] nand: device found, Manufacturer ID: 0xec, Chip ID: 0xf1
[ 15.709207] nand: Samsung NAND 128MiB 3,3V 8-bit
[ 15.713847] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[ 15.721467] Scanning device for bad blocks
[ 15.791258] Bad eraseblock 582 at 0x0000048c0000
[ 15.802942] Bad eraseblock 645 at 0x0000050a0000')

The issue is - are the 'bad eraseblock xx' comments indicating a problem? And - if so, what can I do about it? Does it mean that part of my internal NAND memory is "stuffed"? Or is it a 'temporary' issue that can - effectively - be ignored? I must admit - it doesn't seem to have made any difference, but I'd really like to feel comfortable that it's not a problem.......or is it?

Thanks again!
Mikeinnc
 
Posts: 5
Joined: Fri Oct 12, 2018 6:49 am

Re: Problems with NSA325 and Arch

Postby summers » Sat Oct 13, 2018 12:44 pm

I can't help but smile at your posts. It almost exactly the same as my first ever post on this forum 4 years ago : https://archlinuxarm.org/forum/viewtopic.php?f=58&t=7753#p42353

I've had my go at how arch arm is delivered in the past, but guess I'm now more mellow. What takes time to realise, is there is effectively no staff, the forum maintainers are fairly quiet. Actually whats behind the scenes is one maintainer, is it Kevin? I forget. he has an arm farm. He has an armv7 board that I guess is constantly downloading the main arch build scripts, and the compiles it for armv5 armv6 and armv7, there is another machine (ordroid-c2 IIRC) that does the armv8 code- then its pushed out to mirrors and we get to update.

The only work done in house, is really the board stuff, e.g. how uboot gets installed, and how that accesses the kernel. This is fairly arm specific, so has to be done form arch arm.

So there actually isn't anyone to improve the documentation, its down to users. If we don't make changes, then changes don't happen, and can we get the web site to update? the NSA325 instructions for what its worth, if you follow then to the letter, they do install arch. Problem is if you deviate even slightly, they fail. My failed IIRC because I wanted a separate /home directory, but there are many other reasons.

I think part of the problem is when users get enough experience to help, they have also moved on. I can spend 5 minutes penning a response here, but can't afford much more time. I have to choose where to spend my time, usually its only on the basket cases, where someone is trying to get arm to work in a way that is breaking arch horribly. So there have been a series of recent rockchip threads, where what it brings out is that the kernel is broken - so I guess I'm one man week into patching the kernel. With this amount of effort, I need to choose which battles to fight, and for me as a user, improving documentation isn't one right now.

Maybe its not positive, in some ways, but in others it is - it means the strength or Arch Arm is the people that post here on the forum. These are the people that make a difference.

Oh yes, your flash bad blocks, that actually happens to all flash eventually. Most file systems that are designed for flash work around them, I'm not sure if uboot can. My NSA325 has a few bad blocks near the end of the device. I don't think I've ever heard of it killing a board, but I guess that must occasionally happen ...
summers
 
Posts: 984
Joined: Sat Sep 06, 2014 12:56 pm

Re: Problems with NSA325 and Arch

Postby Mikeinnc » Sun Oct 14, 2018 1:19 am

Thanks so much, summers! I guess I half expected a similar reply - I know there's no huge commercial entity behind all this, and in our way, I suppose we are all pioneers in one way or another!! :) I suppose I should be grateful that there was enough information to be able to 'read between the lines' and work out what to do and where - oh, and that I'm probably savvy enough to be able to do that! But it didn't hurt to ask! :-) As you've suggested, I have, in the past, updated areas (not in this forum) where I believe that there is an error - and we do it in the spirit of community. The web isn't all bad! Hopefully, even these posts and the conversations between you and I will assist someone else in the future. It's often by reading what problems have beset others that you can see a way out of the morass! Oh, and thanks for the flash info. I have an electronics background, so I guess I knew what you were saying, but again - worth a try to see if anyone had hit on a plan to deal with it! So, now I have a NSA325 humming along on Arch Linux with one of two 2TB drives (the new one) installed. Now all I have to do is find where I put those spare HDD mounting rails that came with the box so I can install the original drive as well. I know they are safely put away somewhere........ :D
Mikeinnc
 
Posts: 5
Joined: Fri Oct 12, 2018 6:49 am

Re: Problems with NSA325 and Arch

Postby WarheadsSE » Thu Oct 18, 2018 2:19 pm

I need to write a white paper about this device .. that's how much backing information there is. Sadly, my NSA 325 is dead, because my `bad erase blocks` are in the head of the NAND .. and ate the bootloader.

I'm leaving this post open in a tab, so that I can come back and expound greatly.

Summary items:
- Why the USB stick works when _stock_
- What is on the USB stick, and why
- Why I built-in `run to_stock` in order to reset
- How these scripts work, and how to replicate manually.
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm


Return to ARMv5

Who is online

Users browsing this forum: No registered users and 4 guests