Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

swap-fle on arm64, need to disable, how?

29 views
Skip to first unread message

gene heskett

unread,
Sep 29, 2023, 3:20:06 PM9/29/23
to
Greetings all;

I have SSD's for swap on an rpi4b, so to lessen the abuse of the u-sd
card I need to turn off the swap file, and swapon -a the SSD stuff.

How?

Thnaks all.

Cheers, Gene Heskett.
--
"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.
- Louis D. Brandeis
Genes Web page <http://geneslinuxbox.net:6309/>

Andy Smith

unread,
Sep 29, 2023, 3:30:05 PM9/29/23
to
Hello,

On Fri, Sep 29, 2023 at 03:15:54PM -0400, gene heskett wrote:
> I have SSD's for swap on an rpi4b, so to lessen the abuse of the u-sd card I
> need to turn off the swap file, and swapon -a the SSD stuff.

Have you looked in /etc/fstab where as you know filesystem mounts
are described? If the swap file is listed in there, remove it and
add one that's on your SSD.

If it's noit in there, the situation is more of a mystery and I'd
suggest you paste the output of "swapon -s" so we can see what the
system, thinks it is currently swapping to.

I assume you don't need instruction on how to turn off an existing
swap source, and how to create a new swap file.

Thanks,
Andy

--
https://bitfolk.com/ -- No-nonsense VPS hosting

gene heskett

unread,
Sep 29, 2023, 4:40:06 PM9/29/23
to
On 9/29/23 15:21, Andy Smith wrote:
> Hello,
>
> On Fri, Sep 29, 2023 at 03:15:54PM -0400, gene heskett wrote:
>> I have SSD's for swap on an rpi4b, so to lessen the abuse of the u-sd card I
>> need to turn off the swap file, and swapon -a the SSD stuff.
>
> Have you looked in /etc/fstab where as you know filesystem mounts
> are described? If the swap file is listed in there, remove it and
> add one that's on your SSD.
>
> If it's not in there, the situation is more of a mystery and I'd
> suggest you paste the output of "swapon -s" so we can see what the
> system, thinks it is currently swapping to.
>
> I assume you don't need instruction on how to turn off an existing
> swap source, and how to create a new swap file.

Swap file is the last thing I want, much slower than a swap partition.

> Thanks,
> Andy
>
cnc@rpi4:/etc$ sudo swapon -s
Filename Type Size
Used Priority
/dev/zram0 partition 1048572
98304 100
/dev/sda2 partition 9859068
0 -3

I need it to forget zram0 and use the swap on sda2, although I may try
to move /tmp to sda4 & ext4 now that I know how to run gparted on wayland.

Whats in zram0 ATM is lose able as I just built linuxcnc debs, docs and
all from a git clone.

Thanks Andy.

Andy Smith

unread,
Sep 29, 2023, 5:40:05 PM9/29/23
to
Hello,

On Fri, Sep 29, 2023 at 04:36:04PM -0400, gene heskett wrote:
> On 9/29/23 15:21, Andy Smith wrote:
> > On Fri, Sep 29, 2023 at 03:15:54PM -0400, gene heskett wrote:
> > > I have SSD's for swap on an rpi4b, so to lessen the abuse of the u-sd card I
> > > need to turn off the swap file, and swapon -a the SSD stuff.
> >
> > Have you looked in /etc/fstab where as you know filesystem mounts
> > are described? If the swap file is listed in there, remove it and
> > add one that's on your SSD.

[…]

> Swap file is the last thing I want, much slower than a swap partition.

There has been no performance difference between swap files and
swap partitions for more than a decade.

> cnc@rpi4:/etc$ sudo swapon -s
> Filename Type Size Used
> Priority
> /dev/zram0 partition 1048572 98304
> 100
> /dev/sda2 partition 9859068 0
> -3
>
> I need it to forget zram0 and use the swap on sda2

You didn't respond to the part about /etc/fstab so we have no idea
if you found the information you needed.

Assuming you did find the errant entry in /etc/fstab, a sequence of:

1. swapoff -a
2. edit /etc/fstab to be correct
3. swapon -a

should change things to how you want them.

Max Nikulin

unread,
Sep 29, 2023, 9:30:07 PM9/29/23
to
On 30/09/2023 03:36, gene heskett wrote:
> On 9/29/23 15:21, Andy Smith wrote:
>>
>> On Fri, Sep 29, 2023 at 03:15:54PM -0400, gene heskett wrote:
>>> I have SSD's for swap on an rpi4b, so to lessen the abuse of the u-sd
>>
> cnc@rpi4:/etc$ sudo swapon -s
> Filename                                Type            Size
> Used            Priority
> /dev/zram0                              partition       1048572
> 98304           100
> /dev/sda2                               partition       9859068
> 0               -3
>
> I need it to forget zram0 and use the swap on sda2

Out of curiosity, is zram0 really belongs to the SD card or it is
compressed pages in RAM?

Besides fstab it might be configured through a systemd .mount target.

Accordingly to https://wiki.archlinux.org/title/Zram it requires more
configuration however.

gene heskett

unread,
Sep 30, 2023, 3:30:06 AM9/30/23
to
On 9/29/23 17:32, Andy Smith wrote:
> Hello,
>
> On Fri, Sep 29, 2023 at 04:36:04PM -0400, gene heskett wrote:
>> On 9/29/23 15:21, Andy Smith wrote:
>>> On Fri, Sep 29, 2023 at 03:15:54PM -0400, gene heskett wrote:
>>>> I have SSD's for swap on an rpi4b, so to lessen the abuse of the u-sd card I
>>>> need to turn off the swap file, and swapon -a the SSD stuff.
>>>
>>> Have you looked in /etc/fstab where as you know filesystem mounts
>>> are described? If the swap file is listed in there, remove it and
>>> add one that's on your SSD.
>
> […]
>
>> Swap file is the last thing I want, much slower than a swap partition.
>
> There has been no performance difference between swap files and
> swap partitions for more than a decade.

Maybe on wintel stuff, but the u-sd card the pi runs on has a write
speed below 10 megs/second, an extremely obvious performance hit, and
wearing out the u-sd card rapidly.

But is swap on an rpi4b not on the sd card? as an invisible swap file?
If so there is an obvious speed hit and that sort of use would be hell
on the u-sd card. I long ago converted the buster install so such swap
was all on an SSD.

Here is that fstab from the buster install:
cnc@rpi4:~$ cat /sdb2/etc/fstab
proc /proc proc defaults 0 0
PARTUUID=5e3da3da-01 /boot vfat defaults 0 2
PARTUUID=5e3da3da-02 / ext4 defaults,noatime 0 1
# a swapfile is not a swap partition, no line here
# use dphys-swapfile swap[on|off] for that
UUID=746054d4-9a33-4c79-b028-ff0000c3e40a none swap 0 0
PARTUUID=c61252a1-01 /media/pi/workspace ext4 defaults 0 1
the swap is 10Gigs worth of a 120G SSD on a startech usb/sata thing
and workspace is most of a 240G SSD on a startech usb/sata adapter with
r/w speeds of 4 or 5 hundred megs and write speeds in the 300 range. I
could build lcnc in 30 minutes on that pi. Or a new copy of that kernel
in 23 minutes. And never touch the u-sd card until I installed the debs
for a new lcnc 2 or 3 times a week.

Here is the current fstab:
cnc@rpi4:~$ cat /etc/fstab
UUID=8E25-4B18 /boot/broadcom vfat
defaults,flush 0 2
UUID=47946eb6-d88c-4331-bba9-cbe269a35925 / ext4
defaults,noatime,commit=600,errors=remount-ro 0 1
tmpfs /tmp tmpfs
defaults,nosuid 0 0
# to which I've added but commented ATM
#LABEL=TEMP1 /tmp ext4
defaults,noatime,errors=remount-ro 0 1

The label is good, but is the ext4? Thats the format of /dev/sda4
/dev/sda2 is currently mounted as swap, hows below but was not mounted
when I built linuxcnc yesterday. runtests ran normally, so I did a make
clean and built debs, but haven't installed them.

>> cnc@rpi4:/etc$ sudo swapon -s
>> Filename Type Size Used
>> Priority
>> /dev/zram0 partition 1048572 98304
>> 100
>> /dev/sda2 partition 9859068 0
>> -3
>>
>> I need it to forget zram0 and use the swap on sda2
>
> You didn't respond to the part about /etc/fstab so we have no idea
> if you found the information you needed.

I didn't find the swap listed in the fstab, its apparently setup
someplace else in debian 12 for arm64's, so I've not finalized that yet.
Awaiting guidance.

> Assuming you did find the errant entry in /etc/fstab, a sequence of:
>
> 1. swapoff -a
> 2. edit /etc/fstab to be correct
> 3. swapon -a

I'd also point out that despite the presence of the above listed swap,
swapon -a and swapoff -a, does not enable it, I have to mount it by hand.
>
> should change things to how you want them.
>
> Thanks,
> Andy
>
Take care & stay well, Andy.

Andy Smith

unread,
Sep 30, 2023, 7:50:07 AM9/30/23
to
Hello,

On Sat, Sep 30, 2023 at 03:26:19AM -0400, gene heskett wrote:
> On 9/29/23 17:32, Andy Smith wrote:
> > On Fri, Sep 29, 2023 at 04:36:04PM -0400, gene heskett wrote:
> > > Swap file is the last thing I want, much slower than a swap partition.
> >
> > There has been no performance difference between swap files and
> > swap partitions for more than a decade.
>
> Maybe on wintel stuff, but the u-sd card the pi runs on has a write speed
> below 10 megs/second, an extremely obvious performance hit, and wearing out
> the u-sd card rapidly.

Please show evidence or retract your claim that on a raspberry pi a
swap partition performs better than a swap file (when they are both
on the same storage device). I believe you are making it up, as it
isn't the case in the kernel code and should not make any difference
by architecture.

Testimony from one of the maintainers of the memory management and
ext filesystems in the Linux kernel:

https://lkml.org/lkml/2005/6/29/11
https://lkml.org/lkml/2005/7/7/326

Swapping on SD cards in general is a bad idea regardless of
architecture, but there should be no difference between swap file or
swap partition. I did not suggest you swap to a file on SD card. I
suggested that whether you swap to a file on SSD or a partition on
SSD, the performance will be the same.

> Here is the current fstab:
> cnc@rpi4:~$ cat /etc/fstab
> UUID=8E25-4B18 /boot/broadcom vfat defaults,flush
> 0 2
> UUID=47946eb6-d88c-4331-bba9-cbe269a35925 / ext4
> defaults,noatime,commit=600,errors=remount-ro 0 1
> tmpfs /tmp tmpfs
> defaults,nosuid 0 0
> # to which I've added but commented ATM
> #LABEL=TEMP1 /tmp ext4
> defaults,noatime,errors=remount-ro 0 1

There's no swap listed there and the only thing you've added seems
to have a comment in front of it, so you've effectively added
nothing so I don't understand why you expect something to change now.

> > > cnc@rpi4:/etc$ sudo swapon -s
> > > Filename Type Size Used
> > > Priority
> > > /dev/zram0 partition 1048572 98304
> > > 100
> > > /dev/sda2 partition 9859068 0
> > > -3
> > >
> > > I need it to forget zram0 and use the swap on sda2
> >
> > You didn't respond to the part about /etc/fstab so we have no idea
> > if you found the information you needed.
>
> I didn't find the swap listed in the fstab, its apparently setup someplace
> else in debian 12 for arm64's, so I've not finalized that yet. Awaiting
> guidance.

This isn't Debian 12 though is it? Debian doesn't use zram by
default so this is something else. As usual we struggle to answer
your questions as they're off-topic here, amongst other
difficulties.

As the other poster mentioned, zram is set up by a systemd unit but I
don't know more about it off the top of my head.

> > 1. swapoff -a
> > 2. edit /etc/fstab to be correct
> > 3. swapon -a
>
> I'd also point out that despite the presence of the above listed swap,
> swapon -a and swapoff -a, does not enable it, I have to mount it by hand.

As I said, your fstab as shown does not contain any reference to
swap, so I'm not surprised that you have to manually tell it to use
/dev/sda2.

First tackle disabling the zram (or making it use sda2).

gene heskett

unread,
Sep 30, 2023, 11:20:06 AM9/30/23
to
On 9/30/23 07:46, Andy Smith wrote:
> Hello,
>
> On Sat, Sep 30, 2023 at 03:26:19AM -0400, gene heskett wrote:
>> On 9/29/23 17:32, Andy Smith wrote:
>>> On Fri, Sep 29, 2023 at 04:36:04PM -0400, gene heskett wrote:
>>>> Swap file is the last thing I want, much slower than a swap partition.
>>>
>>> There has been no performance difference between swap files and
>>> swap partitions for more than a decade.
>>
>> Maybe on wintel stuff, but the u-sd card the pi runs on has a write speed
>> below 10 megs/second, an extremely obvious performance hit, and wearing out
>> the u-sd card rapidly.
>
> Please show evidence or retract your claim that on a raspberry pi a
> swap partition performs better than a swap file (when they are both
> on the same storage device). I believe you are making it up, as it
> isn't the case in the kernel code and should not make any difference
> by architecture.

There is a huge difference in the write speeds between a modern SSD that
can be written at usb3 speeds, and the write speed of a micro-sd card
the pi boots from.

This is a real world fact Andy C. Tested, verified FACT.

For small writes it might approach the BS claims on the blister card but
rarely gets there, for megabyte and up writes its often below 10 megs a
second. The blister card may claim up to 120M/S, but dd shows that
outright lie when imaging a 64GB card with a 7G image, doing the last
75% of that 7G at less then 10M/S. On raspios-wheezy, swap was on the
u-sd card. And it took me 3 hours & change to build a realtime preempt
4.19 kernel for the pi, on the pi. Switch the swap to a sata-iii SSD on
a startech usb3-sata adapter, and that same kernel build is 23 minutes
on the pi, for the pi.

> Testimony from one of the maintainers of the memory management and
> ext filesystems in the Linux kernel:
>
> https://lkml.org/lkml/2005/6/29/11
> https://lkml.org/lkml/2005/7/7/326

TL,DR, my experience is a fact. The medium differences which you keep
ignoring, is in FACT important.

> Swapping on SD cards in general is a bad idea regardless of
> architecture, but there should be no difference between swap file or
> swap partition. I did not suggest you swap to a file on SD card. I
> suggested that whether you swap to a file on SSD or a partition on
> SSD, the performance will be the same.

True, as long as both are on the SAME medium. However my experience with
swap files on pi's has been with swap files on the u-sd. They do work,
If you plan on a long nap while they work, and the u-sd card doesn't
wear out, which I have had happen on smaller cards. That upset me, a lot
as I had to rewrite a couple gigs of gcode that disappeared. That
taught me to include the pi in my amanda backups. Then I bought two
seacrate 2T rust buckets, spent about 6 weeks building up a buster on
the new, faster drives. And both drives disappeared off the end of the
cables 4 days apart a week later losing everything. Junk I didn't even
try to warranty. Burn me a third time and I'm all done with that name on
the box. Now I'm collecting 2T gigastones to do it again, about the same
price as the SamSung's, but turn them over and read "made in Taiwan"

Its been hell trying to make bookworm usable. And I seem to be headed
to do it again, the raid10 I built on bullseye for /home, is not
compatible with bookworm and no one can tell me what to do to fix it.
The problem is that ANYTHING that wants write access to that raid10 has
to wait anywhere from 30 seconds to 5 minutes to open the requestor. It
always works, all I have to do is wait, then wait some more. Wash, rinse
and repeat. That's BS and you all wonder why I am in such a bad mood.

It's also a puzzle. I have an AppImages directory off of /home/gene on
that raid10, and those AppImages work as instantly as one would expect
from a raid10 made of 4 1T SamSung 870 SSD's. 2, maybe 3 seconds to a
fully drawn screen ready to do work. Yet when one of those apps want to
write, its always blocked the first time by this wait but not there
after. But leave it running overnight, wash, rinse, repeat the delay
again the next day. Why?
Which is what I want to do. How? is the question...

Thank you, take care and stay well, Andy.
>
> Thanks,
> Andy

Matthias Böttcher

unread,
Sep 30, 2023, 1:30:07 PM9/30/23
to
sudo dphys-swapfile swapoff
sudo systemctl stop dphys-swapfile.service
sudo systemctl disable dphys-swapfile.service

gene heskett

unread,
Sep 30, 2023, 2:00:06 PM9/30/23
to
> .
Looks familiar but none of that is installed
cnc@rpi4:/etc$ sudo dphys-swapfile swapoff
sudo: dphys-swapfile: command not found
cnc@rpi4:/etc$ sudo systemctl stop dphys-swapfile.service
Failed to stop dphys-swapfile.service: Unit dphys-swapfile.service not
loaded.
cnc@rpi4:/etc$ sudo systemctl disable dphys-swapfile.service
Failed to disable unit: Unit file dphys-swapfile.service does not exist.

What I'm trying to do is get rid of zram0, which is being used as swap,
and sub real swap on an SSD in its place. And zram0 is not listed in
fstab, but swapon finds it.

Thank you, Matthias Böttcher

David Wright

unread,
Sep 30, 2023, 2:20:06 PM9/30/23
to
IMO you're being blinded by /etc/fstab and -a. Rather, use /proc/swaps
to see what the kernel knows, and stop using -a. Cut and paste what
you do and the output, rather than all this "doesn't work" etc.

I'm guessing that on a parallel track, you need to examine the startup
files of whatever this beast is, presumably not Debian, and find some
occurrence of swapon that you can, in your jargon, "nuke".

Cheers,
David.

Greg Wooledge

unread,
Sep 30, 2023, 2:20:07 PM9/30/23
to
On Sat, Sep 30, 2023 at 01:50:57PM -0400, gene heskett wrote:
> On 9/30/23 13:28, Matthias Böttcher wrote:
> > sudo dphys-swapfile swapoff
> > sudo systemctl stop dphys-swapfile.service
> > sudo systemctl disable dphys-swapfile.service
> >
> > .
> Looks familiar but none of that is installed
> cnc@rpi4:/etc$ sudo dphys-swapfile swapoff
> sudo: dphys-swapfile: command not found
> cnc@rpi4:/etc$ sudo systemctl stop dphys-swapfile.service
> Failed to stop dphys-swapfile.service: Unit dphys-swapfile.service not
> loaded.
> cnc@rpi4:/etc$ sudo systemctl disable dphys-swapfile.service
> Failed to disable unit: Unit file dphys-swapfile.service does not exist.

Come now, you should be able to figure this shit out by now, Gene.

unicorn:~$ apt-cache search dphys swap
dphys-swapfile - Autogenerate and use a swap file

I've never even HEARD of this thing before, and I can figure out to run
a basic command to search for the right package.

Now, whether running those dphys commands is GOOD or USEFUL is an
entirely different question. But you should have the basic competence
to do an "apt(-cache) search" by now.

Matthias Böttcher

unread,
Sep 30, 2023, 3:30:06 PM9/30/23
to
Hi Gene,

please check explanations in this blog:

HTH
Matthias 

Andy Smith

unread,
Sep 30, 2023, 4:20:06 PM9/30/23
to
Hello,

On Sat, Sep 30, 2023 at 11:15:18AM -0400, gene heskett wrote:
> On 9/30/23 07:46, Andy Smith wrote:
> > On Sat, Sep 30, 2023 at 03:26:19AM -0400, gene heskett wrote:
> > > On 9/29/23 17:32, Andy Smith wrote:
> > > > On Fri, Sep 29, 2023 at 04:36:04PM -0400, gene heskett wrote:
> > > > > Swap file is the last thing I want, much slower than a swap partition.
> > > >
> > > > There has been no performance difference between swap files and
> > > > swap partitions for more than a decade.
> > >
> > > Maybe on wintel stuff, but the u-sd card the pi runs on has a write speed
> > > below 10 megs/second, an extremely obvious performance hit, and wearing out
> > > the u-sd card rapidly.
> >
> > Please show evidence or retract your claim that on a raspberry pi a
> > swap partition performs better than a swap file (when they are both
> > on the same storage device). I believe you are making it up, as it
> > isn't the case in the kernel code and should not make any difference
> > by architecture.
>
> There is a huge difference in the write speeds between a modern SSD that can
> be written at usb3 speeds, and the write speed of a micro-sd card the pi
> boots from.
>
> This is a real world fact Andy C. Tested, verified FACT.

This has become very silly now, or maybe tragic is a more suitable
description. All you have to do is look back at what you have
actually written as quoted above, or in the archives of this thread.

Except where I've paraphrased in [], the following are actual
verbatim words typed by you and I here in this thread on this list.

You said: I have SSD's for swap on an rpi4b, so to lessen the abuse
of the u-sd card I need to turn off the swap file, and
swapon -a the SSD stuff.

I said: If the swap file is listed in [your fstab], remove it and
add one that's on your SSD.

You replied: Swap file is the last thing I want, much slower than a
swap partition.

No one, at any point, told you to put a swap file on an SD card. No
one, at any point, said that SD cards perform the same as SSDs.

What you have said above is that swap files are slower than swap
partitions. When corrected on this, you start saying that SD cards
are slower than SSDs, which is not a claim that anyone has disputed,
nor would anyone sensibly dispute it.

I'm surprised that you do not consider it odd that you find yourself
having to explain to someone that SD cards are slower than SSDs, and
that you do not question why that has happened. I personally am
finding it alarming that I'm having to point out to someone what
words they used two emails back in the same thread. I'm starting to
feel like neither of us are having a good time and we should stop.

> > Testimony from one of the maintainers of the memory management and
> > ext filesystems in the Linux kernel:
> >
> > https://lkml.org/lkml/2005/6/29/11
> > https://lkml.org/lkml/2005/7/7/326
>
> TL,DR, my experience is a fact.

You're having arguments about things that have never been claimed;
I'm having arguments about things you don't even remember writing,
and refuse to read again to refresh your memory. I'm genuinely sorry
to see it has got to this stage and I think it's best if I leave
this particular debate there.

I don't know what to do any more when you post misinformation to the
list. If we're now at a stage where you can't be conversed with
because you don't remember what you've posted even a few emails ago
and won't read back your own emails, it's not possible to convince
you of your error. But on the other hand, it often hasn't been
possible to convince you of your errors on many topics for many
years, so I suppose that can't be and should never have been the
goal. I think perhaps best to just try my best to not enter into any
debate.

gene heskett

unread,
Sep 30, 2023, 6:40:05 PM9/30/23
to
On 9/30/23 13:28, Matthias Böttcher wrote:
> .
However that did give me a clue about getting rid of zram0, which has
been done now, thank you. Now I hope to uncomment the SSD line in fstab.

So I've re-partitioned & reformatted the 120G SSD to a gpt partition
table eith 10G of swap and a hair over 110G of ext4 for workspace.
But that is still no good. I can sudo swapon /dev/sda1 & sudo swapon -a
now works, but sudo swapon -s returns nothing. But I cannot label the
partition. At least not with gparted. I did generate a new blkid then
put the partuuid in fstab, rebooted it and that worked.

So this problem is solved. Until something changes the partuid.

Thanks for putting up with me.

gene heskett

unread,
Sep 30, 2023, 7:50:06 PM9/30/23
to
On 9/30/23 14:16, Greg Wooledge wrote:
> search dphys swap
Something I need to learn. But its been yonks since I last needed that.
Anyway, problem is solved, Thank you. Take care ad stay well.

gene heskett

unread,
Sep 30, 2023, 8:30:06 PM9/30/23
to
Andy, with good luck, you may make to your 89th birthday, which with
good luck I'll celebrate next Wednesday. I certainly hope you do. By
then you will not see any humor in trying to remember what, if anything,
you had for breakfast this morning. I seem to have reached that point.
And I'm not any happier for it either.

Stefan Monnier

unread,
Sep 30, 2023, 10:30:06 PM9/30/23
to
> But I cannot label the partition. At least not with gparted. I did
> generate a new blkid then put the partuuid in fstab, rebooted it and
> that worked.

This sounds to me like a subliminal message telling me "see all the pain
you avoided by using LVM instead".


Stefan

hw

unread,
Sep 30, 2023, 11:30:06 PM9/30/23
to
On Sat, 2023-09-30 at 18:29 -0400, gene heskett wrote:
> On 9/30/23 13:28, Matthias Böttcher wrote:
> > sudo dphys-swapfile swapoff
> > sudo systemctl stop dphys-swapfile.service
> > sudo systemctl disable dphys-swapfile.service
> >
> > .
> However that did give me a clue about getting rid of zram0, which has
> been done now, thank you. Now I hope to uncomment the SSD line in fstab.

Well, zram is the way to go; why would you still use swap partitions
or swap files instead? Are you deliberately trying to wear out your
SSDs or to slow down your computer?

Fedora has it by default since a while, and at first I thought it's a
very stupid idea. In practise, I can't be bothered anymore to create
these annoying swap partitions. They're only a waste of disc space.
There haven't been any issues with it, and when the machine runs out
of memory, using swap partitions or swap files isn't going to fix
that.

Max Nikulin

unread,
Oct 1, 2023, 4:10:05 AM10/1/23
to
On 01/10/2023 10:21, hw wrote:
> Well, zram is the way to go; why would you still use swap partitions
> or swap files instead?

The topic of this thread is a *Pi board. It does not have as much RAM as
significant part of x86_64 laptops and desktops with installed Fedora.

It seems, Gene it trying to run some CNC software and Firefox to control
it, perhaps some CAD. I suspect that some of mysterious issues are
caused by not enough RAM. Adding swap on a hard drive instead of ZRAM
may relief some issues.

However I would consider moving most of application to another machines.
My suggestion is to monitor RAM usage and to avoid overloading of *Pi
boards. Perhaps swap may be still necessary for complicated CNC tasks.

Max Nikulin

unread,
Oct 1, 2023, 4:20:05 AM10/1/23
to
On 01/10/2023 01:16, Greg Wooledge wrote:
> On Sat, Sep 30, 2023 at 01:50:57PM -0400, gene heskett wrote:
>> cnc@rpi4:/etc$ sudo dphys-swapfile swapoff
>> sudo: dphys-swapfile: command not found
...
> unicorn:~$ apt-cache search dphys swap
> dphys-swapfile - Autogenerate and use a swap file

From my point of view, "command not found" is a clear sign that
/dev/zram0 is created by some other package. I have never tried to setup
ZRAM, so I have no idea if some amount of RAM may be preallocated even
when /dev/zram0 is not added to swap. From my point of view, instead of
installing additional packages, it is better to find its current
configuration. At least it will ensure that all RAM is available for
applications.

I posted a link to ArchLinux wiki with hope that it may contain some
hints how to configure ZRAM and thus how to disable it.

gene heskett

unread,
Oct 1, 2023, 4:40:06 AM10/1/23
to
On 9/30/23 23:22, hw wrote:
> On Sat, 2023-09-30 at 18:29 -0400, gene heskett wrote:
>> On 9/30/23 13:28, Matthias Böttcher wrote:
>>> sudo dphys-swapfile swapoff
>>> sudo systemctl stop dphys-swapfile.service
>>> sudo systemctl disable dphys-swapfile.service
>>>
>>> .
>> However that did give me a clue about getting rid of zram0, which has
>> been done now, thank you. Now I hope to uncomment the SSD line in fstab.
>
> Well, zram is the way to go; why would you still use swap partitions
> or swap files instead? Are you deliberately trying to wear out your
> SSDs or to slow down your computer?
>
zram is probably the way to go for board with lots of dram. Something
the pi's don't have. My only pi is an early rpi4b, Claims 2G, shows
1.8G. I tend to do big things with it. I was first on this ball of rock
and water to make linuxcnc and that pi, run an 80 yo lathe I converted
to cnc controls. Teaching that lathe tricks it could not do when it
shipped out out Chicago circa 1946.

To steal over a gig for zram style swap does not make any sense to me.
There's compression and decompression involved too I'm told. By putting
swap on a 10G partition on a 500meg a second SSD, brings big memory into
the picture, allowing that little card to do big things without running
out of memory. I've built its own realtime kernels on it is 23 minutes,
linuxcnc with its docs including some translations ran it 200megs into
that zram and took nearly 4 hours. With real swap back on buster, just
under an hour. Just the English docs are now over 1000 pages of dead
tree. What we really need are translators. Except for the de stuff,
other languages are quite incomplete, but this old Iowa farm kid doesn't
speak anything but English, and doesn't even touch type.

I'm not a "working shop" other than my own product, just a retired bc
engineer. I basically serve as the canary in the coal mine for linuxcnc,
keeping that pi up to date with the git master & looking for
showstoppers. This gets done several times a week, doing a decent job of
keeping me out of the bars.

> Fedora has it by default since a while, and at first I thought it's a
> very stupid idea. In practise, I can't be bothered anymore to create
> these annoying swap partitions. They're only a waste of disc space.
> There haven't been any issues with it, and when the machine runs out
> of memory, using swap partitions or swap files isn't going to fix
> that.

But with zram taking over half its memory, its into swap and slowing
down quicker, and plumb out of memory for big jobs, when it could still
be working fine with bigger, albeit probably slower than zram, swap.

I've no clue how much the zram compression slows it in terms of thru put.

I wiped out the git clone of linuxcnc by re-arranging that SSD
yesterday, but I'll do another build later today and see how long it
takes with real swap.

Thank you. Take care & stay well.

gene heskett

unread,
Oct 1, 2023, 5:10:06 AM10/1/23
to
> .
You've a good view of this hw. However swap is not important to run
linuxcnc, in fact its to be avoided because it messes with realtime
response. Linuxcnc needs, even with much of the control offloaded to
mesa and similar smart cards, it still needs to check what the machine
is doing 1000 times a second. The way I'm doing it, the wobble in this
timing as 50 to 80 microseconds, which doesn't bother the machine all
that much, the real time killer is firing up firefox which can lock out
the irq response for hundreds of milliseconds. So I don't carve metal
and browse the web at the same time. I added some dials and decoders so
I can run this lathe, which only has 3 motors, and no compound at all,
by hand using the dials as hand cranks. Originally doing this on an
rpi3b when it was new in the 2017-2018 timeframe, I put all the hand
control stuff in a slower 200 hz thread since I can't turn the dials any
faster by hand anyway. Its still there. Linuxcnc, driving the two
motors, is a far more accurate compound than the broken compound I've
removed ever was. The third motor is driving the spindle at
continuously variable speeds with an encoder telling linuxcnc where the
spindle is 240 times a revolution. There are no change gears, yet it
can cut any thread, inch or metric including some I've dreamed up.
Sub-micron accurate at any angle. Whats not to like?

Take care & stay well.

Greg Wooledge

unread,
Oct 1, 2023, 9:00:07 AM10/1/23
to
On Sun, Oct 01, 2023 at 05:07:48AM -0400, gene heskett wrote:
> You've a good view of this hw. However swap is not important to run
> linuxcnc, in fact its to be avoided because it messes with realtime
> response. Linuxcnc needs, even with much of the control offloaded to mesa
> and similar smart cards, it still needs to check what the machine is doing
> 1000 times a second. The way I'm doing it, the wobble in this timing as 50
> to 80 microseconds, which doesn't bother the machine all that much, the real
> time killer is firing up firefox which can lock out the irq response for
> hundreds of milliseconds. So I don't carve metal and browse the web at the
> same time.

If Firefox is really just for "browsing the web", and is not part of
the user interface for the CNC pieces, I don't understand why you run
Firefox on this machine at all. I would run the browser on a separate
computer, one which isn't so critical to your operation.

Andrew M.A. Cater

unread,
Oct 1, 2023, 9:40:06 AM10/1/23
to
Echoing Greg:

2G is a fairly small amount of memory - by default the *Debian* install
for RPi 4 now gives you 1G of swap on whatever medium - which you should
never need to use.

It would make sense for something real time critical to be on a 2GB or 4GB RPi
on it's own - if you're running modellers or whatever for 3D printing, that
might be different but a command line or simplest web interface might be
best. You REALLY don't want anything extraneous.

Pi 4GB or 8GB are now available more or less: your BananaPi - you are *very*
much on your own.

All best, sa ever,

Andy
[amac...@debian.org]

Curt

unread,
Oct 1, 2023, 11:10:07 AM10/1/23
to
On 2023-10-01, gene heskett <ghes...@shentel.net> wrote:
>>
> Andy, with good luck, you may make to your 89th birthday, which with
> good luck I'll celebrate next Wednesday. I certainly hope you do. By
> then you will not see any humor in trying to remember what, if anything,
> you had for breakfast this morning. I seem to have reached that point.
> And I'm not any happier for it either.

What are you building? A space ship to get out of here?

> Cheers, Gene Heskett.

David Wright

unread,
Oct 1, 2023, 11:40:05 AM10/1/23
to
Back in 2018, Gene's explanation was:

https://lists.debian.org/debian-user/2018/11/msg00049.html

Cheers,
David.

David Wright

unread,
Oct 1, 2023, 11:40:06 AM10/1/23
to
On Sun 01 Oct 2023 at 04:31:26 (-0400), gene heskett wrote:
> On 9/30/23 23:22, hw wrote:
> > On Sat, 2023-09-30 at 18:29 -0400, gene heskett wrote:

> > > However that did give me a clue about getting rid of zram0, which has
> > > been done now, thank you. Now I hope to uncomment the SSD line in fstab.
> >
> > Well, zram is the way to go; why would you still use swap partitions
> > or swap files instead? Are you deliberately trying to wear out your
> > SSDs or to slow down your computer?
> >
> zram is probably the way to go for board with lots of dram. Something
> the pi's don't have. My only pi is an early rpi4b, Claims 2G, shows
> 1.8G. I tend to do big things with it.

OTOH the Description says:

"zram-tools uses this module to set up compressed swap space.
This is useful on systems with low memory or servers
running a large amount of services with data that's easily swappable
but that you may wish to swap back fast without sacrificing disk
bandwidth.

"By default it allocates 100MB of RAM, you can configure this in
/etc/default/zramswap."

> To steal over a gig for zram style swap does not make any sense to me.

Did they just copy a Fedora configuration? I've read that this is what
it does.

> > Fedora has it by default since a while, and at first I thought it's a
> > very stupid idea. In practise, I can't be bothered anymore to create
> > these annoying swap partitions. They're only a waste of disc space.
> > There haven't been any issues with it, and when the machine runs out
> > of memory, using swap partitions or swap files isn't going to fix
> > that.
>
> But with zram taking over half its memory, its into swap and slowing
> down quicker, and plumb out of memory for big jobs, when it could
> still be working fine with bigger, albeit probably slower than zram,
> swap.

I hadn't come across this package before, so I installed it on an idle
laptop. With configuration completely untouched, OOTB, it reports:

$ free
total used free shared buff/cache available
Mem: 16256864 197692 10999672 1848 5059500 15714244
Swap: 262140 0 262140
$ cat /proc/swaps
Filename Type Size Used Priority
/dev/zram0 partition 262140 0 100
$

Cheers,
David.

gene heskett

unread,
Oct 1, 2023, 12:50:07 PM10/1/23
to
There I disagree, Greg, it makes a handy download tool, directly from
wherever, directly to the machine that needs it. That, apt/synaptic and
git are the major net tools I use. Obviously I'm not trying to run them
simultaneously. Every machine here 7 ATM, can browse the net, making it
very easy to keep them up to date.

gene heskett

unread,
Oct 1, 2023, 1:00:06 PM10/1/23
to
> .
The bananapi-m5 at $80 USD is very much the superior pi except for no
radio, 4 core cpu at 2 GHz, w/o a fan, 4G of dram, 16G of m2 disk
onboard, and all 4 usb ports are usb3 speed. The armbian install runs on
ubuntu jammy repos. Got a pile of them here.

gene heskett

unread,
Oct 1, 2023, 1:00:06 PM10/1/23
to
That is an inviting thought, but I'll likely die en-route.

I'd show folks what I am building but the server does not like jpegs or
png's.
>
>> Cheers, Gene Heskett.

Stefan Monnier

unread,
Oct 1, 2023, 2:10:07 PM10/1/23
to
> There I disagree, Greg, it makes a handy download tool, directly from
> wherever, directly to the machine that needs it. That, apt/synaptic and git
> are the major net tools I use. Obviously I'm not trying to run them
> simultaneously. Every machine here 7 ATM, can browse the net, making it very
> easy to keep them up to date.

Do you have some big honking KVM to multiplex all those machines
onto your screen and keyboard, or do you actually have 7 screens and
7 keyboards and you need to walk over from one to the other?

Personally, I think I'd do neither: I'd have all those little buggers
headless and control them exclusively remotely via SSH (there could be
some alternatives like remote desktop or web-server UIs, but I find the
command line just a lot more convenient).
[ That's what I do with my BananaPi and my Odroid servers. ]


Stefan

gene heskett

unread,
Oct 1, 2023, 3:20:06 PM10/1/23
to
On 10/1/23 14:06, Stefan Monnier wrote:
>> There I disagree, Greg, it makes a handy download tool, directly from
>> wherever, directly to the machine that needs it. That, apt/synaptic and git
>> are the major net tools I use. Obviously I'm not trying to run them
>> simultaneously. Every machine here 7 ATM, can browse the net, making it very
>> easy to keep them up to date.
>
> Do you have some big honking KVM to multiplex all those machines
> onto your screen and keyboard, or do you actually have 7 screens and
> 7 keyboards and you need to walk over from one to the other?
>
Here I was going to ask if you'd ever hear of ssh and sshfs. but thn I
read the next paragraph.

> Personally, I think I'd do neither: I'd have all those little buggers
> headless and control them exclusively remotely via SSH (there could be
> some alternatives like remote desktop or web-server UIs, but I find the
> command line just a lot more convenient).
> [ That's what I do with my BananaPi and my Odroid servers. ]

And Odroid? Where do I send condolence flowers? I spent several days
trying to install a linux on it. Wound up bricking it. That outfit is
married to uefi and our socalled shim was nowhere near ready for prime
time. They said I'd need to get about $275 in jtag tools to unbrick it.
When I took my problem with that back I was told our way or or the
hiway. So I ordered a rpi3b and did the job with it. They will never
see another penny from me. That is their problem, I use what works, and
theirs didn't.

>
> Stefan

hw

unread,
Oct 1, 2023, 4:10:06 PM10/1/23
to
On Sun, 2023-10-01 at 04:31 -0400, gene heskett wrote:
> On 9/30/23 23:22, hw wrote:
> > On Sat, 2023-09-30 at 18:29 -0400, gene heskett wrote:
> > > On 9/30/23 13:28, Matthias Böttcher wrote:
> > > > sudo dphys-swapfile swapoff
> > > > sudo systemctl stop dphys-swapfile.service
> > > > sudo systemctl disable dphys-swapfile.service
> > > >
> > > > .
> > > However that did give me a clue about getting rid of zram0, which has
> > > been done now, thank you. Now I hope to uncomment the SSD line in fstab.
> >
> > Well, zram is the way to go; why would you still use swap partitions
> > or swap files instead? Are you deliberately trying to wear out your
> > SSDs or to slow down your computer?
> >
> zram is probably the way to go for board with lots of dram. Something
> the pi's don't have.

You only need as much RAM as is sufficient for what you're doing.
That's the way to go while having more RAM doesn't hurt much.

Swapping to SSDs is slow. If it's faster than zram, something must be
wrong.

In an earlier message you're saying RAM isn't an issue. So why are
you messing with it?

10GB swap on an SSD you're actually tring to use? Ugh ... It's maybe
ok for preventing the system from going into some undefined and
undesirable state from running out of memory for instances in which
you're trying to figure out how much RAM you need. Once you figured
it out, you add sufficent amounts of RAM and use zram.

BTW, how do you prevent breaking the lathe when the pi or the software
fails? There's things that can go wrong and lathes tend to be rather
powerful tools. Do you have some device to detect failures and some
kind of break that stops the lathe immediately when something goes
wrong?

Stefan Monnier

unread,
Oct 1, 2023, 6:50:07 PM10/1/23
to
>>> There I disagree, Greg, it makes a handy download tool, directly
>>> from wherever, directly to the machine that needs it. That,
>>> apt/synaptic and git are the major net tools I use. Obviously I'm
>>> not trying to run them simultaneously. Every machine here 7 ATM, can
>>> browse the net, making it very easy to keep them up to date.
>> Do you have some big honking KVM to multiplex all those machines
>> onto your screen and keyboard, or do you actually have 7 screens and
>> 7 keyboards and you need to walk over from one to the other?
> Here I was going to ask if you'd ever hear of ssh and sshfs. but thn I read
> the next paragraph.

Then why do you need to run firefox on the rpi's? I'd use Firefox on my
desktop and if I need to download files to one of the other machines,
I'd copy those files via `scp` or `sshfs` or even NFS (NFS
authentication is a PITA in my experience, but if you can use
a dedicated local network where you all machines can somewhat trust
each other, NFS can be a good option).

> And Odroid? Where do I send condolence flowers?

I was not super happy with some aspects (e.g. the fact that I can't get
the source code for some of the firmware, including the Petitboot that's
included, nor is there any way to change that firmware's config (e.g. to
make Petitboot use the serial console rather than the HDMI output)), but
in practice it works well and the hardware is fully supported by the
vanilla Linux kernel.


Stefan

gene heskett

unread,
Oct 1, 2023, 8:00:07 PM10/1/23
to
There are several checks which can stop lcnc in the next millisecond.
They have been well tested, but have yet to do so while working. I am
slowly converting all my stepper drivers to closed loop versions, the
next generation in motors, which have several advantages over std
steppers. First they control motor power with the magnitude of the
error, so motors don't run burn your hand hot unless being really
pushed. 2nd, they get to where lcnc ends them or if they can't get
there, they'll kill the motor power and advise lcnc of the failure which
if wired correctly, shuts lcnc down in its tracks a millisecond later. I
now have 5 of those motors turning things and that failure has yet to
occur while working. I guess I'm sold.

Take care & stay well, hm

Max Nikulin

unread,
Oct 2, 2023, 10:40:06 PM10/2/23
to
On 02/10/2023 03:01, hw wrote:
> Once you figured
> it out, you add sufficent amounts of RAM and use zram.

Is it possible for *Pi boards? Even laptops may have soldered RAM with
no spare slots.

ZRAM may be fast, but if you need, say +2G in comparison to physical RAM
size, the chance of success is fair in the case of RAM size of 16G. If a
board has just 2G of RAM then you need to be really lucky to get extra
2G by compression.

Perhaps Gene's setup is no optimal, but swap on SSD, despite its
disadvantages, may be an alternative to using a more performant board
for building of applications.

gene heskett

unread,
Oct 4, 2023, 4:10:06 AM10/4/23
to
On 10/1/23 18:46, Stefan Monnier wrote:
>>>> There I disagree, Greg, it makes a handy download tool, directly
>>>> from wherever, directly to the machine that needs it. That,
>>>> apt/synaptic and git are the major net tools I use. Obviously I'm
>>>> not trying to run them simultaneously. Every machine here 7 ATM, can
>>>> browse the net, making it very easy to keep them up to date.
>>> Do you have some big honking KVM to multiplex all those machines
>>> onto your screen and keyboard, or do you actually have 7 screens and
>>> 7 keyboards and you need to walk over from one to the other?
>> Here I was going to ask if you'd ever hear of ssh and sshfs. but thn I read
>> the next paragraph.
>
> Then why do you need to run firefox on the rpi's? I'd use Firefox on my
> desktop and if I need to download files to one of the other machines,
> I'd copy those files via `scp` or `sshfs` or even NFS (NFS
> authentication is a PITA in my experience, but if you can use
> a dedicated local network where you all machines can somewhat trust
> each other, NFS can be a good option).

NFS is a pita.
sshfs just works for file movement. ssh -X for login stuff. It helps of
course that I am the only "live user"

>> And Odroid? Where do I send condolence flowers?
>
> I was not super happy with some aspects (e.g. the fact that I can't get
> the source code for some of the firmware, including the Petitboot that's
> included, nor is there any way to change that firmware's config (e.g. to
> make Petitboot use the serial console rather than the HDMI output)), but
> in practice it works well and the hardware is fully supported by the
> vanilla Linux kernel.
>
It wasn't anywhere near primetime ready when I bought on 7 or 8 years
ago. Actually supporting linux was not then a prioirty. I use winderz
stuff for target practice here.
0 new messages