[Bash on Windows] Getting dbus and X server working

[Origin]: https://www.reddit.com/r/Windows10/comments/4rsmzp/bash_on_windows_getting_dbus_and_x_server_working/

submitted 1 year ago * by ShaRose

So, most people who are using bash subsystem in the windows 10 insider builds seem to be aware that it’s possible to use X servers for windows such as vcxsrv or Xming, but most applications require the dbus service, which doesn’t work. This results in applications like Firefox or virt-manager (when ran in the linux subsystem) to crash either on launch or after a short time, and so it’s seen as fairly buggy.

However, the main application I wanted to run for this was virt-manager, because I wanted to be able to administrate qemu servers on windows without having to use a VM to run that. virt-manager needs a dbus server to even launch, so I started trying to get it running: And I succeeded. And surprisingly, it was fairly easy.

All that needed to be done (From a clean install of windows 10 with Bash installed, of course) was do three steps:

1) install an X server. vcxsrv and Xming are confirmed to both work just fine.

2) add DISPLAY=:0.0 to your bashrc: you can do this by executing the following command

echo "export DISPLAY=:0.0" >> ~/.bashrc

Now X programs will show the window correctly.

3) Now we need to fix dbus: The issue with this was that by default, dbus uses unix sockets to communication, which windows bash at the moment doesn’t support. So we just need to tell it to use tcp. In /etc/dbus-1/session.conf, you need to replace <listen>unix:tmpdir=/tmp</listen> with <listen>tcp:host=localhost,port=0</listen> and then you are done. Note this file needs root to edit. An easy way to do this is to execute the following:

sudo sed -i ‘s$&lt;listen&gt;.*&lt;/listen&gt;$&lt;listen&gt;tcp:host=localhost,port=0&lt;/listen&gt;$’ /etc/dbus-1/session.conf

And now close bash, and open it again. Feel free now to run whatever: Firefox and virt-manager work. Chrome sadly doesn’t for another reason of note.

Hope that helps someone.

How to Access Your Ubuntu Bash Files in Windows (and Your Windows System Drive in Bash)

Origin: https://www.howtogeek.com/261383/how-to-access-your-ubuntu-bash-files-in-windows-and-your-windows-system-drive-in-bash/

By Chris Hoffman on July 6th, 2016

Windows 10’s “Bash on Ubuntu on Windows” environment contains a few different components. The first time you run the bash.exe program, it will download and install an entire Ubuntu user space environment. You can access these files in File Explorer or other Windows programs, if you know where to look.

You can also access your Windows system drive–and any other drives on your computer–from within the Ubuntu Bash shell. This allows you to work with your normal Windows files using Linux command-line utilities.

Where the Ubuntu Bash Shell Files Are Stored in Windows

Note that each Windows user account that uses Bash will have its own separate Bash environment and files under its own user directory.

To access these files, you’ll first need to show hidden folders in File Explorer. Open a File Explorer window and click View > Options > Change Folder and Search Options.

In the Folder Options window that appears, select View > Show Hidden Files, Folders, and Drives.

Navigate to the following directory to find these folders:


The Ubuntu system files are stored at:


Your Ubuntu user account’s home folder is stored at:


The root account’s home folder is stored at:


Where Your Windows System Drive Appears in Bash

The Ubuntu Bash shell environment makes your full Windows system drive available so you can work with the same files in both environments. However, the Bash environment doesn’t just dump you in your C:\ drive. Instead, it places you in /, or the root directory you’d have on Linux. If you perform an ls command to view the contents of the directory, you’ll just see the Ubuntu directories that provide the Linux environment.

Your Windows system drive and other connected drives are exposed in the /mnt/ directory here, where other drives are traditionally made available in the Linux directory structure. Specifically, you’ll find the C: drive at the following in the Bash environment:


To change to this directory with the “cd” command, run the following command:

cd /mnt/c

If you have a D: drive, you’ll find it located at /mnt/d, and so on.

For example, to access a file stored at C:\Users\Chris\Downloads\File.txt, you’d need to use the path /mnt/c/Users/Chris/Downloads/File.txt in the Bash environment.

Note that, when accessing Windows system files, your Bash shell environment has the permissions it was launched with. If you launched it normally from the shortcut, it will have the same file access permissions your Windows user account does.

For example, if you want to access the C:\Users\Administrator folder, you’d need to right-click the Bash shell shortcut and select “Run as Administrator” to launch the Bash shell with Windows Administrator privileges.

This works just like the Command Prompt, which needs to be launched as Administrator if you need write access to Administrator-only files, or write access to system files. You can’t just use “sudo” in the Bash environment.