On 19/05/2020 22:19, Dawid Czeluśniak wrote:
> Hi OpenBSD community,
> 
> First of all, thank you for 6.7 release.
> 
> I am a huge fan of minimal and custom installations
> as I mostly use OpenBSD to host simple HTTP servers.
> I basically use vi to edit httpd.conf file,
> obtain a certificate from Let's Encrypt using built-in acme-client,
> then start the server and things just work.


As the others already told you, you're on your own for this.


That being said, there are a few leads to get what you're asking.
Remind you that a good part of the actual size of the base install comes
from the kernel objects (almost 350 MB on my install), since they are
required for KARL, meaning you won't get a 10 MB install unless you drop
this functionality (and I guess nobody will recommend that).
Applications from the base install mostly do not take too much place.

Let's get a taste of what an actual OpenBSD looks like, size-wise:

# du ...
3.7M    /usr/local/bin/
6.5M    /bin
21.2M   /sbin/
22.7M   /usr/sbin/
41.7M   /usr/share/man/   # almost 42 MB just for manuals
149M    /usr/bin/         # mostly unused programs for my use
253M    /usr/lib          # thanks to C++, for a good part
349M    /usr/share/relink/kernel/

So yes, there a lot we can remove for a minimal install, not just Perl.
(and one may argue that it's required for a few important things, we
may don't really want to remove it with the current OpenBSD code base)

For people running several instances of OpenBSD there is no point having
10 times the same files. Yes, snapshots could be a good thing to solve
the problem, but let's try other approaches.


For the first solution, you can get a simpler base system by compiling a
release of you own.  To achieve that, read at least mk.conf(5) and the
FAQ about making a release [1].  I didn't play a lot with this, but I
successfully removed compilers and a few programs.  Here is what I did.

# In file /etc/mk.conf
# Remove games, compilers (and a few other things with gnu/), manuals
# and a few applications.
# You can remove other applications, just add directories to the list.
SKIPDIR= games \
  gnu \
  lib/cxx \
  share/man \
  share/snmp \
  usr.sbin/ospfd usr.sbin/ospf6d usr.sbin/ospfctl usr.sbin/ospf6ctl \
  usr.sbin/ripd usr.sbin/ripctl

(This was just a test, there a lot more to remove to get a minimal
install)

I would like to drop the single core kernel since I don't need it, but
I'm not entirely sure it could be achieved by adding "GENERIC/" in the
above list. That's not super relevant either, since it won't be
installed on the system, so there is not much to care here.
Besides, I guess we could add an option in /etc/mk.conf for the size:
`CFLAGS=-Os`.
The good part of this solution is that it _completely_ works as the
upstream OpenBSD. You end-up with installation medias and sets, you have
the installer… that's kinda great.


Another solution could be resflash [2]. Resflash is a tool to create
OpenBSD images designed for flash storage.  I don't like this solution
much, because it changes a bit the way the system is used.  However, you
can probably learn from it.


Finally, I think crunchgen(8) could be a good lead if someone truly
wants to get basic image with the size of Busybox (or toybox) coreutils.
The whole point is to get several applications into a single one.  It
sounds a bit retarded, but I'm sure there is a legit use to it,
somewhere in the wild.  That's the last step to get _the_ smallest
install, I guess. Of course, this is not really _just_ to get a minimal
install, but more to get openbsd working on ISP routers with just a few
megabytes of RAM and disk. That's a bit experimental.


Food for thoughts: on FreeBSD, there is NanoBSD [3] which can be
configured to remove up to everything except the kernel and init. This
tool is used to create appliances, and I guess it could be nice to have
something like that on OpenBSD. I would use it for sure for minimal
installs on RPi-like boards.


I hope it will help!
Have a nice day everyone.

[1]: https://www.openbsd.org/faq/faq5.html
[2]: https://stable.rcesoftware.com/resflash/
[3]: https://www.freebsd.org/doc/en_US.ISO8859-1/articles/nanobsd/article.html

Reply via email to