Python, numpy and or other libraries not installing

There is no dedicated image (nor sysupgrade files) for that board in 19.07 either, so I'm not sure what you mean.
https://downloads.openwrt.org/releases/19.07.7/targets/x86/64/
the only thing that changed in 21.xx is that someone added the sub target name in the file name, so now it is called "generic ----"

PC Engines APU (2-3-4) is just a mini PC and uses generic x86_64 image like a normal PC. Only special thing for it is kmod-pcengines-apuv2 package you can install if you want to use the front button and leds.

That said, x86 targets have no sysupgrade images, you use the same image type you used to install as a sysupgrade image. So for example if you used combined-ext4.img.gz from 19.07 you should use generic-ext4-combined.img.gz from 21.xx. Same procedure as normal sysupgrade, you just give the same image as you downloaded it in the Luci web interface for firmware upgrade, or with the command from SSH

At least this is if you are using normal OpenWrt.

Okay, now I got things up to the 21 version. New problem. I cannot resize the overlay partition the way it is described in here (https://openwrt.org/docs/guide-user/installation/openwrt_x86#resizing_f2fs_overlay). I have only a few megabytes for installing python before it is full. The problem comes at the step:

root@OpenWrt:~# resize2fs /dev/sda2
resize2fs 1.45.6 (20-Mar-2020)
resize2fs: Resource busy while trying to open /dev/sda2
Couldn't find valid filesystem superblock.

The method described did work in the previous 19 version.

I updated with the openwrt-21.02.0-rc3-x86-64-generic-squashfs-combined.img.gz file

the wiki says to do


OFFSET="$(losetup -n -O OFFSET /dev/loop0)"
losetup -o ${OFFSET} /dev/loop1 /dev/sda2
resize.f2fs /dev/loop1

and that's not what you are doing.

/dev/sda2 is not /dev/loop1

The wiki also says

Make sure to resize partitions beforehand.

of which final step is the resize2fs.

Without it if I do the commands you outlined, nothing happens, and after reboot, nothing has changed, except that fdisk says that partition size is 4G

Hmm, that paragraph is unclear.

The way I understand it, the "Resize partitions" does not include
resize2fs /dev/sda2

resize2fs is a tool to resize ext4 filesystem, and you don't have that.

It also says

This is possible only if you have chosen the combined-ext4.img.gz type of image, and currently due to technical limitations you can't just resize the ext4 partition online (while it is mounted) so you will need to install OpenWrt on another drive to use it to perform the following operations. Also using a Linux system (either from a VM or actually installed in a PC) will of course work.

so not all the commands in there are applicable to your case.

and from the error you get, it seems you are trying to work on a mounted partition (it says it is busy), while the instruction says to do this from a secondary OpenWrt.
I think that PCEngines APU boot sequence is first USB and then internal SD card, so if you write an OpenWrt on a USB drive and then plug it in it should start from that, and then you can enlarge partitions when they are not busy (not mounted).

Although I'm not 100% sure and it's probably best to call in @vgaetera since he wrote the paragraph about resizing F2fs partition so he should know.

I installed ext4 version. Tried to use the tutorial, following was recorded:

root@OpenWrt:~# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0 14.9G  0 disk
├─sda1   8:1    0   16M  0 part /boot
└─sda2   8:2    0  104M  0 part /
root@OpenWrt:~# fdisk /dev/sda

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/sda: 14.91 GiB, 16013942784 bytes, 31277232 sectors
Disk model: Hoodisk SSD
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: dos
Disk identifier: 0x40e33d43

Device     Boot Start    End Sectors  Size Id Type
/dev/sda1  *      512  33279   32768   16M 83 Linux
/dev/sda2       33792 246783  212992  104M 83 Linux

Command (m for help): d
Partition number (1,2, default 2): 2

Partition 2 has been deleted.

Command (m for help): n
Partition type
   p   primary (1 primary, 0 extended, 3 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (2-4, default 2): 2
First sector (33280-31277231, default 34816): 33792
Last sector, +/-sectors or +/-size{K,M,G,T,P} (33792-31277231, default 31277231):

Created a new partition 2 of type 'Linux' and of size 14.9 GiB.
Partition #2 contains a ext4 signature.

Do you want to remove the signature? [Y]es/[N]o: n

Command (m for help): w

The partition table has been altered.
Syncing disks.

root@OpenWrt:~# resize2fs /dev/sda2
resize2fs 1.45.6 (20-Mar-2020)
Filesystem at /dev/sda2 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
resize2fs: Invalid argument While checking for on-line resizing support
root@OpenWrt:~# OFFSET="$(losetup -n -O OFFSET /dev/loop0)"
root@OpenWrt:~# losetup -o ${OFFSET} /dev/loop1 /dev/sda2
losetup: failed to parse offset: '/dev/loop1': Invalid argument
root@OpenWrt:~# resize.f2fs /dev/loop1
Info: Segments per section = 1
Info: Sections per zone = 1
Info: sector size = 512
Info: total sectors = 0 (0 MB)
        Invalid SB CRC offset: 0
        Can't find a valid F2FS superblock at 0x0
root@OpenWrt:~# reboot
root@OpenWrt:~#
login as: root
root@192.168.8.100's password:


BusyBox v1.33.1 (2021-06-13 22:02:19 UTC) built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt 21.02.0-rc3, r16172-2aba3e9784
 -----------------------------------------------------
root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root               126.4M     17.5M    106.3M  14% /
tmpfs                   934.4M     64.0K    934.3M   0% /tmp
/dev/sda1                15.7M      4.8M     10.7M  31% /boot
/dev/sda1                15.7M      4.8M     10.7M  31% /boot
tmpfs                   512.0K         0    512.0K   0% /dev
root@OpenWrt:~# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0 14.9G  0 disk
├─sda1   8:1    0   16M  0 part /boot
└─sda2   8:2    0 14.9G  0 part /

So clearly I have some problem getting the box to have more memory regardless of the image file I use to flash it. In 19.07.7 that I used before, the tutorial worked well with squashfs version. So I assume something has broken the functionality somehow.

You are trying to resize mounted partitions, you cannot do that. I don't know what you did in the past but it shouldn't have worked either.

The tutorial requires you to boot from a different disk with OpenWrt on it and perform these operations from that. NOT do it on mounted partitions of your main disk.

Okay, that makes things much harder. I have no idea how to do that, and my main computer is a Windows machine, so anything involving doing linux stuff gets exponentially harder (For example, windows subsystem for linux and debian virtual machines both seem unable to compile OpenWRT, even at basic settings, so I really hope to avoid using too much linux). Is there a possibility to unmount the partition, as it is not the boot partition, and then do the resize?

as said in the tutorial
This is possible only if you have chosen the combined-ext4.img.gz type of image, and currently due to technical limitations you can't just resize the ext4 partition online (while it is mounted) so you will need to install OpenWrt on another drive to use it to perform the following operations. Also using a Linux system (either from a VM or actually installed in a PC) will of course work.

So grab a USB drive, copy away all files on it, then install a new OpenWrt on it, remove SD card from the APU, plug the USB drive in the APU and then power it up

After you have connected to it you can insert the SD card and it will be detected, you can write "dmesg" in ssh or console to see on what sdxx is connected.

this for example is a USB drive connected to sdd so its partitions will be sdd1 and sdd2 and so on
and you can use that for the commands in the tutorial.

[109042.049590] usb 3-2: new high-speed USB device number 7 using xhci_hcd
[109042.206202] usb 3-2: New USB device found, idVendor=8564, idProduct=1000, bcdDevice= 1.00
[109042.206214] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[109042.206218] usb 3-2: Product: Mass Storage Device
[109042.206222] usb 3-2: Manufacturer: JetFlash
[109042.206224] usb 3-2: SerialNumber: PZKYT2CF
[109042.206747] usb-storage 3-2:1.0: USB Mass Storage device detected
[109042.206922] scsi host10: usb-storage 3-2:1.0
[109043.239424] scsi 10:0:0:0: Direct-Access     JetFlash Transcend 4GB    8.07 PQ: 0 ANSI: 4
[109043.239785] sd 10:0:0:0: Attached scsi generic sg3 type 0
[109043.240403] sd 10:0:0:0: [sdd] 7839744 512-byte logical blocks: (4.01 GB/3.74 GiB)
[109043.241066] sd 10:0:0:0: [sdd] Write Protect is off
[109043.241069] sd 10:0:0:0: [sdd] Mode Sense: 23 00 00 00
[109043.241745] sd 10:0:0:0: [sdd] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[109043.267193]  sdd: sdd1
[109043.269290] sd 10:0:0:0: [sdd] Attached SCSI removable disk

After you have done, you shut down and remove the USB drive, and then it should be ok

For example, windows subsystem for linux and debian virtual machines both seem unable to compile OpenWRT, even at basic settings, so I really hope to avoid using too much linux)

I think this is your mistake, but it's harder and longer to do than the above.

Debian works fine if you install necessary packages (there is a list of commands to install packages for most common distros, Debian is one of them), https://openwrt.org/docs/guide-developer/build-system/install-buildsystem

Windows subsystem for Linux also works fine if you change a setting and then install the prerequisites (depending on what distro you installed in the WSL, usually it's Ubuntu) https://openwrt.org/docs/guide-developer/build-system/wsl

EDIT: that said, I fully agree that this is absolute bs, and that normal users should not be forced to do this if they want to install more packages, I did send a contribution to increase size of partition and allow online resize, but they did not accept it and think people don't need more than 256Mb of space in root partition https://github.com/openwrt/openwrt/pull/1669

1 Like

I reorganized the content to avoid confusion:
Resizing filesystem /root on X86_64 - #2 by vgaetera
Resizing partitions is a common procedure required to perform before expanding the filesystem.
That should apply for both combined-squashfs.img and combined-ext4.img.

wait are you sure of this?
Note that Ext4 can be expanded online i.e. while mounted, so we can do this from OpenWrt commandline directly.

Afaik OpenWrt ext4 image is too small for online resize (it contains too little inodes). Smallest partition size that can be resized online in ext4 is 2GB afaik

~650+ is a sane default in 2021

2 Likes

Well, it works for me in a VM with OpenWrt 19.07.

1 Like

interesting, so something has changed in the tool since 2018, now it does not care. Just tried on my linux PC

1 Like

Another attempt with the combined ext4 image (tried to resize to "only" 2G in case that was the problem):

root@OpenWrt:~# fdisk /dev/sda

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/sda: 14.91 GiB, 16013942784 bytes, 31277232 sectors
Disk model: Hoodisk SSD
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: dos
Disk identifier: 0x40e33d43

Device     Boot Start    End Sectors  Size Id Type
/dev/sda1  *      512  33279   32768   16M 83 Linux
/dev/sda2       33792 246783  212992  104M 83 Linux

Command (m for help): d
Partition number (1,2, default 2): 2

Partition 2 has been deleted.

Command (m for help): n
Partition type
   p   primary (1 primary, 0 extended, 3 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (2-4, default 2): 2
First sector (33280-31277231, default 34816): 33792
Last sector, +/-sectors or +/-size{K,M,G,T,P} (33792-31277231, default 31277231): +2G

Created a new partition 2 of type 'Linux' and of size 2 GiB.
Partition #2 contains a ext4 signature.

Do you want to remove the signature? [Y]es/[N]o: n

Command (m for help): w

The partition table has been altered.
Syncing disks.

root@OpenWrt:~# reboot
root@OpenWrt:~#
login as: root
root@192.168.8.100's password:


BusyBox v1.33.1 (2021-06-13 22:02:19 UTC) built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt 21.02.0-rc3, r16172-2aba3e9784
 -----------------------------------------------------
root@OpenWrt:~# resize2fs /dev/sda2
resize2fs 1.45.6 (20-Mar-2020)
Filesystem at /dev/sda2 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
resize2fs: Invalid argument While checking for on-line resizing support
root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root               126.4M     16.7M    107.5M  13% /
tmpfs                   934.4M     64.0K    934.3M   0% /tmp
/dev/sda1                15.7M      4.8M     10.7M  31% /boot
/dev/sda1                15.7M      4.8M     10.7M  31% /boot
tmpfs                   512.0K         0    512.0K   0% /dev

root@OpenWrt:~# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0 14.9G  0 disk
├─sda1   8:1    0   16M  0 part /boot
└─sda2   8:2    0    2G  0 part /

I did also try without rebooting after resizing the partition, and got this error instead:

root@OpenWrt:~# resize2fs /dev/sda2
resize2fs 1.45.6 (20-Mar-2020)
Filesystem at /dev/sda2 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
Performing an on-line resize of /dev/sda2 to 3905430 (4k) blocks.
resize2fs: Invalid argument While trying to add group #1
root@OpenWrt:~# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0 14.9G  0 disk
├─sda1   8:1    0   16M  0 part /boot
└─sda2   8:2    0 14.9G  0 part /
root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root               126.4M     17.2M    106.6M  14% /
tmpfs                   934.4M     64.0K    934.3M   0% /tmp
/dev/sda1                15.7M      4.8M     10.7M  31% /boot
/dev/sda1                15.7M      4.8M     10.7M  31% /boot
tmpfs   

I will have to try the USB method, first I just need to go and buy myself a usb stick.

This could be faulty storage, or a corrupted filesystem, or a release/build-specific issue.
Testing in a VM should help to isolate the problem.

I amaged to expand the filesystem by getting another APU and a mSATA <-> USB board. Now to the original task of getting python and some libraries working. I followed the setup instructions at the given LXC tutorial. There were some install errors:

pkg_hash_check_unresolved: cannot find dependency libiwinfo20210430 for luci-mod-status

but assuming LUCI is irrelevant for this project, I decided to just ignore this. Then I tried checking the config as the tutorial instructed:

root@OpenWrt:~# lxc-checkconfig
LXC version 4.0.5
--- Namespaces ---
Namespaces: enabled
Utsname namespace: enabled
Ipc namespace: enabled
Pid namespace: enabled
User namespace: enabled
Network namespace: enabled

--- Control groups ---
Cgroups: enabled

Cgroup v1 mount points:


Cgroup v2 mount points:
/sys/fs/cgroup

Cgroup v1 systemd controller: missing
Cgroup v1 freezer controller: missing
Cgroup namespace: required
Cgroup device: missing
Cgroup sched: enabled
Cgroup cpu account: enabled
Cgroup memory controller: enabled
Cgroup cpuset: enabled

--- Misc ---
Veth pair device: enabled, loaded
Macvlan: enabled, not loaded
Vlan: enabled, not loaded
Bridges: enabled, not loaded
Advanced netfilter: enabled, not loaded
CONFIG_NF_NAT_IPV4: missing
CONFIG_NF_NAT_IPV6: missing
CONFIG_IP_NF_TARGET_MASQUERADE: missing
CONFIG_IP6_NF_TARGET_MASQUERADE: missing
CONFIG_NETFILTER_XT_TARGET_CHECKSUM: enabled, not loaded
CONFIG_NETFILTER_XT_MATCH_COMMENT: enabled, loaded
FUSE (for use with lxcfs): enabled, not loaded

--- Checkpoint/Restore ---
checkpoint restore: missing
CONFIG_FHANDLE: enabled
CONFIG_EVENTFD: enabled
CONFIG_EPOLL: enabled
CONFIG_UNIX_DIAG: missing
CONFIG_INET_DIAG: missing
CONFIG_PACKET_DIAG: missing
CONFIG_NETLINK_DIAG: enabled
File capabilities:

Note : Before booting a new kernel, you can check its configuration
usage : CONFIG=/path/to/config /usr/bin/lxc-checkconfig

The config differs from the tutorial, but the tutorial is concerned with arm stuff, so once again I ignore things that I don't understand, and just check if it could work:

lxc-create --name myLMS --template download -- --dist debian --release buster --arch x86_64
Failed to create lock for myLMS
lxc-create: myLMS: tools/lxc_create.c: main: 260 Failed to create lxc container

... Probably wrong name for arch parameter, trying again with different (that I found on the internet)

root@OpenWrt:~# lxc-create --name myLMS --template download -- --dist debian --release buster --arch amd64
Setting up the GPG keyring
ERROR: Unable to fetch GPG key from keyserver
lxc-create: myLMS: lxccontainer.c: create_run_template: 1616 Failed to create container from template
lxc-create: myLMS: tools/lxc_create.c: main: 319 Failed to create container myLMS

I also tried the web UI, but it coudln't set up the container anyways, so I assume something to be very much not configured correctly.

EDIT: Nevermind, just used gui and the other mirror to get the container

EDIT2:

The container won't start via LUCI nor via terminal. The log output I get:

lxc-start debian 20210630111452.893 ERROR    cgfsng - cgroups/cgfsng.c:cg_legacy_set_data:2824 - No such file or directory - Failed to setup limits for the "         devices" controller. The controller seems to be unused by "cgfsng" cgroup driver or not enabled on the cgroup hierarchy
lxc-start debian 20210630111452.893 ERROR    cgfsng - cgroups/cgfsng.c:cgfsng_setup_limits_legacy:2873 - No such file or directory - Failed to set "devices.d         eny" to "a"
lxc-start debian 20210630111452.893 ERROR    start - start.c:lxc_spawn:1828 - Failed to setup legacy device cgroup controller limits
lxc-start debian 20210630111452.893 ERROR    lxccontainer - lxccontainer.c:wait_on_daemonized_start:860 - Received container state "ABORTING" instead of "RUN         NING"
lxc-start debian 20210630111452.894 ERROR    lxc_start - tools/lxc_start.c:main:308 - The container failed to start
lxc-start debian 20210630111452.894 ERROR    lxc_start - tools/lxc_start.c:main:311 - To get more details, run the container in foreground mode
lxc-start debian 20210630111452.894 ERROR    lxc_start - tools/lxc_start.c:main:314 - Additional information can be obtained by setting the --logfile and --l         ogpriority options
lxc-start debian 20210630111452.895 ERROR    start - start.c:__lxc_start:1999 - Failed to spawn container "debian"

command used:

lxc-start -n debian --logfile lxclog.log --logpriority ERROR

Okay, have you modified the /usr/share/lxc/config/common.conf file to disable old legacy v1 cgroups ?

The arch and images may be found here : https://us.images.linuxcontainers.org/ amd64 should be ok

Just add the switch —no-validate when you get error with gpg

I have nothing much useful to add, but installing numpy used to be a pain even on desktop OSes. Almost can't believe that someone is installing numpy on openwrt. Can I ask why?