Hello, I see that you fixed the keyboard issue. Just so it’s clear. If you are running the free version of NoMachine, so you are attaching to the physical display, the keyboard you get will be the one on the remote server. This allows the user to simply change the keyboard layout by selecting the keyboard in the control panel of the desktop environment, as you did. The keyboard on your Ubuntu server must have been set to US.
If previously you were using one of the terminal server products, then when running a session, it is the client keyboard which is ‘passed’ to the virtual desktop. (Local German -> Remote German) Just so you know, in version 4 the keycodes are sent by the client untranslated and the translation happens inside the target X server, according to the keymap selected by the user. So in your case, a local German keyboard will mean you get a remote German keyboard, unless of course you configure it differently.