What to do if USB support is disabled on Linux with NoMachine 6 or later installed
If you have USB support disabled among the NoMachine services, it is likely that the USB module, nxusb.ko, has not been compiled on your Linux during the installation of NoMachine. Commands in this article are intended to be run from command line in a terminal opened on the machine where the session is run.
There are two ways to check whether it has been compiled or not:
1) You can verify it by typing the following in a command prompt:
ls -l /usr/NX/bin/drivers/
If the output is empty, it means that nxusb.ko is not compiled.
2) Alternatively, you can verify it by checking the install log file placed in the /usr/NX/var/log directory.
To separate usb install information use the following command:
cat /usr/NX/var/log/install.log | grep -i usb
If the module is not compiled, the install log will report a similar message to this:
NX> 700 Compiling usb module.
NX> 700 Cannot compile USB module.
NX> 700 Support for USB forwarding over the network will not
NX> 700 be available.
NX> 700 To compile USB module be sure that Linux kernel headers
NX> 700 are available. You can then update this installation.
If you want to activate support for USB forwarding, you need to install the Linux kernel headers and be sure that the 'make' program is available on your system.
How to install the kernel headers
You can retrieve the kernel version of your machine:
uname -r
Let's say that this command returns on Ubuntu 5.4.0-165-generic, download and install the kernel headers for such kernel version.
On SUSE and other distributions using Zypper program:
sudo zypper install kernel-default-devel
On Red Hat and other RPM-based distributions using dnf:
sudo dnf install kernel-devel-$(uname -r)
On Ubuntu and other DEB-based distributions using apt-get:
sudo apt-get install linux-headers-$(uname -r)
Then, ensure that you have all the necessary tools to compile: gcc and make. You can verify if they are present by running from command line.
On SUSE/Red Hat and other distributions using RPM, run:
rpm -qa | grep gcc
and:
rpm -qa | grep make
On Ubuntu and other distributions usinf DPKG, run:
sudo dpkg --get-selections | grep gcc
and
sudo dpkg --get-selections | grep make
If gcc and/or make are not present, you have to install them.
On SUSE and other distributions using Zypper:
sudo zypper install make gcc
On Red Hat and other RPM-based distributions:
sudo dnf install make gcc
On Ubuntu and other distributions using apt-get:
sudo apt-get install make gcc
When the environment is ready and you have acquired all the necessary packages, please do the following (assuming that NoMachine is installed in /usr/NX):
1. Navigate to /usr/NX/share/src/nxusb
cd /usr/NX/share/src/nxusb
2. Build the module as non-privileged user:
make
If the build fails due to permission problems, please run the following command:
sudo rm -rf /usr/NX/share/src/nxusb/include/linux
And then retry:
make
If there are still problems with permissions, run the compilation as root.
Do not use 'sudo make' because sudo drops the PWD environment variable and causes compilation problems! Use 'su' and then run 'make' command instead.
3. When the module has been built, copy it to the drivers directory:
sudo cp nxusb.ko /usr/NX/bin/drivers/
4. Clean the build directory
make clean
5. The module, if compiled, is in the /usr/NX/bin/drivers/ directory:
ls -l /usr/NX/bin/drivers/nxusb.ko
After compiling the kernel module it's a good idea to check that it loads correctly on the machine where you compiled it.
To do this start a NoMachine connection, open the NoMachine menu inside the session (ctrl+alt+0 or click on the page peel on the top right corner of the window) and open Devices -> Connect a USB device. Wait for 10 seconds, if there are available devices, they will appear. Then, open a terminal on the host where you compiled nxusb.ko and type:
lsmod | grep nxusb
If the output is not empty, for example:
$ lsmod | grep nxusb
nxusb 36864 5
it means that the nxusb kernel has been compiled and loaded correctly on your machine.
Note that until the Devices -> Connect a USB device UI is opened, the nxusb module is not loaded, even if present.
