NanoPi R4S-RK3399 is a great new OpenWrt device

So it does !!....how to install on emmc then??

You seem to interpret the word "no" differently than the world around you…

2 Likes

:joy: he’s making the same error as me, the one with the eMMC is the R4SE, see here: https://www.cnx-software.com/2022/07/24/nanopi-r4se-dual-gigabit-ethernet-router-32gb-emmc-flash/.

By the way mine is arrived, I’m starting to configure it while I'm using the r7800 as main/WAN router:

...but about the DSA VS swconfig, on the OpenWRT VLAN wiki I just read:

Newer devices with embedded switches (like Netgear R7800) use the DSA switch driver,

Now I’m a bit confused about your post :thinking: so the DSA migration is ready but not in use? And why the wiki says the R7800 uses it?

Yes, sorry...my fault, didn't read word 'no' before flash emmc

Nice photo. Like what others said above, although many targets use DSA now, the R7800 still uses swconfig.

1 Like

Ah okay thanks, ideed the layout/names of the interfaces are different, but I don't know why the wiki says the R7800 use the DSA.

I'm starting to have (stupid) issue, I've installed the ext4 image, configured the newtork, installed LuCi, etc... then I updated it from LuCi with the squashfs.

Now I want to exapand the filesystem to use the 32Gb microSD but I don't understand what to do here, following the wiki:

root@OpenWrt:~# losetup
NAME       SIZELIMIT  OFFSET AUTOCLEAR RO BACK-FILE  DIO LOG-SEC
/dev/loop0         0 3014656         1  0 /mmcblk1p2   0     512

root@OpenWrt:~# losetup -d -o 3014656 /dev/loop0 mmcblk1p2
losetup: -o: failed to use device: No such device
root@OpenWrt:~# losetup -d -o 3014656 /dev/loop0 /dev/mmcblk1p2
losetup: -o: failed to use device: No such device
root@OpenWrt:~# losetup -d -o 3014656 /dev/loop0 /dev/sde2
losetup: -o: failed to use device: No such device

root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 3.0M      3.0M         0 100% /rom
tmpfs                     1.9G      1.2M      1.9G   0% /tmp
/dev/loop0               99.1M     64.8M     34.3M  65% /overlay
overlayfs:/overlay       99.1M     64.8M     34.3M  65% /
tmpfs                   512.0K         0    512.0K   0% /dev

Surely a stupid issue, I've never used losetup, but what is the correct name of the "device"?

Edit: oh, I’ve found this discussion, glad I’m not the only one with this issue :smiley: I’ll try to expand the file system before the first boot (and I’ll make again all the installation process).

After an hour of work I've finally done it, probably was long time since I don't use linux, and unfortunately I have only Macs, so I can't use GUI apps like Gparted, but I had to mount the microSD into my other OpenWrt router, resize the partition from there using fdisk, then boot the R4S, then expand the filesystem using tune2fs and resize2fs.

before

Device     Boot  Start    End Sectors  Size Id Type
/dev/sdb1  *     65536  98303   32768   16M 83 Linux
/dev/sdb2       131072 344063  212992  104M 83 Linux

after

Device     Boot  Start      End  Sectors  Size Id Type
/dev/sdb1  *     65536    98303    32768   16M 83 Linux
/dev/sdb2       131072 62333951 62202880 29.7G 83 Linux

PS: every time I re-write the microSD and I boot again I have to edit the /etc/config/network in order to add the default gateway and DNS, after I have to reboot the R4S because if I only reload the network it can ping but it can't solve the DNS and I can't use opkg to install packages.

Finally

root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                29.3G     11.4M     29.3G   0% /
tmpfs                     1.9G     76.0K      1.9G   0% /tmp
tmpfs                   512.0K         0    512.0K   0% /dev

An easy thing like this takes hours if you don't have a linux machine. I hope the wiki for the squashfs will be fixed/corrected.

Now I'm scared to upgrade to the squashfs :sweat_smile: is it safe to upgrade with the Sysupgrade Squashfs image before doing other things? The Squashfs filesystem is more appropriate for the micrSD for what I'm reading, and -most important- after the upgrade, the /root will not "shrink" again to 100mb?! Right? :grinning:

Wrong :frowning: I'm back with 100MB root partition. I have to do all again, I think I have to understand well what's the difference from ext4, squashfs and how they work. Sorry for annoying, I'll post into the Installing and Using OpenWrt forum.

Have you tried following the reply to earlier question here?

1 Like

What the f... this worked for the squashfs in few minutes! Easy and functionally. Thanks a lot for it. (This tip should be absolutely included in the wiki in my opinion)

root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 3.0M      3.0M         0 100% /rom
tmpfs                     1.9G      1.2M      1.9G   0% /tmp
/dev/loop0               29.7G    915.2M     28.8G   3% /overlay
overlayfs:/overlay       29.7G    915.2M     28.8G   3% /
tmpfs                   512.0K         0    512.0K   0% /dev

I know you said you cant use Gparted, but why not just create a ubuntu usb, boot fromm USB then click try ubuntu, and open gparted.

Ive booted ubuntu from mac mini

Yes yes, I can but to me seems to be a bit overkill run a complete new OS only to resize a partition! Probably this would have took me less time, but in the end I solved the issue and I learned new things that can be useful in the future.

Homebrew ( https://brew.sh/ ) is a package manager for Macs that has a lot of open source apps, with many of the useful utilities found on *nix systems ported to the mac. I use gdisk from there to manage GPT partition tables on sd cards. MacPorts ( https://www.macports.org/ ) is another source but I haven't used that one.

1 Like

I have installed Homebrew and I'm using it often, I hadn't thought about it, thanks for the suggestion, what tool did you used to write the squashfs fs on macOS?

I'm not sure that I understand your question but I imaged my sd card for the initial installation with squashfs OpenWrt for my R4S with the dd command. I did not extend the f2fs for /overlay. I did one ota upgrade so far with Luci. My usage of gdisk on sd cards was for other linux purposes.

Okay, because if you need to do it (as I did) or you follow the tutorial linked above and you expand it directly from OpenWrt, or you have to install “ *something” to write squashfs on macOS. *I don’t know which free tools allow it (Or you can use Linux as suggested). This was my issue.

But in the end I managed it straight on OpenWrt.

1 Like

I have question @walmartshopper, and to who ever else is using the r8168 driver...

When using the r8168 driver, are you also selecing the r8169 firmware and the kmod-phy-realtek? In other words, these:

and

Or are you just selecing the r8168 driver and nothing more?

1 Like

Uhm I was configuring it, I installed my packages (also the luci package that displays your mount points in the GUI, block-mount? IIRC), then I updated with the latest snapshot build, rebooted and…

…my root partition has been resized again to 100MB!

Hmmm this is annoying.

So I tried to resize it again to fill the sd, done it via gparted, but when I tried to expand the root I got an error in the sd

root@nanoPi-R4S:~# fsck.f2fs -f ${LOOP}
Info: Force to fix corruption
Magic Mismatch, valid (0xf2f52010) - read (0x6320)
Can't find a valid F2FS superblock at 0x0
Magic Mismatch, valid (xf2f52010) - read (0x2005)
Can't find a valid F2FS superblock at 0x1

I have only a screenshot because if I copy/paste it gets bad formatted:

I tried to mount and repair the file system from the other OpenWrt router (mounted as USB) but I wasn’t able to repair it. The error was still there.

I had the partition correctly resized but I was unable to expand the fs inside it.

So in the end I want to do a clean installation, I was annoyed, I cleared the sd card, reinstalled all again, (I had the backup of packages/settings) and I flashed the squashfs build.

Now I’m again with the 100mb in the main partition but I’m frustrated to understand what’s going on.

I can resize it again and expand (if I get no errors) but then again I’m scared that it will be automatically resized to 100mb.

So I’ll leave the 100mb as root, I don’t need more space, I’m using 2/3mb but I wonder why it gets resized. Probably is because I’m using the online build server.

My only problem is the wearing of the microSD, cause if OpenWrt writes and rewrites only in this 100MB the sd will last nothing. I hope something like the TRIM or GC works well and the blocks used are not always the same inside this 100mb.

But I also don’t know what to do with the other free space.

With my old config I was writing all the collectd stats to an external USB drive, in order to save the internal drive wear and then I was importing it into a graphs a server to build some stats and get alerts when the temperature is to high or there’re lots of packets queued in th SQM, etc… see here: http://giuliomagnifico.blog/networking/2022/06/02/my-network-home-setup.html

Maybe I can use the other free space to save the data instead of the external USB drive? Hmmm :thinking: if the USB drive became corrupted I can replace it but if it’s the microSD with the main system also, it’s annoying and I will be also offline.

Any other suggestion with all of this free space in the microSD?

What are you using it for?

Thanks

I'am using only r8168 in my test build. In the realtek driver package there is r8168_firmware.c + r8168_firmware.h

imo selecting r8169 firmware is not needed because you dont use it. saves you some space.

I've got now 2x NanoPi R4S. 1GB and 4GB variant. Both are working fine with patched OpenWrt.

I'am using r8168 + friendlyarm u-boot patches + armbian u-boot patches for 1GB version.
I have to stress test them in next few days/weeks before I will use the 4GB variant as my main router. After that I will release weekly builds and try to push u-boot patches to official.
But first I have still some things to learn.. :sweat_smile:

3 Likes

I just select kmod-r8168 and unselect kmod-r8169. I did not unselect kmod-phy-realtek or r8169-firmware. I don't think they get used when r8168 is loaded, but it doesn't seem to hurt anything leaving them enabled.

1 Like