Follow

How small can you get a base system?

I wish to run a couple no-dependencies C programs, along with inetd and relayd, with as little RAM as possible (also storage, but I do have non-OS stuff that'll inevitably need the space so that's not a priority).

It might have to do with QEMU but with -m 256M and 1 core my VM locks up quickly after some I/O. I've removed the sets x* and game* from the system.

Any optimisation tips welcome!

· · Web · 1 · 3 · 2

@cadadr removing sets won't reduce memory or cpu usage.

you can put ssh as an inetd service so it doesn't always stay in memory.

I'm very curious it crashes with 256 MB of memory.

@cadadr you may want to disable some cron jobs at night which can use a LOT of memory or i/o like the locate database update in daily(8)

@solene I think I can rid of ssh altogether in a "production" deployment server.

What happens is after the first attemps on IO (e.g. typing at the login prompt or connecting to vger over a network bridge from host), it becomes unresponsive to any IO, local or networked.

Maybe it's Qemu that's the culprit...

(BTW, are you the author of vger? Pretty neat software!)

@cadadr I am vger author :) thanks

Yes, maybe it's Qemu :flan_think:
I daily use OpenBSD on a macppc computer with 512 MB of ram and I don't have any crash but it's twice as ram as you, but I also run big software like webkit.

@solene Hmmm. I think I'll try to fiddle with the flags then or try a different hypervisor.

Thanks a lot for your help and for vger!

@cadadr I just installed OpenBSD 6.8 on a qemu/kvm VM with 256 MB of ram and I have 138 MB of free memory at first boot. It seems perfectly fine here.

How long before your VM freeze? Does it happen when you run something?

@solene Generally it freezes moments after the vty login prompt appears, or as I write my first command in the shell.

The QEMU cli:

qemu-system-x86_64 \
-m 256M -enable-kvm \
-drive file=disk.qcow2,media=disk,if=virtio \
-device e1000,netdev=n1 \
-netdev "user,id=n1,hostname=openbsd-vm,hostfwd=tcp::1965-:1965"

The disk is a 2G image and the swap space is pretty tiny, (~60M IIRC).

I just managed to log in and run vmstat which reported 2M free and then froze.

@cadadr maybe your disk is too small for the kernel reordering at boot. 2GB is really small and you may want a bit of swap. Maybe kernel reordering requires a bit more than what you offer as free memory and the swap could handle this.

I have a swap and no issue :)
I tried to run big scripts like /etc/{daily,weekly,monthly} and they all run fine.

@solene That's probably the case, I just disabled sshd, sndiod, and check_quotas and that only bought me 4M of memory.

Later today I'll make a new vm with larger disk / smaller install and see if a larger swap helps.

Thanks a lot for your help!

@cadadr 100 MB of swap may be enough to be honest :flan_smile:

disabling kernel ordering would be a solution too but I'd not advise it. But I understand on such small systems sacrifices must be made sometimes.

@solene @cadadr I still run a couple of PCEngines ALIX systems with a 500MHz single core CPU and 256MB RAM. They're slow on startup due to relinking but otherwise work fine for their purpose (jump host) with default configurations (i.e no defaults are disabled).

The biggest pain for me is getting the disk partitioning right on a 4GB CF card..I was affected by the 6.5 -> 6.6 requirement of at least 1.1GB in /usr so the machines are stuck on 6.5. Should have bought 8GB CF cards!

Sign in to participate in the conversation
Mastodon @ SDF

"I appreciate SDF but it's a general-purpose server and the name doesn't make it obvious that it's about art." - Eugen Rochko