NetBSD 6.1.2 apparently came out sometime recently when I wasn't looking. I have probably a half dozen NetBSD installations running in various emulators, but my primary NetBSD development environment is x86. I'll get around to upgrading the others in due time, but the x86 VM can't wait. It can't!Installation
As with most OS'es these days, you can either download a DVD image with everything on it and install from that, or you can do a netinstall over FTP or HTTP or something. I usually go with the netinstall unless I'm installing some really old version that's hard to find, and I went with the netinstall in this case too.
I downloaded the boot iso from: ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-6.1.2/i386/installation/cdrom/boot.iso, aimed VMware at it and began the installation.
VMware always wants to know what kind of OS you're using but never gives you a NetBSD option. Other -> FreeBSD has always seemed close enough and I went with it again this time. I wonder exactly what the difference between that and Other -> Other would be though. I know you get IDE disks with FreeBSD and it defaults to 20g rather than 8g but there's probably something else too. Maybe I'll look into that some day.
Other settings... 8G disk, bridged Network Adapter, 800 x 600 display, 256M of RAM. I also removed the Floppy, USB and Sound Card.
NetBSD runs in a lot of emulators so I've probably done more NetBSD installations than anything else. The installation process always seems pretty straightforward to me. Just follow the prompts.
I selected Full Installation, Use Entire Disk, Use Existing Partition Sizes and installed from FTP. I also declined IPv6 autoconfiguration.
Pretty soon, I was in business.
I've always liked how the installer shows you the full ftp session output.
The downloads are getting quicker every year. I'm always surprised how quickly an entire distro comes down.
As of 6.1, I think, but maybe 6.0, after the sets are installed there's a menu that lets you configure the network, timezone, root password, etc. You can bypass all of it if you like but I usually go down the list, configuring each thing.
It's important to "Enable installation of binary packages" and "Enable sshd" but I chose not to enable ntpd, ntbdate or mdnsd.
I also got a little concerned when pkgsrc stalled out at the end but it eventually finished so I guess everything is OK there.
When the installation is over the installer drops you back at the main menu.
I don't usually like poking around as root, so the first thing I do with a new system, unless I was able to do it during the installation, is create a user for myself.
NetBSD has the standard useradd/userdel commands.
useradd -m -G wheel dmuse passwd dmuse
The -m creates a home directory and the -G wheel adds the user to the wheel group, making it possible to su. On linux and some other platforms those options aren't necessary but it I believe it is on all of the BSD's. useradd doesn't prompt for a password so that's important to run afterward.
The next thing I usually do is make it possible to sudo without a password. Unfortunately sudo isn't installed by default but fortunately, NetBSD supports pkgin, and by virtue of selecting the "Enable installation of binary packages" option during the installation, I can install sudo easily.
pkgin install sudo
pkgin is great. It's similar to apt-get and yum. You can list available packages, search for packages, install them over the internet (with dependency resolution) etc.
It even has a feature that I'm not sure how to do (or if you can) with apt-get and yum. If you manually install a package and it drags in dependent packages, but then you uninstall the main package, the dependent packages are orphaned. It would be great to uninstall them as well but who keeps track of all the dependent packages that got installed along with the one you meant to install? Pkgin does. Those packages are marked auto-removable, as nothing else depends on them. You can run "pkgin autoremove" and it will remove all auto-removable (orphaned) packages. Awesome.
There is a significant quirk though. It appears that if you install a meta-package (ie. a package that doesn't install anything, only has dependencies that cause other packages to be installed) then the dependencies themselves get marked as having been installed directly and can't be removed automatically. This is particularly frustrating when you install something large like the Gnome desktop and then attempting to remove it, expecting autoremove to do most of the work for you.
But I digress.
I was in the middle of configuring sudo...
NetBSD puts its packages in /usr/pkg so the sudoers file is in /usr/pkg/etc. I appended to it:
dmuse ALL=(ALL) NOPASSWD: ALL
All right, no more logging in as root.
I enabled sshd during installation. xauth was installed as well. X11 Forwarding wasn't enabled by default though, so I enabled it by editing /etc/ssh/sshd_config and setting:
then restarting ssh
After that I copied my entire .ssh directory from another VM and was able to ssh into the NetBSD VM without a password.
All right, no more logging in on the console.
ssh, scp, sftp and ftp all appeared to be present. tar, gzip, bzip2 and unzip appeared to be present as well. zip was conspicuously absent but quickly installed:
sudo pkgin install zipWeb
On the client side, I like to have firefox, lynx and wget available and apache on the server side. None were installed but all were available. "pkgin search firefox" and "pkgin search apache" revealed several options for each but it looked like "firefox" and "apache" would install the latest version.
sudo pkgin install firefox lynx wget apache
The apache config file appeared to be /usr/pkg/etc/httpd/httpd.conf with DocumentRoot /usr/pkg/share/httpd/htdocs.
I enabled cgi's.
LoadModule cgid_module lib/httpd/mod_cgid.so
AddHandler cgi-script .cgi
Options Indexes FollowSymLinks ExecCGI
DirectoryIndex index.html index.cgi
Apache for NetBSD comes with an example init script but it's not installed by default. I installed it...
sudo cp /usr/pkg/share/examples/rc.d/apache /etc/rc.d
...and enabled it by adding the appropriate line to /etc/rc.conf
Then started apache. Would my test program work?
echo "Content-type: text/plain"
Excellent. Moving on.Graphical Desktop
What kind of graphical desktop could I get working? A few pkgin searches revealed Gnome 2 and 3, KDE 3 and 4 and XFCE 4 but no obvious metapackage stood out for any of them.
After a little digging on the web I found the pkgsrc meta-packages list for 6.1.2 at ftp://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/i386/6.1.2/meta-pkgs/. It looks like "gnome-platform" will get me Gnome 2, "kde" will get me KDE 3 and "xfce4" will get me XFCE 4.
Well, as it turns out, gnome-platform doesn't get you all of Gnome 2. To get it, you have to manually install tons of individual packages and it's difficult to figure out which. Worse, if you get started and want to bail, pkgin autoremove doesn't work help because gnome-platform is a meta-package.
XFCE 4 looked like a better choice...
sudo pkgin install xfce4
The list of dependencies looked more realistic.
I created my .xinitrc...
... switched back to the console and ran ...
I love their little mouse logo.
All right, what about a graphical login? XFCE doesn't have its own and they recommend using gdm, lightdm, slim or lxdm. Of that list, pkgin only knows aboug gdm. Maybe plain old xdm would work. It was already installed.
I created an .xsession file with:
to /etc/rc.conf and rebooted.
Well, it wasn't pretty, but it worked:
And logging in got me an XFCE session too.
What about the web browser...
I clicked on "Web Browser" and it ran "Nightly" but "Nightly" looked a lot like Firefox. I checked the Preferred Applications settings in XFCE and they were set to use Firefox as the web browser. Indeed, running firefox from the command line in a terminal ran "Nightly" as well. Does "Nightly" mean "nightly build of Firefox"?
At any rate, I aimed it at my trails site and it worked as expected. The fonts were a little big, but zooming out by 1 took care of that.
Were there any productivity apps available? It appeared so. pkgin could see LibreOffice 3 and 4, OpenOffice 3.1, KOffice, fengoffice and various other packages.
sudo pkgin install libreoffice4-bin
LibreOffice had some interesting dependencies like suse_base, suse_x11, suse_libtiff, etc. NetBSD supports binary emulation. Maybe LibreOffice was just a linux app with the necessary support packages.
pkg_info -L suse_base sure made it look like it was. Everything was stored under /usr/pkg/emul/linux. Interesting.
I had to run it from the command line using "soffice" and it complained about a non-existent java vm and threw a bunch of dbus/gconf errros but in the end, it worked:
AbiWord and GNUmeric were also available and appeared to be native NetBSD apps.
sudo pkgin install abiword abiword-plugins gnumeric
They integrated better too, showing up in the XFCE menu after installation and appearing as the default .doc handler for Firefox (or Nightly).
All right, enough of that. I'm ulimately setting up this VM to test my software on.
Some packages that I needed appeared to already be installed: gcc/g++, pcre, openssl, apr, perl, sqlite, cvs
But even more needed to be:
sudo pkgin install readline php ruby tcl erlang openjdk7 mysql-client postgresql92-client unixodbc freetds gmake vim-gtk2
I copied my .cvsrc and .vimrc from another VM and some build scripts too, checked out my source code and ran the main build script.
To test it I had to add /usr/local/firstworks/bin to my PATH and /usr/local/firstworks/lib to my LD_LIBRARY_PATH. The BSD's in general are difficult to set system-wide paths on because the .profile scripts override anything you set in /etc/profile so I just added them to my .profile instead of setting them system-wide.
After that, I could run the sqlrelay server against the different databases that I was able to build support for. sqlrsh could connect just fine to the instance on my linux host connected to oracle.
Everything appeared to work as expected.Clean Up
I don't need X Windows for most of what I do so I disabled xdm in /etc/rc.conf
and rebooted. During the reboot I reduced the VM's memory configuration to 128M. That's always been plenty in the past.Quirks
I did run into some interesting quirks.
Shell aliases need to go in a particular location in ~/.shrc rather than in ~/.profile directly or it causes all kinds of problems. I don't remember that from 6.1.1 but maybe it was an issue in that release too.
XFCE itself doesn't appear to read ~/.profile and its terminals don't either. On top of that, the shell doesn't understand ". .profile" or "source .profile". To get my PATH settings, I had to run a terminal, then run bash and manually source my .profile. I'm sure there's some way to fix that but it was very confusing.
There's also a swap partition issue. No swap partition was created by the default installation options but the system was configured to save core (in case of a kernel panic) to the nonexistent swap partition. /etc/rc.d/swap2 complains that there isn't one too. It's possible to add a swap file by running:
dd if=/dev/zero of=/swap bs=1m count=256
chmod 600 /swap
swapctl -a -p 1 /swap
and adding to /etc/fstab:
/swap none swap sw,priority=1 0 0
but the kernel can't dump to that so it's only a half fix. Very strange. I'll have to keep that in mind for next time.