Error message when opening an application in WSL - linux

I'm getting this error message when opening an application in Windows Subsystem for Linux from the terminal:
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-adduser'
qt.qpa.screen: QXcbConnection: Could not connect to display
Could not connect to any X display.
Any ideas?

Wireshark will need to GUI to run in WSL and so you will be better off using the terminal version of wireshark which is tshark
https://www.wireshark.org/docs/man-pages/tshark.html
Install by running bash as administrator at Windows level and then executing the command:
sudo apt-get install tshark

Related

Failed to open X11 display - How to execute SFML output on WSL - Load WSL GUI apps

have any of you tried compile and executing SFML c++ project output on wsl?
I tried and got
Failed to open X11 display; make sure the DISPLAY environment variable is set correctly
Aborted
Is it possible at all to execute GUI applications through wsl?
(I've installed ubuntu's for wsl)
Linux distributions set up for WSL 1 will not function with Linux GUI applications, which are only supported with WSL 2.
Due to the official documentation from Microsoft regarding WSL, you might need to check these steps:
Select Start, type PowerShell, right-click Windows PowerShell, and then select Run as administrator.
after that type this command and then press enter:
wsl --update
You will need to restart WSL for the update to take effect. You can restart WSL by running the shutdown command in PowerShell.
wsl --shutdown
now, once again open powershell and type in this command:
wsl --list --verbose
You should see the number 2 for your installed distro under the heading VERSION in the response.
If everything went as planned until this point, see if your distro can open any windows by installing a GUI app like gedit and trying to open it:
sudo apt update
now install gedit:
sudo apt install gedit -y
After the installation has finished, launch gedit by typing gedit in your wsl terminal. A window from wsl inside of Windows should now open, and the issue should now be resolved.
find more information here:
https://learn.microsoft.com/en-us/windows/wsl/tutorials/gui-apps
If you had the same problem
first, you need to install VcXsrv and X11 for executing GUI applications through wsl
then you have to add these 2 to your environment variables:
export DISPLAY=:0
export LIBGL_ALWAYS_INDIRECT=0

How would you properly install MATLAB in ubuntu that is running on WSL2?

I want to install matlab in ubuntu 20.04, but I'm running ubuntu in WSL2 and it doesn't want to work.
I keep getting the error: terminate called after throwing an instance of 'framework::window::DisplayError what(): No. Display Avaliable.
I have the linux version of matlab unzipped in a folwer and I'm trying to instal it into the user files. Things I've tried to install it that were suggested for people having the same issue on other distros:
sudo ./install
./install
bash install
install
bash ./install
sudo bash ./install
sudo su and then doing ./install
export DISPLAY=:0.0 and then sudo ./install
bash ./install -v -inputFile installer_input.txt
It gives the same error for every one that I've tried.
Let me know if anyone has any solutions. Thanks.
Posting this to help out others in the future. It actually involved a few things to get this fully working properly:
1)Had to get a X Server
2)Had to change display settings in ubuntu to get it to recognize the X server and turn off some firewall features for Windows.
3)Had to when installing matlab install using the legacy install file instead of the normal install file

Can't stop automatic PostgreSQL start-up on WSL Ubuntu terminal open

I'm starting my coding journey and I have set up the Ubuntu terminal(WSL2). I followed this guide my cousin gave me and it included some directions to install PostgreSQL. I thought it would be a good idea to get it ahead of time, but now it's turning into a nightmare. I installed it and followed the directions to make it automatically connect to the server on the Ubuntu terminal start-up. Long story short, it makes the terminal take awhile to start-up, puts my terminal in some weird directory, and I won't even be using it, so we decided to get rid of it. We tried everything and finally decided to just uninstall it. Now on start-up, it's still trying to connect to the server or whatever. I tried running the code to make it automatically start-up again in case it might just toggle it on and off, but now it's attempting to connect three times on open. Please see the directions I used below as well as what my terminal is showing on start-up. Also, when I try commands to end it or whatever, it can't do it because postgresql can't be found (because I uninstalled it). Any thoughts?
Directions:
In a few weeks, we'll talk about SQL and Databases and you'll need something called PostgreSQL, an open-source robust and production-ready database.
Let's install it now.
sudo apt install -y postgresql postgresql-contrib libpq-dev build-essential
sudo /etc/init.d/postgresql start
sudo -u postgres psql --command "CREATE ROLE `whoami` LOGIN createdb;"
You can configure PostgreSQL to autostart, so you don't have to execute sudo /etc/init.d/postgresql start each time you open a new terminal:
sudo echo "`whoami` ALL=NOPASSWD:/etc/init.d/postgresql start" | sudo tee /etc/sudoers.d/postgresql
sudo chmod 440 /etc/sudoers.d/postgresql
echo "sudo /etc/init.d/postgresql start" >> ~/.zshrc
Error Code:
sudo: /etc/init.d/postgresql: command not found
sudo: /etc/init.d/postgresql: command not found
sudo: /etc/init.d/postgresql: command not found
➜ /home
Just remove the offending line from .zshrc.
Let me add that the Linux emulation of Windows cannot be used for serious work with a database, as it does not implement the vital system call fsync to persist data. Any operating system crash will result in data corruption.

Installing beanstalkd on a shared hosting account at Godaddy

I am trying to install beanstalkd (http://kr.github.io/beanstalkd/download.html) via the Linux Terminal on a shared hosting account at Godaddy.
The previous link gives commands that should install beanstalkd on the server. I use SSH (with PuTTy) to access the Linux Terminal. I have practically tried all the commands in the previous link and am consistently obtaining errors like:
sudo apt-get install beanstalkd
error message: -bash: sudo: command not found
brew install beanstalkd
error message: -bash: brew: command not found
su -c 'rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm'
su -c 'yum install beanstalkd --enablerepo=epel-testing'
error message: -bash: su: command not found
yaourt -S beanstalkd
error message: -bash: yaourt: command not found
I am not even sure what bash is exactly and if it is causing the problem, or if its because I'm using an SSH connection, or if it's really because the commands don't actually exist on the server (which would be strange because when I do man sudo or man su I do in fact get the complete manual of both commands in the terminal).
QUESTION: Why am I unable to run the previous commands to install beanstalkd on the linux server? Does it have to do with me using PuTTy (ssh connection)? What could I possibly do to get beanstalkd installed? Could it be because its shared hosting with Godaddy, and I might not have full power over the linux terminal?
SERVER INFO: When running cat /proc/version I obtain my linux distribution: Red Hat 4.4.7-16. I have a shared hosting account with Godaddy with a linux server hosting my site.
You have a RedHat distro, and they use rpm+yum for package management.
I see from yum search beanstalkd on my box that I can find it, but only on EPEL.
However, you have a really old version of RedHat, so can't just install the epel-release rpm, also, there doesn't seem to be a built version for RedHat 4.
If you had at least RedHat 5 you could do:
$ sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-5.noarch.rpm
$ sudo yum install beanstalkd
You may in fact have a restricted instance of batch...
You must go to your provider's interface and do the necessary to have root access. Have you tried something like explained here?
https://uk.godaddy.com/help/enable-adminroot-access-managed-or-fully-managed-12270
If it doesn't work for you, you may also try asking https://serverfault.com/ that seems more relevant for your case.

Xmanager not working on Centos

I am trying to take a gui session of a centos machine on my linux machine. I am receiving the following error:
Just type the following command :
yum install xorg-x11-xauth xterm
It will work.

Resources