Under which circumstances is NetBSD a better option than the other BSDs? reddit / BSD ---------------------------------------------------------------------- fusion809 · 2018-02-12 12:21 NetBSD is probably the most ported operating system out there, aside from perhaps Linux. So sometimes if you're using an obscure architecture and you want a BSD you have to use NetBSD. Under which other circumstances is NetBSD the best option out of the BSDs? FreeBSD is best under most circumstances, as its repositories are larger, its development team is larger, it has binary compatibility with Linux, better support for the alternative Z File System (ZFS), etc. OpenBSD is best when good security, documentation and code correctness are of the upmost importance. So, aside from when the architecture is only supported by NetBSD, when is NetBSD the better choice? ---------------------------------------------------------------------- player1dk · 2018-02-12 13:36 Ten to fifteen years ago NetBSD would be considerable if running on obscure, obsolete or someway minor platform. Today, I can’t really find its strengths anymore. ---------------------------------------------------------------------- Queen_Cherry_Muffin · 2018-02-12 14:48 ***Eye-roll*** TL;DR -- NetBSD is just as good as any other BSD for a basic desktop or server. It's only when you get into specific use cases or niches that one may be better over the other. And even then, things have changed so much over the years that descriptions like those in the OP are no longer accurate. I hate posts like these -- they repeat dogma about the BSDs that is decades out of date (these stereotypes are from the 90's). Below is a list of things that FreeBSD, NetBSD, and OpenBSD do well or don't do well. Things have changed a lot over the years. NetBSD * It's third-party software respositories are as large as, if not larger than, FreeBSD's. NetBSD created the pkg_src framework for managing and installing packages, which has been adopted by a number of other operating systems. * It has great documentation - just as good as FreeBSD or OpenBSD's (they all are good honestly, but none are perfect). * Don't trust it's "portability." Only a handful of its ported architectures are supported, most architectures have been abandoned or are maintained "organically." * It's easily portable. You can cross-compile NetBSD from any architecture to any other architecture (in theory and mostly in practice). Developing a new arm-board or creating new custom hardware? NetBSD is probably easier to port than your other options. * It's just as secure as OpenBSD. NetBSD is also "secure by default" like OpenBSD because NetBSD's base install only has the bare minimum up and running. Like OpenBSD, NetBSD does not come with a bunch of extraneous network servers running with the default install. Just like OpenBSD, if you start running a lot of network accessible third- party software (web servers, mail servers, *etc.*), you start compromising the security of your system. There is only so much the operating system can do in that instance. * It's a great research operating system if you want to tinker with new ideas. The code is really clean and portable, so a lot of entities use it as a testbed for new concepts or ideas (e.g., rump kernels, Lua scripting in kernel, Kauth, etc.) * NetBSD has binary compatibility with Linux just like FreeBSD (and like OpenBSD used to). However, it is also maintained just as poorly as FreeBSD's. * NetBSD is actively working to bring their older ZFS implementation up to date. * If you're a big user of Xen for virtualization, NetBSD is a Tier 1 supported platform and one of the first operating systems to implement Xen. FreeBSD - I love this operating system, but it's hardly "the best" * FreeBSD has much better third-party driver support than the other BSDs. For example, Nvidia, Realtek, and other vendors provide FreeBSD specific drivers on a regular basis. They don't do that for the other BSDs. * FreeBSD tends to get new features sooner than the other BSDs (because they have more developers and sponsors). This only matters if you actually need the new features that are implemented. * FreeBSD's multi-processor performance is far better than OpenBSD's. I don't know how it compares to NetBSD. But they all lag behind DragonFlyBSD's scalability. * FreeBSD is equally "secure by default" as only an SSH server is enabled with the default install, assuming you choose to enable it as part of the installation. * FreeBSD's linux emulation is poorly maintained. The kernel API is woefully out of date. * FreeBSD's port of PF is divergant from OpenBSD's. FreeBSD's pf is SMP optimized (OpenBSD's is still single-threaded), but FreeBSD uses a much older version of PF's syntax. The result is that you can't use OpenBSD guides on FreeBSD anymore. OpenBSD * Performance is generally worst of the BSDs. Most of the kernel code is still single-threaded or only crudely multi-threaded. Given the direction of today's processors is more cores because of thermal limits from increasing clock speeds, this is a big deal long term. * They don't support basic features like TRIM for SSD (it's 2018 - really guys?!). * They have a lot of cool security ideas, but I'm only sold on some of them. Good things they do is remove old code that's unmaintained (*e.g.* linux compatibility, lots of cruft in OpenSSL, *etc.*), minimize the number of network services enabled in the default installation (but everyone does this), and constantly audit their code to replace unsafe functions (e.g., gets(), strcpy(), *etc.*) with safer functions (*e.g.,* strncpy()). They also tend to be the first to implement new security paradigms (*e.g.,* W^X bit support). However, other stuff they do I remain unconvinced about (*e.g.,* their pledge() framework). * I would argue that their support for a variety of architectures is far better than the other BSDs. OpenBSD has "Tier 1" support for 13 different architectures, while NetBSD has support for 7, FreeBSD supports 6, and DragonFlyBSD supports 1. * My limited experience has also been that while OpenBSD has less support for third-party hardware, mainly because of OpenBSD's strict requirement for open-source licensed drivers and a refusal to allow driver BLOBs into the code, the hardware they do support is supported better. DragonFlyBSD -- The unsung hero of the BSDs. * I don't know much about them, but their claim to fame is performance - specifically multiprocessor scalability. They forked from FreeBSD 4.x to implement a message-passing framework in-kernel (think MACH but without the system call overhead) to allow for SMP processing while FreeBSD pursued a fine-grained lock approach. The data over the last few years is showing that DragonFly's approach was the better one. * They have a really small team. So while the code quality is good and releases are regular, it takes a while for new features to become production ready. **EDIT** - Fixed some formatting. ---------------------------------------------------------------------- vabruce · 2018-02-12 15:15 Before someone points out some "flaw" with your list, thank you for taking your time to make this list and answer the OP's question to the best of your ability. ---------------------------------------------------------------------- doaslol · 2018-02-12 15:17 >However, other stuff they do I remain unconvinced about (e.g., their pledge() framework) Why are you unconvinced about pledge? ---------------------------------------------------------------------- tangomikey · 2018-02-12 15:30 Rump Kernels are cool. https://wiki.netbsd.org/rumpkernel/ ---------------------------------------------------------------------- [deleted] · 2018-02-12 16:07 [deleted] ---------------------------------------------------------------------- Queen_Cherry_Muffin · 2018-02-12 16:22 My biggest complaint with pledge is that it's optional, which makes the whole thing a solution in search of a problem. You have three types of programs: * trusted programs (e.g., base system, my own code, etc.) * untrusted programs (e.g., third-party code, my own code sometimes :-), etc.). * trusted programs running untrusted code (e.g., browsers). Trusted programs are already implementing pledge, but I wasn't really concerned about which system calls they were using anyway. For example, the OpenBSD devs are "pledging" all the programs in the base system. But I already trusted the OpenBSD devs not to do anything crazy with the programs in the base system anyway. Untrusted programs (e.g., third party binaries) are not required to implement pledge, and the nefarious ones won't. If I manage to install a worm/trojan/virus/rootkit/nefarious program on your system, I'm not going to "pledge()" myself! So it doesn't defend against this threat. Browsers (which these days are basically an operating system unto themselves) are the most interesting case for pledge. And OpenBSD has implemented Chromium with pledge(). However, browsers are no longer document viewers, but legitimate operating systems in their own right (with a full-blown JavaScript interpreter) that legitimately need access to system calls that allow you to read files, write files, change file permissions, allocate memory, open network sockets, close network sockets, *etc., etc.* that I am not sure that restricting access to available system calls meaningfully limits the attack surface. This is doubly true when many common browser based threats need little to any access to system calls. I'm not saying that pledge is useless. It's definitely a good idea of one way to apply the principle of least privilege. But the optional aspect of it makes me wonder about its worth. ---------------------------------------------------------------------- slainthejabberwock · 2018-02-12 16:24 > It's just as secure as OpenBSD. How do you justify claiming this? No stack protector, no W\^X, no free guard, no heap canaries, the base daemons aren't privilege separated and sandboxed; eg. the base ntpd is still ntp.org. > FreeBSD is equally "secure by default" as only an SSH server is enabled There's more to OpenBSD's security by default than not turning stuff on. FreeBSD doesn't even have ASLR, but you're claiming it's equally as secure as OpenBSD? ---------------------------------------------------------------------- Queen_Cherry_Muffin · 2018-02-12 16:27 Thanks! I'm not trying to start a flame war. And there's a lot more that I could have added to this list (but I have a day job). Each of the BSDs have done so much over the years that the simple characterization of "FreeBSD = performance, NetBSD = portability, OpenBSD = security" just isn't fair to the hard work those developers have been doing in other areas. ---------------------------------------------------------------------- Queen_Cherry_Muffin · 2018-02-12 16:40 NetBSD has supported W^X since version 2.0. It uses PaX for number of stack and memory protections (many of which are similar to what Open BSD does). NetBSD was the first (and as far as I know, only) BSD to implement ASLR in kernel. NetBSD also has kernel based file integrity checks (veriexec) which can provide protections against file modifications even in the event of a root compromise (which OpenBSD doesn't do). Some of OpenBSD's implementations of features may be better. OpenBSD may have pioneered some of them first. But security is not a check the box thing. A system is not "less secure" because it fails to implement one feature, but implements something else. ---------------------------------------------------------------------- slainthejabberwock · 2018-02-12 16:41 Pledge isn't about about restricting unknown programs from doing bad things, it's about restricting vulnerable trusted programs from being exploited and doing something they shouldn't. You'd be right about pledging a browser being useless if chromium wasn't privilege separated, hence why Firefox isn't pledged. The different processes of chromium are pledged with differing permissions, so a vulnerability in the rendering process or the gpu process or the plugin process doesn't get an attacker full file system access or the ability to open sockets, and the part that can open file descriptors isn't the part that's reading arbitrary code from the internet. ---------------------------------------------------------------------- Queen_Cherry_Muffin · 2018-02-12 16:47 This makes *A LOT* more sense than the last person who explained pledge to me. I stand corrected about it's value. Thanks! :-) ---------------------------------------------------------------------- ahandle · 2018-02-12 17:36 Small footprint in source and binary form, short path to a running a highly-interoperable BSD environment with a simple, [2-clause license](http://www.netbsd.org/about/redistribution.html). ---------------------------------------------------------------------- Ubertekk · 2018-02-12 18:16 OpenBSD does kernel 'ASLR' now. They relink the kernel on every boot with everything in a different address ---------------------------------------------------------------------- Nanosleep · 2018-02-12 18:23 It is objectively less secure if [someone audits the codebase](https://www.youtube.com/watch?v=rRg2vuwF1hY) and finds 2-3x the number of exploitable vulnerabilities in it. ---------------------------------------------------------------------- thunderbird32 · 2018-02-12 18:55 I've found a use for NetBSD on legacy hardware. Not just weird architectures (as you point out), but older hardware. I've got it running quite usably on a 200MHz Pentium Pro. ---------------------------------------------------------------------- raevnos · 2018-02-13 00:49 In addition to the other stuff already mentioned, Net is compiled with -fstack-protector by default. ---------------------------------------------------------------------- fusion809 · 2018-02-13 01:10 Thanks for your answer, it is truly wonderful. One point though NetBSD's pkgsrc repos contain 15,495 packages at the time of writing (source: http://cdn.netbsd.org/pub/pkgsrc/current/pkgsrc/README- all.html). FreeBSD's ports contains 29,781 ports (source: https://www.freebsd.org/ports/). So I do believe FreeBSD's ports is considerably larger. ---------------------------------------------------------------------- Queen_Cherry_Muffin · 2018-02-13 03:46 Well, I learn something new everyday! Honestly, I probably wouldn't even notice the difference in the number of packages. All the software I use has a pretty large userbase (*e.g.,* python, nginx, samba, php, nextcloud, X11, KDE, firefox, *etc.*), which means it's ported pretty much everywhere. So I've never noticed something as being missing. But your mileage may vary - I am hardly the typical user. ---------------------------------------------------------------------- master_of_lemon · 2018-02-13 07:03 In my opinion, the only time where NetBSD is appropriate is with old/obscure hardware and embedded applications, such as embedded ARM CPUs and stuff. I can't think of any reason I personally would use it as a desktop or server over any other BSD. However, someone else may be able to pitch in on the reason they use it. That being said, if I had something like an X68000 I'd absolutely run NetBSD on it. That'd be badass. ---------------------------------------------------------------------- [deleted] · 2018-02-13 12:00 it's good for any non-x86 architecture, not just ones unsupported by others. It's much easier to hack with easy cross compilation, offers a modern compiler on all platforms, and has actual users on those architectures. It's made up by people who genuinely work/expect an update from a 15 year old install to be as easy as a 2 month update, which is awesome for confidence in updating machines. ---------------------------------------------------------------------- [deleted] · 2018-02-13 12:02 Also pkgsrc compiles all packages with SSP/FORTIFY by default. ---------------------------------------------------------------------- [deleted] · 2018-02-13 12:06 > the base daemons aren't privilege separated and sandboxed; eg. the base ntpd is still ntp.org. Excuse me while I run my non-root ntpd then. ---------------------------------------------------------------------- [deleted] · 2018-02-13 12:14 > > Don't trust it's "portability." Only a handful of its ported architectures are supported, most architectures have been abandoned or are maintained "organically." Do you have any specific complaints? ---------------------------------------------------------------------- [deleted] · 2018-02-13 12:25 pkgsrc, when built, generates 20450 packages. e.g. py- packages are built for python2 and python3. it's really easy to inflate or deflate those numbers, I don't recommend comparing them. ---------------------------------------------------------------------- fusion809 · 2018-02-13 14:00 I'd argue they aren't different packages. They're just different variations of the same package (hence why they're lumped together in pkgsrc). But nonetheless, with such a large margin it's fairly safe. Like running pkg stats on FreeBSD 11.1 returns 28,778 packages. So 28,778 vs 20,450 still shows a clear difference in favour of FreeBSD. I'm setting up a FreeBSD 12-CURRENT system so I can run pkg stats on it too as I suspect it'll have closer to that 29,781. ---------------------------------------------------------------------- [deleted] · 2018-02-13 14:11 OpenBSD lists 10,000 (half as many as pkgsrc), which if you're comparing just numbers sounds awful, but I assume isn't the case in practice. ---------------------------------------------------------------------- ulises314 · 2018-02-13 18:00 Alas, not many people understand that security is not only a matter of steps, but a war with very clever enemies; thus your mentality to counter them should be evolving accordingly, spearheading techniques and not in the "me too" approach that most other follow. correctness is also paramount to security, OpenBSD is the only OS that has that deeply ingrained in the culture. ---------------------------------------------------------------------- devnexen · 2018-02-14 13:37 I believe they re going (or already are) moving towards microkernel architecture "a la" minix3 (maybe I m wrong though) ? Just for that as said it s great base research os, would not bet on the secure statement too much though. ---------------------------------------------------------------------- MrThugger · 2018-02-14 18:09 NetBSD does KASLR. In fact NetBSD has the strongest KASLR, better than Linux, Windows and MacOS. ---------------------------------------------------------------------- MrThugger · 2018-02-14 18:20 OpenBSD has remote vulnerabilities by default, look at their errata page, it is less secure than Windows ---------------------------------------------------------------------- Ubertekk · 2018-02-14 18:58 Cool! From reading the article I think that the OpenBSD kernel is more mixed up (iirc it links every .o file at a random address, so that'll be more sections thrown all over) but NetBSD does some cool tricks to increase entropy by a crazy amount, [here](https://blog.netbsd.org/tnf/entry/the_strongest_kaslr_ever) for all the other people. ---------------------------------------------------------------------- BumpitySnook · 2018-02-16 01:45 FreeBSD does the same re: python packages. It wouldn't surprise me if FreeBSD's ports collection was in fact a little larger than pkgsrc. This isn't a criticism. ---------------------------------------------------------------------- vermaden · 2018-02-18 00:12 I would add HardenedBSD to Your list which tries to be as much secure as OpenBSD (or even more) while having all the features and performance of FreeBSD. https://hardenedbsd.org/content/easy-feature-comparison ---------------------------------------------------------------------- shevy-ruby · 2021-12-18 12:48 Several years ago I remember on the NetBSD-mailing list someone mentioning that Linux may now be available on more architectures than NetBSD. So I am not sure whether portability by NetBSD is really superior to Linux in this regard.