Customizing the QNX Amazon Machine Image

The QNX AMI is generated by the QNX Image Filesystem (IFS); it allows developers to leverage QNX operating systems running on Amazon EC2 instances. This root IFS should remain unaltered by the user. However, the user can customize the QNX instance in the following ways:
  • manage user accounts, passwords, and groups
  • enable root access for SSH
  • add files
  • add storage and create partitions
  • extend the boot process
To save your customized QNX AMI, follow the Amazon EC2 User Guide at https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/creating-an-ami-ebs.html.

Managing user accounts, passwords, and groups

When the QNX AMI instance first boots, it prompts you to input new passwords for the root account and the qnxuser account. Once complete, you can login as either root or qnxuser.

You can add users or user groups to the system. For detailed steps, go to the QNX Neutrino User's Guide about Managing User Accounts.

Enable root access for SSH

To allow root access for SSH, edit the sshd configuration file:
  1. In superuser mode, open /etc/ssh/sshd_config.
  2. Find and change the line “PermitRootLogin no” to “PermitRootLogin yes”.
  3. Save the configuration file.
  4. Restart the SSH service to reload the configuration file.
  5. Confirm that you have root access for SSH.

Adding files

You can use the Momentics IDE or the scp utility to copy or upload files from the host to the AMI instance, or vice versa. For details on the scp command, go to the scp entry in the Utilities Reference.

Currently, the QNX AMI instance has one writeable partition. To display partition information, run mount in the QNX instance terminal. For example:

# mount
/dev/nvme0t178 on / type qnx6
ifs on / type ifs
The partition /dev/nvme0t178 is a system partition union mounted at / (slash), where you can upload (via Momentics or scp) your own libraries, binaries, etc.
CAUTION:
Do not change the permissions of the directories under this partition. Otherwise, users won't be able to log in.
You can add your own update management software as appropriate. As this partition is small, it should be reserved for “system” libraries and binaries and not the application-level libraries and binaries.

Adding more storage

Initially, there is one NVME device (nvme0) associated with the AMI. In the QNX instance terminal, run ls /dev to view the devices:

# ls /dev
bpf           pci           ptyp4         slog          ttyp0         tymem
console       pf            ptyp5         slog2         ttyp1         urandom
io-sock       pfil          ptyp6         socket        ttyp2         zero
mem           pipe          ptyp7         stderr        ttyp3
mqueue        ptyp0         random        stdin         ttyp4
null          ptyp1         sem           stdout        ttyp5
nvme0         ptyp2         ser1          text          ttyp6
nvme0t178     ptyp3         shmem         tty           ttyp7

To attach an additional volume to an instance, follow the steps in Attach an Amazon EBS volume to an instance at https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-attaching-volume.html.

When the volume is attached to the QNX instance, go in the QNX instance terminal and reboot the instance by running shutdown.

After the instance reboots, the additional associated volume appears as the next NVME device nvmeN, where N is the next available number (e.g., nvme1).

# ls /dev
bpf           nvme1         ptyp2         ser1          text          ttyp6
console       nvme1t179     ptyp3         shmem         tty           ttyp7
io-sock       pci           ptyp4         slog          ttyp0         tymem
mem           pf            ptyp5         slog2         ttyp1         urandom
mqueue        pfil          ptyp6         socket        ttyp2         zero
null          pipe          ptyp7         stderr        ttyp3
nvme0         ptyp0         random        stdin         ttyp4
nvme0t178     ptyp1         sem           stdout        ttyp5

Partitioning and formatting your storage

To partition a volume (e.g., nvme1), follow these command steps:
  1. Create a type 178 partition in nvme1:
    fdisk /dev/nvme1 add -t178
    Reboot the instance with shutdown.
  2. Confirm the addition of nvme1t178:
    ls /dev
  3. Format nvme1t178:
    mkqnx6fs /dev/nvme1t178
  4. Mount nvme1t178 to your desired pathname:
    mount /dev/nvme1t178 /pathname
    The mounted path is now available for use.

The QNX AMI instance can mount as many disk volumes as required.

For more on the root IFS, go to the QNX Neutrino User's Guide about Working with Filesystems.

Extending the boot process

The QNX AMI environment provides two methods to extend the boot process:
  • startup script

    The startup process looks for the existence of the script /var/start_script.sh. The IFS executes the script, integrating its code into the boot process.

  • System Launch and Monitor (SLM) configuration file

    The startup process also looks for the existence of an SLM configuration file /etc/slm/slm.conf. The SLM uses this configuration file to start and manage any custom components to run during boot. For details on the slm command, go to the slm entry in the Utilities Reference.

All extension options can be as complex or simple as you would like. If the user has their own software lifecycle management tool to manage their application-level software, call either the start_script.sh or the SLM to launch those custom processes, such as starting the customer-specific process for the lifecycle management.

Page updated: