Reply to comment

FreeBSD i386 Install (Part 3, Xorg)

So in the last part, wireless internet was setup. Great. Can't live without the internet!

In this glimpse into the world of FreeBSD, the X server will be setup and some other GUI stuff. It is worth bearing in mind, that if this machine was being setup as a server, none of this would be necessary.

The first thing to do, before anything else, and I am surprised that it has been tolerated this far in, is to get rid of that stupid terminal beeping.

$ su
Password:
# sysctl -a | grep bell
hw.syscons.bell: 1
# sysctl hw.syscons.bell=0
hw.syscons.bell: 1 -> 0

So that bastard has been found and disabled. But heaven forbid it it comes back on next boot:

# echo "hw.syscons.bell=0" >> /etc/sysctl.conf
# cat /etc/sysctl.conf
# $FreeBSD: src/etc/sysctl.conf,v 1.8.34.1.2.1 2009/10/25 01:10:29 kensmith Exp$
#
#  This file is read when going to multi-user and its contents piped thru
#  ``sysctl'' to adjust kernel values.  ``man 5 sysctl.conf'' for details.
#

# Uncomment this to prevent users from seeing information about processes that
# are being run under another UID.
#security.bsd.see_other_uids=0
hw.syscons.bell=0

Good. Now to get this system up to date with freebsd-update:

# freebsd-update fetch install
Looking up update.FreeBSD.org mirrors... 3 mirrors found.
Fetching metadata signature for 8.0-RELEASE from update5.FreeBSD.org... done.
Fetching metadata index... done.
Inspecting system... done.
Preparing to download files... done.

No updates needed to update system to 8.0-RELEASE-p2.
No updates are available to install.
Run '/usr/sbin/freebsd-update fetch' first.

The system was already up to date so it doesn't show any updates, but you get the idea. Now to automate this so that updates will be fetched every night via a cron job. Cron will send root an email if something needs installing (which then should be done manually via freebsd-update install) :

# echo "@daily root freebsd-update cron" >> /etc/crontab

OK the next thing to do is get the ports up to date. FreeBSD ports is a wonderful system which allows tons of software to be compiled and installed from source code. The whole collection exsits in /usr/ports by default. It was selected during installation so it should be there, but it won't be up to date. Ports can be updated using cvsup or portsnap, and probably also git if you can be asked, but here portsnap will be used because it is quick and saves bandwidth both on here and over at the FreeBSD mirror. To get the first portsnap:

# portsnap fetch extract

And then in the future, keep this updated with:

# portsnap fetch update

Now that ports is up to date, it is time to build the Xorg port. The alternative is just to use pkg_add -r to add a precompiled package. But I prefer to build from source wherever possible so as to be able to choose various compile time options and so on.

Go into the ports directory for xorg (as root). Actually, I hate this shell, and I want one with tab completion, so first of all install bash:

# cd /usr/ports/shells/bash
# make install clean

This will go and dilligently fetch, compile, and install the port. It might ask some questions along the way. To use bash by default (at login), edit /etc/passwd using vipw. Change the shell entry (the last entry in the line) for the users that you want to use bash. The default install of bash will be at /usr/local/bin/bash.

Great. Logged back in under bash, and su'd to root. Now to install Xorg. This is going to take a while, so better to preconfigure all options in advance before doing the make install clean:

[root@ ~]# cd /usr/ports/x11/xorg
[root@ /usr/ports/x11/xorg]# make config-recursive
===> Setting user-specified options for xorg-7.5 and dependencies
[root@ /usr/ports/x11/xorg]# make install clean

Once that build is complete, and only very rarely does something go wrong with FreeBSD ports, it is time to configure X. OK, the manual says that startx might work on its own, in which case, great. Otherwise, do this:

[root@ ~]# X -configure
[root@ ~]# X -config xorg.conf.new -retro

The retro switch should result in a black and grey grid, instead of a blank screen if it is omitted... Note I didn't want hald and dbus because I'm not that kind of guy. But this kind of tomfoolery requires adding:

Section "ServerFlags"
	Option "AllowEmptyInput" "False"
EndSection

To the config file, otherwise X will start crying. Here is the whole file for the Acer Travelmate 2303LCi:

Section "ServerFlags"
	Option "AllowEmptyInput" "False"
EndSection

Section "ServerLayout"
	Identifier     "X.org Configured"
	Screen      0  "Screen0" 0 0
	InputDevice    "Mouse0" "CorePointer"
	InputDevice    "Keyboard0" "CoreKeyboard"
EndSection

Section "Files"
	ModulePath   "/usr/local/lib/xorg/modules"
	FontPath     "/usr/local/lib/X11/fonts/misc/"
	FontPath     "/usr/local/lib/X11/fonts/TTF/"
	FontPath     "/usr/local/lib/X11/fonts/OTF"
	FontPath     "/usr/local/lib/X11/fonts/Type1/"
	FontPath     "/usr/local/lib/X11/fonts/100dpi/"
	FontPath     "/usr/local/lib/X11/fonts/75dpi/"
	FontPath     "/usr/local/lib/X11/fonts/URW/"
EndSection

Section "Module"
	Load  "dbe"
	Load  "dri"
	Load  "dri2"
	Load  "extmod"
	Load  "glx"
	Load  "record"
	Load  "freetype2"
EndSection

Section "InputDevice"
	Identifier  "Keyboard0"
	Driver      "kbd"
	Option "XkbLayout" "gb"
EndSection

Section "InputDevice"
	Identifier  "Mouse0"
	Driver      "mouse"
	Option	    "Protocol" "auto"
	Option	    "Device" "/dev/sysmouse"
	#Option	    "ZAxisMapping" "4 5 6 7"
EndSection

Section "Monitor"
	Identifier   "Monitor0"
	VendorName   "Monitor Vendor"
	ModelName    "Monitor Model"
EndSection

Section "Device"
        Option     "DRI"
	Identifier  "Card0"
	Driver      "intel"
	VendorName  "Intel Corporation"
	BoardName   "82852/855GM Integrated Graphics Device"
	BusID       "PCI:0:2:0"
EndSection

Section "Screen"
	Identifier "Screen0"
	Device     "Card0"
	Monitor    "Monitor0"
	SubSection "Display"
		Viewport   0 0
		Depth     24
		Modes "1024x768"
	EndSubSection
EndSection

Great, everything should work now, so copy the file to it's default position:

[root@ ~]# cp xorg.conf.new /etc/X11/xorg.conf

I also want a GUI login screen at boot. For kicks, I used slim because I thought it looked nice and slim:

[root@ ~]# cd /usr/ports/x11/slim/
[root@ /usr/ports/x11/slim]# make install clean
[root@ ~]# echo "slim_enable=\"YES\"" >> /etc/rc.conf

I even made a custom theme:

This is just a knock off of this theme called Rear Window by a guy called slackhack, combined with this logo. To install the theme do this:

[root@ ~]# cd /usr/ports/ftp/wget
[root@ /usr/ports/ftp/wget]# make install clean
[root@ /usr/ports/ftp/wget]# cd /usr/local/share/slim/themes/
[root@ /usr/local/share/slim/themes]# wget www.ashleymills.com/misc/bsd.tar.gz
--2010-05-10 22:54:02--  http://www.ashleymills.com/misc/bsd.tar.gz
Resolving www.ashleymills.com... 109.74.199.96
Connecting to www.ashleymills.com|109.74.199.96|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 132189 (129K) [application/octet-stream]
Saving to: `bsd.tar.gz'

100%[======================================>] 132,189      247K/s   in 0.5s    

2010-05-10 22:54:02 (247 KB/s) - `bsd.tar.gz' saved [132189/132189]

[root@ /usr/local/share/slim/themes]# tar xzvf bsd.tar.gz 
x bsd/
x bsd/slim.theme
x bsd/panel.png
x bsd/background.png
[root@ /usr/local/share/slim/themes]#

Then edit /usr/local/etc/slim.conf and change the current_theme value to bsd. Don't ask my why slim puts its config there.

Almost done, but I forgot that X isn't much use without a window manager. You could use twm, but I want to use icewm:

[root@ ~]# cd /usr/ports/x11-wm/icewm
[root@ /usr/ports/x11-wm/icewm]# make install clean

Now make sure icewm starts when you login from slim. Do this as the normal user:

[you@ ~]$ echo "exec icewm-session" > .xinitrc
[you@ ~]$ cat .xinitrc 
exec icewm-session
[you@ ~]$ 

I think that is everything. Reboot and it should boot into slim login manager, after which logging in will load icewm.

[you@ ~]$ su
Password:
[root@ /home/you]# reboot

Reply

  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
Are you human? Or are you dancer?
Fill in the blank