How to learn FreeBSD deeply?

Hello,
If someone wants to learn FreeBSD in depth so that he\she knows how it works, can debug it, knows how it is structured (kernel, file system, etc.), then what book do you recommend?

Thank you.
 
Reading the theory from a book is useful, but actually using it, run into problems and solving those issues builds experience. There is no shortcut that'll trump good, old fashioned, experience.

I can watch videos and read books about wood carving but I'll never get any good at it without carving some actual wood.
 
But the chances of cutting your thumb while watching videos about wood carving are almost nil.
Yeah, you'd better stock up on band-aids ;)

Same with FreeBSD though, I've made some very stupid and catastrophic mistakes in the past 30 or so years. But that's all part of the learning process. At least you don't have to visit the ER when you screw up. At most you're going to lose some files and a lot of time.
 
When I was new to Unix, I read man pages of every command one by one and experimented with them until I had a decent idea of how to use them. I spent more time learning about compilers, profiling (for finding performance hot spots) & debugging. And writing lots of small programs. I also read lots of code. Of utilities & kernel code and tried to figure things out myself. But back then unix kernel was quite small so it wasn’t too hard to read a significant portion of it. Now I guess you’d have to pick a subsystem and use a kernel debugger to watch it execute to aid your understanding. Easier to do so when it is running in a VM. Later the Stevems books were useful for learning about networking when I worked in a router company. Learning sticks with me by writing code and not just reading books. But the trick is to not get lost in minutiae of code! The code you write for production is use very different from the code you write to explore something and learn.

Botyom line: decide what your goals are (& think about *why* you have those goals) and then go about it systematically & have fun!
 
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...

hack3rcon please don't take this as an offense, but as a serious warning that you're obviously falling for some wrong conception (which I really guess you are, judging from your post history on here).

The first things you need is lots of patience and stubbornness, then, learn C and start with simple user-level programs. Yes, C. Actually the first programming language to learn deeply isn't *that* important, but C is still used a lot at the core of operating systems, which seems to be what you're most interested in. Nevertheless, stay away from OS code for quite a while unless you really have some programming skill in plain userspace applications. While here, learn about build systems (especially make), debuggers like llvm, and so on.

Then you can gradually start to dive into the source of an OS, e.g. FreeBSD ... first in its userspace parts, study code there, do local modifications and test them, and so on. Kernel code is probably the last thing you should read and touch ... it's also very different in that it typically doesn't have the "hosted environment".
 
Interesting....

Here are few man pages.... I wonder how decent an idea you have about how to use them ;)

rc.conf(), xterm(), sh() to name just a few...
Quite well actually. You also have to read related man pages xrdb, editres, etc. as X11 has its own set of fiddly little details you have to learn. But by the time X11 came about I had already learned enough about Unix and I didn't like X11 so i learned only what I had to. In general, if you want to learn anything "deeply" as the OP wants, you have to put in the hours. But that deep learning would be a waste of time if you are not using it or are not enjoying learning for learning sake.
 
I only learn by doing. With FreeBSD you can do that by looking at code and modifying it to your needs.

There are some examples in /usr/share/examples/ with device drivers and kernel modules. The most accessible part of the kernel, at least to me, is the filesystem. You could start from there.
 
Hello,
I have three questions:
1- Is it true that each BSD distribution has its own kernel?
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
3- I know there are distributions that mix BSD and Linux. Which ones are active?
 
1- Is it true that each BSD distribution has its own kernel?
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.

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
"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.

3- I know there are distributions that mix BSD and Linux. Which ones are active?
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.
 
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
I'll agree with zirias@ on "you need to define what you mean by performance" but historically the first 3 had different project goals in mind, at least at the start. My understanding of the original goals (which may not be 100% accurate):

FreeBSD was more server oriented on PC hardware (x86 cpus)
NetBSD was/is "run on as many different hardware as possible"
OpenBSD was/is as secure as possible in the default configuration out of the box
DragonFly was forked from FreeBSD at the end of the 4.x series, technical disagreements in how best to achieve large scaling was the root cause.
hello: I have no experience with this so can't say.

I've run the first 4 as a daily driver, they all worked fine for that, but I kept coming back to FreeBSD for the overall feel of the project. OpenBSD does a very good job of auditing the software, not just the OS but a lot of the ports.
 
I started with FreeBSD around version 5.0 until 7-CURRENT when I lost my hard drive with lots of patches and stuff. I came like a prodigal son with 14.0 and since Christmas I've been playing with the latest NetBSD, Dragonfly & OpenBSD. (Also OpenSolaris with OpenIndiana and was pleasantly surprised that it comes with a working MATE desktop and latest versions of packages).

The NetBSD userland seems to me to be like 5 years behind FreeBSD. The find(1) utility doesn't even support scanning for suid/sgid files at the same time with `-perm +06000`. I will contribute a patch but I have to install the GNU utilities to really work with it. I recompiled the kernel with llvm because gcc didn't properly support `-march=native`.

With OpenBSD it's even worse as it lacks the `-v` (verbose) option for a lot of utilities like install(1). To me it's just an OS to run the Packet Firewall.

DragonflyBSD seems to be sadly on life support. It failed to recompile the kernel for me. I will try again this weekend.
 
DragonflyBSD seems to be sadly on life support. It failed to recompile the kernel for me. I will try again this weekend.
Did you manage to get a working Xorg/wayland desktop on it?
It's still being developed and worked on by the folks on the IRC channel but seems like there's a few issues, and the documentation on the website is sadly quite outdated. Needs some love! Filesystems seem good though, and works will in CLI.
 
Did you manage to get a working Xorg/wayland desktop on it?
It's still being developed and worked on by the folks on the IRC channel but seems like there's a few issues, and the documentation on the website is sadly quite outdated. Needs some love! Filesystems seem good though, and works will in CLI.
I haven't tried X on it yet.
 
Hello,
If someone wants to learn FreeBSD in depth so that he\she knows how it works, can debug it, knows how it is structured (kernel, file system, etc.), then what book do you recommend?

Thank you.

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
 
Back
Top