For participants only. Not for public distribution.

Note #9
QNX Tips

John Walker
Last revised December 29, 2002.

Here are a collection of random tips I've stumbled over in the process of installing and working with the QNX operating system ( All of these apply to the QNX 6.2.0(NC) non-commercial release.

Where Are the Manuals?

See the Documentation Roadmap: for all the manuals you're looking for.

Linux/QNX Dual-Boot

It is very easy to configure a system to dual-boot Linux and QNX. Partition your hard drive with a partition for Linux, a partition for the Linux swap space, and a third partition for QNX. Since you're using fewer than four partitions, all of these can be primary partitions on an IDE drive. For example, here's a 48 Gb drive so partitioned:

Disk /dev/hda: 255 heads, 63 sectors, 5494 cylinders
Units = cylinders of 16065 * 512 bytes

Device Boot Start End Blocks Id System  
/dev/hda1 *
Linux swap
QNX4.x 3rd part

The Linux LILO loader is installed in the Master Boot Record of the drive, and configured with the following /etc/lilo.conf file:



The lba32 statement permits booting from a partition which is more than 2 Gb from the start of the drive, assuming the BIOS supports this (most machines manufactured after 1998 have a suitable BIOS).

Note that the fourth primary partition remains unused in this configuration, so you could further subdivide the disc and create a Windows partition. If you do so, it's probably a good idea to make the Windows partition the first physical one on the drive, but this may just be superstition.

Changing the Hostname

When you install QNX, the hostname of the system defaults to localhost.localdomain. You can change this with the Configure/Network dialogue box, in the "Network" tab. If you do so, you should also add the host name you've selected to the /etc/hosts files or lookups of the host by network applications will fail. If you're using DHCP configuration of your IP address and network connectivity, it's usually adequate to define the host name as pointing to the localhost IP address of For example, if you've changed the local machine name to "lysandra", you'd use an /etc/hosts file like:


# Host Database
127.1 localhost.localdomain localhost
::1 localhost.localdomain localhost lysandra

What's My IP Address?

If you're assigning the machine's IP address with DHCP, you may be curious to discover what it is. Assuming you're using the default Ethernet configuration where the primary interface is named en0, you can determine this with the command:

/sbin/ifconfig -L en0

which you needn't be root to run. Better still, put a shell script called ipconfig in your local bin directory with the following commands:


#! /bin/sh
/sbin/ifconfig -L en0

and you can query your dynamic IP address just as on Windows.

Bashing Away

Linux users accustomed to the BASH (GNU Bourne-Again Shell) environment may prefer using it to the default shell provided with QNX. A packaged, ready-to-install binary of BASH is provided

on the QNX "3rd Party Software" collection. Place the CD-ROM repository burnt from the ISO image downloaded from the site in the CD-ROM drive and, while logged in as root, launch the Installer from the Applications toolbar. Select BASH, and complete the installation; this will install BASH in /usr/bin/bash. You'll want to add it to the list of valid login shells in /etc/shells, for example:


# List of available shells

and then change your userid line in /etc/passwd to set it as your default shell. In your home directory, create rudimentary BASH profile files as follows:


. .bash_profile


PS1='[\u@\h \W]\$ '
PS2='> '
PS4='+ '

to establish an informative command line prompt and define a per-user local binaries directory at the start of the search path.

SSH and Samba

You'll almost certainly want to install OpenSSH and Samba from the 3rd Party Software repository. These install cleanly and allow you to get from the QNX machine easily to your Linux/Unix machines (SSH) and Windows machines (Samba). Note that the "sftp" utility included with SSH makes it very simple to transfer files between a Linux machine and QNX.

Where Can I Get a Current Mozilla?

The QNX distribution includes a pre-release version of Mozilla built for the Photon GUI. You'll find a current Photon version of Mozilla on the OpenQNX project page at SourceForge:

along with a variety of other OpenSource software ported to QNX, some of which may be more recent versions than those included in the QNX 3rd Party repository. When you download Mozilla, be sure to select the Photon version, not the xlib release, if you wish to run the default Photon GUI. The

OpenQNX project has a complete port of XFree86, Lesstif, and various X tools including Nedit, but although I've downloaded and installed them, I haven't figured out how to configure the X server to run under QNX. (Hint: just copying the /etc/X11/XF86Config-4 file which works with Linux on the same machine doesn't work.)

Most (but not all) of the OpenQNX tools are posted as tarballs which you extract when logged in as root with "/" as the current directory. They then install everything in the proper place using

root-relative pathnames with the bulk under "/opt". Once you've installed Mozilla, a quick and dirty way to make the new version launch by default is to create a symbolic link in your ~/bin directory (see the BASH section above for how to set this up) like the following:

ln -s /opt/openqnx/mozilla-ph-VER/mozilla mozilla

where VER is the Mozilla version ("1.2.1" for the one posted as of this writing).

If you're a fan of CSCOPE, you'll also find it on the OpenQNX page.

Hard Target/Soft Underbelly

QNX installs by default with no password on root. I wasn't worried about this since my QNX machine is configured behind an adamantine firewall, but I worried about a machine open to the Internet with a fixed IP address, especially as both telnet and ftp services are enabled by default in /etc/inetd.conf.

This turns out not to be a problem out of the box, since inetd is not started by default after a reboot. But, if you *do* start it, your machine is indeed wide-open to anybody who can get to it. If you execute /usr/sbin/inetd, then gaining remote root access is as simple as:

[kelvin@lysander tmp]$ telnet
Connected to (
Escape character is '^]'.
login: root
Sun Dec 29 14:54:50 2002 on /dev/ttyp4
Last login: Sun Dec 29 14:53:18 2002 on /dev/ttyp4

Edit the file .profile if you want to change your environment.

To start the Photon windowing environment, type "ph".

# uname -a
QNX lysandra 6.2.0 2002/05/21-12:17:24edt x86pc x86

so if you do intend to run inetd, better make sure you've set secure passwords on all accounts or, better still, situate the QNX machine behind a firewall or defend it with a package like TCPD.