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.' ?