GWSL-Source icon indicating copy to clipboard operation
GWSL-Source copied to clipboard

Getting DBUS to work?

Open Andrew-J-Larson opened this issue 4 years ago • 6 comments

Also I noticed something in https://github.com/Opticos/GWSL-Source/blob/master/assets/GWSL_helper.sh:

Is there a reason for the double slashes at lines 114 and 117?:

...
113		echo "injecting dbus into .profile"
114		sed -i.bak '//etc/init.d/dbus start/d' ~/.profile
115		echo "sudo /etc/init.d/dbus start" >> ~/.profile
116		
117		sed -i.bak '//etc/init.d/dbus start/d' ~/.bashrc
118		echo "sudo /etc/init.d/dbus start" >> ~/.bashrc
...

Andrew-J-Larson avatar Apr 15 '21 23:04 Andrew-J-Larson

I am not sure about what to do with the dbus button. I think I did it wrong and wonder if it works for that many people. Can you think of other ways to make it work? Also, I will push the changes I made to the helper.sh file soon. They are mid-progress but closer to working.

Pololot64 avatar Apr 16 '21 00:04 Pololot64

I actually did find my own way to get it automatically started, but it requires using the /etc/profile.d/ directory and creating/adding a script to be called with sudo for all nopass. I'll relay the details if you think it would be better.

Andrew-J-Larson avatar Apr 16 '21 01:04 Andrew-J-Larson

Made a script ...

at /usr/local/bin/gwsl-fix-dbus.sh

#!/bin/bash

ps -e | grep -q "dbus\-daemon"
if [ $? -eq 1 ]; then
  service dbus start > /dev/null 2>&1
fi

Then ran sudo chown root: /usr/local/bin/gwsl-fix-dbus.sh and sudo chmod 755 /usr/local/bin/gwsl-fix-dbus.sh

Made a second script ...

at /etc/profile.d/gwsl-fixes.sh

#!/bin/bash

sudo /usr/local/bin/gwsl-fix-dbus.sh

Then ran sudo chown root: /etc/profile.d/gwsl-fixes.sh and sudo chmod 777 /etc/profile.d/gwsl-fixes.sh

Lastly, edited sudoers ...

via sudo visudo and added the following line

# Fixes GWSL dbus not starting issue
ALL ALL=(root) NOPASSWD: /usr/local/bin/gwsl-fix-dbus.sh

And then optionally restart Ubuntu, or start up another session (via an app or terminal)

This may be helpful to script the visudo part.

Andrew-J-Larson avatar Apr 16 '21 20:04 Andrew-J-Larson

The main advantage of this is, it doesn't rely having to be put in every user's profile, and it should start up only when it needs to, and every time ubuntu gets started.

Not sure how much of my scripts can be used in other distros though.

Andrew-J-Larson avatar Apr 16 '21 20:04 Andrew-J-Larson

Thanks! Hmm. I'll look into it. I don't really want to edit sudoers so I currently just ask for the password every time a shortcut uses dbus. I gtg afk

Pololot64 avatar Apr 16 '21 20:04 Pololot64

No problem 👌🏻

Andrew-J-Larson avatar Apr 16 '21 22:04 Andrew-J-Larson