User VMPlayer as root

i hope the question is well placed here. If not please let me know.

May problem:
I have installed VMPlayer on openSuse Leap 15.1
It runs well in common user case.
But I have to add a physical device to my VM and this is only possible if I run it as root.

I tried sudo vmplayer & and this cause me in a mystic error message:

DISPLAY is not set, unable to open the VMware Player user interface.

This confuse me because in user mode it run well.

I tried kdesu but then the VM is not reachable because the USB drive is not shown.

Any idea how I can run VMPlayer as root without rocket science knowledge?

Your “mystery” error is just what kdesu is for. Setting the DISPLAY variable to it’s proper value.

But it also hide all connected devices. So nothing helpful as I wrote. My question targets more into:
Why a user can start a software well and a root user (Admin) not. I understand it vice versa but not this way.

So how I can fix it that sudo allow me to start VMPlayer as root?

I guess the VM here is a Virtual Machine. In which case this should have been in the Virtualization. Maybe there people understand why you not able to use hardware in the way you want it.

And a more general answer to your question is that this is not about root not being able to detect your DISPLAY, every other user (except of course the one that runs the GUI at that moment in time) would experience the same.
A GUI program is started. A GUI program needs a display to have a window created on it. Unix/Linux is a multi-user and multi-session operating system. Thus many users can be logged in in the GUI, all having using (logical) displays. Thus you have to tell the GUI program on which display it should open. That is defined by the DISPLAY variable. Of course the DISPLAY variable is set for programs running already on a display from the start and they inherit that value from each other. But another user running from another (CLI) session does not have it defined.

For the probably only session on a PCs screen the value is mostly DISPLAY=:0. But setting it will not help directly because the display owner must allow other sessions/users to open on their display. You, as a user probably do not want that others open windows (maybe invisible with a keyboard/mouse tracker) on you display.

What kind of physical device are you adding?
If it’s storage (eg a direct connected storage) or a network device, if you reboot doesn’t your HostOS system and VMware Player recognize the new device and automatically access it?
Remember, the HostOS recognizes the new hardware, but ordinarily the Guest does not access any hardware directly… Guests access nearly all hardware through virtualized devices, so you may need to “Add…” a new virtual device in the Guest configuration settings and point to your hardware.

In other words, you should not need to have root permissions to do anything… With your usual permissions, you should be able to “Add…” whatever device is needed to the Guest configuration.

TSU