Nanopi R4S (4GB) install problems

Greetings

Bought a pair of Nanopi R4S (4GB) machines, some switching 5V - 5A switching power supplies (making sure I have 4A clean power available!!) and 32 GB SD cards (and cabling).
The idea is a router and a spare - - - so that when things are working if the router dies (all electronics does!!) then I have a setup spare ready to drop into production.
Some questions to start.
I have an existing router on my present wireless ISP provider connection that is set on 192.168.1.1 - - - how do I set up this replacement box easily so the routers are not on the same address?
(Do I set the new router to 192.168.2.1 say?)
(New router is because I'm getting a direct fiber connection later this fall with 1 Gbit capable although I'm only getting 250 MBit as compared to my present 9 Mbit down and 2 Mbit up I think I can live with the 250 MBit although if the new ISP is offering a sale on 500 MBit - - - I'll likely take it!)
Now to the problems.
I format the SD card by using
$ mkfs -t ext4 /dev/sdX
downloaded the image 'firmware openwrt snapshot install' from

then following the destructions on

image is copied to the sd card using the command
$ dd if=openwrt-*-sysupgrade.img of=/dev/sdX

when I examine the sd card after this point gparted says that there is one
partition /dev/sdX1 and the second is not labelled

tried using the 'expanding the filesystem' section but
$ losetup -d -o <offest> /dev/loop0 /dev/sdx
puked returning OFFSET
dunno what that means or what to do to change it.

tried labeling the second partition and expanding it using gparted but then the contents disappear.

Does anyone have a 'recipe' file for a noob at this to follow so that I can get my new girl working?

I've tried a three different times to get through this - - - should I be reformatting the sd card first before the next attempt?

My long time mentor (who had used openwrt for many years_ is no longer with us so I'm fully dependent upon list support now.

Please - - - help?

TIA

Are you working with the squashfs version or the ext4 version?

The following is for the squashfs version.

I have an R4S but have not expanded the writable f2fs (second partition) yet myself but it works for others. Note that because the dd command used to write the image to the sd card works at the block device level, there is no need to format anything on the sd card first. The image copied by the dd command writes the partition table.

It is my understanding at this point that the process in this link is done after first boot, unlike the instruction in the OpenWrt wiki, and can be done on the running router or a linux system.
https://forum.openwrt.org/t/nanopi-r4s-rk3399-r6s-rk3588s-4g-is-a-great-new-openwrt-device/79143/949

It may be good to browse that nano pi thread or search it for more details.
I hope this is what you need.

Sorry - - - my electronics 'joys' get fit around all the other things that need to get done around here so I sometimes take some time to get things tried or done.

Thank you for your link - - - that took me to the instructions that I needed.
Was able to complete the first step. Then to step 2.
Except - - - there are no definitions for what is being meant.

Blockquote

  1. grow f2fs filesystem
LOOP="$(losetup -n -O NAME | sort | sed -n -e "1p")"
ROOT="$(losetup -n -O BACK-FILE ${LOOP} | sed -e "s|^|/dev|")"
OFFS="$(losetup -n -O OFFSET ${LOOP})"
LOOP="$(losetup -f)"
losetup -o ${OFFS} ${LOOP} ${ROOT}
fsck.f2fs -f ${LOOP}
mount ${LOOP} /mnt
umount ${LOOP}
resize.f2fs ${LOOP}
reboot

Blockquote

I'm assuming that NAME is /dev/sdX - - - -
but what is BACK-FILE ?
what is OFFSET ?

I've tried looking at man pages for resize.f2fs as well as other pages and am finding no information to the information.

The final instruction is to 'reboot'.

This card is being developed on a my main workstation for the nanopi r4s.
What computer is being rebooted?
If the main workstation - - - - why?

What is that final step?
(Maybe just remove the connection from the SD card to the main workstation?)

The fiber line locates are now out - - - means that I need this new router pretty soon.

Thanks for the assistance!!

Hi. As I stated in my first reply I have not done this yet myself but I have read about it in preparation to do it. If the following doesn't meet your needs then it may be better to ask in the OpenWrt nano pi forum linked in my first reply. It gets a lot of traffic and you should get good answers.

From the info in the OpenWrt documentation, this process is to be done on the running router without other customization to the filesystems yet. I'm pretty sure it takes some changes to the process to do it from another linux system. I also think I read that it has to be done after first boot as the f2fs filesystem gets setup on first boot and is not shipped in the image file in a state usable to do these alterations.

Be sure to back up the router config to another device (not on the sd card) if you have some non default config in place.

You are not to supply any values to the commands in the "grow f2fs filesystem" instruction text block. What may look like parameters for you to substitute values for ("NAME", "BACK-FILE", "OFFSET" in upper case letters) are literal strings passed to the "-O" option of the losetup command. It is all an automated process that you can copy/paste to the router command line in your ssh session. Per the OpenWrt docs, the reboot is of the router and is needed to put the changes into effect.

That may be enough info to move forward with the process. The following is just for more knowledge.

Most of the programs and some of the built-in commands have help available. Try passing --help or -h parameter to a command to get help on it. The following all work:
losetup --help
sort --help
sed --help
fsck.f2fs --help
mount --help
umount --help
resize.f2fs --help

Specifics for the "grow f2fs filesystem" section:

LOOP="$(losetup -n -O NAME | sort | sed -n -e "1p")"
...gets the name of the loop device for the overlay filesystem for the writable area on the sd card as provisioned by the image installation and assigns it to a the variable "LOOP".
Show the value of the LOOP variable with echo $LOOP
Type losetup to see the default output.
Type losetup -n -O NAME to see what the script gets before adding /dev to it.

ROOT="$(losetup -n -O BACK-FILE ${LOOP} | sed -e "s|^|/dev|")"
...gets the device name for the combined root and overlay filesystems on the sd card and prepends /dev to the string and assigns it to variable ROOT

OFFS="$(losetup -n -O OFFSET ${LOOP})"
...gets the offset from the beginning of the partition to the start of the writable overlay area and assigns it to variable OFFS

LOOP="$(losetup -f)"
...gets the next free (-f) loop device id and assigns it to variable LOOP which is reusing variable LOOP.

losetup -o ${OFFS} ${LOOP} ${ROOT}
...creates a second loop device for the overlay filesystem that is already used and mounted for modification in the next four commands. It is passed the values in the three variables.

fsck.f2fs -f ${LOOP}
...I'm not sure if this is just an integrity check or if it fixes (-f) anything for use in other commands. It is passed the value of the LOOP variable.

mount ${LOOP} /mnt
umount ${LOOP}
...I'm not sure why this is needed but it probably sets info needed elsewhere. It is passed the value of the LOOP variable.

resize.f2fs ${LOOP}
... resizes the overlay filesystem to fill the partition per default values as the size is not specified on the command line. It is passed the value of the LOOP variable.

reboot
...reboots the router to put the changes into effect. The active overlay filesystem needs to be mounted early in the boot process as all the config is stored on it. I'm not sure what problems may arise with continuing to run with the changes made to the overlay filesystem so shutting down soon after resizing is probably a good idea.
NOTE that reboot will turn off the router and it may not restart due to an issue with voltage to the sd card reader. You may need to unplug the power cable and re plug it to get it to boot. This may always be the case on all reboots and system crash/restart unless you run a build with the right patch included.

Good Luck! I hope this info helps.

Dunno - - - I seem to more lost - - - don't even know how to get out of the hole I'm in.

Asked my question over on the 'dev' side of things.
Likely they will rant over such noob questions.
Dunno how to do this - - - the destructions I can find are incomplete and assume a lot of knowledge and activities I know nothing about.

Getting hard to keep asking questions.

Can't even find any routers for sale in the area that are supported on Openwrt.
Really don't like the option the new ISP is offering ( a M$ win controlled Mikrotik) but I'm running out of ideas and would like a functioning router.

To be very honest, you may be better served paying someone local to help you out and put it all together for you. It's pretty common even with 'prosumer' gear like Ubiquiti.

Hmmmmmmm - - - and how do I find such unobtanium?

Well, I suppose you can inquire here, or Craigslist is probably a decent option. There's enough OpenWRT knowledge around the world that there has to be someone local in your area, but it's pretty clear that forum support isn't going to be sufficient. Unfortunately, OpenWRT still hasn't quite reached the level of plug-and-play, particularly on specialty hardware.

You make some interesting assumptions - - I'd be willing to bet a good steak dinner that there likely isn't such a knowledgeable person within 20 minutes drive (in any direction!).

Curious as to what makes it '. . . pretty clear that forum support isn't going to be sufficient.' ?

Hello,

Any update on this thread?
I've just received my nanopi R4SE and I don' trust the friendlyWRT FW that comes with it. I just want to install the latest OpenWrt release there.

I'm following the instructions above (downloading the correct FW and copying it to the SD card with Win32imager) and I boot the Nanopi with the SD card inserted (I'm simply inserting the SD card and force a reboot - Not sure if anything else is needed, at least nothing is stated anywhere).

However, it seems the SD card is ignored by nanopi and the friendlyWRT loads instead. I've tried different SD cards already and the result is the same.

SSH'ing into the friendlyWRT I'm able to mount the SD card and see the OpenWRT contents, so the card seems to be OK. Just not sure how to force Nanopi to boot from it.

Any suggestion?
Thanks!

To boot from the SDCard you either have to press the Mask Button or you would need to overwrite the Loader on the emmc.

https://wiki.friendlyelec.com/wiki/index.php/NanoPi_R4SE#The_Boot_order_between_eMMC_and_SD_card

1 Like

That was it! Thanks a million!

I had missed that chapter, but had tried booting with the mask button pressed. It seems I didn't hold it for enough time.

You saved my day :slight_smile:

Did you just used the mask button option or did you also tried the boot loader overwriting?
My emmc is giving me issues so I haven't been able to try the boot loader overwrite.

I used the mask button.
Then, already in OpenWRT I did something stupid but by then seemed fine:

dd if=/dev/mmcblk2 of=/dev/mmcblk1

Basically I wanted to copy the contents of sd card to emmc.

Now it can only boot with the mask button on :frowning:

Welcome to the club.
While I installed my image via the Friendlywrt Webinterface but same result the emmc is not visibile anymore. Booting openwrt SD Card via mask button works but none of the friendlywrt recovery SD's working anymore. Will have to connect a UART when I have time.

BTW you wrote of=/dev/mmcblk1, based on the friendlywrt page they overwrite the Loader on mmcblk2.

Have you tried it?
I've just been able to load a friendlyWRT image back to the nanopi, what an adventure!

Then it booted automatically to friendlyWRT without mask button. Not exactly what I wanted, but at least it booted something in case of a power outage.

This friendlyWRT version had the eMMC tools option in the GUI, while the other coming from factory didn't.

Tried to upload an openWRT image throught the eMMC tools option, it bricked the device again (had to recover it again with UART procedure).

But then when using the dd if=/dev/zero of=/dev/mmcblk2 bs=8M count=1 option, I'm now able to boot from the SD. :slight_smile:

I guess it will not be possible to load OpenWRT on the eMMC, unless it uses the Rockchip MiniLoader.

As this is currently my main firewall I haven't had time to dismantle it.

Ok, based on the screenshot you used the Windows Recovery tool? Maybe I try that.

Well at least that makes the device useable.

Agree that a openwrt on the emmc might be a long shot but maybe one day someone make it happen.

Thanks for the info, I was about to buy a Nanopi R4SE, but if is unable to boot OpenWRT from the eMMC, I will choose another model .

Gabrielo

Well, not sure if it is possible/easy to have OpenWRT booting with Rockchip miniLoader. It's beyond my knowledge and understanding.

To be honest, if it was today, I'd buy this one instead: It is a "pure RPI4" with 2x GB ports, so compatibility should be much easier.

But to be fair, I think I feel safer to boot from the SD card. I plan to have another card as a backup, so if I get any corruption, I can easily replace it. Having a corruption in eMMC would be more troublesome to recover.

Gabriel Ramirez gabrielo
December 15 |

  • | - |

jabss:

I guess it will not be possible to load OpenWRT on the eMMC, unless it uses the Rockchip MiniLoader.

Thanks for the info, I was about to buy a Nanopi R4SE, but if is unable to boot OpenWRT from the eMMC, I will choose another model .

Greetings

If you load the FriendlyWRT - - - you're going to get the FriendlyWRT.

If on the other hand you follow the directions for burning OpenWRT on your SD card
well - - - you'll have something different.

What to load - - - sorry that's what I'm working on.
I do have a functioning openwrt on my Nanopi R4S.

HTH