Some general observations on FreeBSD from a rookie coming from Linux

mrbeastie0x19

Active Member

Reaction score: 59
Messages: 102

Hi everyone. I have used Linux since Ubuntu 12.04. Lately I have noticed a gradual decline in that system and even seem to enjoy using Windows 10 more, so I have been looking at alternatives.

These are just some of my thoughts on the installer process and base system.

Copying the ISO very easy and many options available. Good start. The installer is very plain. However it is functional, unlike Red Hat's Anaconda which has crashed my system multiple times. Not quite as beautiful as Ubuntu's live installer, but perhaps less likely to crash than its command line installer (which I think is a fairer comparison given the base install is similar to a server install).

Selecting keyboard layout easy enough. The modular separation of optional components is great, as is the fact my hardware actually seems to be automatically detected (Debian's has choked on finding the cdrom or network interfaces multiple times). Partitioning easy enough with the default options selected. Fetching the distribution took a matter of minutes, significantly faster than the Debian apt-get, although I think that fetches the files from the network whereas this ISO already has them available and just does the extraction.

Setting the root password was a little confusing, if you make a mistake you kind of just have to type it in wrong twice.

Creating a user account was actually really easy.

Timezone setting was a little unintuitive. Many options and did not seem to detect daylight savings.

On the whole I found the process to be very pleasant, the system (particularly the file system) seems more consistent and the boot times are quicker than my Linux install was.

That installed a very quick but bare bones system that does not include a graphical display. Setting that up was also very easy, just pulling in pkg, which seems slightly slower than apt but comparatively fast compared to dnf on Fedora.

Some not so good things:

Multiple LLVM versions are required to build packages and ports. The current implementation leads to a polluted file system structure, I think a better solution would be a dedicated /usr/local/bin/llvm/version/ directory. I did think it would be more consistent to compile ports with the same compiler as the base but I understand there might be technical limitations to that.

The ports and packages system seems really dependent on pulling in a large number of unnecessary software, I understand the approach is generic in the case of packages but it does have a tendency to bring in Linux stuff like pulseaudio. That's really quite unfortunate. I don't know what the solution to that would be in large software projects like Firefox where you guys might not have much control over the source.

The base system seems to include references to Xorg, which confused me since Xorg is not included by default.

Some of the naming seems a little inconsistent. For example why is there a CC and Mail in /usr/bin? These look like links to c++ and mail, but why are these treated specially?

I noticed that svn has been replaced by git, but the svn tools remain in base. Are these being replaced?

On the whole I am really impressed with the project and the amount of work that has gone into it seems really quite remarkable given the lack of awareness of the system.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,347
Messages: 38,863

Some of the naming seems a little inconsistent. For example why is there a CC and Mail in /usr/bin? These look like links to c++ and mail, but why are these treated specially?
cc(1) is part of LLVM, there is an LLVM version (specific version depends on the FreeBSD version) included with the base OS. mail(1) is part of the sendmail suite, which is also included with the base OS.

I noticed that svn has been replaced by git, but the svn tools remain in base. Are these being replaced?
Eventually. The transition to git was fairly recently done. The next major version (14) will likely remove those old svn tools. There's still some debate about which tool(s) to include for git, net/gitup appears to be a strong contender.
 
OP
M

mrbeastie0x19

Active Member

Reaction score: 59
Messages: 102

cc(1) is part of LLVM, there is an LLVM version (specific version depends on the FreeBSD version) included with the base OS. mail(1) is part of the sendmail suite, which is also included with the base OS.


Eventually. The transition to git was fairly recently done. The next major version (14) will likely remove those old svn tools. There's still some debate about which tool(s) to include for git, net/gitup appears to be a strong contender.
With regards to the CC and Mail I don't think I have quite understood you (or you me?), I am curious why there is both a lowercase and uppercase cc (there is both a cc and CC in the directory, and a mail and Mail). And thanks that makes sense about git!
 

Jose

Daemon

Reaction score: 1,002
Messages: 1,207

Multiple LLVM versions are required to build packages and ports. The current implementation leads to a polluted file system structure, I think a better solution would be a dedicated /usr/local/bin/llvm/version/ directory. I did think it would be more consistent to compile ports with the same compiler as the base but I understand there might be technical limitations to that.
Use poudriere(8) to build ports if you're concerned about filesystem pollution. It builds everything in a jail.

The ports and packages system seems really dependent on pulling in a large number of unnecessary software, I understand the approach is generic in the case of packages but it does have a tendency to bring in Linux stuff like pulseaudio. That's really quite unfortunate. I don't know what the solution to that would be in large software projects like Firefox where you guys might not have much control over the source.
The philosophy is to provide pre-compiled packages that include most of the things any reasonable person is likely to want. This does translate into often very heavy dependency trees for even trivial software. Some packages have -lite, and even -tiny versions, like git(1), for example. It sounds like you may be building your own packages using the ports framework. You can tune dependencies in the ports tree using a custom make.conf(5). Again poudriere(8) makes it easy to use different make.conf files for different package sets. I use it to build the packages for both this machine and my headless server.
 

Zirias

Son of Beastie

Reaction score: 1,572
Messages: 2,696

Additionally, you'll almost always have a lot more build-time dependencies than run-time. So don't compare using the ports-tree, building your own, to some binary package manager on some Linux dist. Compare using pkg(8) to that (or compare building your own packages using the methods of some Linux dist to using the ports tree).
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,347
Messages: 38,863

With regards to mail(1):
Code:
root@molly:~ # ls -ali /usr/bin/Mail /usr/bin/mail
251018 -r-xr-xr-x  3 root  wheel  102696 Sep 15 14:44 /usr/bin/Mail
251018 -r-xr-xr-x  3 root  wheel  102696 Sep 15 14:44 /usr/bin/mail
They're the same executable (they're hardlinked; inodes are the same). To be honest I don't know why there's a 'Mail' and a 'mail', I suspect it has something to do with an old habit or something from the past.

I'm not sure why /usr/bin/CC and /usr/bin/cc exist. Might be because lots of scripts (and makefiles) use a variable named CC, that's set to a compiler. Failure to declare it properly would result in an error. It's easy to mistype $CC, forget to include the $ to get CC. But that's just speculation on my part.
 

Zirias

Son of Beastie

Reaction score: 1,572
Messages: 2,696

I suspect it has something to do with an old habit or something from the past.
Probably, some ancient tools/scripts exist(ed) somewhere expecting the capitalized names, yes. A hardlink hardly costs anything, so, why not ;)
 

Argentum

Aspiring Daemon

Reaction score: 289
Messages: 610

The ports and packages system seems really dependent on pulling in a large number of unnecessary software, I understand the approach is generic in the case of packages but it does have a tendency to bring in Linux stuff like pulseaudio. That's really quite unfortunate. I don't know what the solution to that would be in large software projects like Firefox where you guys might not have much control over the source.
BTW, Firefox has a build option to switch the pulseaudio off.
cd /usr/ports/www/firefox
make config
 

astyle

Daemon

Reaction score: 482
Messages: 1,117

The ports and packages system seems really dependent on pulling in a large number of unnecessary software, I understand the approach is generic in the case of packages but it does have a tendency to bring in Linux stuff like pulseaudio. That's really quite unfortunate. I don't know what the solution to that would be in large software projects like Firefox where you guys might not have much control over the source.
Some of that 'unnecessary' software is actually 'Build' dependencies, in addition to 'Run' dependencies. For example devel/oclgrind actually pulls in devel/llvm80. Useless, I know, but FreeeBSD can do nothing about it. It's up to the oclgrind devs to re-work the project to compile with devel/llvm12.
 

gpw928

Aspiring Daemon

Reaction score: 243
Messages: 557

To be honest I don't know why there's a 'Mail' and a 'mail', I suspect it has something to do with an old habit or something from the past.
The executable Mail has been present in BSD Unix for as long as I can remember. Wikipedia attributes the authorship to Kurt Shoens for 2BSD in 1978.
I'm not sure why /usr/bin/CC and /usr/bin/cc exist.
CC has traditionally been the name of the c++ executable on some platforms (e.g. native c++ compiler on Solaris).
 
OP
M

mrbeastie0x19

Active Member

Reaction score: 59
Messages: 102

The executable Mail has been present in BSD Unix for as long as I can remember. Wikipedia attributes the authorship to Kurt Shoens for 2BSD in 1978.

CC has traditionally been an alias for c++ on some platforms (e.g. native c++ compiler on Solaris).
The man page says:
"Usually, mail is just a link to Mail and mailx, which can be confusing."

I'm inclined to agree as I am still not sure which particular variation of the program this is :)
 

Zirias

Son of Beastie

Reaction score: 1,572
Messages: 2,696

I'm inclined to agree as I am still not sure which particular variation of the program this is :)
It's simply all the same. There were different names for the standard mailer on different Unix systems, so they are kept (for obscure ancient tools expecting one of those old names).
 

grahamperrin

Daemon

Reaction score: 695
Messages: 2,214

… Firefox has a build option to switch the pulseaudio off. …

Use poudriere(8) to build ports if …

With ports-mgmt/poudriere-devel and PULSEAUDIO=off += www/firefox in /usr/local/etc/poudriere.d/make.conf:

Code:
root@mowa219-gjp4-8570p-freebsd:~ # grep PULSEAUDIO /usr/local/etc/poudriere.d/make.conf
PULSEAUDIO=off += www/firefox
root@mowa219-gjp4-8570p-freebsd:~ # poudriere pkgclean -j main audio/pulseaudio
[00:00:00] Cleaning in previously failed build directory
[00:00:00] Gathering all expected packages
[00:00:00] Creating the reference jail... done
[00:00:02] Mounting system devices for main-default
[00:00:02] Mounting ccache from: /var/cache/ccache
[00:00:02] Mounting ports from: /usr/local/poudriere/ports/default
[00:00:02] Mounting packages from:
[00:00:02] Mounting distfiles from: /usr/ports/distfiles
[00:00:02] Copying /var/db/ports from: /usr/local/etc/poudriere.d/main-options
[00:00:02] Appending to make.conf: /usr/local/etc/poudriere.d/make.conf
/etc/resolv.conf -> /usr/local/poudriere/data/.m/main-default/ref/etc/resolv.conf
[00:00:02] Starting jail main-default
[00:00:02] Loading MOVED for /usr/local/poudriere/data/.m/main-default/ref/usr/ports
[00:00:03] Ports supports: FLAVORS SELECTED_OPTIONS
[00:00:03] Gathering ports metadata
[00:00:05] Calculating ports order and dependencies
[00:00:05] Sanity checking the repository
[00:00:05] Unqueueing existing packages
[00:00:05] Unqueueing orphaned build dependencies
[00:00:05] Sanity checking build queue
[00:00:05] Looking for unneeded packages
[00:00:05] No stale packages to cleanup
[00:00:05] Cleaning up
main-default: removed
main-default-n: removed
[00:00:05] Unmounting file systems
root@mowa219-gjp4-8570p-freebsd:~ # poudriere bulk -j main -b latest -n www/firefox
[00:00:00] [Dry Run] Creating the reference jail... done
[00:00:03] [Dry Run] Mounting system devices for main-default
[00:00:03] [Dry Run] Using packages from previously failed build: /usr/local/poudriere/data/packages/main-default/.building
[00:00:03] [Dry Run] Mounting ccache from: /var/cache/ccache
[00:00:03] [Dry Run] Mounting ports from: /usr/local/poudriere/ports/default
[00:00:03] [Dry Run] Mounting packages from: /usr/local/poudriere/data/packages/main-default
[00:00:03] [Dry Run] Mounting distfiles from: /usr/ports/distfiles
[00:00:03] [Dry Run] Copying /var/db/ports from: /usr/local/etc/poudriere.d/main-options
[00:00:03] [Dry Run] Appending to make.conf: /usr/local/etc/poudriere.d/make.conf
/etc/resolv.conf -> /usr/local/poudriere/data/.m/main-default/ref/etc/resolv.conf
[00:00:03] [Dry Run] Starting jail main-default
[00:00:03] [Dry Run] Will build as nobody:nobody (65534:65534)
[00:00:03] [Dry Run] Logs: /usr/local/poudriere/data/logs/bulk/main-default/2021-09-18_11h55m57s
[00:00:03] [Dry Run] Loading MOVED for /usr/local/poudriere/data/.m/main-default/ref/usr/ports
[00:00:04] [Dry Run] Ports supports: FLAVORS SELECTED_OPTIONS
[00:00:04] [Dry Run] Inspecting ports tree for modifications to git checkout... yes
[00:00:05] [Dry Run] Ports top-level git hash: 188df2a78 (dirty)
[00:00:05] [Dry Run] Gathering ports metadata
[00:00:09] [Dry Run] Calculating ports order and dependencies
[00:00:10] [Dry Run] Trimming IGNORED and blacklisted ports
[00:00:10] [Dry Run] Package fetch: Looking for missing packages to fetch from pkg+http://pkg.FreeBSD.org/${ABI}/latest
Updating FreeBSD repository catalogue...
[main-default] Fetching meta.conf: 100%    163 B   0.2kB/s    00:01  
[main-default] Fetching packagesite.pkg: 100%    6 MiB   6.6MB/s    00:01  
Processing entries: 100%
FreeBSD repository update completed. 31021 packages processed.
All repositories are up to date.
[00:00:29] [Dry Run] Package fetch: Will fetch 118 packages from remote or local pkg cache

Number of packages to be fetched: 118
No packages are required to be fetched.
Integrity check was successful.
[00:00:30] [Dry Run] Sanity checking the repository
[00:00:30] [Dry Run] Checking packages for incremental rebuild needs
[00:00:34] [Dry Run] Deleting adwaita-icon-theme-40.1.1.pkg: missing dependency: pango-1.48.7
[00:00:34] [Dry Run] Deleting ffmpeg-4.4_3,1.pkg: missing dependency: libass-0.15.2
[00:00:34] [Dry Run] Deleting frei0r-1.7.0.18.pkg: missing dependency: cairo-1.17.4,3
[00:00:34] [Dry Run] Deleting stale symlinks... done
[00:00:34] [Dry Run] Deleting empty directories... done
[00:00:34] [Dry Run] Package fetch: Generating logs for fetched packages
[00:00:48] [Dry Run] Unqueueing existing packages
[00:00:48] [Dry Run] Unqueueing orphaned build dependencies
[00:00:48] [Dry Run] Sanity checking build queue
[00:00:48] [Dry Run] Processing PRIORITY_BOOST
[main-default] [2021-09-18_11h55m57s] [load_priorities:] Queued: 126 Built: 0   Failed: 0   Skipped: 0   Ignored: 0   Fetched: 115 Tobuild: 11   Time: 00:00:45
[00:00:48] [Dry Run] Dry run mode, cleaning up and exiting
[00:00:48] [Dry Run] Would build 11 packages using 4 builders
[00:00:48] [Dry Run] Ports to build: graphics/cairo graphics/frei0r graphics/libepoxy graphics/librsvg2-rust multimedia/ffmpeg multimedia/libass print/harfbuzz www/firefox x11-themes/adwaita-icon-theme x11-toolkits/gtk30 x11-toolkits/pango
[00:00:48] [Dry Run] Logs: /usr/local/poudriere/data/logs/bulk/main-default/2021-09-18_11h55m57s
[00:00:48] [Dry Run] Cleaning up
main-default: removed
main-default-n: removed
[00:00:48] [Dry Run] Unmounting file systems
root@mowa219-gjp4-8570p-freebsd:~ #

poudriere bulk -j main -b latest www/firefox would build 11 packages.
 

Zirias

Son of Beastie

Reaction score: 1,572
Messages: 2,696

PULSEAUDIO=off += www/firefox
And how do you think this should do anything meaningful? 🤔 It will just define a PULSEAUDIO variable to some silly value.

What you're probably looking for is ${OPTIONS_NAME}_UNSET, in this case www_firefox_UNSET+= PULSEAUDIO.
See Mk/bsd.options.mk for complete docs of the ports' options framework.
 

ondra_knezour

Aspiring Daemon

Reaction score: 229
Messages: 806

It may be, that that silly value set in the poudriere configuration file may change how poudriere does something? Eg. build the www/firefox port in this case? :)
 

grahamperrin

Daemon

Reaction score: 695
Messages: 2,214

… value set in the poudriere configuration file …

Set by me, to show how poudriere can create a local repo including Firefox without downloading a package for PulseAudio.

Code:
% pkg -vv | grep url | grep -v -i PkgBase
    url             : "pkg+http://pkg.FreeBSD.org/FreeBSD:14:amd64/latest",
    url             : "file:///usr/local/poudriere/data/packages/main-default",
%

mrbeastie0x19 FYI <https://www.freshports.org/www/firefox/#message> the Audio backend sub-section. Here, forcing OSS:

1631970995725.png
 

Zirias

Son of Beastie

Reaction score: 1,572
Messages: 2,696

It may be, that that silly value set in the poudriere configuration file may change how poudriere does something? Eg. build the www/firefox port in this case? :)
Well, no. Poudriere just generates a make.conf from the fragments in /usr/local/etc/poudriere.d. It still must be understood by the normal ports' make framework.
 
OP
M

mrbeastie0x19

Active Member

Reaction score: 59
Messages: 102

Quick question about the .cshrc and .profile at the top level. Just tinkering with the system to get a general idea of how it works.

Looks like the .sujournal is important and used by the fs.
./.snap/ I cleared as it looks like it is for recovery (is that autogenerated when needed if I delete it?)

So the .cshrc and .profile look like they are the shell configuration used by root. I was curious so I deleted them. Surprisingly nothing happened, I exited the privileged user and relogged and it created the files in /root/ instead (which is the root user's home directory). Curious again to see what would happen if the root user had no access to any shell (and if I could recover it), I deleted the root directory and remade it.

Now I appear to have no .cshrc or .profile but it still works. So two questions:

Where is the default? (Does it check .cshrc, then /root/.cshrc, and then where?)
Is there any difference between these versions? Will I miss something by deleting the top level one.
 

Tieks

Well-Known Member

Reaction score: 117
Messages: 284

/.sujournal is the journal for soft updates when you activated soft update journaling for your file system. See tunefs -p / for that.
/.snap I don't know for sure, could be for "trash can" deletions.
/.profile and /.cshrc on my disk are hardlinked to the ones I have under /root. Using ls -lia /.cshrc and Using ls -lia /root/.cshrc give the same inode for both. Since yours are probably mising now, you can find the originals on your install medium, possibly under /usr/src too.
 

grahamperrin

Daemon

Reaction score: 695
Messages: 2,214

.cshrc and .profile at the top level. Just tinkering

Files such as those should be at the root of the home directory, not the root of the file system.

(I found one such file misplaced a few months ago. Probably the result of me tinkering without paying attention to the working directory.)
 
OP
M

mrbeastie0x19

Active Member

Reaction score: 59
Messages: 102

Files such as those should be at the root of the home directory, not the root of the file system.

(I found one such file misplaced a few months ago. Probably the result of me tinkering without paying attention to the working directory.)
It looks like these are being created in the top level by default on first su in FreeBSD 13 release.
 

astyle

Daemon

Reaction score: 482
Messages: 1,117

Quick question about the .cshrc and .profile at the top level. Just tinkering with the system to get a general idea of how it works.

Looks like the .sujournal is important and used by the fs.
./.snap/ I cleared as it looks like it is for recovery (is that autogenerated when needed if I delete it?)

So the .cshrc and .profile look like they are the shell configuration used by root. I was curious so I deleted them. Surprisingly nothing happened, I exited the privileged user and relogged and it created the files in /root/ instead (which is the root user's home directory). Curious again to see what would happen if the root user had no access to any shell (and if I could recover it), I deleted the root directory and remade it.

Now I appear to have no .cshrc or .profile but it still works. So two questions:

Where is the default? (Does it check .cshrc, then /root/.cshrc, and then where?)
Is there any difference between these versions? Will I miss something by deleting the top level one.
Normally on FreeBSD, system-wide defaults are stored in /etc and /usr/local/etc. This is straight from the Handbook. I would suggest that you spend some quality time reading it, it contains a surprising amount of useful info to get you started on a LOT of stuff.
 
Top