Re: Firefox crashes all the time on the RaspBerry Pi Zero 2W

From: Mark Millard <marklmi_at_yahoo.com>
Date: Sun, 13 Apr 2025 23:13:34 UTC
On Apr 13, 2025, at 14:47, Mario Marietto <marietto2008@gmail.com> wrote:

> ->14.2-RELEASE does not officially support any RPi* but what is listed...
> 
> Why isn't there a specific version of FreeBSD for the raspberry pi zero 2W ?

No one creating such things has had an interest in doing
so. No one has the job of providing such: Just Volunteers
and Intersted-and-Knowdgable-Party activity.

> I see that there is another image that I can install,this one : FreeBSD-14.2-STABLE-arm64-aarch64-RPI-20250320-84ca9ab010dc-270791.img. Is there any chance that it works better than this one ? ---> FreeBSD-14.2-RELEASE-arm64-aarch64-RPI.img ?

Both:

https://cgit.freebsd.org/src/log/release/arm64?h=stable%2F14
https://cgit.freebsd.org/src/log/release/arm64?h=releng%2F14.2

have that same RPI.conf (by DTB= content).

By contrast,

https://cgit.freebsd.org/src/log/release/arm64?h=main

has a couple of updates but the net result still does not
include bcm2710-rpi-zero-2-w.dtb :

# grep -r "\.dtb" /usr/src/release/arm64 | more
/usr/src/release/arm64/RPI.conf:DTB="bcm2710-rpi-2-b.dtb bcm2710-rpi-3-b.dtb bcm2710-rpi-3-b-plus.dtb bcm2710-rpi-cm3.dtb \
/usr/src/release/arm64/RPI.conf:        bcm2711-rpi-4-b.dtb bcm2711-rpi-cm4-io.dtb bcm2711-rpi-cm4.dtb"
/usr/src/release/arm64/RPI.conf:OVERLAYS="mmc.dtbo pwm.dtbo disable-bt.dtbo"

Nothing official from FreeBSD does.

> ->I've no clue what the minimum RAM might be for firefox use
> ->in your context. For all I know, 512 MiBytes might be too
> ->little. How little may well depend on which graphics
> ->environment you are using, as it all competes for RAM+SWAP .
> 
> I can setup the swap space following this tutorial :
> 
> https://docs.vultr.com/how-to-add-swap-memory-on-freebsd-14-0

It gives what is in my view bad advice: I never recommend
using a swap file for FreeBSD, only swap partitions/slices.
Why? . . .

Quoting https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=206048#c7 :

QUOTE
On 2017-Feb-13, at 7:20 PM, Konstantin Belousov <kostikbel at gmail.com> wrote
on the freebsd-arm list:

. . .

swapfile write requires the write request to come through the filesystem
write path, which might require the filesystem to allocate more memory
and read some data. E.g. it is known that any ZFS write request
allocates memory, and that write request on large UFS file might require
allocating and reading an indirect block buffer to find the block number
of the written block, if the indirect block was not yet read.

As result, swapfile swapping is more prone to the trivial and unavoidable
deadlocks where the pagedaemon thread, which produces free memory, needs
more free memory to make a progress. Swap write on the raw partition over
simple partitioning scheme directly over HBA are usually safe, while e.g.
zfs over geli over umass is the worst construction.
END QUOTE

I've suffered such deadlocks in the past.

> How many GB of swap do you suggest to add ? 

For aarch64, FreeBSD complains about potential mistuning if
you have much bigger than something like 3.6*RAM. So a maximum
may be something like 1.75 GiBytes for 512 MiBytes of RAM.
(I've never tested this on anything with that small of a
RAM size, however. The overhead RAM usage could be a larger
percentage of the RAM size so 1.75 GiBytes might get the
notice about potential mistuning.)

But, did your use of FreeBSD-14.2-RELEASE-arm64-aarch64-RPI.img
end up creating and setting up a swap space automatically? If
yes, how big is it? What is the total: RAM+SWAP if swap was
set up?

> On Sun, Apr 13, 2025 at 11:30 PM Mark Millard <marklmi@yahoo.com> wrote:
>> On Apr 13, 2025, at 12:37, Mario Marietto <marietto2008@gmail.com> wrote:
>> 
>> > I don't know if it is relevant or not,but this is the image file that I've installed on the sd card of my raspberry pi zero 2W
>> > 
>> > FreeBSD-14.2-RELEASE-arm64-aarch64-RPI.img
>> 
>> It brings up a very good point, in part based on your earlier:
>> 
>> QUOTE
>> Mario Marietto <marietto2008@gmail.com> escreveu (sábado, 29/03/2025 à(s) 22:32):
>> Hello to everyone.
>> 
>> I've installed FreeBSD 14.2 on my Raspberry Pi Zero 2W. 
>> The problem that I'm having is that Firefox crashes all the time. . . .
>> END QUOTE
>> 
>> 14.2-RELEASE does not officially support any RPi* but what is listed
>> in:
>> 
>> https://cgit.freebsd.org/src/tree/release/arm64/RPI.conf?h=releng/14.2
>> 
>> as having support files that it supplies for the release media,
>> such as the *.dtb files copied from the RPi* firmware. What is
>> listed for the DTBs is:
>> 
>> DTB="bcm2710-rpi-2-b.dtb bcm2710-rpi-3-b.dtb bcm2710-rpi-3-b-plus.dtb bcm2710-rpi-cm3.dtb bcm2711-rpi-4-b.dtb"
>> 
>> The file bcm2710-rpi-zero-2-w.dtb is not listed.
>> 
>> There is also no FreeBSD port for a U-boot that is explicitly
>> for the RPi Zero 2 W:
>> 
>> # ls -dC1 /usr/ports/sysutils/u-boot-rpi*
>> /usr/ports/sysutils/u-boot-rpi
>> /usr/ports/sysutils/u-boot-rpi-0-w
>> /usr/ports/sysutils/u-boot-rpi-arm64
>> /usr/ports/sysutils/u-boot-rpi2
>> /usr/ports/sysutils/u-boot-rpi3
>> /usr/ports/sysutils/u-boot-rpi3-32
>> /usr/ports/sysutils/u-boot-rpi4
>> 
>> I've no clue if /usr/ports/sysutils/u-boot-rpi-arm64 would
>> support the RPi0-2-W or not. sysutils/u-boot-rpi-arm64 was
>> used to supply U-Boot for arm64 for 14.2-RELEASE.
>> 
>> It seems you likely have a non-standard/adjusted
>> configuration in order to use the RPi0-2-W with the
>> correct RPi* firmware-related files (and possibly
>> more).
>> 
>> Separately, you do not mention any configuration of swap
>> space. With so little RAM you may well need RAM+SWAP.
>> 
>> I've no clue what the minimum RAM might be for firefox use
>> in your context. For all I know, 512 MiBytes might be too
>> little. How little may well depend on which graphics
>> environment you are using, as it all competes for RAM+SWAP .


===
Mark Millard
marklmi at yahoo.com