NetBSD Documentation: The X Window System

Running X

Compiling programs


Running X

How to get the mouse working with XFree? (top)

Assuming you're using the default wscons console driver, make sure you adjust the mouse protocol and device properly in the XF86Config file's "Pointer" section:

Section "Pointer"
   ###Protocol       "PS/2"                    # Linux
   ###Device         "/dev/mouse"              # Linux
   ##Protocol        "busmouse"                # NetBSD 1.4.x
   ##Device          "/dev/pms0"               # NetBSD 1.4.x
   Protocol          "wsmouse"                 # NetBSD 1.5 or later
   Device            "/dev/wsmouse"            # NetBSD 1.5 or later
EndSection

If you don't use wscons (as is the default on 1.4.x systems), use /dev/pms0 and the "busmouse" protocol for a PS/2 mouse.

Protocol "PS/2" is still supported for older kernels, you'll have to use Device "/dev/pms0" with the opms mouse driver in the kernel for that, though. Useful for X-Servers that don't support the wscons protocol (like XFree V4 or Linux/FreeBSD X server binaries).

Changing the keyboard mapping from 'US' under X (top)

XFree 3.x maps the keyboard with an english map per default. To change this to e.g. german, make sure the following is in your XF86Config file:

#       XkbDisable
#       XkbKeymap   "xfree86(us)"

        XkbModel        "pc102"
        XkbLayout       "de" XkbVariant      "nodeadkeys"

To get e.g. a german keyboard in XFree 4.x, put the following into your XF86Config's "InputDevices" section:

Options		"XkbLayout"	"de"

Configuring the keyboard for the console under wscons is described elsewhere.

How do I make the Caps key another Control key (top)

For XFree 3.x (as shipped with NetBSD 1.l5), add “XkbOptions "ctrl:nocaps"” if you want the caps-lock key become a second control-key. If you want to use the "Windows" keys on your keyboard, you can get some useful keysyms for them by using “XkbModel "pc105"” instead.

XFree 4.x uses a different config file format. For it, put

Option "XkbOptions" "ctrl:nocaps"

into the "InputDevice" section of your XF86Config file.

XF86_SVGA corrupts glyphs on Rage 128 if accelerated (top)

To fix this make sure you have xsrc of at least 2000-01-13 (otherwise you will have to also apply the patch in PR misc/9171). Then use

Option "xaa_no_color_exp"

in the Device section of your XF86Config.

X is very slow when compiling under NetBSD 1.3.x (top)

A patch for the NetBSD 1.3 series is available which will significantly improve the interactive performance under X while compiling or performing other tasks.

How to bypass xdm (top)

If xdm(1) is enabled but you are unable to login for some reason, possibly because there is no root password, and you do not have virtual consoles enabled (or they are not yet supported on your port), you can either press ^C at the immediately after the boot messages indicate xdm is starting, or:

When I type 'startx' I get the message: startx: Command not found. What's wrong? (top)

You need to add the location of the X binaries to your shell's path variable. For csh(1) and its derivatives, add /usr/X11R6/bin to the line in your .cshrc file which sets the path variable. For sh and its derivatives, you'll need to modify you .profile instead.

Unable to run X - 'xinit: not found' (top)

You need /usr/X11R6/bin in your path. As root add 'set path = ( $path /usr/X11R6/bin )' to /etc/csh.cshrc, and start a new shell.

startx fails -'X connection to: 0.0 broken' (top)

To see the error messages in this case, run:

Then view ~/x.log

Console output (such as from 'su') garbles X display. (top)

The system is outputting a line to the console indicating something has happened (such as 'su'). You should really run xconsole(1) or one 'xterm -C' to capture this console output.

You may need to ensure your kernel is compiled with the following enabled:

options  UCONSOLE  # allow anyone to steal the virtual console

See How to build a kernel for details on how to build your own kernels.

If you're logged in as root, and get annoying portmap notices, you may wish to look at the FAQ entry on how to turn those messages off.

How do I get my mouse wheel to work? (top)

If you use a Microsoft IntelliMouse, Logitech Wheel Mouse (cordless our not) or something similar that has a scroll wheel, and you want to use the wheel under NetBSD, first make a kernel that includes the "pmsi" driver, and make sure "wsmouse" uses it. Something like this should occur in your dmesg(8) output:

pmsi0 at pckbc0 (aux slot)
wsmouse0 at pmsi0

If you are running XFree86 3.x (as shipped with NetBSD 1.5.2 and earlier), ensure your /etc/XF86Config contains:

Section "Pointer"
    Protocol    "wsmouse"
    Device      "/dev/wsmouse"
    ZAxisMapping 4 5
EndSection

If you are running XFree86 4.x, ensure your /etc/X11/XF86Config contains:

Section "InputDevice"
    Identifier  "Mouse0"
    Driver      "mouse"
    Option      "Protocol"      "wsmouse"
    Option      "Device"        "/dev/wsmouse"
    Option      "Buttons"       "5"
    Option      "ZAxisMapping"  "4 5"
EndSection

That's enough to make xterms scroll. For other apps, you'll need to edit your ~/.Xdefaults. See Colas Nahaboo X mouse wheel scroll page for details on a lot of applications that can be made working.

XFree86 Documentation (top)

Which version of XFree86 am I running? (top)

To quickly tell which version of the X server you are running, you can use xdpyinfo(1). E.g.:

$ xdpyinfo | grep release
vendor release number:    335

In the case of XFree86, this tells us that the server version is 3.3.5.

How to setup anti-aliased fonts on NetBSD with XFree86 4 (top)

NOTE: The paths below should be adjusted appropriately if using xpkgwedge

  1. Install the following packages from pkgsrc:
  2. Setup the font hints:
    • mkfontscale /usr/X11R6/lib/X11/fonts/TrueType
    • mkfontdir /usr/X11R6/lib/X11/fonts/TrueType
    There should now be a 'fonts.dir' and 'fonts.scale' in the TrueType font directory.
  3. Configure the X server:
    • In the "Module" section, make sure that the following exists:
      		Load "type1"
      		Load "freetype"
    • In the "Files" section, verify the order of the font paths. Verify that the TrueType and Type1 font paths are before the rest:
      		FontPath   "/usr/X11R6/lib/X11/fonts/local/"
      		FontPath   "/usr/X11R6/lib/X11/fonts/TrueType/"
      		FontPath   "/usr/X11R6/lib/X11/fonts/Type1/"
      		FontPath   "/usr/X11R6/lib/X11/fonts/misc/"
      		FontPath   "/usr/X11R6/lib/X11/fonts/75dpi/:unscaled"
      		FontPath   "/usr/X11R6/lib/X11/fonts/100dpi/:unscaled"
      		FontPath   "/usr/X11R6/lib/X11/fonts/75dpi/"
      		FontPath   "/usr/X11R6/lib/X11/fonts/100dpi/"
  4. Configure Xft -- an example /usr/X11R6/lib/X11/XftConfig follows:
    ##### Example XftConfig
    dir "/usr/X11R6/lib/X11/fonts/TrueType"
    dir "/usr/X11R6/lib/X11/fonts/Type1"
    # Uncomment the following line if using an LCD display
    #match edit rgba = rgb;
    match any family == "fixed"             edit family =+ "mono";
    includeif       "~/.xftconfig"
    match any family == "Times"             edit family += "Times New Roman";
    match any family == "Helvetica"         edit family += "Verdana";
    match any family == "Courier"           edit family += "Courier New";
    match any family == "serif"             edit family += "Times New Roman";
    match any family == "sans"              edit family += "Verdana";
    match
            any family == "mono"
            all slant == roman
            all weight < bold
    edit
            family += "monotype.com";
    match any family == "mono"              edit family += "Courier New";
    match any family == "Charter"           edit family += "Bitstream Charter";
    match any family == "Bitstream Charter" edit family =+ "Charter";
    match any family == "Lucidux Serif"     edit family += "LuciduxSerif";
    match any family == "LuciduxSerif"      edit family =+ "Lucidux Serif";
    match any family == "Lucidux Sans"      edit family += "LuciduxSans";
    match any family == "LuciduxSans"       edit family =+ "Lucidux Sans";
    match any family == "Lucidux Mono"      edit family += "LuciduxMono";
    match any family == "LuciduxMono"       edit family =+ "Lucidux Mono";
    match any family == "Comic Sans"        edit family += "Comic Sans MS";
    match any family == "Comic Sans MS"     edit family =+ "Comic Sans";
    match any family == "Trebuchet"         edit family += "Trebuchet MS";
    match any family == "Trebuchet MS"      edit family =+ "Trebuchet";
    match any family == "Monotype"          edit family =+ "Monotype.com";
    match any family == "Andale Mono"       edit family += "Monotype.com";
    match any family == "Monotype.com"      edit family =+ "Andale Mono";
    ##### End of XftConfig
    	    
  5. Rebuild the font cache for applications that use fontconfig:
    fc-cache -v
    This will take a very long time (~20 minutes on a PII 366), so be patient.
  6. That's it! Restart the X server, and test the configuration:
    xterm -ls -fg gray -bg black -ls -fa "Courier New Bold" -fs 10

This Anti-Aliased-Fonts-Mini-Howto was written by Jared D. McNeill.

Xft using applications eat CPU cycles, but don't appear to do anything! (top)

It is possible that the application in question is computing the font information that should have been prepared by fc-cache -- re-run 'fc-cache -v' to make sure the information in the cache is up-to-date.

'No fonts found' - what does this mean? (top)

No fonts found; this probably means that the fontconfig
library is not correctly configured. You may need to
edit the fonts.conf configuration file. More information
about fontconfig can be found in the fontconfig(3) manual
page and on http://fontconfig.org

You haven't run 'fc-cache -v' like the fonts/fontconfig MESSAGE suggests during installation. For details, see 'pkg_info -D fontconfig' and above.

How do I change the default window manager? (top)

First thing to do is to install the window manager you prefer. You can find a lot of them, ready to install, in pkgsrc's wm category. After a successful installation, figure out how is the binary named. It will usually match package's name.

Once you know how to execute the window manager, you have to configure your X session to start it up. We will be using twm in our examples (which comes with X), whose binary is named twm:

You can see that the content for each file is the same, so you may want to create a link between them.


Compiling programs

Compile fails - 'unable to locate libXm' (top)

Xm does not come with the standard X11 environment. It is part of Motif, which is a commercial graphical user interface.

A freeware implementation of Motif called Lesstif is also available. It is available as part of the NetBSD packages collection, under x11/lesstif.

Compile fails - 'unable to locate xpm.h', or '-lXpm: no match' (top)

xpm.h is part of the X PixMap library, used by many programs to allow more multi (than two) colour icons. It is available as part of the NetBSD packages collection, under graphics/xpm

Compile fails to link: Undefined symbol '_XOpenDisplay' (top)

If it is a third party item of software, you should check if a version is available via the NetBSD packages collection. If you are writing you own code you need to ensure you link against the necessary X libraries. In this case, add -L/usr/X11R6 -lX11 to the end of your link line.


Back to  NetBSD Documentation

(contact us)   Generated from %NetBSD: index.xml,v 1.2 2005/07/25 14:38:25 rpaulo Exp %
Copyright © 1994-2006 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.
NetBSD® is a registered trademark of The NetBSD Foundation, Inc.