[BPI-R3] Debian Bullseye Image

Normally apt-get clean removes cached packages from /var/lib/apt. It is a fast way to possible make free space. You can look into that dir if there are any packages. Or cleanup some other dirs e.g. /var/log (but here not delete files,but only truncate them e.g. with echo -n “”>/var/log/logfile and only with textlogs…not wtmp)

Have not seen this before,i guess something with card/filesystem is wrong…but to do anything you have to make space of course…than ran fsck/badblocks and compare rootfs in “df -h” with “du -hs”…it should show same used space…all other is really strange.

This is what it shows for the moment, where is the swap?

Erase and write again is to return to the initial state

root@bpi-r3:~/Documentos/Bpi# df -h
S.ficheros     Tamaño Usados  Disp Uso% Montado en
/dev/root        5,9G   5,7G     0 100% /
devtmpfs         993M      0  993M   0% /dev
tmpfs            995M      0  995M   0% /dev/shm
tmpfs            398M   1,6M  397M   1% /run
tmpfs            5,0M      0  5,0M   0% /run/lock
/dev/mmcblk0p5   100M   7,8M   92M   8% /boot
tmpfs            199M      0  199M   0% /run/user/0


 df -h
S.ficheros     Tamaño Usados  Disp Uso% Montado en
/dev/root        5,9G   5,7G     0 100% /
devtmpfs         993M      0  993M   0% /dev
tmpfs            995M      0  995M   0% /dev/shm
tmpfs            398M   1,6M  397M   1% /run
tmpfs            5,0M      0  5,0M   0% /run/lock
/dev/mmcblk0p5   100M   7,8M   92M   8% /boot
tmpfs            199M      0  199M   0% /run/user/0



root@bpi-r3:~/Documentos/Bpi# fdisk -l
Disk /dev/mtdblock0: 20 MiB, 20971520 bytes, 40960 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mtdblock1: 10,5 MiB, 11010048 bytes, 21504 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mtdblock2: 512 KiB, 524288 bytes, 1024 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mtdblock3: 512 KiB, 524288 bytes, 1024 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
 I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mtdblock4: 256 KiB, 262144 bytes, 512 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mtdblock5: 128 KiB, 131072 bytes, 256 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mtdblock6: 128 KiB, 131072 bytes, 256 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mmcblk0: 119,08 GiB, 127865454592 bytes, 249737216 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 2BD17853-102B-4500-AA1A-8A21D4D7984D

Device          Start      End  Sectors  Size Type
/dev/mmcblk0p1     34     8191     8158    4M Linux filesystem
/dev/mmcblk0p2   8192     9215     1024  512K Linux filesystem
/dev/mmcblk0p3   9216    13311     4096    2M Linux filesystem
/dev/mmcblk0p4  13312    17407     4096    2M Linux filesystem
/dev/mmcblk0p5  17408   222207   204800  100M Linux filesystem
/dev/mmcblk0p6 222208 12805120 12582913    6G Linux filesystem
root@bpi-r3:~/Documentos/Bpi# fdisk /dev/mmcblk0

Welcome to fdisk (util-linux 2.36.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/mmcblk0: 119,08 GiB, 127865454592 bytes, 249737216 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 2BD17853-102B-4500-AA1A-8A21D4D7984D

Device          Start      End  Sectors  Size Type
/dev/mmcblk0p1     34     8191     8158    4M Linux filesystem
/dev/mmcblk0p2   8192     9215     1024  512K Linux filesystem
/dev/mmcblk0p3   9216    13311     4096    2M Linux filesystem
/dev/mmcblk0p4  13312    17407     4096    2M Linux filesystem
/dev/mmcblk0p5  17408   222207   204800  100M Linux filesystem
/dev/mmcblk0p6 222208 12805120 12582913    6G Linux filesystem

Command (m for help):

swap ?

root@bpi-r3:~/Documentos/Bpi#  file -s /dev/mmcblk0p1
/dev/mmcblk0p1: data
root@bpi-r3:~/Documentos/Bpi#  file -s /dev/mmcblk0p2
/dev/mmcblk0p2: data
root@bpi-r3:~/Documentos/Bpi#  file -s /dev/mmcblk0p3
/dev/mmcblk0p3: data
root@bpi-r3:~/Documentos/Bpi#  file -s /dev/mmcblk0p4
/dev/mmcblk0p4: data
root@bpi-r3:~/Documentos/Bpi#  file -s /dev/mmcblk0p5
/dev/mmcblk0p5: DOS/MBR boot sector, code offset 0x3c+2, OEM-ID "mkfs.fat", sectors/cluster 4, reserved sectors 4, root entries 512, Media descriptor 0xf8, sectors/FAT 200, sectors/track 63, heads 255, hidden sectors 17408, sectors 204750 (volumes > 32 MB), reserved 0x1, serial number 0x832cc230, label: "BPI-BOOT   ", FAT (16 bit)
root@bpi-r3:~/Documentos/Bpi#  file -s /dev/mmcblk0p6
/dev/mmcblk0p6: Linux rev 1.0 ext4 filesystem data, UUID=be301eb8-7cb9-4f3d-abd1-e1ce32973fa6, volume name "BPI-ROOT" (needs journal recovery) (errors) (extents) (large files) (huge files)

Captura%20de%20pantalla%202023-07-17%20100220htop

I have not defined any swap as this is a very basic image,only necessary changes (fstab,hostname,network config,wifi firmware) and some few preinstalled packages like hostapd

I see df twice (after reformatting with <> button) but not the du summary. If the output differs there is something wrong with the fs…and we are at the fsck step

If I want to make a clean image, only with this system?

I see that you also need to be able to implement security

root@bpi-r3:/var/log# modprobe xt_connlimit
modprobe ip_nat_amanda
modprobe ip_conntrack_ftp
modprobe ip_nat_ftp
modprobe ip_conntrack_irc
modprobe ip_nat_irc
modprobe ip_conntrack_amanda
modprobe iptable_filter
modprobe iptable_nat
modprobe iptable_mangle
modprobe iptable_raw
modprobe iptable_security
modprobe nf_nat_ipv4
modprobe nf_nat_ipv6
modprobe nf_conntrack_ipv4
modprobe nf_conntrack_ipv6
modprobe nf_conntrack
modprobe nf_defrag_ipv4
modprobe nf_defrag_ipv6
modprobe ipt_LOG
modprobe ipt_REJECT
modprobe ip_tables
modprobe nfnetlink
modprobe nf_conntrack_netlink
modprobe nf_conntrack_broadcast
modprobe xt_conntrack
modprobe ipt_MASQUERADE
modprobe iptable_nat
modprobe nf_nat
modprobe nf_log_ipv6
modprobe sch_tbf
modprobe act_police
modprobe xt_OSPF
modprobe: FATAL: Module xt_connlimit not found in directory /lib/modules/6.1.0-bpi-r3-main
modprobe: FATAL: Module ip_nat_amanda not found in directory /lib/modules/6.1.0-bpi-r3-main
modprobe: FATAL: Module ip_conntrack_ftp not found in directory /lib/modules/6.1.0-bpi-r3-main
modprobe: FATAL: Module ip_nat_ftp not found in directory /lib/modules/6.1.0-bpi-r3-main
modprobe: FATAL: Module ip_conntrack_irc not found in directory /lib/modules/6.1.0-bpi-r3-main
modprobe: FATAL: Module ip_nat_irc not found in directory /lib/modules/6.1.0-bpi-r3-main
modprobe: FATAL: Module ip_conntrack_amanda not found in directory /lib/modules/6.1.0-bpi-r3-main
modprobe: FATAL: Module iptable_filter not found in directory /lib/modules/6.1.0-bpi-r3-main
modprobe: FATAL: Module iptable_nat not found in directory /lib/modules/6.1.0-bpi-r3-main
modprobe: FATAL: Module iptable_mangle not found in directory /lib/modules/6.1.0-bpi-r3-main
modprobe: FATAL: Module iptable_raw not found in directory /lib/modules/6.1.0-bpi-r3-main
modprobe: FATAL: Module iptable_security not found in directory /lib/modules/6.1.0-bpi-r3-main
modprobe: FATAL: Module nf_nat_ipv4 not found in directory /lib/modules/6.1.0-bpi-r3-main
modprobe: FATAL: Module nf_nat_ipv6 not found in directory /lib/modules/6.1.0-bpi-r3-main
modprobe: FATAL: Module nf_conntrack_ipv4 not found in directory /lib/modules/6.1.0-bpi-r3-main
modprobe: FATAL: Module nf_conntrack_ipv6 not found in directory /lib/modules/6.1.0-bpi-r3-main
modprobe: FATAL: Module nf_conntrack not found in directory /lib/modules/6.1.0-bpi-r3-main
modprobe: FATAL: Module nf_defrag_ipv4 not found in directory /lib/modules/6.1.0-bpi-r3-main
modprobe: FATAL: Module nf_defrag_ipv6 not found in directory /lib/modules/6.1.0-bpi-r3-main
modprobe: FATAL: Module ipt_LOG not found in directory /lib/modules/6.1.0-bpi-r3-main
modprobe: FATAL: Module ipt_REJECT not found in directory /lib/modules/6.1.0-bpi-r3-main
modprobe: FATAL: Module ip_tables not found in directory /lib/modules/6.1.0-bpi-r3-main
modprobe: FATAL: Module nfnetlink not found in directory /lib/modules/6.1.0-bpi-r3-main
modprobe: FATAL: Module nf_conntrack_netlink not found in directory /lib/modules/6.1.0-bpi-r3-main
modprobe: FATAL: Module nf_conntrack_broadcast not found in directory /lib/modules/6.1.0-bpi-r3-main
modprobe: FATAL: Module xt_conntrack not found in directory /lib/modules/6.1.0-bpi-r3-main
modprobe: FATAL: Module ipt_MASQUERADE not found in directory /lib/modules/6.1.0-bpi-r3-main
modprobe: FATAL: Module iptable_nat not found in directory /lib/modules/6.1.0-bpi-r3-main
modprobe: FATAL: Module nf_nat not found in directory /lib/modules/6.1.0-bpi-r3-main
modprobe: FATAL: Module nf_log_ipv6 not found in directory /lib/modules/6.1.0-bpi-r3-main
modprobe: FATAL: Module sch_tbf not found in directory /lib/modules/6.1.0-bpi-r3-main
modprobe: FATAL: Module act_police not found in directory /lib/modules/6.1.0-bpi-r3-main
modprobe: FATAL: Module xt_OSPF not found in directory /lib/modules/6.1.0-bpi-r3-main

Yes,this is kernel topic not image (image only uses my kernel). R3 has very limited kernel config,i need to add firewall modules and some more…but very limited in time atm (i’m no employee of bpi and do this all in spare time).

Thats why i created the image creator script which allows creating image with the latest LTS kernel for the device, so have not to do all manually for each device and distro and update these images after some time. And it is clear how the image was created for security reasons (prove that i have not added some own code).

But creating an image automaticly is also some work and needs a bit more work on user side (not only download,unpack,flash).

Greetings.

Today I had a bit more time trying to create something with https://github.com/frank-w/BPI-Router-Images

I have installed a virtual machine with ubuntu to be able to start working for a possible image in which to include more things.

# Download the necessary files
# Installbootstrap
sudo apt install -y debootstrap

# uboot repository

cd /home/gabriel/Downloads
  git clone https://github.com/frank-w/u-boot.git
  git clone https://github.com/frank-w/BPI-Router-Images.git
  cd BPI-Router-Images/

./buildimg.sh bpi-r3 bookworm

bash: ./buildimg.sh: No such file or directory
root@vmwareubuntu:/home/gabriel/Downloads# cd BPI-Router-Images/
root@vmwareubuntu:/home/gabriel/Downloads/BPI-Router-Images# ./buildimg.sh bpi-r3 bookworm
create image for bpi-r3 (arm64) bookworm 6.1
board: bpi-r3
kernel: 6.1
board:bpi-r3 ubootfile: https://github.com/frank-w/u-boot/releases/download/CI-BUILD-2023-07-bpi-2023.07-2023-07-18_0722/bpi-r3_sdmmc.img .gz
board:bpi-r3 kernelfile: https://github.com/frank-w/BPI-Router-Linux/releases/download/CI-BUILD-6.1-main-6.1.50-2023-08-31_2023/bpi-r3_6 .1.50-main.tar.gz
ubootfile: https://github.com/frank-w/u-boot/releases/download/CI-BUILD-2023-07-bpi-2023.07-2023-07-18_0722/bpi-r3_sdmmc.img.gz filename: bpi -r3_sdmmc.img.gz
kernelfile: https://github.com/frank-w/BPI-Router-Linux/releases/download/CI-BUILD-6.1-main-6.1.50-2023-08-31_2023/bpi-r3_6.1.50-main. tar.gz filename: bpi-r3_6.1.50-main.tar.gz
image-file: bpi-r3_sdmmc.img.gz
kernel-file: bpi-r3_6.1.50-main.tar.gz
checking for needed packages...
qemu-arm-static missing
-rw-r--r-- 1 root root 7.2M sep 1 10:13 bpi-r3_sdmmc.img.gz
ls: cannot access 'bookworm_arm64.tar.gz': No such file or directory
rootfs file missing

what am I doing wrong?

we should discuss this in the right thread Debian/Ubuntu image creation

you do not need to clone u-boot-repo, as the script downloads files (uboot,kernel) from github-releases built by github actions CI

yes i have not yet added a check for packages…and some error-checks are missing (to stop script after an error)

for the debootstrap things you will need these:

sudo apt install qemu-user-static debootstrap binfmt-support

uploaded bookworm image for r3 here created by repo above:

https://drive.google.com/drive/folders/1fxDR-uL3DIO-8ebgqOJd5MoWORQTTm7Z?usp=drive_link

edit: found an issue in second hostapd service file which prevents hostapd to be started…passed pidfile is wrong…just add the “2” like in PID-variable above

edit: uploaded new version with fixed uboot (missing emmc-partconf, sata-config) and fixed service file and prepared pppoe/ipv6tunnel

i try to extract some parts of my very complicated firewall file as basic config for r3…

Hi,

First thank you for your work.

Anyone eho can tell me how to get a USB wifi module to work?

I did like this: https://wiki.debian.org/ath9k_htc#supported apt-get update && apt-get install firmware-atheros

But it seems like there is missing something to load the driver…

Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 006: ID 0cf3:7015 Qualcomm Atheros Communications TP-Link TL-WN821N v3 / TL-WN822N v2 802.11n [Atheros AR7010+AR9287] Bus 001 Device 002: ID 1a40:0101 Terminus Technology Inc. Hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

[ 145.751888] usb 1-2: USB disconnect, device number 3 [ 149.112288] usb 1-2: new high-speed USB device number 4 using xhci-mtk [ 525.118105] usb 1-2: USB disconnect, device number 4 [ 530.412270] usb 1-2: new high-speed USB device number 5 using xhci-mtk [ 1071.635854] usb 1-2: USB disconnect, device number 5 [ 1074.902278] usb 1-2: new high-speed USB device number 6 using xhci-mtk

I am using the Bookworm image - but could not find better place to put the question??

Thank you

hi

@frank-w what is the latest 6.1 kernel for the bpir3 in your repository ? i try 6.1-main and 6.1-r3 because both missing the VRF option.

is the git checkout -r origin/6.1-main , for example , the right path to checkout the 6.1 kernel branch ?

how can i modify this remote checkout that is my main branch , to do an simple git pull for 6.1

sorry for this questions but i’m not an regular git user.

Holger

  • 6.1-main is the latest…just “git checkout 6.1-main” after clone
  • Just stay local on this branch…git itself has no “default” branch it is only for remote checkout…if you stay here you can update using git pull…
  • Change build.conf to bpi-r3 make ./build.sh importconfig and then ./build.sh config for menuconfig to add your own options

hi

thank you , for answer

Holger

hi

@frank-w if i use your bullseye image , why can´t use your kernel deb package , he will not boot the new installed kernel by dpkg -i . the bullyseys dist boot allways the default kernel.

with your debain image for the r2 and your kernel build deb package work this well , i upgrade the kernel with dpkg and the r2 boot the new version.

how can do this behavior with the r3 bullseye dist with your kernel build repository and the generated deb package.

Holger

The default kernel deb only unpacks the kernel,but not tell uboot to use the new file.

So you just need to add the new filename to the uEnv.txt

fit=bpi-r3-6.6.x.itb

I want to avoid overwriting the old kernel so added version to the file,but have not tried to modify uEnv.txt in deb script of kernel as this needs to add a script in the deb.

the modification , and copy , of the uEnv.txt did not work .

per default in your bullseys dist , there is no uEnv.txt in /boot i try to copy and modify out of the deb file , this file but the bpir3 will allways boot the default kernel.

Holger

There is no uEnv.txt in the deb file…there is an itb which should be in /boot now…this file is the one fit var in uEnv.txt has to point to. /boot needs to be mountpoint of mmcblkXp5 (default in my image)

Just create the file there and add the fit line with correct filename

hi

i recreate the kernel again , backup the boot dir and overwrite the old files with the new kernel , now he boot again and i have my mpls and vrf lite

holger

Ok,but still wonder why uenv.txt setting is not recognized…

Do you have

  • /dev/mmcblk0p5 mounted to /boot
  • A itb file from deb-package with kernel version number in /boot
  • An uEnv.txt in /boot with line fit=<filename of itb>

?

root@bpir3:/home/glaess# mount | grep blk
/dev/mmcblk0p6 on / type ext4 (rw,relatime)
/dev/mmcblk0p5 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)

root@bpir3:/home/glaess# ls -l /boot
insgesamt 31478
drwxr-xr-x 2 root root     2048  2. Mai 12:42 6_1_50
-rwxr-xr-x 1 root root    21335  2. Mai 12:38 bpi-r3.dtb
-rwxr-xr-x 1 root root  8671816  2. Mai 12:38 bpi-r3.itb
-rwxr-xr-x 1 root root 23534144  2. Mai 12:38 uImage_nodt

i hope that helps as answer. all file from my own build kernel package

You do not need uImage_nodt and dtb…only the itb. The other 2 files are for making tests with overlays or using separate dtb. And i see no uEnv.txt there…default value for fit var is bpi-r3.itb,so this is why it works