This is the fourth part in our seven-part series on the BSD series of operating systems.
Now on to NetBSD. I know very little about this operating system. Circa 1996ish, I ran it on an old Mac 68K at my desk at the University of Michigan to turn it into a Unix server. That is my last memory of NetBSD.
To me, NetBSD’s “identity” is that it runs on nearly everything. If you count Tier II systems (“Organic ports are highly valued by the NetBSD project, but their development is not as tightly mandated as that of the focus ports. Generally speaking, the hardware platforms of organic ports have lost their industrial relevance, or there is not enough community activity for the port to make it to the first tier”), then NetBSD 10.0 (the latest version) can run on 54 hardware platforms.
If you only count Tier I systems (“Focus ports are the architectures that NetBSD targets as part of its strategy”), then as of this writing, OpenBSD runs on more platforms (12) than NetBSD (8).
Fun fact! NetBSD once ran on the legendary pc532, a homebrew computer board that was made in 1989. Only 200 of these boards were made! NetBSD reluctantly dropped support in 2008 when gcc dropped support.
I’m going to be installing NetBSD 10.0.
Let’s go!
I took a detour to check out the Utility menu.
OK, basic rescue tools, cool.
Yes, let’s continue.
Well, well. Defaults to GPT you say? Looks like NetBSD is a bit advanced ahead of FreeBSD. Orange Flag 1, Red Devil 0.
Looking back, I think this was this highwater mark of my relationship with NetBSD.
Oh good God, no, I don’t know my hard drive drive geometry. I don’t want to know it. I don’t want to remember how hard drive geometry works.
I’m in your hands, NetBSD installer.
Oh for pity’s sake…I thought you were going to do do something fancy, not just put everything in one partition.
LAST CHANCE!
YOLO.
Needle scratch.
Install the wha…
OK, I know what bootblocks but I’ve never heard them in the context of ports. I read up on this and chose “Use BIOS console”.
Custom? What are the options…
I changed this to:
And away we go:
and then:
“now able to boot…”
We’ll see about that.
This screen gave me hell.
First, I thought, okay, I’ll add a user. So I select that and got to this screen:
And then somehow my keyboard was locked to uppercase…?
Yes, I did check my caps lock.
OK, stuff happens, but eventually the only thing I could do was hit control-C. The dropped me into a shell. I played around with keys endlessly and somehow eventually got back to normal function. My keys were working fine when typing into this Chrome window and Sublime text, so…
Anyway, when I hit exit to get out of the shell, I was back at the start so I had to completely redo the install. Ugh. Then when I was back at the finalizing configuration screen, I decide to configure networking.
It asked me:
Well, I can say the answer isn’t “ethernet” or “auto” or whatever else I could think of. And there is no way to abort or go back.
So, control-C…third install…
And this time we finish up. I remove the CD, reboot, and…
Completely failed to boot.
OK, so after 3 boots, maybe NetBSD got confused at some point with all that re-partitioning, so I went the extra mile.
I nuked that VM and provisioned a brand new VM. Went through the installed a fourth time. After that…
Problems Continue
So on bootup, I had no network. OK, I’ll try to run dhcpcd manually.
It says “no interfaces have a carrier”.
I manually ifconfig’d the ethernet adapter and it worked. Then I fixed up sshd_config so root could login over ssh because messages on console made working on it unpleasant.
I took a shot at figuring out how network setup worked. I created an /etc/ifconfig.XXX file, and I thought I then had to create a variable in rc.conf. However, if you look closely, auto_ifconfig is set by default so this shouldn’t be necessary…?
The way I remember this ancient setup working is that if you created an /etc/ifconfig.XXX file, it got read and processed. If you didn’t want to configure the interface, you didn’t create the file.
Anyway, I played with it, but then I decided to try dhcpcd again and it worked, so…I went with that.
Now on to Packages
# echo $PKG_PATH http://cdn.NetBSD.org/pub/pkgsrc/packages/NetBSD/x86_64/10.0/All/ # export PKG_PATH # pkg_add pkgin pkgin-23.8.1nb3: copying /usr/pkg/share/examples/pkgin/repositories.conf.example to /usr/pkg/etc/pkgin/repositories.conf # pkgin search bash processing remote summary (https://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/x86_64/10.0/All)... pkg_summary.gz 100% 6210KB 1.0MB/s 00:06 bash-5.2.26nb1 The GNU Bourne Again Shell bash-2.05.2.13 The GNU Bourne Again Shell (version 2) bash-completion-2.11 Programmable completion specifications for bash bash-doc-2.05.2nb1 Documentation for the GNU Bourne Again Shell bash-preexec-0.5.0 Preexec and precmd hook functions a la zsh bats-0.4.0 Testing framework for Bash dash-0.5.12 Debian Almquist shell, POSIX-compliant shell faster than bash fff-2.2 Simple file manager written in bash git-sh-1.3 Customized bash environment suitable for git work memo-0.6nb1 A simple memo tool written in bash py310-argcomplete-3.2.3 Bash and other shells tab completion for argparse py310-bracex-2.4 Bash style brace expander py311-argcomplete-3.2.3 Bash and other shells tab completion for argparse py311-bracex-2.4 Bash style brace expander py312-argcomplete-3.2.3 Bash and other shells tab completion for argparse py312-bracex-2.4 Bash style brace expander py38-argcomplete-3.2.3 Bash and other shells tab completion for argparse py38-bracex-2.4 Bash style brace expander py39-argcomplete-3.2.3 Bash and other shells tab completion for argparse py39-bracex-2.4 Bash style brace expander shfmt-3.7.0nb8 Shell formatter with bash support tree-sitter-bash-0.20.5 Bash grammar for tree-sitter xonsh-0.10.1nb4 Python-ish, BASHwards-looking shell language and command prompt =: package is installed and up-to-date <: package is installed but newer version is available >: installed package has a greater version than available package # pkgin install bash calculating dependencies...done. 1 package to install: bash-5.2.26nb1 0 to remove, 0 to refresh, 0 to upgrade, 1 to install 1662K to download, 9.9M of additional disk space will be used proceed ? [Y/n] y [1/1] bash-5.2.26nb1.tgz 100% 1662KB 1.6MB/s 00:00 [1/1] installing bash-5.2.26nb1... bash-5.2.26nb1: adding /usr/pkg/bin/bash to /etc/shells pkg_install warnings: 0, errors: 0 reading local summary... processing local summary... # # bash -o vi bash-5.2#
OK, so packages work. pkg_add is a low-level command to extract, etc. apparently. pkgin is the apt/yum/pkg equivalent I take it.
That PKG_PATH command comes from the NetBSD package manager web site. So to get pkgin installed, you have to run that command, and then install pkgin. But here’s the thing. Once pkgin is installed, you don’t need to have that variable set. So…why not…just…install pkgin when you install the OS? The examples on pkgsrc.org use pkgin, so…I don’t get it.
The Final Straw
# pkgin install mariadb-server-10.11.6 (various messages) [13/13] installing mariadb-server-10.11.6... mariadb-server-10.11.6: Creating group ``mariadb'' mariadb-server-10.11.6: Creating user ``mariadb'' =========================================================================== The following files should be created for mariadb-server-10.11.6: /etc/rc.d/mariadb (m=0755) [/usr/pkg/share/examples/rc.d/mariadb] =========================================================================== pkg_install warnings: 1, errors: 0 pkg_install error log can be found in /var/db/pkgin/pkg_install-err.log reading local summary... processing local summary...
How charming – you’re not going to tell me what the 1 warning was but instead I have to go dig for it?
And when I look:
useradd: Warning: home directory `/var/db/mariadb' doesn't exist, and -m was not specified
Guys, this isn’t really a warning.
But the thing that really irritates me is this:
The following files should be created for mariadb-server-10.11.6: /etc/rc.d/mariadb (m=0755) [/usr/pkg/share/examples/rc.d/mariadb]
In other words, to make mariadb actually run at boot you need to:
- copy this example file to /etc/rc.d and make sure you get the permissions right
- modify rc.conf
Ugh.
I mean, if you’re installing software from a package, doing basic setup like setup scripts, etc. seems like table stakes. And think there should be something more elegant than manually copying to /etc/rc.d AND having to muck with rc.conf.
bash-5.2# cp /usr/pkg/share/examples/rc.d/mariadb /etc/rc.d bash-5.2# vi /etc/rc.conf bash-5.2# !v vi /etc/rc.conf bash-5.2# service mariadb start Initializing MariaDB database system tables. Installing MariaDB/MySQL system tables in '/var/db/mariadb' ... OK To start mariadbd at boot time you have to copy support-files/mariadb.service to the right place for your system Two all-privilege accounts were created. One is root@localhost, it has no password, but you need to be system 'root' user to connect. Use, for example, sudo mysql The second is mariadb@localhost, it has no password either, but you need to be the system 'mariadb' user to connect. After connecting you can set the password, if you would need to be able to connect as any of these users with a password and without sudo See the MariaDB Knowledgebase at https://mariadb.com/kb You can start the MariaDB daemon with: cd '/usr/pkg' ; /usr/pkg/bin/mariadb-safe --datadir='/var/db/mariadb' You can test the MariaDB daemon with mysql-test-run.pl cd '/usr/pkg/' ; perl mariadb-test-run.pl Please report any problems at https://mariadb.org/jira The latest information about MariaDB is available at https://mariadb.org/. Consider joining MariaDB's strong and vibrant community:Get InvolvedStarting mariadb. bash-5.2# 240527 20:27:28 mysqld_safe Logging to '/var/log/mariadb/error.log'. 240527 20:27:29 mysqld_safe Starting mariadbd daemon with databases from /var/db/mariadb
So reading that, I conclude I have to do more things with mariadb.service and to start it, I have to change to /usr/pkg and then run a command there.
It can’t really mean that, right?
I mean, MariaDB is running…
So I put this in /etc/rc.conf:
mariadb=YES
and rebooted.
And MariaDB was not running. Nginx does run (I have nginx=YES in rc.conf), but not MariaDB. Should it be called mysql=YES? That wouldn’t make sense, because the service name in “service mariadb start” is “mariadb”.
NetBSD is just a fight at every turn.
I really don’t think that installing a very popular package and configuring it to start at boot should be this hard. If it involves mucking around with a lot of config files because heritage, because tradition, genuflection, that’s fine but then it should be well documented.
I got tired of NetBSD and decided it just wasn’t for me.
Related Posts:
- Crunchbits Discontinuing Popular Annual Plans – The Community Mourns! - November 20, 2024
- RackNerd’s Black Friday 2024: Bigger, Better, and Now in Dublin! - November 19, 2024
- It’s the Season of Giving and CharityHost Has Deals for You! - November 18, 2024
Hi, I enjoyed reading your series. As a Linux and NetBSD fan, I do have some friendly mentions: NetBSD uses NPF, not pf like FreeBSD. As well, binary install of packages is incredibly easy using pkgin. You missed the option during install to enable binary package installation.
I will say that NetBSD does take some getting used to, but compared to FreeBSD, NetBSD has much better potential from a resource standpoint (it runs with the least footprint in my experience). You literally have to add almost every package you want in addition to the base, which is fantastic. Also, hardware support is fantastic for older systems, and as I’ve said elsewhere, I think NetBSD has a real niche versus any of the other BSDS; IMO it also has a future where they don’t. C’mon, just use Linux if you want the best performance/speed/security.
Having said that, I do have some respect still for OpenBSD, but that’s no surprise; it’s based on NetBSD. Unfortunately, it’s more buggy in my experience (crashes mounting CDs, Firefox random segfaults/crashes largely attributable to memory use user profile parameters, lack of software support for things as Wine/Bluetooth/Linux emulation/file system support capabilities, crashes switching the Wi-Fi switch on/off (YES the WI-FI switch) on my laptop, lack of hardware support for things as newer laptops, and probably most crucially, a list of unproven security technologies like doas and division of partitions. I’m not convinced any of these things actually work, and neither is the IT industry, but having said that, I appreciate OpenSSH. Also, very funny, but I don’t appreciate an OS calling me an idiot when I mistype the password several times.
For all those reasons, other than Linux for serious work, I’m a NetBSD fan through and through :)