rootkiwi / an2linuxserver

Sync Android notifications encrypted to a Linux desktop
Other
402 stars 43 forks source link

Dbus problem with an2linux running as a user service #61

Closed LinuxOnTheDesktop closed 4 years ago

LinuxOnTheDesktop commented 4 years ago

Hello! Yesterday I pulled the most recent changes from your git and today I have a problem. It is possible though that something else is causing the problem.

The problem is as follows. I have an2linux installed as a user service under the dreaded systemd. I have a bash script that does

su -c systemctl --user is-enabled anlinux <my username>

And it used to work. Now, though, it generates: Failed to connect to bus: No such file or directory.

Also, I see, now, this:

$ su
# systemctl --user is-enabled an2linux
Failed to connect to bus: Operation not permitted

I do not have any other user services, and I do not know enough about systemd to easily set up another such service; so, the situation is hard for me to test. But I post this here just in case you've made a relevant change to the code within the last few weeks or months - a change that might have caused the problem.

An2linux still works, though. It is just that I cannot check its status when I am not my normal user (and, for involved and boring reasons, I do in fact need to be able to do that).

My system: Linux Mint 19.3 Cinnamon x64; kernels 5.7 and 5.3. (I have the problem on both kernels.)

rootkiwi commented 4 years ago

Hello!

No changes here that I know of that would impact this.

I can not be of much help with systemd sorry. But the following long command seems to work as root to check the status of my systemd user service.

export YOUR_USER=LinuxOnTheDesktop                                          && \
export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u $YOUR_USER)/bus && \
su -c "systemctl --user is-enabled an2linux" $YOUR_USER

On ArchLinux DBUS_SESSION_BUS_ADDRESS is on my system for my normal user the following:

unix:path=/run/user/1000/bus

On other distros it may be something else so that may need to be changed.

LinuxOnTheDesktop commented 4 years ago

Brilliant. Thank you very much. That works. I do not know why suddenly I had the problem - that is, why, previously it worked without the 'exports' and now suddenly it needs the exports. But, with those exports, it works.

rootkiwi commented 4 years ago

Yeah strange indeed. Glad that it worked.