TL;DR: Running X-Plane with sudo
is a bad idea. Instead, create proper udev rules (per this and this).
During the 11.10 beta, I’ve gotten a lot of bug reports from Linux users who report that their keyboard is being recognized as a joystick. This is… sort of a bug, but mostly intentional.
(If you’re not a Linux user, this won’t apply to you… but it will bore you! 😉 )
Background: What changed?
On Linux, prior to X-Plane 11.10, we were very picky about what USB devices we considered to be a joystick: we required a device to present a so-called “absolute” axis (in contrast to a “relative” axis like a mouse uses). The downside of this is that it prevented home cockpit builders from creating button-only hardware.
So, in 11.10 and beyond, we relaxed the requirements: if a USB device presents us with either an axis, button, or hat switch, we’ll treat it like a joystick.
The problem with this policy seems obvious: keyboards have “buttons”! Like, 104+ of them!
The reason we didn’t worry about this is that the keyboard is only accessible (as a USB device) to programs running as root. So long as X-Plane runs as a normal user, it doesn’t even have the option of treating the keyboard as a joystick.
Why do people run as root?
The impetus for running as root (via sudo
) is simple: if your Linux distro doesn’t recognize your joystick hardware as something that should be available to normal applications, running as root is a brute-force way to let X-Plane use your joystick.
Let me say emphatically: This is a bad idea.
Especially with early, buggy betas, running as root makes it possible for X-Plane to do way more damage to your system than would ever be possible as a normal user. Consider the unlikely—but possible!—scenario where somebody made a typo in the code which inadvertently tries to delete a system folder. There are two possible outcomes here:
- If you’re running as a normal user: Nothing happens. The operating system refuses to let X-Plane hurt your system.
- If you’re running as root: The operating system silently obeys. You curse X-Plane for breaking your system.
Running X-Plane as root is like giving a blank check to every cashier you buy something from—it’s way more power than they need to do their job, and it’s liable to burn you at some point!
The Right Way™ to let X-Plane use your joystick
As described in the latter half of this old dev blog post, you don’t have to run with sudo
. Instead, you can create udev rules to tell your operating system to let normal applications use your joystick. The GUI tool linked at the end of that post makes it even easier.
(Some users found the instructions there confusing; this post on the Org might help.)
Remember that after you create your rules, you can even submit them to your distro to make life easier for other flight simmers!
There’s one hitch: after running with root, your file permissions (especially your prefs) may have gotten screwed up. This can be fixed from the terminal by making your normal user account the owner of your X-Plane directory, like this:
$ sudo chown -R <username>:<username> /path/to/X-Plane/
(So, in my case, my username is tyler, and X-Plane is installed to ~/Documents/X-Plane/, so I’d run $ sudo chown -R tyler:tyler ~/Documents/X-Plane/
.)
Now, to those of you who have been running as root… “go, and sin no more”! 😉
Just like every other application on linux … don’t run them as root 😀
I would say this summarizes it quiet good 😀
https://i.memecaptain.com/gend_images/37bQYQ.jpg
Ben suggested the complete text of this post could be:
> Seriously, don’t.
…but I thought I should expand on that a bit. 😉
Linux could be compared with Blender where are too many unknown things, so thanks Tyler for this post which looks like a flashlight into the dungeon.
sudo dont use sudo
Why do people run as root?
Because they are lazy, ignorant, or both.
*nix SysAdmin 20+ years
I’ve certainly been guilty of that laziness before! Can’t figure out what the permissions should be on this? Bam! chmod 777! 😉
I don’t know whether this is still current, but it sounds interesting as well: https://forums.opensuse.org/showthread.php/512349-Wrong-joystick-permissions
The same issue (still) applies and solution works for Ubuntu 14.04LTS and 16.0LTS and likely many other distros, too.
Here is my favored solution and it also explains why rudder pedal permissions usually go wrong: https://forums.x-plane.org/index.php?/forums/topic/110413-xp11-joystick-permissions/. It pretty much works for all ruder pedals on the market and also for most linux distributions – as long as you can find where the udev rule directory is.
Sorry for this off-topic post, but I really need to say this:
Thanks a lot for your now outstanding transparency at bug handling!
I filed a bug through the reporting system (false field elevation at KLAS scenery) and almost immediately received a confirmation mail by Jennifer with a link to the status page of this bug. Well, it was only changing one single digit in the apt.dat but hey, it was fixed within 5 hours only! This is impressive when reading what other items you’re working hard on.
I know it is extra work for Jennifer – sorry about this – but it is really cool to see how you internally prioritize bugs and how/when you deal with it. I really appreciate this!
It is really amazing how much you listen to your customers. This level of transparency and customer interaction is pretty rarely seen at other software companies!
Carry on with your amazing work.
Regards,
Marc
Glad to hear you had a good experience! We’re working on striking the right balance between communicating with people reporting bugs and, well, you know… fixing bugs. 🙂 Long-term, we have big plans for a public-facing X-Plane bug database (of the kind we run on the Gateway), which would be a massive upgrade in terms of feedback for reporters, but that requires major development time… development time that could otherwise be spent improving X-Plane. For the foreseeable future, our plan is to just keep working on our email game. 🙂
Present a box at software startup with big red letters explaining the matter, with links. Don’t allow for closing the box for sixty second countdown. Only after the countdown perform asset loading and any other functionality. Make sure closing the box in any way before the countdown end shuts down the entire process. Run the box inside the main process, not in a wrapper as to prevent tampering.
Great update, work almost flawless for me. And congrats for you communication policy, I find it really cool to read the blog and learn what’s going on with the product.
One question, will you include more updated airports from the gateway in future beta releases of 11.10? Ive seen many interesting updates that were uploaded at the end of October.
Keep up the great work
We will either do one more pull at the end of 11.10 or right after (e.g. 11.11 or 11.15).