Saturday, November 09, 2013

Long time since my last post.
What's more, it might be sometime before I can seriously focus on this blog again as I'll be away from home for three weeks starting on Tuesday next (today is Saturday).

Well, in the last while I've been playing around with NetBSD on my Pi.
I have never used NetBSD before although I do have some experience with FreeBSD.

However, I have now got it working very well on my 512 MB Pi and I'll outline here what I've done together with any problems I've noticed.
First, I'll say that NetBSD, like FreeBSD and Gentoo, only has a limited availability of precompiled binary packages.
That means that for most things you want to install, you're going to have to compile them.
Compiling in NetBSD is easy and well-documented.
However, it can be stupifyingly slow on the Pi because of the slow CPU speed and limited RAM.

I got my NetBSD rpi image from this link which I found in the RPi forum here.
Regularly updated rpi images are available here and the link looks like this.

I gunzipped the .img.gz file and burned it to an 8GB SD card using

# dd bs=1M if=2013-10-20-netbsd-raspi (2).img.gz.img of=/dev/sdd

The SD card booted fine in the Pi and brought me to login page (no GUI).
Log in as root and no password is needed.

Type startx at the (root) prompt to get to the Desktop.

Actually, there is no directory called Desktop as the image uses the lightweight IceWM as a window manager and this is very similar to Fluxbox.

At this stage there are three important "housekeeping" tasks to complete.

1. The keyboard layout in the image in Japanese. So for many people, including me, to enable fluent typing it's necessary to open /root/.xinitrc and find the line

setxkbmap -layout jp

to

setxkbmap -layout us

or whatever you want.

In the same file, find the line

export LANG=ja_JP.UTF-8

and change it to

export LANG=en_US.UTF-8

or whatever is appropriate for you.

At this stage, reboot and you should be able to type a lot more easily.

2. Now set up the time for your time zone.
This requires merely setting up the following symlink:

# ln -s /usr/share/zoneinfo/Europe/Dublin /etc/localtime

and set the Continent/City as appropriate for your location.

3. Expand the file system to fill the SD card.

The NetBSD image I used provides a root partition of only 1.8GB size.
Indeed, it's almost full before installing anything.
Luckily, it's easy to expand the root partition to take up all remaining space on the SD card by following the very clear instructions given here (see section marked 'Growing the Root file-system')

At this stage, NetBSD should start looking very usable on the Pi.
But, there's a lot more to be done.

1. First, set up your own user account with the following commands:

# useradd -m -G wheel paul# passwd paul

(where paul is my user)

2. Before booting to your own user account, make sure that you can use sudo in your account.
You need to do this from the root account.

For this, issue the visudo command and edit the /usr/pkg/etc/sudoers file
If you've put yourself in the wheel group as I did with the useradd command above, then you just need to uncomment the following line in the sudoers file.

%wheel ALL=(ALL) NOPASSWD: ALL

Remember, however, that this allows use of sudo without any password which might be dangerous if others have access to your account.

3. Next, enable the IceWM window manager in your account and get it to start up at boot.

# cp -r /root/.icewm /home/paul/

# cp -r /root/.xinitrc /home/paul

4. Edit ~/.profile to include the line

startx

at the bottom.
This will autostart the X server after login.

5. But wouldn't it be better just to autologin as well?

It took me a while to track down how to do this but I finally found it in the mailing-list post.
Basically, I did no more than add

#Autologin Paul

paul_login:\

:al=paul:np:sp#9600:ig:ht:

at the bottom of the /etc/gettytab file.
And in /etc/ttys, comment out the line

ttyE0 "/usr/libexec/getty Pc" wsvt25 off secure

and add the following line

ttyE0 "/usr/libexec/getty paul_login" vt100 on secure

6. Finally, at this initial stage we might as well overclock the CPU just a little as NetBSD on the Pi is slow.
Note that no config.txt file exists in /boot.
So, I just created one and added the following two lines

arm_freq=860

force_turbo=1

Now reboot and see how it looks.
You should get straight to the IceWM "Desktop" without logging in.

Here’s how mine looks.

Although what’s on the right-hand side looks like Conky, I couldn’t get Conky to compile which seems to be a known problem in NetBSD (Look at Conky Doesn’t Compile in NetBSD in the FAQs for Conky).
It’s actually Torsmo which, although unmaintained for years, still works reasonably well although it’s not as polished as Conky now.

There's still a lot more can be done and I'll add these points when I get some time.

No comments:

Post a Comment

Arrived here via a search engine?

Not all pages are indexed.
So to find the page you want, or possibly other similar pages as well, use the Search Blog box in the upper left-hand side.

What's that picture?

This is the Praça de Estação (Station Park) near the center of Belo Horizonte, MG in Brazil where I live. This area which includes a metro station was recently cleaned up and refurbished and has become one of the picture postcard areas of a city that is truly finding its identity. Read more about Belo Horizonte.