How to learn FreeBSD deeply?

This book was also a real joy for me:

Designing BSD Rootkits

I was recently trying some code I did on it and you should only prepend `sys_` when calling syscalls in the examples.
 
For moderate (or deeper) learning, use FreeBSD-CURRENT.

You'll read many statements that updates to CURRENT must be built and installed from source. This is no longer true! Updates can be far less complicated:
  • source code not required.
From the third edition of Absolute FreeBSD, the chapter that mentions debug printfs:

… FreeBSD’s kernel includes all sorts of features that aren’t included in GENERIC. …

Beware of things taken out of context (as I did with my quote of the sentence above).

GENERIC – the default kernel for CURRENT – is superior, it includes:
  • much more than GENERIC for RELEASE
  • much more than GENERIC-NODEBUG for CURRENT.


… add debug printfs to /usr/src

Please, how so?

The debug printfs NOTES example in Absolute FreeBSD is no longer in NOTES:


… what book do you recommend?

Many of the early answers were not books, so let's note that intro(9) was recently rewritten. These two editions are very different:
For manual pages in general, many links are broken (sorry). Reports include <https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=265128>, <https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=266336>, and <https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=271479>.

1- Is it true that each BSD distribution has its own kernel?

No.

GhostBSD is based on FreeBSD, and so on.

2- Can you briefly tell me the performance of each of the following distributions in order?

  1. FreeBSD
  2. NetBSD
  3. OpenBSD
  4. DragonFly BSD
  5. hello

For two of those, not specific to performance, three days ago:
I like both operating systems a lot. What are some major advantages of both we could name?
 
A BSD nowadays isn't a distribution, but a whole OS. There's typically a distribution of 3rd-party software attached, built from the "ports" tree, but that's something different. The D in BSD is "historic", BSD started as a distribution of modifications and extensions to AT&T Unix, but gradually replaced all components until it became a complete OS itself.

So, yes, every BSD OS also has its own kernel, although their development can be traced back to what was done at University of Berkeley. Nevertheless there are "(re-)distributions" of BSD systems, e.g. GhostBSD is a distribution of FreeBSD and therefore includes the FreeBSD kernel.


"Performance" isn't a well-defined measurable thing, so this is completely impossible. It at least requires a specific scenario of what should be done. Any attempt to say something about "general" performance is subjective because it will assume a specific mix of use cases (and also depend on other things when trying to measure like the hardware itself or specific drivers used). All I can tell you here is that performance considerations are typically more in focus for FreeBSD than for NetBSD (aiming for portability) and OpenBSD (aiming for security), and I can only guess it's somewhat similar for dfly. "hello" is just a distribution of FreeBSD, so nothing to say here. And again, this doesn't mean that e.g. OpenBSD can't perform better for a specific task than FreeBSD. You'll certainly find examples.


This is technically impossible as well. "Linux" is just a kernel, and the userland of a BSD OS certainly won't run with Linux. Some BSD tools can run of course (like OpenSSH, which is developed as a part of OpenBSD, and is still used by almost every Linux distribution). There was a port of Debian using FreeBSD's kernel, which required porting the GNU userland to this kernel ... it's typically used as the userland parts for a Linux system. But then, the result had nothing to do with Linux any more, and was consequently named "GNU/kFreeBSD". AFAIK, this project is dead, and I'm not aware of any projects actively developing something similar at the moment.
Hello,
Thank you so much for your reply.
By performance, I mean efficiency. Where are they used?
 
There are many Books About FreeBSD but knowing what I know today I would start in that order:
- Install FreeBSD in a VM or a spare laptop/desktop (better on real hardware of course but not suitable for everyone)
- Read Absolute FreeBSD (3nd Edition)
- Read FreeBSD Handbook https://freebsd.org/handbook
- Read FreeBSD FAQ https://freebsd.org/faq
- Read FreeBSD Man Pages https://man.freebsd.org/ (for the parts that You are doing in that moment) [You can also download them in PDF files]

You will know quite well at that moment.

Next these for more deeper knowledge:
- Read Design and Implementation of FreeBSD 11 Operating System (2nd Edition)
- Read FreeBSD Architecture Handbook https://docs.freebsd.org/en/books/arch-handbook/
- Read FreeBSD Developers Handbook https://docs.freebsd.org/en/books/developers-handbook/
- Read FreeBSD Porters Handbook https://docs.freebsd.org/en/books/porters-handbook/

Next you may also check the other books about FreeBSD that I listed here: Books About FreeBSD.

There was time when FreeBSD Mastery: Jails would be very valuable - but first - now FreeBSD Handbook has a Jails section with VNET covered - and second - the FreeBSD Mastery: Jails also covers iocage that is essentially dead now and one should now run either plain FreeBSD Jails or with BastilleBSD or with Nomad/Pot solutions.

There are two ZFS dedicated books and You will likely get some insight about ZFS from them FreeBSD Mastery: ZFS and FreeBSD Mastery: Advanced ZFS ... but as its OpenZFS times now - some Illumos and OpenZFS Documentation is also very useful.

... and while You will be digging ANY topic that you want to realize on FreeBSD - check duck.com/google.com/... search results for HOWTO + THAT TOPIC - a lot is nicely covered in FreeBSD Forums threads, in FreeBSD Journal (BSD Magazine seems dead now), in various blogs and articles and sometimes even in a single X/Twitter/Mastodon messages.

Regards,
vermaden
Hello,
Thank you so much for your roadmap.
Is the roadmap the same if someone wants to build a distribution of BSD?
 
Hello,
Thank you so much for your roadmap.
Is the roadmap the same if someone wants to build a distribution of BSD?
nope...

To roll your own, you need to have a good handle not just on the technical details of how FreeBSD is even put together, but also on how to rent and maintain publicly available web hosting infrastructure for the project... There's LOTS of people who modify Ubuntu with their own GNOME theme, a few precompiled packages like VLC/LibreOffice and call it a 'distro'. Such projects take a lot of time and money to set up, and then they get abandoned after about 2-3 years.

Nothing stops you from setting up your own hardware with FreeBSD, and making adjustments that you like. FreeBSD is a very minimalistic, DIY thing. But don't waste your time on 'building a distribution'.

If you want to do in-depth learning about FreeBSD, you gotta have a good handle on stuff like recovering from a disaster. As in: If you mess up an installation of FreeBSD, do you have a good enough handle on the booting and installation process to be able to fix it using just the rescue shell? I think that 'recovering from a disaster' is a pretty useful and tangible goal to have when learning about FreeBSD.

Hello,
Thank you so much for your reply.
By performance, I mean efficiency. Where are they used?
And 'efficiency'... of what exactly? You do need to define a task, like compiling a specific software, serving up a web page, reacting to pings, boot time, and the like.

As for myself, I'm doing a project that addresses upgradability of KDE. It's a personal project. It did force me to learn a LOT about FreeBSD, and how it's different from Linux. I had to go in-depth into Porter's Handbook to figure out how to work with ports system and KDE. The project is far from over, there's still lots of technical hurdles to resolve. But at least I know where I'm going with it.
 
Hello,
Thank you so much for your roadmap.
Is the roadmap the same if someone wants to build a distribution of BSD?
Hi,

I believe not much in these books will help You to create your own FreeBSD based distribution.

The easiest way is to clone something existing and modify it - like GhostBSD or NomadBSD.

Take a look at GhostBSD Way section of my Personal FreeBSD PKGBASE Update Server available - https://vermaden.wordpress.com/2023/12/09/personal-freebsd-pkgbase-update-server/ - here. It covers the build.sh script from GhostBSD with which GhostBSD creates their own ISO and how they manage to create and later update the parts of their base system.

I did not checked how NomadBSD does it but they also have GitHub and they share lots of stuff there.

You can also try on your own with Poudriere. Install poudriere-devel package and check poudriere-image(8) man page.

Also read this:
- https://klarasystems.com/articles/building-customized-freebsd-images/

Regards,
vermaden
 
Hello,
Thanks again everyone for the replies.
Is it harder to build a BSD distribution than Linux? Doesn't BSD have something like LFS to download and compile packages one by one?
I am looking for something like this. Something that will teach me step by step how to do this.
 
Is it harder to build a BSD distribution than Linux? Doesn't BSD have something like LFS to download and compile packages one by one?
I am looking for something like this. Something that will teach me step by step how to do this.
What should a "BSD distribution" be? As I explained earlier, today's BSDs are complete operating systems, the D in the name is historic. They also typically come with their own distribution of 3rd-party software (packages) built from ports.

Linux is only a kernel, you need quite some userspace tools to create a full OS (and the "base tools" typically come from GNU). That's why following LFS, you have to build a lot of packages just to get a working base system. With a BSD, you get the whole system in a single source tree, and you can build and install from that in a few simple steps. The process for FreeBSD is described in the handbook and there are reference docs in manpages like build(7) and release(7).

So, the word "distribution" makes little sense here, you just build and install it. If you want to change anything, you'd actually create a "fork".

Finally, for building 3rd-party software, there's already a well-working framework with ports to build and install packages from upstream sources. And there are tools like poudriere to automate bulk builds and reliably create a package repository.

All a "BSD distribution" could mean would be to combine the base system (maybe slightly modified) with a predefined and preconfigured set of 3rd-party packages, like some systems are doing in order to provide some "out of the box FreeBSD desktop" or whatever.
 
… Is it harder to build a BSD distribution than Linux? …

I can't comment on the other BSDs, or on Linux, but FreeBSD essentials include:
Watch from around 11:29 on the timeline of a recent video, to the point where jgrafton runs:

make memstick

Whilst it's not the deep step-by-step that you want, this part of the video does demonstrate the simplicity with which an installer (for a distro) can be made with FreeBSD.
 
What should a "BSD distribution" be?
BSD OS + any combination of:
  • software
  • configuration
  • source changes
From a practical standpoint, it seems weird to call that a distro. But my understanding of BSD license is that you are free to do so. You take the source code, bundle it up however you want, call it whatever you want, and distribute it however you want, so long as you include the license information.

In other words, I could take FreeBSD source code, add /usr/bin/hello_world, and make millions of dollars selling my cutting edge operating system HelloBSD.

Nerds won't be fooled, of course. "It's just FreeBSD with a program added!" But I don't think there's a specific threshold where something goes from a configuration to a modification to a distribution.
 
I always thought that the 'D' in BSD meant 'Distribution' in the sense that copies of Berkeley Software are actually meant for distribution to the general public (as opposed to keeping it for yourself) in the same sense that potatoes are grown for distribution. I see Linux playing on the word 'distribution' -> 'distro' to make it sound like a bistro :p Any bistro does a basic salami sandwich differently, and distributes it...

But I don't think there's a specific threshold where something goes from a configuration to a modification to a distribution.
Yeah, people gamble on that idea, and litter the Internet with terabytes' worth of abandoned projects that amount to little more than changing the output of
uname -a to MyPirsonalLinaxPorjectIsDamCool... :/
 
I've seen this so many times, some people want to be "hackers" (or something along these lines) and keep asking, looking for the "secret silver-bullet" kind of knowledge they imagine they'd need for that...
I keep looking for that silver bullet myself. But year after year after year... it seems like it's all hard work and elbow grease :(
 
Operating system abbreviated from six syllables, to two (OS).

Berkeley Software Distribution abbreviated from eight syllables, to three (BSD).

Distribution abbreviated from four syllables, to two (distro).

Distro:
  • is not Linux-specific
  • may refer to a software distro.
 
Hello,
Thanks again everyone for the replies.
Is it harder to build a BSD distribution than Linux? Doesn't BSD have something like LFS to download and compile packages one by one?
I am looking for something like this. Something that will teach me step by step how to do this.
It probably makes more sense to learn how to compile ports on FreeBSD first... just to get a handle on what's included, what's not, and how long that will take on your hardware.

THEN learn to recompile the FreeBSD kernel... If you installed sources (into /usr/src/)when you installed FreeBSD for the first time, you can follow the Handbook, and learn how to recompile the kernel, and how to install it correctly.

After that, it probably makes sense to see if you can pull off following -STABLE-tagged git branches.

Heh, there's even pkgbase, which is basically FreeBSD kernel compiled and packaged so that you can pick version and arch, and use the pkg command to install it ;) I think that idea is actually borrowed from the Linux camp.

It's still plenty of work to get kernel compilation and upgrading down correctly - a lot of people try to skip steps, and mess up their systems to the point of needing a complete reinstall. It's best to treat such situations as a learning experience. :)
 
It probably makes more sense to learn how to compile ports on FreeBSD first... just to get a handle on what's included, what's not, and how long that will take on your hardware
First set your goal and start installing FreeBSD on real metal with options of debug tools. Download source code of FBSD and port system. Try it whatever way you like in structured way. For specific problem or query you may consult the referenced book and ask for help here also.
 
Distro:
  • is not Linux-specific
  • may refer to a software distro.
https://en.wikipedia.org/wiki/Distro

That disambiguation page leads to the Linux-specific one and the second, supposedly not specific to Linux ...

https://en.m.wikipedia.org/wiki/Software_distribution

... but like much of Wikipedia, that's just someone's opinion.

I can't speak for openbsd or netbsd, let alone Berkeley, but I've never heard anyone inside FreeBSD call it a 'distro', more usually correcting that term's misuse as being mistakenly applied from Linux-speak.

I think it cheapens FreeBSD.

Just my opinion, of course.
 
I think (the word distro) cheapens FreeBSD.

From a 2014 status report about a GSoC project:

… booting the fai (Fully Automatic Installer) from the network by PXE. An installer distro was created based on mfsBSD. …

In 2018 when TrueOS was a thing – ericbsd described GhostBSD as becoming a distro of TrueOS with MATE desktop. It didn't cheapen things then, the word distro need not cheapen things now.

More recently (2022) Liam Proven described GhostBSD and MidnightBSD as distros, he's not known for cheapening. MidnightBSD is more correctly a fork, not a distro, but that's beside the point.

From <https://www.midnightbsd.org/developer/>:

* distro is often used in the Linux community. Some BSD folks hate that term applied to other projects. My working definition is a system with core componets (kernel, large parts of userland) that are not developed by the entity releasing the operating environment. It is a collection of software grouped together possibly with an installer. This can be applied to Live CD projects, BSD firewall projects, PC-BSD, DesktopBSD, and non BSD projects like Fedora, Gentoo, and so on.

OS is no cheaper than operating system. GSoC is no cheaper than Google Summer of Code. fai was simply an abbreviation. PXE is no cheaper than Preboot eXecution Environment. mfs is no cheaper than memory filesystem. I don't recall any significant upset when Apple's Mac OS X became known macOS (whilst remaining Mac OS X under the hood) – it was easier to pronounce (nearly everyone failed to speak the Roman numeral); not disrespectful. Historically, PC meant Windows to most people, but PC-BSD didn't cheapen things for FreeBSD. And so on, IMHO we should be well past the point where a commonplace abbreviation – distro – causes offence.



hack3rcon historically: PC-BSD was, like, a predecessor to TrueOS.
 
https://en.m.wikipedia.org/wiki/Software_distribution

... but like much of Wikipedia, that's just someone's opinion.
I think it's making one important point though distinguishing "distro" from "distribution". The word "distribution" indeed has a wider meaning in the software context, and in that sense, the D in BSD is still correct ... although I really assume that naming was chosen because back then, it was neither a complete system nor just one single component, it's generic enough to still apply, it actually only names some means to get a software from the producer to the consumers. That's also in line with calling any file (source "tarball", binary archive, installer, ...) offered by some software project for download a "distfile". "Distribution" also doesn't say anything about the author of the sofware, you can distribute your own or someone else's, you can distribute one piece of software or a whole collection, etc pp.

But then, we've seen "Linux distributions" emerge, and they all had a few things in common: They all distributed a whole collection of software, and it was always "3rd-party" software (with very few own code added by the distributor for automation, integration, management etc), and it's typically more than needed for "just" a complete OS, but instead including lots of packages for applications to optionally install. For this specific kind of software distribution, the (sloppy) term "distro" was established.

There's naturally no clear definition for "distro", but I also disagree with the interpretation presented on Wikipedia here. To me, the aspect of being a (re-)distribution of 3rd party software is important. And while all BSDs also include lots of (imported) 3rd-party software in their source trees, these are just additions. They're tightly integrated at the source level and built with the entirety of the OS. So, BSDs are indeed "software distributions" (as the name already tells), although that means very little. But they are not "distros". But then, we also have ports and packages, which come very close to the "distro" concept, calling just them distros wouldn't be wrong IMHO.
 
Graham,

you misquote me as saying:

smithi said:
I think (the word distro) cheapens FreeBSD.

After I had said:

I can't speak for openbsd or netbsd, let alone Berkeley, but I've never heard anyone inside FreeBSD call it a 'distro', more usually correcting that term's misuse as being mistakenly applied from Linux-speak.

Where "it" clearly is FreeBSD.

I then actually said:

I think it cheapens FreeBSD.

Where "it" clearly (to me at least) means "referring to FreeBSD as a 'distro'."

Even Phoronix doesn't cast the BSDs as distros nowadays, but then it doesn't generally use the term for Linux either:

https://www.phoronix.com/search/BSD

However I'm not going to try competing with your awesome ability to grep all BSD venues and a dozen other fora to make any point.

My own experience is limited to about a dozen mailing lists from 1998 to 2017 and this forum for less than two years.

Historically, PC meant Windows to most people, but PC-BSD didn't cheapen things for FreeBSD. And so on, IMHO we should be well past the point where a commonplace abbreviation – distro – causes offence.

No offence, it's just inaccurate, and only commonplace from the GNU/Linux milieu.

You've here talked about forks or derivatives of FreeBSD being called 'distros' by their authors; ok if that's what they want, but I was talking specifically about the common misconception - seen in these fora quite often enough from new participants - that FreeBSD is akin to a Linux 'distro'.

<&^{=
 
It's funny. Nomenclature in the Linux community has been a mess since Linux and GNU were in it's infancy. Stallman's evangelical stance on copy-left drew a lot of people away from him and GNU; I don't blame them.. I recall them (Linus/Stallman) having a heated exchange over what is a "complete system" in order to appropriately name the system. So this split in community gradually dropped "GNU/Linux" (coined by Stallman, and technically is a base system) and just called it "Linux"; incorrectly calling it an operating system. Technically, the term "Linux distro" is incorrect; as it's just a kernel. Much like GNU isn't a complete operating system; as argued by that side of the community. "BSD" is holistic; it started off as a bunch of extensions by researchers to an already existing base system. The "Free" in "FreeBSD" is a verb, denoting it's lack of proprietary code from AT&T out of BSD (or 4.3BSD specifically during the x86 port). I'd wager a lot of folks in the Linux crowd aren't aware of the historical reasons why calling FreeBSD a "distro" is largely incorrect.
 
Well, 'Free' in 'FreeBSD' also means free as in free beer - even if NetBSD and OpenBSD (and all other BSD's) are free of charge to download and use...

1706204320404.png
 
Yeah but those licensing grants hadn't been realized until after the USL v. BSDi lawsuit was over with. At the time 386BSD (which predates Linux, btw) was still riddled with proprietary code. It had to be removed and re-written from scratch; thus the name FreeBSD being chosen when Jordan Hubbard forked it. So "Free" as in "Unencumbered".
 
I've seen FreeBSD refered to as a Linux distro. Which is an incredibly confusing concept. I'm not sure if that could actually be done.

Anyway, interesting topic here. I don't know that I would ever actually want to know how to build the entire os. I just get excited to install the prebuilt system on machine and get x or Wayland going.

But I did want comment on the Linux vs FreeBSD terminology. I can say in all the years I've been familiar with unix like operating systems I've never confused one for the other or the associated terms.

Although there is a project going to create a BSD that is FSF compliant or GNU compliant system which is a combination that would have likely occured without Linux.

https://wiki.hyperbola.info/doku.php?id=en:manual:contrib:hyperbolabsd_faq

I fully support their efforts. I find the goals of the FSF to be admirable.
 
Back
Top