Welcome! Log In Create A New Profile

Advanced

NSA320 initial rootfs creation to USB not booting

Posted by dhargens 
NSA320 initial rootfs creation to USB not booting
May 14, 2024 03:00AM
I'm unable to successfully create a USB rootfs to thumbdrive that will boot on my NSA320.
I had this booting for a while, but now the simple process has stopped working.
U-Boot has been updated to 2017.07.
I've used multiple drives to eliminate that as the problem.
I've formatted with Ext3 & Ext4 to no effect.
uEnv.txt has been tried with 3 settings, with no effect: created & left empty; created with a few settings; or not in place at all. This instance shows it not in place.

Here are my steps, following the instructions for Debian-6.5.7 (01 Nov 2023):
  1. confirm md5 & sha256 of file Debian-6.5.7-kirkwood-tld-1-rootfs-bodhi.tar.bz2
  2. wipe drive
  3. create a single partition (/dev/sda)
  4. format it with: Ext3/Ext4, non-lazy, labelled 'roofs'
  5. mount drive at /mnt ; cd /mnt
  6. tar ~/Kirkwood/Debian-6.5.7-kirkwood-tld-1-rootfs-bodhi.tar.bz2
  7. edit /mnt/etc/fstab to ext4 (this setting has no effect if ext3 or ext4)
  8. cd ; umount /mnt
  9. insert thumbdrive into front USB port of NSA320 & apply power
Here's the output, 'printenv' included:
U-Boot 2017.07-tld-1 (Sep 05 2017 - 00:46:11 -0700)
ZyXEL NSA320 2-Bay Power Media Server

SoC:   Kirkwood 88F6281_A1
DRAM:  512 MiB
WARNING: Caches not enabled
NAND:  128 MiB
In:    serial
Out:   serial
Err:   serial
Net:   egiga0
MV88E1318 PHY initialized on egiga0
Hit any key to stop autoboot:  0
NSA320> printenv
arcNumber=2097
bootcmd=run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec
bootcmd_exec=run load_uimage; if run load_initrd; then if run load_dtb; then bootm $load_uimage_addr $load_initrd_addr $load_dtb_addr; else bootm $load_uimage_addr $load_initrd_addr; fi; else if run load_dtb; then bootm $load_uimage_addr - $load_dtb_addr; else bootm $load_uimage_addr; fi; fi
bootcmd_uenv=run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi; sleep 3
bootdelay=10
bootdev=usb
device=0:1
devices=usb ide
disks=0 1 2 3
dtb_file=/boot/dts/kirkwood-nsa320.dtb
ethact=egiga0
ethaddr=fc:f5:28:08:ac:b2
if_netconsole=ping $serverip
ipaddr=192.168.0.231
led_error=orange blinking
led_exit=green off
led_init=green blinking
load_dtb=echo loading DTB $dtb_file ...; load $bootdev $device $load_dtb_addr $dtb_file
load_dtb_addr=0x1c00000
load_initrd=echo loading uInitrd ...; load $bootdev $device $load_initrd_addr /boot/uInitrd
load_initrd_addr=0x1100000
load_uimage=echo loading uImage ...; load $bootdev $device $load_uimage_addr /boot/uImage
load_uimage_addr=0x800000
machid=0x831
mainlineLinux=yes
mtdids=nand0=orion_nand
mtdparts=mtdparts=mtdparts=orion_nand:0x100000(uboot),0x80000(stock_uboot_env),0x80000(key_store),0x80000(info),0xA00000(etc),0xA00000(kernel_1),0x2FC0000(rootfs1),0xA00000(kernel_2),0x2FC0000(rootfs2)
partition=nand0,2
preboot_nc=run if_netconsole start_netconsole
scan_disk=echo running scan_disk ...; scan_done=0; setenv scan_usb "usb start";  setenv scan_ide "ide reset";  setenv scan_mmc "mmc rescan"; for dev in $devices; do if test $scan_done -eq 0; then echo Scan device $dev; run scan_$dev; for disknum in $disks; do if test $scan_done -eq 0; then echo device $dev $disknum:1; if load $dev $disknum:1 $load_uimage_addr /boot/uImage 1; then scan_done=1; echo Found bootable drive on $dev $disknum; setenv device $disknum:1; setenv bootdev $dev; fi; fi; done; fi; done
serverip=192.168.0.220
set_bootargs=setenv bootargs console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts $custom_params
start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version;
stderr=serial
stdin=serial
stdout=serial
uenv_addr=0x810000
uenv_import=echo importing envs ...; env import -t $uenv_addr $filesize
uenv_init_devices=echo Initializing devices...; setenv init_usb "usb start"; setenv init_ide "ide reset";  setenv init_mmc "mmc rescan"; for devtype in $devices; do run init_$devtype; done
uenv_load=run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices; do for disknum in $disks; do if test $uenv_loaded -eq 0; then setenv device_type $devtype; setenv disk_number $disknum; run uenv_read; fi; done; done;
uenv_read=echo Loading envs from $device_type $disk_number...; if load $device_type $disk_number:1 $uenv_addr /boot/uEnv.txt; then setenv uenv_loaded 1; echo ... envs loaded; fi
usb_ready_retry=15

Environment size: 3002/131068 bytes
NSA320> boot
Initializing devices...
starting USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 3 USB Device(s) found
       scanning usb for storage devices...
Use USB retry period from the environment: 15 second(s)
1 Storage Device(s) found

Reset IDE: Bus 0: .......OK Bus 1: OK
  Device 0: Model: ST3320820SCE Firm: 3.ACE  Ser#: 9QF4Z1H0
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 305245.3 MB = 298.0 GB (625142448 x 512)
  Device 1: Model: ST3160815AS  Firm: 3.AAD  Ser#: 6RX5X9CX
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 152627.8 MB = 149.0 GB (312581808 x 512)
Loading envs from usb 0...
** File not found /boot/uEnv.txt **
Loading envs from usb 1...
** Bad device usb 1 **
Loading envs from usb 2...
** Bad device usb 2 **
Loading envs from usb 3...
** Bad device usb 3 **
Loading envs from ide 0...
** File not found /boot/uEnv.txt **
Loading envs from ide 1...
** File not found /boot/uEnv.txt **
Loading envs from ide 2...
** Bad device ide 2 **
Loading envs from ide 3...
** Bad device ide 3 **
running scan_disk ...
Scan device usb
device usb 0:1
1 bytes read in 661 ms (0 Bytes/s)
Found bootable drive on usb 0
loading uImage ...
6223944 bytes read in 943 ms (6.3 MiB/s)
loading uInitrd ...
5791271 bytes read in 833 ms (6.6 MiB/s)
loading DTB /boot/dts/kirkwood-nsa320.dtb ...
13373 bytes read in 2937 ms (3.9 KiB/s)
## Booting kernel from Legacy Image at 00800000 ...
   Image Name:   Linux-6.5.7-kirkwood-tld-1
   Created:      2023-10-31  22:53:22 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    6223880 Bytes = 5.9 MiB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at 01100000 ...
   Image Name:   initramfs-6.5.7-kirkwood-tld-1
   Created:      2023-10-31  22:53:55 UTC
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)
   Data Size:    5791207 Bytes = 5.5 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 01c00000
   Booting using the fdt blob at 0x1c00000
   Loading Kernel Image ... OK
   Loading Ramdisk to 0fa7a000, end 0ffffde7 ... OK
   Loading Device Tree to 0fa73000, end 0fa7943c ... OK
Using machid 0x831 from environment

Starting kernel ...

[    0.000000][    T0] Booting Linux on physical CPU 0x0
[    0.000000][    T0] Linux version 6.5.7-kirkwood-tld-1 (root@tldDebian) (gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #2 PREEMPT Wed Oct 18 21:14:11 PDT 2023
[    0.000000][    T0] CPU: Feroceon 88FR131 [56251311] revision 1 (ARMv5TE), cr=0005397f
[    0.000000][    T0] CPU: VIVT data cache, VIVT instruction cache
[    0.000000][    T0] OF: fdt: Machine model: Zyxel NSA320
[    0.000000][    T0] Memory policy: Data cache writeback
[    0.000000][    T0] Zone ranges:
[    0.000000][    T0]   Normal   [mem 0x0000000000000000-0x000000001fffffff]
[    0.000000][    T0] Movable zone start for each node
[    0.000000][    T0] Early memory node ranges
[    0.000000][    T0]   node   0: [mem 0x0000000000000000-0x000000001fffffff]
[    0.000000][    T0] Initmem setup node 0 [mem 0x0000000000000000-0x000000001fffffff]
[    0.000000][    T0] Kernel command line: console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 mtdparts=mtdparts=orion_nand:0x100000(uboot),0x80000(stock_uboot_env),0x80000(key_store),0x80000(info),0xA00000(etc),0xA00000(kernel_1),0x2FC0000(rootfs1),0xA00000(kernel_2),0x2FC0000(rootfs2)
[    0.000000][    T0] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.000000][    T0] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes, linear)
[    0.000000][    T0] Built 1 zonelists, mobility grouping on.  Total pages: 129920
[    0.000000][    T0] mem auto-init: stack:off, heap alloc:on, heap free:off
[    0.000000][    T0] Memory: 491984K/524288K available (12288K kernel code, 1755K rwdata, 5416K rodata, 1024K init, 301K bss, 32304K reserved, 0K cma-reserved)
[    0.000000][    T0] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000][    T0] trace event string verifier disabled
[    0.000000][    T0] rcu: Preemptible hierarchical RCU implementation.
[    0.000000][    T0] 	Trampoline variant of Tasks RCU enabled.
[    0.000000][    T0] 	Tracing variant of Tasks RCU enabled.
[    0.000000][    T0] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[    0.000000][    T0] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000][    T0] rcu: srcu_init: Setting srcu_struct sizes based on contention.
[    0.000000][    T0] clocksource: orion_clocksource: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 9556302233 ns
[    0.000002][    T0] sched_clock: 32 bits at 200MHz, resolution 5ns, wraps every 10737418237ns
[    0.000049][    T0] Switching to timer-based delay loop, resolution 5ns
[    0.000646][    T0] Console: colour dummy device 80x30
[    0.000720][    T0] Calibrating delay loop (skipped), value calculated using timer frequency.. 400.00 BogoMIPS (lpj=2000000)
[    0.000751][    T0] CPU: Testing write buffer coherency: ok
[    0.000892][    T0] pid_max: default: 32768 minimum: 301
[    0.009614][    T0] LSM: initializing lsm=capability,integrity
[    0.012076][    T0] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.012115][    T0] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.024730][    T1] RCU Tasks: Setting shift to 0 and lim to 1 rcu_task_cb_adjust=1.
[    0.025111][    T1] RCU Tasks Trace: Setting shift to 0 and lim to 1 rcu_task_cb_adjust=1.
[    0.025603][    T1] Setting up static identity map for 0x100000 - 0x100058
[    0.025964][    T1] mvebu-soc-id: MVEBU SoC ID=0x6281, Rev=0x3
[    0.026398][    T1] rcu: Hierarchical SRCU implementation.
[    0.026415][    T1] rcu: 	Max phase no-delay instances is 1000.
[    0.029502][    T1] devtmpfs: initialized
[    0.041138][    T1] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.041185][    T1] futex hash table entries: 256 (order: -1, 3072 bytes, linear)
[    0.044011][    T1] prandom: seed boundary self test passed
[    0.048258][    T1] prandom: 100 self tests passed
[    0.048274][    T1] pinctrl core: initialized pinctrl subsystem
[    0.052150][    T1] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    0.053130][    T1] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.058538][    T1] audit: initializing netlink subsys (disabled)
[    0.059618][   T19] audit: type=2000 audit(0.050:1): state=initialized audit_enabled=0 res=1
[    0.][    T9] usb-storage 1-1.2:1.0: USB Mass Storage device detected
[    6.971455][    T9] scsi host2: usb-storage 1-1.2:1.0
[    8.002663][   T10] scsi 2:0:0:0: Direct-Access     SanDisk  Cruzer Fit       1.26 PQ: 0 ANSI: 6
[    8.023269][   T18] sd 2:0:0:0: [sdc] 62530624 512-byte logical blocks: (32.0 GB/29.8 GiB)
[    8.042642][   T18] sd 2:0:0:0: [sdc] Write Protect is off
[    8.060800][   T18] sd 2:0:0:0: [sdc] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[    8.087013][   T18]  sdc: sdc1
[    8.100976][   T18] sd 2:0:0:0: [sdc] Attached SCSI disk
[    8.794683][    T1] clk: Disabling unused clocks
[    8.803274][    T1] Freeing unused kernel image (initmem) memory: 1024K
[    8.821622][    T1] Checked W+X mappings: passed, no W+X pages found
[    8.828062][    T1] Run /init as init process
Loading, please wait...
Starting systemd-udevd version 252.17-1~deb12u1
[   10.472856][  T153] usbcore: registered new interface driver uas
Begin: Loading essential drivers ... done.
Begin: Running /scripts/init-premount ... done.
Begin: Mounting root file system ... Begin: Running /scripts/local-top ... done.
Begin: Running /scripts/local-premount ... done.
Begin: Will now check root file system ... fsck from util-linux 2.38.1
fsck: error 2 (No such file or directory) while executing fsck.ext4 for /dev/sda1
fsck exited with status code 8
done.
Warning: File system check failed but did not detect errors
[   26.775102][  T181] EXT4-fs (sda1): mounted filesystem 7ee65773-d39a-4dff-906b-c82d93e3bd7b ro with ordered data mode. Quota mode: none.
done.
Begin: Running /scripts/local-bottom ... done.
Begin: Running /scripts/init-bottom ... mount: mounting /dev on /root/dev failed: No such file or directory
mount: mounting /dev on /root/dev failed: No such file or directory
done.
mount: mounting /run on /root/run failed: No such file or directory
run-init: can't execute '/sbin/init': No such file or directory
Target filesystem doesn't have requested /sbin/init.
run-init: can't execute '/sbin/init': No such file or directory
run-init: can't execute '/etc/init': No such file or directory
run-init: can't execute '/bin/init': No such file or directory
run-init: can't execute '/bin/sh': No such file or directory
run-init: can't execute '': No such file or directory
No init found. Try passing init= bootarg.


BusyBox v1.35.0 (Debian 1:1.35.0-4+b3) built-in shell (ash)
Enter 'help' for a list of built-in commands.

(initramfs)
I'm at a loss. It's the simplest thing which I've done many times, but now it's not working after no matter what I try. I've spent 2 days working on this and have tried to distill it down to some simple steps to get it working, but no joy.

Any ideas on what's going on here?

Thanks much in advance.



Edited 1 time(s). Last edit at 05/14/2024 03:01AM by dhargens.
Re: NSA320 initial rootfs creation to USB not booting
May 14, 2024 01:59PM
dhargens,

> create a single partition (/dev/sda)

I hope this was a typo, should be /dev/sda1.

> I'm at a loss. It's the simplest thing which I've
> done many times, but now it's not working after no
> matter what I try. I've spent 2 days working on
> this and have tried to distill it down to some
> simple steps to get it working, but no joy.
>
> Any ideas on what's going on here?

I'd suspect you had a typo somewhere. It can happen when you copy/paste old steps that you've saved in a log file.

The booting behaviour points to a corrupted file system.

- Don't use Ext4, use Ext3 file system with MBR partition until you booted this box successfully.
- Make sure the rootfs has been sync a few times before unmounted.
- Mount this rootfs drive on another Linux box (not the one you used to create it) and try to run e2fsck, and also access some files at least at 2, 3 level deep.
- When all fails to fix it, check the NSA320 power supply.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: NSA320 initial rootfs creation to USB not booting
May 16, 2024 02:30AM
bodhi Wrote:
-------------------------------------------------------
> > create a single partition (/dev/sda)
>
> I hope this was a typo, should be /dev/sda1.

More an error by omission. I was using fdisk to partition sda and then mkfs.ext3 formatting sda1 - I just didn't say it correctly. Good point.

> - Don't use Ext4, use Ext3 file system with MBR
> partition until you booted this box successfully.
Done.

> - Make sure the rootfs has been sync a few times
> before unmounted.
Done.

> - Mount this rootfs drive on another Linux box
> (not the one you used to create it) and try to run
> e2fsck, and also access some files at least at 2,
> 3 level deep.
Done. Booted fine on this test box too.

> - When all fails to fix it, check the NSA320 power
> supply.
Not the problem directly, but lead to what the real issue was.

I initially had 2x Seagate 160G HDs I was using for testing installs etc. Since all that was left now was the PS, I took the drives out and now it booted. At some point I had started testing other drives - since booting worked fine - while updating USB drives and testing my configurations, and had left a Seagate 320G HD in there with the 160G drive; this is what killed it.
It seems that the 320G drive used too much power, but since it was old (and heavy) I could understand it. It's been removed, and given that it won't work with marginal power supplies will likely be recycled soon.

Now I was worried the 2x 3TB HDs I had ordered to put in this would use up too much power. Put one in w the 160G and it booted. Swap out the 160G for the second 3T and it booted from a cold start, but the drive timed out.
Reset IDE: Bus 0: ............................................................** Timeout **
A warm reboot didn't timeout though. Maybe I need to set an env to wait longer for it to come up?

Thanks again for the help. I had changed 2 things at once, and you can't troubleshoot that way - one thing at a time!
Re: NSA320 initial rootfs creation to USB not booting
May 16, 2024 01:54PM
> I initially had 2x Seagate 160G HDs I was using
> for testing installs etc. Since all that was left
> now was the PS, I took the drives out and now it
> booted. At some point I had started testing other
> drives - since booting worked fine - while
> updating USB drives and testing my configurations,
> and had left a Seagate 320G HD in there with the
> 160G drive; this is what killed it.
> It seems that the 320G drive used too much power,
> but since it was old (and heavy) I could
> understand it. It's been removed, and given that
> it won't work with marginal power supplies will
> likely be recycled soon.

>
> Now I was worried the 2x 3TB HDs I had ordered to
> put in this would use up too much power.

This box power supply can handle 2 large 3.5" HDDs in the slots.

> Put one
> in w the 160G and it booted. Swap out the 160G for
> the second 3T and it booted from a cold start, but
> the drive timed out.
>
Reset IDE: Bus 0:
> ............................................................**
> Timeout **
> A warm reboot didn't timeout though.

It seems the spin up is taking longer for this HDD. But the HDD in the SATA slot usually does not have this problem. So I think when it's convenient, you should check the power supply output, just in case. These Kirkwood boxes are quite old and usually the power supply is the first component to fail. I had 2 GoFlex Home power supply failures after about 8-10 year running 24/7.

> Maybe I need
> to set an env to wait longer for it to come up?
>

1. Try
ide reset; sleep 3; ide reset

2. Or just ignore the HDDs altogether if you are booting with USB rootfs. You can put the env changes in /boot/uEnv.txt
bootdev=usb
device=0:1
devices=usb

Or set them permanently (after some testing) in Debian using fw_setenv.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: