License : Creative Commons Attribution 4.0 International (CC BY-NC-SA 4.0)
Copyright :
Jeremy Fix,
CentraleSupelec
Last modified : April 19, 2024 02:04
Link to the source : index.md
NoMachine is a software that allows you to get access to a remote desktop hosted on quite powerful machines we have at school. It is cross plateform and available for Linux, MacOs and Windows on the NoMachine website.
The NoMachine client is already installed on the computer of the labs but if you work from your computer, you need to install it.
For the following I suppose you have been given a login, call it myremotelogin. This should be given to you by your teachers already.
Now, the general process to access a remote desktop is the following :
Before connecting to the nomachine servers, you need to configure your ssh-key and get the cscluster script as explained on this page
To do the next steps, you must be able to log on the frontal node without being asked your password. Otherwise, the next steps are going to be cumbersome.
Before using one of the machines of the Kyle server, you need to allocate a node on our clusters. This guarantees you are the only user on the machine you use. I suppose in the following you have your login called myremotelogin. Now there can be two situations, either you have a reservation name provided by the teachers and you go in this section, or you can access directly to the cluster during specific time slots and you go in this section.
I suppose you have been provided with a reservation name, call it myreservationname. Now we can proceed with the allocation :
mylogin@mymachine:~$ cscluster book -u myremotelogin -c kyle -r myreservationname -n 32
The -n 32
option ensures your are booking all the resources on a kyle machine. If the reservation was successful, you can move on the next step. This step succeeds if the command ends up display “The reservation … is running”.
On some dedicated timeslots, you can access the Kyle cluster without a reservation name. In that situation, rather than a reservation name, you must specify a partition which is a collection of machines in specific states. In the case of NoMachine, you need to use a partition which gathers machine with the NoMachine server installed and switched on which is called k12g
(‘g’ stands for graphical). For NoMachine to start, you must be using a graphical partition. The graphical partitions on Kyle all end with a lower ‘g’. Finally, you must be specifying a maximum amount of time which cannot exceed a hardcoded timelimit. For k12g
, the timelimit is 4h30. So suppose you want to book a node for \(H\) hours on the partition k12g
, the command is :
mylogin@mymachine:~$ cscluster book -u myremotelogin -c kyle -p k12g -w H:00 -n 32
The -n 32
option ensures your are booking all the resources on a kyle machine. If the reservation was successful, you can move on the next step.
Technically speaking, if you want to connect to the NoMachine servers we host on our CPU clusters, there a series of so-called hoops on which you have to bounce before reaching them. Fortunately, the cscluster
script handles that technical part for you.
First, given you have already an allocation on the CPU cluster, we need to ask for its job id :
mylogin@mymachine:~$ cscluster port_forward -u myremotelogin -c kyle
Using SLURM
You must specify a machine with -m <MACHINE> or a job id with -j <JOB_ID>
more info with .cscluster -h
Your current reservations are listed below :
JOBID PARTITION NAME USER ST TIME NODES NODELIST(REASON)
272 k1 bash myremote R 0:54 1 kyle01
Once you have the jobid, call it JOBID (in our illustration 272), we can perform the port forwarding:
mylogin@mymachine:~$ ./cscluster port_forward -u myremotelogin -c kyle -j JOBID -p 4000:4001
Using SLURM
Checking the status of the reservation JOBID=xxx
The reservation xxx is still running
Activating port forwarding from host kyle01:4000 to 127.0.0.1:4001
Warning: Permanently added 'slurm1' (ECDSA) to the list of known hosts.
You must keep that window/terminal opened otherwise the connection to the server would be closed. In this terminal, the port_forward operation will be running in foreground (except if you put in background) and indeed cannot type in new commands. Just open a new terminal tab if you need to.
In the command above, we map the remote host, port 4000, to the localhost port 4001. The choice of port 4001 is arbitrary. I choose that port instead of 4000 because you may have a nomachine server running on your localhost port 4000 already.
You must now start the NoMachine client. On gnome, you click on “Activities” or hit the Windows key of your keyboard and then type in the first few letters of NoMachine, the application should be proposed to you.
Once the NoMachine is started, let us see how to configure your nomachine connection the first time you are starting NoMachine. Attention In the video below, you need to change the port from 4000 to 4001 when configuring the connection.
Below is a video showing how to share a USB device with NoMachine.
Sharing a USB device may fail in various ways
First, from time to time, the USB connection fails but retrying again sometimes succeed.
The main case of failure is when the driver used, on the NoMachine client side, to share a USB device is not properly loaded because it actually failed to get compiled when NoMachine was installed or because it failed to be loaded for security reasons.
Indeed, given the nomachine module is not necessarily signed, the secure boot may prevent it from being loaded. So one option would be to disable Secure Boot to bypass that protection.
Then, to see if the module can be loaded
mylogin@mymachine:~$ sudo insmod /usr/NX/bin/drivers/nxusb.ko
and then :
mylogin@mymachine:~$ lsmod | grep nxusb
The first command should not complain and the second should show you a line with nxusb. As a side node, to get more information on the problem, you could run journalctl -f
in one terminal and try loading the module in another and the journalctl should display complains.
If you have an issue with the module and we need to compile it manually. To do so, proceed the following way :
Install the required dependencies :
mylogin@mymachine:~$ sudo apt install -y flex bison linux-headers-$(uname -r)
mylogin@mymachine:~$ sudo ln -fs /usr/src/linux-headers-$(uname -r) /lib/modules/$(uname -r)/build
And then compile the module
mylogin@mymachine:~$ cd /usr/NX/share/src/nxusb
mylogin@mymachine:~$ sudo su
mylogin@mymachine:~$ make clean
mylogin@mymachine:~$ make -f Makefile
mylogin@mymachine:~$ cp -arp /usr/NX/share/src/nxusb/nxusb.ko /usr/NX/bin/drivers/
mylogin@mymachine:~$ /usr/NX/bin/nxserver --restart
Finally, try to load the module with the insmod command above and it should now work. If loading the module does not complain and it appears in the lsmod command, you can try again to share the USB device within NoMachine, that should work.
On MacOS, I was once instructed that NoMachine on MacOS may have not installed the usb kext extension. To fix this, the support team told me you have to execute the following commands within a shell :
mylogin@mymachine:~$ sudo cp -ap /Applications/NoMachine.app/Contents/Frameworks/bin/drivers/nxusbproxy_11.0.kext /Library/Application\ Support/NoMachine/Extensions/
mylogin@mymachine:~$ sudo cp -ap /Applications/NoMachine.app/Contents/Frameworks/bin/drivers/nxusbvhci_11.0.kext /Library/Application\ Support/NoMachine/Extensions/
mylogin@mymachine:~$ sudo cp -ap /Applications/NoMachine.app/Contents/Frameworks/bin/drivers/nxusbvic_11.0.kext /Library/Application\ Support/NoMachine/Extensions/
mylogin@mymachine:~$ sudo chown -R root:wheel /Library/Application\ Support/NoMachine/Extensions/nxusb*
mylogin@mymachine:~$ sudo chmod -R 755 /Library/Application\ Support/NoMachine/Extensions/nxusb*
The scripts should be running on windows with WSL.
If NoMachine is not detecting your USB peripherals, it happens that the NoMachine device server service might not be running. In that case, open the services window, go to the windows search bar, look for “NoMachine Device Server” and trigger it to “Launch + automatic startup” if it is stopped.
Below is a video showing you how you can connect to the session of another user for co-working. The critical thing is to remember to click the “back” button once connected to the nomachine server to see the list of existing sessions.