Slashdot Mirror


miniBSD - reducing FreeBSD

dnaumov writes "miniBSD - reducing FreeBSD is a great guide, which explains in great detail, how you can create a truly small installation of FreeBSD on your system, completely by yourself. There is also the PicoBSD project, which has similar goals, but it's based on an outdated version of FreeBSD and is considered to be way too minimalistic (2 floppies) by many. The guide will walk you through things like creating the directory tree inside a chroot jail, rebuilding the bootloader and everything else needed to create a FreeBSD install that takes just around 20 MB of space."

39 comments

  1. Amazingly, almost half of that is perl! by RLiegh · · Score: 4, Interesting
    From the article:

    I did another minimal FreeBSD install and started looking for things I could remove in order to save space. After much tinkering, my "miniBSD" only weighed 22 MB (all binaries linked dynamically) and still had all the functionality I wanted (including ssh, FTP, perl and all the basic commands one expects on a reasonable UNIX system). Without perl, it fits in about 12 MB.

    emphasis mine.
    1. Re:Amazingly, almost half of that is perl! by alexpage · · Score: 1, Informative

      Who the fuck modded you up like your "emphasis" means anything? Perl is big. Everybody knows this. It's got a lot of "core" modules that help it do its job, a common base that other modules can build against safely. Its size is one reason that FreeBSD has been looking to remove any dependency on it in the base install, though it'll still be available as a port.

      Your "emphasis" seems like pointless perl bashing to me.

    2. Re:Amazingly, almost half of that is perl! by awx · · Score: 2, Insightful

      I think you'll find that it was incredulity that one program and it's associated libs takes up that amount of space. So? Replace it with python for example, and that'd take up the same space - it's not language bashing, just program-size bashing. get off your perl high-horse, perf.

      --
      Feel that power? That's mah MOUSING FINGER
  2. Why does it have to be FreeBSD? by mnmn · · Score: 1


    Why not just use OpenBSD without any optional crypto crap? Or NetBSD?

    With no perl etc, the minimal install should be small, although i havent tried.

    --
    "Give orange me give eat orange me eat orange give me eat orange give me you." -Nim Chimpsky
    1. Re:Why does it have to be FreeBSD? by dnaumov · · Score: 2, Redundant

      FreeBSD supports much more hardware than OpenBSD and OpenBSD *STILL* doesn't do SMP.

    2. Re:Why does it have to be FreeBSD? by Anonymous Coward · · Score: 0

      Unlike FreeBSD, SMP on OpenBSD isn't on the list of major priorities... It's SECURITY!

      - Have you installed your 15,235+ security related patches lately? cvsupit!

      ps: PF 0wnz IPFW/IPF.

    3. Re:Why does it have to be FreeBSD? by eht · · Score: 1

      True enough, though I can't imagine what you'd want to do on an SMP machine with a minimal install.

    4. Re:Why does it have to be FreeBSD? by dnaumov · · Score: 1

      Clusters ? Ever heard the "Can you imagine a..." ;)

    5. Re:Why does it have to be FreeBSD? by bluGill · · Score: 1

      FreeBSD 5.0 will not have perl as a part of the OS. I think the installation will install it, but it is not a part of the base system and you are free to remove it without worries.

    6. Re:Why does it have to be FreeBSD? by evilviper · · Score: 4, Insightful

      FreeBSD's hardware advantage isn't all that significant. OpenBSD supports every network card I have ever tried (and that is a huge number of diverse types). So what exactly does FreeBSD support that is so important??? The only hardware I can recall OpenBSD not supporting is a few sound-cards I have, and that's a non-issue for this type of system.

      Sure, it doesn't support SMP, but I don't consider that to be much of a drawback. SMP isn't all that popular, and would likely be even less so in these types of machines.

      If you still want to site hardware/SMP support as a major issue, I can point out that Linux supports even more hardware, and (supposedly) has far better SMP support.

      As for the advantages of OpenBSD, it is smaller, far less complex to setup/configure/maintain, more secure, and has plenty of great programs that FreeBSD lacks (Systrace and PF kick ass).

      --
      Slashdot gets worse every day... Pipedot: News for nerds, without the corporate slant
    7. Re:Why does it have to be FreeBSD? by Anonymous Coward · · Score: 0

      Errr, because there are SO many embedded SMP machines out there?! That doesn't make sense, dude. The whole point of a mini BSD is to run on old or embedded hardware. Think one 486 + RAM drive on the space shuttle or something.

    8. Re:Why does it have to be FreeBSD? by tigga · · Score: 1
      As for the advantages of OpenBSD, it is smaller, far less complex to setup/configure/maintain, more secure, and has plenty of great programs that FreeBSD lacks (Systrace and PF kick ass).

      Hmm, how much smaller? Do you have number at hand or just think so?

      I don't see much complexity in FreeBSD setup/configure/maintain... If OpenBSD even less complex then it's missing some features?

      Do you have bigger list of "great programs that FreeBSD lacks"? BTW there is a systrace port for FreeBSD -http://www.citi.umich.edu/u/provos/systrace/systr ace-for-FreeBSD4.5.tgz
      and instead of PF you could use IPFW or IPF or both simultaneously ;P

      Couple years ago I tried to run OpenBSD on 486. I remember it was definitely slower than FreeBSD on the same hardware.. No benchmarks were run though.

      Basically I don't see much difference in running any BSD on embedded or small system. Manuel Kasper who implemented MiniBSD just liked/knew FreeBSD more.

    9. Re:Why does it have to be FreeBSD? by Anonymous Coward · · Score: 0

      FreeBSD has way better performance, they don't even compare.

      Security? If you can't secure FreeBSD to be as secure as a secured OpenBSD box, then no default security in the world can help you.

      OpenBSD jumps up and down about security, mind you, my NetBSD servers has had far less security advisories over the years.

    10. Re:Why does it have to be FreeBSD? by eht · · Score: 1

      I try not to think in terms of slashdotisms, but true enough I guess, but if i were to do anything like that anyways I'd probably just netboot them, not worry about being minimalistic at all

    11. Re:Why does it have to be FreeBSD? by evilviper · · Score: 3, Informative
      Hmm, how much smaller? Do you have number at hand or just think so?

      Well, emBSD (small OpenBSD distro) fits on a 32MB flash card with room to spare, and that includes SSH, IPSec, pf, network card drivers, etc. No doubt it could be made much smaller.

      I don't see much complexity in FreeBSD setup/configure/maintain... If OpenBSD even less complex then it's missing some features?

      It's not missing any features, it's just a better, simpler, configuration system. Try it some time, rather than just complaining about what you don't know.

      instead of PF you could use IPFW or IPF or both simultaneously ;P

      No other firewall software out there has anything like PF-Auth. Then there is ALTQ which has been merged with PF to allow complex bandwidth limiting. PF also has SCRUB and MODULATE STATE directives, which clean up packets, and provide more security for the network. Then there is all of PF's advanced options.

      Do you have bigger list of "great programs that FreeBSD lacks"? BTW there is a systrace port for FreeBSD

      Those were just off the top of my head... There are certainly more. You are welcome to install OpenBSD and find out for yourself. And it's good to hear the systrace port is finished.

      Couple years ago I tried to run OpenBSD on 486. I remember it was definitely slower than FreeBSD on the same hardware..

      Well, the one place that FreeBSD has an advantage is kernel startup times on slow hardware. After startup, it should run jut as fast. Besides, it sounds like you haven't tried it in some time (or on very modern hardware)... It was around Release 2.8 that OpenBSD got a big speed boost.
      --
      Slashdot gets worse every day... Pipedot: News for nerds, without the corporate slant
    12. Re:Why does it have to be FreeBSD? by evilviper · · Score: 1
      FreeBSD has way better performance, they don't even compare.

      Not true. FreeBSD's performance is only nominally better.

      If you can't secure FreeBSD to be as secure as a secured OpenBSD box, then no default security in the world can help you.

      Security is a very complex animal that you obviously don't understand... Either that or you are just trolling.

      my NetBSD servers has had far less security advisories over the years.

      That doesn't mean NetBSD is any more secure, just that NetBSD isn't commonly used in highly secure situations, so they don't put as much effort into it. OpenBSD's bread-and-butter is security, so they issue an announcement everytime anything that MIGHT be expolitable (even if only locally) is discovered.

      It's funny. It wasn't long ago that OpenBSD was getting flack because they DIDN'T issue an advisory about every potential bug they discover. They've been reporting more since then.
      --
      Slashdot gets worse every day... Pipedot: News for nerds, without the corporate slant
    13. Re:Why does it have to be FreeBSD? by JumpSuit+Boy · · Score: 1

      5.1 not 5.0 which was released a while ago.

      --
      Oh really?
    14. Re:Why does it have to be FreeBSD? by Anonymous Coward · · Score: 0

      FreeBSD has way better performance, they don't even compare.

      Not true. FreeBSD's performance is only nominally better.

      No it isn't!

      Try PPPoE for example:

      NetBSD 1.6 = 8.5Mbits/s CPU-usage 23%
      FreeBSD 4.7 = 7.7Mbits/s CPU-usage 35%
      OpenBSD 3.2 = 2.0Mbits/s CPU-usage 99%

      Run benchmark programs like bonnie, postal, iobench etc on all the platforms you run before you open your mouth.
      I run OpenBSD on MC86k based Sun machines that I let the students toy with; just because the other admins wanted to try to admin OpenBSD in addition to our farm of Solaris, OS/400 (just 2 servers though), MacOS9, FreeBSD and NetBSD boxes (Windows machines are managed by a group of youngsters); I've been using OpenBSD on and off since 96, so I know what I'm talking about.



      If you can't secure FreeBSD to be as secure as a secured OpenBSD box, then no default security in the world can help you.

      Security is a very complex animal that you obviously don't understand... Either that or you are just trolling.


      You obviously don't know jack about security, I'm not going to waste my time on trying to explain it to you. I bet you're a Linux user that just diverted to OpenBSD to be more "elite" or what the hell you kids call it.
      Security is all in the admin, not in the tools.


      my NetBSD servers has had far less security advisories over the years.

      That doesn't mean NetBSD is any more secure, just that NetBSD isn't commonly used in highly secure situations, so they don't put as much effort into it. OpenBSD's bread-and-butter is security, so they issue an announcement everytime anything that MIGHT be expolitable (even if only locally) is discovered.

      It's funny. It wasn't long ago that OpenBSD was getting flack because they DIDN'T issue an advisory about every potential bug they discover. They've been reporting more since then.

      You don't follow the hackers ml's of all the BSD's do you? No, didn't think so. All the BSD's report potential security advisories, and that's why OpenBSD got rap when it didn't.


      I use, OpenBSD often, but not on a daily basis, Solaris is my OS of choice since it utilices Sun-hardware's superb I/O and SMP.
      Stop trolling, and realise that security is all in the admin and not in the OS.
      Naturally, tools allow us to to this, but that's why we run Systrace on all the BSD and Solaris machines, which is nothing special to OpenBSD.
      Infact, the developer of Systrace is in fact not a member of the OpenBSD developer team, but his OS of choice is NetBSD.

  3. PicoBSD by coldcup · · Score: 2, Redundant

    Yes, they do know PicoBSD exists.

  4. A new possible BSD ? by dnaumov · · Score: 4, Interesting

    There is a thread on BSDForums, where people are discussing the possibility of either creating a script that would automate the creation of a "MiniBSD installation" or possibly creating a new BSD altogether, using the MiniBSD philosophy and FreeBSD base.

    1. Re:A new possible BSD ? by smnolde · · Score: 1

      Check out the cdroot port. This port will make a bootable freebsd cdrom and you can install packages to it. When you boot, configuration files in /etc will load from a floppy.

      I've used this port to make a FreeBSD-specific boot disk like tomsrtbt, but with more horsepower.

      I think a few minor modifications to the cdroot port will do what you want.

      Good luck.

    2. Re:A new possible BSD ? by josepha48 · · Score: 3, Interesting
      I think that one thing people are missing is that in a real FreeBSD system the /bin and /sbin contain static executables. Thus they are larger because all the code in 'in there'. In miniBSD all the programs are shared executables.

      This thread, if you read all of it, suggests that a new BSD would be a little to much and that it may be better for it to be part of FreeBSD as either an option or a seperate script.

      If you read the miniBSD there are scripts that do the coping for files from the real system to the directory that is going to be the compact flash directory. He starts out by telling the user to make world, which essentially tells people to build the system from the gound up. Also making sure to make NO static binaries. On most systems you may want static binaries, in case the system had an improper shutdown.If sh is shared and the shared libs are in /usr/lib (where they are on FreeBSD) then you would not be able to run sh if you could not mount /usr. In his scenerio it is a compact flash card that is being used and it is mounted read only ALL the time. If you do this to your system then you could cut down the size of the system.

      Also there is pam to think about. My FreeBSD 4.7 system has pam on by default. He does not mention this. So when I used his mklibs.pl script it did not get the pam libs and the system was pretty hosed.

      Oh and I have managed to cut FreeBSD down to about 72Megs with sshd running and bind 9, ipsec, and ipfw2, natd, and console access. Still I am looking at how to cut down more and still not loose functionality.

      I think the real solution would be a project in the ports that would allow an automated minibsd system to be built. i.e. run script x and make a few choices and it builds the system for you. Options could be include sshd, include bind 8 or 9, include perl or not and get your customizish system that way.

      --

      Only 'flamers' flame!

    3. Re:A new possible BSD ? by Anonymous Coward · · Score: 0
      the possibility of either creating a script that would automate the creation of a "MiniBSD installation" or possibly creating a new BSD altogether,

      i'd like to see a script to automate an install of a suidless, fully systraced OpenBSD system, a la Dug Song style, as in this post.

    4. Re:A new possible BSD ? by usotsuki · · Score: 1
      What I'd like to see, personally, is a *x clone (Linux or *BSD, doesn't matter) that

      • fits in its most basic state on a 1.44 MB floppy, with a little bit of breathing room, so I can download it onto a floppy, transfer it to my (DOS) HDD, and then blit it back out.
      • supports access over the COM: ports.
      • does PPP (both ways, incoming and outgoing), and possibly telnet, ftp, Berkeley Mail or somesuch, and maybe lynx (so I can use it to connect to the outside world).
      • contains something like nano for a text editor.
      • allows me to install software on a separate hard disk partition (including it?).
      It would be ideal for me. Maybe a few zips I can download 1.3 MB at a time and transfer to my own PC could then supply a C compiler and an X Window implementation. Ah, the benefits of small software.

      -uso.

      --
      Dreams, dreams, don't doubt dreams, dreaming children's dreaming dreams. Sailor Moon SS
  5. PicoBSD and miniBSD have two different goals by eht · · Score: 4, Informative

    The Tentative PicoBSD FAQ has useful information on how to built a PicoBSD build out of the current source tree and therefore isn't anywhere near two years old, nor does it build to two floppies, there are three differnet versions of it with a fourth in psuedo permanent beta testing

    miniBSD has a different aim of not so much tweaking, for example in PicoBSD SSH daemon and client are just two aspects of one program instead of two sperate programs because of all the shared code between them, it's more meant to run on compact flash and is easier to update since PicoBSD is a compressed bootable image

  6. Anyone use the hardware??? *NM* by drrocco · · Score: 0

    *NM*

  7. Packagizing "base" by cperciva · · Score: 3, Interesting

    Every time someone asks about dropping Sendmail or Bind from the base system, discussion on the FreeBSD lists ends up with the following: If you go ahead and work out how to packagize "base", we'll probably end up doing it.

    I think starting with this "miniBSD" and adding everything else back in might be the right way to do it.

  8. Size? by JDWTopGuy · · Score: 2, Funny

    You know what they say about the size of a geek's BSD...

    --
    Ron Paul 2012
  9. Are there any miniBSD's akin to uClinux? by torpor · · Score: 2, Interesting

    i.e. portable to non-MMU, cheap processor families such as the Coldfire, MIPS, or ARM?

    It's been a while since I bothered checking to see if such a thing as an 'embedded BSD distro' existed, guess it's time to suss it out ...

    --
    ; -- the corruption of government starts with its secrets. a truly free people keep no secrets. --
    1. Re:Are there any miniBSD's akin to uClinux? by tigga · · Score: 2, Informative

      Well, check out NetBSD - they support 39 platforms('ports').
      http://www.netbsd.org/Ports/

    2. Re:Are there any miniBSD's akin to uClinux? by josepha48 · · Score: 1

      Then you'd have to figure out how to scale down NetBSD to fit in uClinux space. Not sure what that is. But the miniFreeBSD would tell you pretty much what files you could keep at a minimum. It wouldn't help much with the /etc dir as NetBSD and FreeBSD /etc are slightly different.

      --

      Only 'flamers' flame!

    3. Re:Are there any miniBSD's akin to uClinux? by Anonymous Coward · · Score: 0

      NetBSD and OpenBSD can be installed by default as about 15-20meg userland. That's not really too big for embedded applications considering you can get 64meg flash drives for well under $100. Unfortunately there's no real "slim down" version that is out there, but 15-20meg? Not a big deal. If you want to get really anal about it you could go through each program that is useless for your application (probably the whole gcc suite, Perl (incl. adduser scripts) and so on) and recompile the kernel. Or just compile the source tree but only install /bin and /sbin. If you leave out /usr i'm fairly sure you could cut it down really small. Save your shell history and put it into a script so you can repeat it. If you're going to roll it out in a production environment you'll be tweaking it anyway, so hey.

    4. Re:Are there any miniBSD's akin to uClinux? by glitchvern · · Score: 1

      He said non-MMU processor families such as the Coldfire, MIPS, or ARM.
      If you look at netbsd's ports page you'll note that it says, "NetBSD should be portable to just about any 32bit or larger machine with an MMU. Machines without an MMU would be more work."
      So while it is possible to port Netbsd to non-mmu machines it is a bit more work. It should be noted there are 7 Netbsd ports to arm, 11 ports to mips, and I think none to Coldfire's. They list further arm ports as being fairly trivial to do. They do not state how difficult ports to other MIPS would be. Coldfire is a subset of the 68k architecture of which there are many NetBSD ports for which could be used as a starting point. There does appear to be commercially available partial Coldfire port of OpenBSD from Stallion Technologies, so it is possible to do.
      But what he was really asking was is there any bsd set up to be easily ported in general to platforms without mmu's the way uClinux is. The answer is currently no. Although that is one of NetBSD's future goals according to their 2002 USENIX Presentation.

  10. Script to remove parts with make buildworld by Groganz · · Score: 1

    Is something I would like to see. For example if I buldworld with NOUUCP in /etc/make.conf, I don't want the old binaries hanging around. A make deinstall UUCP option in /usr/src/Makefile would be handy :)

    1. Re:Script to remove parts with make buildworld by Anonymous Coward · · Score: 0

      Well, you could just do a find /bin /sbin /usr/bin /usr/sbin -mtime +3 and find any files which are from an installworld more than 3 days ago. (fit time to your need).