Sunday, April 20, 2025

How to configure ftp server on QNX 7.1 with PAM user authentication

How to configure ftp server on QNX 7.1 with PAM user authentication

Create empty folder, I am using vm12
C:\> cd \
C:\> mkdir vms
C:\> cd vms
C:\vms> mkdir vm12
C:\vms> cd vm12
Bootstrap the VM, this creates a VirtualBox VM. Note that you have to install VirtualBox on this computer
C:\vms\vm12>C:\qnx710\host\win64\x86_64\usr\bin\bash C:/qnx710/host/common/bin/mkqnximage --noprompt --hostname=vm12 --type=vbox --arch=x86_64 --build
Update system_files.custom
C:\vms\vm12>nvim C:\vms\vm12\local\snippets\system_files.custom
Below contains more than just FTP but lines 5 to 21 are for FTP server
# local/snippets/system_files.custom
# Placeholder for local list of files to add to system partition
lib/libpci.so.2.3=lib/libpci.so.2.3
lib/libpci.so.3.0=lib/libpci.so.3.0
xbin/inetd=usr/sbin/inetd
xbin/telnetd=usr/sbin/telnetd
xbin/ftpd=usr/sbin/ftpd
etc/inetd.conf={
telnet stream tcp nowait root /system/xbin/telnetd in.telnetd
ftp stream tcp nowait root /system/xbin/ftpd in.ftpd -c /system/etc
}
[perms=444] pam/config/ftpd = {
auth requisite pam_qnx.so
account requisite pam_qnx.so
session requisite pam_qnx.so
password requisite pam_qnx.so
}
etc/ftpusers={
root allow
qnxuser allow
}
Update ifs_files.custom to sym link /system/xbin/login to /bin/login
# local/snippets/ifs_files.custom
# Placeholder for local list of files to add to ifs
[+script] .script = {
procmgr_symlink /system/xbin/login /bin/login
}
Update post_start.custom to start super server (inetd)
# local/snippets/post_start.custom
# Commands executed from post_startup.sh. Executed at the end of system startup whether slm is in use
# or not
#
# To allow resource managers to be run properly with and without security policies, command lines
# should be written in one of the following forms:
#
# START(resmgr_t) resmgr DROPROOT(resmgr_uid)
# STARTU(resmgr_t, resmgr_uid) resmgr
# Where resmgr_t is the security type name (arbitrary but usually the name of the resmgr with _t appended),
# and resmgr_uid is the id to use for both uid and gid. DROPROOT is used only in cases where the
# resource manager supports a -U option for switching to non-root.
inetd -D /system/etc/inetd.conf
Rebuild and run the VM, like:
C:\vms\vm12>C:\qnx710\host\win64\x86_64\usr\bin\bash C:/qnx710/host/common/bin/mkqnximage --noprompt --hostname=vm12 --type=vbox --arch=x86_64 --build --force --run

Saturday, April 19, 2025

Got "Makefile:8: recurse.mk: No such file or directory" building a project after applying QNX 6.5 SP1

Got "Makefile:8: recurse.mk: No such file or directory" building a project after applying QNX 6.5 SP1

I applied QNX 6.5 SP1 to an existing QNX 6.5 on Raspberry Pi OS (2022-07-01-raspios-bullseye-i386) but I am getting error below when building.
/opt/qnx650/host/linux/x86/usr/bin/make -k CPULIST=x86 all --file=/tmp/QMakefile174511465999353758.tmp
Makefile:8: recurse.mk: No such file or directory
make: *** No rule to make target `recurse.mk'.
make: Failed to remake makefile `recurse.mk'.
make: *** No rule to make target `all'.
I don't know the workaround but I leaned I have to apply SP1 like below -
$ sudo -E ./qnxsdp-6.5.0SP1-201206271006-linux.bin
-E will preserve the environment variables when running the installer, which is required for successful installation.

Got "Permission denied" running a binary from CD-ROM

Got "Permission denied" running a binary from CD-ROM

I was trying to install QNX SDP 6.5 from a CD-ROM, like below:
$ sudo ./qnxsdp-6.5.0-201007091524-linux.bin
But got this error instead
sudo: unable to execute ./qnxsdp-6.5.0-201007091524-linux.bin: Permission denied
To fix, do:
$ sudo mount -o remount,ro,exec /media/cdrom0

Installing TigerVNC in Ubuntu 24.04

Installing TigerVNC in Ubuntu 24.04

Ubuntu 24.04 supports RPD protocol but it behaves in a way that is not fit for my needs. The Desktop Sharing mode needs to have a user logged in or set to automatically login on reboot. Anyone will have access to your desktop if they are physically present. The Remote Login would have been the best option but when the connection is lost, all applications running on that session are gone. So you can't reconnect to that same session.

So, we are back to the tried and tested VNC protocol. To get TigerVNC working on Ubuntu 24.04 is a little tricky due to Wayland becoming the default in 24.04. To workaround Wayland, we need to install XFCE, like so:
$ sudo apt install --no-install-recommends xubuntu-desktop
This installs base XFCE4 with very applications specific to XFCE.

Install xfce4-terminal for convenience. GNOME-Terminal is pretty heavy and uxterm/xterm are not to my liking.
$ sudo apt install xfce4-terminal
Now install TigerVNC
$ sudo apt install tigervnc-standalone-server
Then set the password that will be used to connect to the VNC server by running it like below:
$ vncpasswd
Now we have to define the mapping between a VNC session and user for that session. To do this open /etc/tigervnc/vncserver.users, like:
$ sudo vim /etc/tigervnc/vncserver.users
Below is an example that shows user u1 is mapped to VNC server session 2:
# TigerVNC User assignment
#
# This file assigns users to specific VNC display numbers.
# The syntax is <display>=<username>. E.g.:
#
# :2=andrew
# :3=lisa
:2=u1
Now run VNC server, like:
$ vncserver -geometry=1360x768 -xstartup /usr/bin/startxfce4 :2 -localhost no
Using RealVNC client on Windows, you can calculate geometry of the server like this to get maximum client area:
Add-Type -AssemblyName System.Windows.Forms;
$wa = [System.Windows.Forms.Screen]::PrimaryScreen.WorkingArea
$titleBarHeight = [System.Windows.Forms.SystemInformation]::CaptionHeight
$offset = 16
$w = $wa.Height - $titleBarHeight - $offset
$h = $wa.Width - $offset
Write-Host "$($h)x$($w)"
Should you need to close/kill the session, do:
$ vncserver -kill :2


There is a big caveat that I haven't figured out, yet. No user should be logged in to the console/physical session. Otherwise, everything goes crazy.
References:
https://medium.com/oracledevs/your-next-developer-desktop-with-ubuntu-24-04-and-tigervnc-on-oci-d0356ffa0cf9

Friday, April 18, 2025

Rust on QNX

Rust on QNX

This blog shows how to build a Rust toolchain for QNX 7.1 OS.

Below is my environment:
Host OS: Linux Mint 22.1
QNX: 7.1

To get started, let's get lastest Rust so we can use it to bootstrap the new toolchain
$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Install development dependencies
$ sudo apt install build-essential cmake python3 perl git llvm-dev
Setup
$ source ~/qnx710/qnxsdp-env.sh
$ mkdir ~/repo
$ cd ~/repo
$ git clone https://github.com/rust-lang/rust.git
$ cd rust
$ #create config.toml
$ echo 'profile = "compiler"' > config.toml
$ echo change-id = 999999 >> config.toml
Update environment variables for CC_/CF_FLAGS/CXX_/AR_, this is targetting x8_64
$ export build_env='
    CC_x86_64_unknown_nto_qnx710=qcc
    CFLAGS_x86_64_unknown_nto_qnx710=-Vgcc_ntox86_64_cxx
    CXX_x86_64_unknown_nto_qnx710=qcc
    AR_x86_64_unknown_nto_qnx710=ntox86_64-ar
    '
Build the toolchain
$ env $build_env \
    ./x.py build \
        --target x86_64-unknown-linux-gnu,x86_64-pc-nto-qnx710 \
        rustc library/core library/alloc library/std
Now, let's tell Rust that there is a toolchain we call qnx-toolchain
$ rustup toolchain link qnx-toolchain ~/repo/rust/build/x86_64-unknown-linux-gnu/stage1/
And for convenience, make it the default:
$ rustup default qnx-toolchain
There should be a Rust binary located like below:
$ ls ~/prj/hello-world/target/x86_64-pc-nto-qnx710/debug/hello-word
Now copy this file into QNX 7.1 OS (x86_64) target and run the hello-world

Thursday, March 27, 2025

How to configure nfs server on QNX 7.1

How to configure nfs server on QNX 7.1

Target: QNX 7.1 running on a VM (VMware Workstation or VirtualBox). It is assummed that the targets are newly creaed VMs. Server target VM has an IP of 192.168.1.2, the client target has the IP of 192.168.1.3
Copy nfsd and portmap to the server target in /system/xbin, like:
C:\>ntox86_64-gdb.exe -ex "target qnx 192.168.1.2:8000" -ex "upload C:\qnx710\target\qnx7\x86_64\usr\sbin\nfsd /system/xbin/nfsd" -ex "quit"
C:\>ntox86_64-gdb.exe -ex "target qnx 192.168.1.2:8000" -ex "upload C:\qnx710\target\qnx7\x86_64\usr\bin\portmap /system/xbin/portmap" -ex "quit"
Add/edit /etc/netconfig
udp tpi_clts v inet udp - -
tcp tpi_cots_ord v inet tcp - -
udp6 tpi_clts v inet6 udp - -
tcp6 tpi_cots_ord v inet6 tcp - -
rawip tpi_raw - inet - - -
local tpi_cots_ord - loopback - - -
unix tpi_cots_ord - loopback - - -
Now define folder to be exported, you have to do this on the target.
# mkdir /data/export
Now create /etc/exports on the target. This maps to the real root user and allow connection only from 192.168.1.3
/data/export -root=0 192.168.1.3
Create /var/run, needed by portmap.
# mkdir /var/run
Now run portmap
# portmap
Verify running using pidin, like:
# pidin -faA | grep portmap
Now run nfsd
# nfsd
Verify nfsd running, like:
# pidin -faA | grep nfsd
To mount on the QNX 7.1 client, copy fs-nfs3 to the client target
C:\>ntox86_64-gdb.exe -ex "target qnx 192.168.1.3:8000" -ex "upload C:\qnx710\target\qnx7\x86_64\usr\sbin\fs-nfs3 /system/xbin/fs-nfs3" -ex "quit"
On the client QNX 7.1 target, mount the exported directory
# fs-nfs3 192.168.1.2:/data/exports /data2
Verify that you can write and read from /data2
# echo "Hello world" >> /data2/hello.txt
# cat /data2/hello.txt

Wednesday, March 26, 2025

QNX 7.1 error booting up a VM - "ldd:FATAL: Failed to load lazyload dependency. Unresolved symbol: _ITM_registerTMCloneTable"

QNX 7.1 error booting up a VM - "ldd:FATAL: Failed to load lazyload dependency. Unresolved symbol: _ITM_registerTMCloneTable"

I recently created a QNX 7.1 VM target on Windows 10 (verified on both VMware Workstation Pro 14.1.8 and VirtualBox 7.1.6) but it would not properly boot up. The console shows ldd:FATAL: Failed to load lazyload dependency. Unresolved symbol: _ITM_registerTMCloneTable
To fix this issue, add the following to "C:\Users\username\ide-7.1-workspace\vm10\local\snippets\system_files.custom", you have to change the path that aligns with how your system is setup.
# local/snippets/system_files.custom
# Placeholder for local list of files to add to system partition
lib/libpci.so.2.3=lib/libpci.so.2.3
lib/libpci.so.3.0=lib/libpci.so.3.0
Then rebuild the VM, like:
C:\Users\username\ide-7.1-workspace\vm10>C:\qnx710\host\win64\x86_64\usr\bin\bash C:/qnx710/host/common/bin/mkqnximage --build --run
That's one very long line.
Where:
- You have to be in the directory where the VM files are located, in my case it is in C:\Users\yh\ide-7.1-workspace\vm10
- Do a build and then run the vm

How to configure ftp server on QNX 7.1 with PAM user authentication

How to configure ftp server on QNX 7.1 with PAM user authentication Create empty folder, I am using vm12 C:\> cd \ C:\> mkdir vms ...