Welcome! Log In Create A New Profile

Advanced

[SOLVED] No Netconsole on NSA325v2

Posted by SanderV 
[SOLVED] No Netconsole on NSA325v2
December 03, 2020 07:13AM
Hi everyone,

Sorry, I posted this in the wrong section before!

About a year ago, I flashed the latest U-Boot from this forum to my NSA325v2, and then made it boot Arch.

Now, I wish to make some modifications, but I hope to do so without having to take the device apart again to reach the serial pins. That's why I'd like to get the netconsole working before I move ahead.

However, despite trying my best to follow the instructions from this forum, I can't get the netconsole to start.

My envs:

arcNumber=4495
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
bootdelay=10
bootdev=usb
device=0:1
devices=usb ide mmc
disks=0 1 2 3
dtb_file=/boot/dts/kirkwood-pogo_e02.dtb
ethact=egiga0
ethaddr=52:3b:20:9c:11:51
if_netconsole=ping $serverip
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
mainlineLinux=yes
mtdids=nand0=orion_nand
mtdparts=mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)
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
set_bootargs=setenv bootargs console=ttyS0,115200 root=/dev/sda1 rootdelay=10 $mtdparts $customparams
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=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 0; do run uenv_read_disk; done; done;
uenv_read=echo loading envs from $devtype $disknum ...; if load $devtype $disknum:1 $uenv_addr /boot/uEnv.txt; then setenv uenv_loaded 1; fi
uenv_read_disk=if test $devtype -eq mmc; then if $devtype part; then run uenv_read;  fi; else if $devtype part $disknum; then run uenv_read; fi;  fi
usb_ready_retry=15
serverip=192.168.1.106
ethprime=egiga0
ipaddr=192.168.1.104

If I kept my notes well, the only changes I made in these envs compared to the defaults in the provided U-boot are:
- Boot from /dev/sda1 instead of "rootfs" label
- ethprime=egiga0, which I tried in order to get the netconsole working.

If I understood the instructions, the above envs should make the NSA325 ping to 192.168.1.106 and if it finds it, redirect the boot console to the network. I tried the given nc commands on the machine at 192.168.1.106 but am getting nothing.

Tried with:

nc -l -u -p 6666

And also with

nc -l -u -p 6666 192.168.1.106 6666

And with

nc -l -u -p 6666 192.168.1.104 6666

(wasn't sure what hostnames to put there).

Note that pinging to 192.168.1.106 works without issues once the device is booted.

I also noticed, using wireshark, that there is zero network activity coming from the device during the boot. Until the point that I am able to SSH into it after booting, Wireshark doesn't log any activity from the device.

Can anyone help me figure this out?
One thing I noticed is that once I am booted (into Arch Linux ARM), the main ethernet device is called "eth0" and not "egiga0" as it is set in the envs above. Could this be an issue?

Thanks in any case.



Edited 1 time(s). Last edit at 12/04/2020 08:37AM by SanderV.
Re: No Netconsole on NSA325v2
December 03, 2020 04:21PM
SanderV,

There are a few things wrong with your u-boot envs.

I'll come back to write a few commands for you to try.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: No Netconsole on NSA325v2
December 04, 2020 12:06AM
SanderV,

This is the correct command to run in the netconsole server:
nc -lup 6666 192.168.1.104 6666
(because your box u-boot env is ipaddr=192.168.1.104)


1. Now, you did not say what system is running in the netconsole server. If it is Debian/Ubuntu/Mint lapop/dekstop then you need to install netcat-traditional.

2. When you start pinging 192.168.1.104, and then power up the NSA325, you should see the reponse during u-boot booting. And then it will stop respond. During Debian booting, you will see the response again if you use static IP addres 192.168.1.104 in your rootfs. If the IP is dynamic, then you will not see any response after u-boot completed booting, you would have to know what dynamic IP the router has assigned to this box during the kernel booting phase.

3. You have the correct u-boot envs for netconsole

if_netconsole=ping $serverip
preboot_nc=run if_netconsole start_netconsole
start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version;
serverip=192.168.1.106
ipaddr=192.168.1.104
ethaddr=52:3b:20:9c:11:51
ethact=egiga0
ethprime=egiga0

So as long as your netconsole server box is 192.168.1.106, then you should see this box pinging 192.168.1.106 during boot, and netconsole server should respond.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: No Netconsole on NSA325v2
December 04, 2020 02:34AM
Hi bodhi,

Thanks a bunch for helping out.

I am running Arch on the 192.168.1.106 machine. It seems to have two flavors of netcat: gnu-netcat and openbsd-netcat. I have been trying the GNU version so far, and it seems that the command you posted is only valid for the GNU version.

With your command I still don't get any output though.

It looks like my problem is not just netcat. I tried to ping 192.168.1.104 in a loop during boot, and it never responds. I confirmed with Wireshark that there are no ARP packets coming from the NAS at all during boot - neither in response to my ping, nor for it pinging to 192.168.1.106.

Is there anything else that could be wrong? For example, how can I be sure that "egiga0" is the correct name for the device?

Thanks again!
Re: No Netconsole on NSA325v2
December 04, 2020 04:14AM
SanderV,

Ah, I've overlooked this. Now that I did a doubletake, it is obvious.

This is not enough
preboot_nc=run if_netconsole start_netconsole

You also need to set preboot during u-boot installation. That env is missing on your list.

Quote
https://forum.doozan.com/read.php?3,12381

10. Set up netconsole. It's important to set up neconsole if you don't already have serial console connected. If you have serial console, don't set up netconsole at this moment, because it will interfere with serial console.

If you've flashed the default environments in step 8 then activate netconsole with the following envs:

Adjust 192.168.0.xxx and 192.168.0.yyy below to the real numbers in your network configuration. 192.168.0.xxx is this plug IP address, and 192.168.0.yyy is the IP address of the netconsole server where it will monitor the output from the this plug (adjust them to the real values in your own local network settings).

fw_setenv preboot_nc 'setenv nc_ready 0; for pingstat in 1 2 3 4 5; do; sleep 1; if run if_netconsole; then setenv nc_ready 1; fi; done; if test $nc_ready -eq 1; then run start_netconsole; fi'
fw_setenv preboot 'run preboot_nc'
fw_setenv ipaddr '192.168.0.xxx'
fw_setenv serverip '192.168.0.yyy'

So now boot into Arch rootfs, and set the envs again.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: No Netconsole on NSA325v2
December 04, 2020 08:36AM
Great success - you are a hero!

Thanks for your help and eye for detail. I must have overlooked that variable somehow.
Author:

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: