[SOLVED] Unable to use "Exit" menu and mount USB as normal user.

You have a problem with Slackel? Post here and we'll do what we can to help.
Papasot
Posts: 231
Joined: 13 May 2016 22:32
Location: Patras, Greece

[SOLVED] Unable to use "Exit" menu and mount USB as normal user.

Post by Papasot »

Whenever I try to logout/shutdown, or in general use the "Exit" menu in Openbox, nothing happens as a normal user (works if I am logged in as root). Switching to console reveals the following message:

Code: Select all

dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the
remote application did not send a replay, the message bus security policy blocked the reply, the reply timeout expired,
or the network connection was broken.
Note that I don't use any display manager (the system boots at runlevel 3, then I start X-Windows whenever I need it). The problem appears both in 32-bit and 64-bit Slackel 7.2 Openbox installations.
It seems to me it the problem is related to a policy issue after a system update sometime in the recent past. The exact same user was able to use the "Exit" menu before, belongs to the same groups as before, and in general nothing concerning normal user privileges has been changed by me.
A probably similar problem is that, as a normal user, I cannot mount a USB stick - again, I was able to do that before. I have to mount the USB as root or via sudo.
Any ideas?
Last edited by Papasot on 07 Mar 2020 17:58, edited 1 time in total.
djemos
Site Admin
Posts: 676
Joined: 15 Apr 2016 06:03

Re: Unable to use "Exit" menu and mount USB as normal user.

Post by djemos »

about mount a usb stick.
insert a usb stick while on X. Then a window will appear saying "a removable media has plunged in". Clicking on OK, pcmanfm will mount and open the usb. Does this happen? What is the message appeared?
Look at /etc/polkit-1/rules.d/49-nopasswd_global.rules If the file exists.
Otherwise create it

Code: Select all

cat <<EOF >> "$RDIR/etc/polkit-1/rules.d/49-nopasswd_global.rules"
/* Allow members of the wheel group to execute any actions
 * without password authentication, similar to "sudo NOPASSWD:"
 */
polkit.addRule(function(action, subject) {
    if (subject.isInGroup("wheel")) {
        return polkit.Result.YES;
    }
});

/* Allow members of the polkitd group to execute any actions
 * without password authentication, similar to "sudo NOPASSWD:"
 */
polkit.addRule(function(action, subject) {
    if (subject.isInGroup("polkitd")) {
        return polkit.Result.YES;
    }
});
EOF
About exit. wm-logout has deps ConsoleKit2,dbus,python,upower.
Create a new user and try to log in and log out with this user. Also put user in wheel group so it will have root privileges.This is not done automatically at creation time since it is not the first user.
Maybe openbox settings file is broken. also try to reinstall wm-logout.
There are new files added on slackware current and others have been dropped. Look at slackware current ChangeLog.txt search for ADD and see what files added and replaced.
Also check your ~/.xinitrc file.

Code: Select all

#!/bin/sh

userresources=\$HOME/.Xresources
userdefaults=\$HOME/.Xdefaults
usermodmap=\$HOME/.Xmodmap
sysresources=/usr/lib/X11/xinit/.Xresources
sysmodmap=/usr/lib/X11/xinit/.Xmodmap
 
# merge in defaults and keymaps
[ -f \$sysresources ] && xrdb -merge \$sysresources
[ -f \$sysmodmap ] && xmodmap \$sysmodmap
[ -f \$userresources ] && xrdb -merge \$userresources
[ -f \$userdefaults ] && xrdb -merge \$userdefaults
[ -f \$usermodmap ] && xmodmap \$usermodmap

#Force OpenOffice.org to use GTK theme
export OOO_FORCE_DESKTOP=gnome

# start the openbox session, if possible attached to consolekit
if [ -e /usr/bin/ck-launch-session ] && [ -e /usr/bin/dbus-launch ]; then
	exec /usr/bin/ck-launch-session /usr/bin/dbus-launch /usr/bin/openbox-session
else
	exec /usr/bin/openbox-session
fi
It has to be the same with /etc/X11/xinit/xinitrc which is a link to /etc/X11/xinit/xinitrc.openbox
Papasot
Posts: 231
Joined: 13 May 2016 22:32
Location: Patras, Greece

Re: Unable to use "Exit" menu and mount USB as normal user.

Post by Papasot »

djemos wrote:about mount a usb stick.
insert a usb stick while on X. Then a window will appear saying "a removable media has plunged in". Clicking on OK, pcmanfm will mount and open the usb. Does this happen? What is the message appeared?
Look at /etc/polkit-1/rules.d/49-nopasswd_global.rules If the file exists.
Otherwise create it

Code: Select all

cat <<EOF >> "$RDIR/etc/polkit-1/rules.d/49-nopasswd_global.rules"
/* Allow members of the wheel group to execute any actions
...
EOF
Sorry, I should provide more information about this problem in the first place:
pcmanfm does see that a USB stick was inserted. However, when I try to mount it I get this message:

Code: Select all

Not authorized to perform operation (polkit authority not available and caller is not uid 0)
I can mount the USB if I run pcmanfm as root. The exact same things happen when using Worker (my favorite file manager). It clearly has to do with polkit. I tried to reinstall polkitd - no luck. Please note this happens with any user, including the first one, or new ones.
The file 49-nopasswd_global.rules was there already, and its contents is exactly the same as yours, except that "EOF" in the end is missing (apparently, an end-of-file signal). In a desperate attempt to fix the problem, I even tried to add that "EOF", and I would be surprised if it would work - It didn't.
djemos wrote:About exit. wm-logout has deps ConsoleKit2,dbus,python,upower.
Create a new user and try to log in and log out with this user. Also put user in wheel group so it will have root privileges.This is not done automatically at creation time since it is not the first user.
Maybe openbox settings file is broken. also try to reinstall wm-logout.
I tried all the above, and the problem persists.
All the dependencies for wm-logout were there, since I never touched them. I tried reinstalling wm-logout - problem persists. I tried to run wm-logout with the first user and new users, all members of the following groups:

Code: Select all

pap[~]$ groups
users lp wheel floppy audio video cdrom pulse plugdev power netdev polkitd scanner
No change - problem persists. It doesn't matter which user is trying to run wm-logout. It doesn't work for all of them. Please note that both my 32- and 64-bit Slackel systems were installed from scratch when version 7.2 was released, and everything worked flawlessly for quite some time. No change was made to the system by me since then, just the regular system updates.
My work on Slackel is mainly programming with gcc and Emacs, and secondary browsing the internet on trusty websites and with privacy measures. I don't mess with the system files. The only changes I did were completely harmless, namely I modified ~/.config/fbpanel/default and changed symlink /usr/share/icons/default to point to my favorite cursor theme (and those changes were made long before I started to have issues). The two problems started to appear after a slapt-get -u, slapt-get --upgrade, sometime ago (and that upgrade went normally as all other upgrades). In other words, the two problems I mention here happened all of a sudden and without me doing anything special.
djemos wrote:Also check your ~/.xinitrc file.

Code: Select all

#!/bin/sh
...
fi
It has to be the same with /etc/X11/xinit/xinitrc which is a link to /etc/X11/xinit/xinitrc.openbox
.xinitrc was untouched by me, its content is the same as yours, and identical to /etc/X11/xinit/xinitrc.openbox:

Code: Select all

pap[~]$ diff ~/.xinitrc /etc/X11/xinit/xinitrc.openbox
(no output - files are identical)
Surprisingly, the symbolic link /etc/X11/xinit/xinitrc was broken (and I am sure I didn't touch it). I restored it to point to /etc/X11/xinit/xinitrc.openbox.
djemos wrote:There are new files added on slackware current and others have been dropped. Look at slackware current ChangeLog.txt search for ADD and see what files added and replaced.
Now, this is the most tricky part. The changelog for 32-bit, for example, is huge, and I'm not sure how I can extract any useful information from it.
Since everything worked before, and I never did any change to the system myself other than normal updates, I am surprised I am the only one reporting this. It clearly happened after a system update, so I would expect most (if not all) Slackel users should be affected. The issues are not severe, so I kept doing my work for some time since I were busy. But even though they are not severe problems, they are still really annoying inconveniences, so I decided to do something to fix them. Judging from the error messages, my best bet is (a) the USB issue is related to a recent Slackware-Current change to polkit, and (b) the wm-logout issue is related to a change to DBus. Both are essential system components, and I never messed with them.
djemos
Site Admin
Posts: 676
Joined: 15 Apr 2016 06:03

Re: Unable to use "Exit" menu and mount USB as normal user.

Post by djemos »

I am trying to reproduce the problem. So i moved /etc/polkit-1/rules.d/49-nopasswd_global.rules file to /tmp and rebooted.
I plunged the usb stick and mounted successfully. But trying to mount other partitions i got a message from udisks2 package to type root's password. Then i moved /tmp/49-nopasswd_global.rules to /etc/polkit-1/rules.d/49-nopasswd_global.rules again and message disappeared.
So look if udisk2 package is installed also look at /etc/polkit-1/rules.d/ folder must contain these files be sure 49-nopasswd_global.rules file exists there.

Code: Select all

10-org.freedesktop.NetworkManager.rules  
20-plugdev-group-mount-override.rules	 
30-blueman-netdev-allow-access.rules
49-nopasswd_global.rules
50-default.rules
are these files installed ?

Code: Select all

polkit-0.116-x86_64-2
polkit-gnome-0.105-x86_64-2
polkit-kde-agent-1-9d74ae3_20120104git-x86_64-3
polkit-kde-kcmodules-1-001bdf7_20120111git-x86_64-3
polkit-qt-1-0.112.0-x86_64-2
dbus-1.12.16-x86_64-1        
dbus-glib-0.110-x86_64-2
dbus-python-1.2.16-x86_64-1
Now, this is the most tricky part. The changelog for 32-bit, for example, is huge, and I'm not sure how I can extract any useful information from it.
Since everything worked before, and I never did any change to the system myself other than normal updates, I am surprised I am the only one reporting this.
Go to Changelog and type ctrl-F on firefox and the type Add and see all packages added.
Do not go to the end look in february only.
for example fuse3, f2fs-tools I do not know if these needed.
I have upgraded to latest today packages and i do not have any problem with usb or partitions mounted from pcmanfm.
I cannot reproduce the problem. Maybe something is missing.
When this happened? After latest upgrade and if you remember there were a lot of files upgraded? Look at /var/log/removed_packages/ to see what latest files upgraded.

Also see if output is the same

Code: Select all

ls -ld /usr/lib/polkit-1/polkit-agent-helper-1  /usr/bin/pkexec* /etc/polkit-1/rules.d /usr/share/polkit-1/rules.d/
drwx------ 2 polkitd root 4096 Μαρ   7 13:59 /etc/polkit-1/rules.d
-rwsr-xr-x 1 root    root    0 Μαρ   7 14:44 /usr/bin/pkexec
-rwsr-xr-x 1 root    root    0 Μαρ   7 14:44 /usr/lib/polkit-1/polkit-agent-helper-1
drwx------ 2 polkitd root 4096 Φεβ  15 22:39 /usr/share/polkit-1/rules.d/
djemos
Site Admin
Posts: 676
Joined: 15 Apr 2016 06:03

Re: Unable to use "Exit" menu and mount USB as normal user.

Post by djemos »

Look in /etc/polkit-1/rules.d if there are .new files. Maybe these need to update old files. For example 20-plugdev-group-mount-override.rules.new
Papasot
Posts: 231
Joined: 13 May 2016 22:32
Location: Patras, Greece

Re: Unable to use "Exit" menu and mount USB as normal user.

Post by Papasot »

First of all, thank you Dimitri for trying to reproduce the problem in order to help me. The following is the additional information I gathered, as you requested,
djemos wrote:So look if udisk2 package is installed also look at /etc/polkit-1/rules.d/ folder must contain these files be sure 49-nopasswd_global.rules file exists there.

Code: Select all

10-org.freedesktop.NetworkManager.rules  
20-plugdev-group-mount-override.rules	 
30-blueman-netdev-allow-access.rules
49-nopasswd_global.rules
50-default.rules
udisks2 is installed. The following files are in /etc/polkit-1/rules.d/ folder:

Code: Select all

root[rules.d]# ls -l /etc/polkit-1/rules.d/
total 16
-rw-r--r-- 1 root root 189 Mar 26  2016 10-org.freedesktop.NetworkManager.rules
-rw-r--r-- 1 root root 461 Mar 26  2016 20-plugdev-group-mount-override.rules
-rw-r--r-- 1 root root 509 Mar  7 13:34 49-nopasswd_global.rules
-rw-r--r-- 1 root root 324 Feb 15 21:30 50-default.rules
As you can see, the file 30-blueman-netdev-allow-access.rules is missing in my installations, but I read that's related to bluetooth access via dbus, another thing I never used. I am not sure which package installs that file. The crucial file, 49-nopasswd_global.rules, is there and its contents is the same as in your previous post.
djemos wrote:are these files installed ?

Code: Select all

polkit-0.116-x86_64-2
polkit-gnome-0.105-x86_64-2
polkit-kde-agent-1-9d74ae3_20120104git-x86_64-3
polkit-kde-kcmodules-1-001bdf7_20120111git-x86_64-3
polkit-qt-1-0.112.0-x86_64-2
dbus-1.12.16-x86_64-1        
dbus-glib-0.110-x86_64-2
dbus-python-1.2.16-x86_64-1
The polkit package and all dbus-related packages are installed. The following 4 packages are not installed:

Code: Select all

polkit-gnome-0.105-x86_64-2
polkit-kde-agent-1-9d74ae3_20120104git-x86_64-3
polkit-kde-kcmodules-1-001bdf7_20120111git-x86_64-3
polkit-qt-1-0.112.0-x86_64-2
I installed the first one, polkit-gnome-0.105-x86_64-2; nothing changed, problems persist. I doubt the other three are needed, since they are related to KDE/Qt, and I only use Openbox, which is GTK-based. Nothng related to KDE was ever used in those Slackel machines, and the only package installed that needs Qt4 is cmake (and that just for the Qt-based Cmake GUI, which I never use anyway). I can install those 3 remaining packages, but they have lots of KDE-related dependencies. If you think installing them may do the difference I will keep notes of all extra dependencies installed so I can get rid of them, if they don't fix the problems.
djemos wrote:When this happened? After latest upgrade and if you remember there were a lot of files upgraded? Look at /var/log/removed_packages/ to see what latest files upgraded.
The problem is that I don't remember when exactly I started to have issues with USB and wm-layout. Most probably, it was in January. I was quite busy developing applications with gcc on Slackel, and since the problem was not fatal, I postponed fixing it for later. Big mistake... I won't do it again. Because of that mistake it is pretty hard to narrow the Slackware-Current changelog right now.
Now, the folder /var/removed_packages you mentioned might help. It has lots of files. The following are related to polkit:

Code: Select all

root[removed_packages]# ls -l *polkit*
-rw-r--r-- 1 root root 7112 Apr 21  2018 polkit-0.113-i586-4-removed-2019-01-27,02:35:27
-rw-r--r-- 1 root root 8423 Jan 27  2019 polkit-0.115-i586-1-upgraded-2019-12-19,19:00:07
-rw-r--r-- 1 root root 8518 Dec 19 19:00 polkit-0.116-i586-1-upgraded-2020-03-06,20:43:35
and the following are related to dbus:

Code: Select all

root[removed_packages]# ls -l *dbus*
-rw-r--r-- 1 root root 4374 Aug 22  2018 dbus-1.12.10-i586-1-removed-2019-01-27,01:49:24
-rw-r--r-- 1 root root 4345 Jan 27  2019 dbus-1.12.12-i586-1-removed-2019-01-27,01:51:48
-rw-r--r-- 1 root root 4345 Jan 27  2019 dbus-1.12.12-i586-1-upgraded-2019-05-26,18:47:01
-rw-r--r-- 1 root root 4343 May 26  2019 dbus-1.12.14-i586-1-upgraded-2019-07-29,10:27:57
-rw-r--r-- 1 root root 2724 Apr 21  2018 dbus-glib-0.110-i586-2-upgraded-2019-05-27,18:42:47
-rw-r--r-- 1 root root 7944 Sep  4  2019 dbus-python-1.2.10-i586-1-upgraded-2019-10-28,18:44:19
-rw-r--r-- 1 root root 7909 Oct 28 18:44 dbus-python-1.2.12-i586-1-upgraded-2019-12-19,18:35:50
-rw-r--r-- 1 root root 7909 Dec 19 18:35 dbus-python-1.2.14-i586-1-upgraded-2020-01-23,20:14:40
-rw-r--r-- 1 root root 7944 Jul 17  2018 dbus-python-1.2.8-i586-1-upgraded-2019-03-20,17:41:10
-rw-r--r-- 1 root root 7935 Mar 20  2019 dbus-python-1.2.8-i586-2-upgraded-2019-09-04,11:29:03
As you can see, they are all files that were upgraded during one of the system upgrades. The timestamps might be useful though, I am currently trying to gather any helpful information from Slackware-Current changelog based on those timestamps.
djemos wrote:Also see if output is the same

Code: Select all

ls -ld /usr/lib/polkit-1/polkit-agent-helper-1  /usr/bin/pkexec* /etc/polkit-1/rules.d /usr/share/polkit-1/rules.d/
drwx------ 2 polkitd root 4096 Μαρ   7 13:59 /etc/polkit-1/rules.d
-rwsr-xr-x 1 root    root    0 Μαρ   7 14:44 /usr/bin/pkexec
-rwsr-xr-x 1 root    root    0 Μαρ   7 14:44 /usr/lib/polkit-1/polkit-agent-helper-1
drwx------ 2 polkitd root 4096 Φεβ  15 22:39 /usr/share/polkit-1/rules.d/
I get the same files as output, but note the sizes of pkexec and polkit-agent-helper-1:

Code: Select all

pap[~]$ ls -ld /usr/lib/polkit-1/polkit-agent-helper-1  /usr/bin/pkexec* /etc/polkit-1/rules.d /usr/share/polkit-1/rules.d/
drwx------ 2 polkitd root  4096 Mar  7 17:01 /etc/polkit-1/rules.d
-rwsr-xr-x 1 root    root 22124 Feb 15 21:30 /usr/bin/pkexec
-rwsr-xr-x 1 root    root 13752 Feb 15 21:30 /usr/lib/polkit-1/polkit-agent-helper-1
drwx------ 2 polkitd root  4096 Feb 15 21:30 /usr/share/polkit-1/rules.d/
djemos wrote:Look in /etc/polkit-1/rules.d if there are .new files. Maybe these need to update old files. For example 20-plugdev-group-mount-override.rules.new
No *.new files in /etc/polkit-1/rules.d
djemos
Site Admin
Posts: 676
Joined: 15 Apr 2016 06:03

Re: [SOLVED] Unable to use "Exit" menu and mount USB as normal user.

Post by djemos »

I agree. There is no need to install these packages polkit-kde-agent-1-9d74ae3_20120104git-x86_64-3, polkit-kde-kcmodules-1-001bdf7_20120111git-x86_64-3, polkit-qt-1-0.112.0-x86_64-2

I cannot think what is the problem. I suggest that you can mount through pcmanfm other partitions and problem is only related to usb sticks.
It is really strange and i cannot imagine what is wrong since i cannot reproduce the problem.
Papasot
Posts: 231
Joined: 13 May 2016 22:32
Location: Patras, Greece

Re: [SOLVED] Unable to use "Exit" menu and mount USB as normal user.

Post by Papasot »

Both problems solved. I will post what I did in case someone else encounters the same issues.
The folder /var/removed_packages was the key. Using timestamps related to polkit I was able to narrow Slackware-Current changelog drastically. And look what I found:

Code: Select all

Wed Dec 11 21:03:27 UTC 2019
...
l/mozjs52-52.9.0esr-i586-2.txz:  Removed.
  This was used only by polkit-0.115.
l/mozjs60-60.9.0esr-i586-1.txz:  Added.
  This is needed for polkit-0.116
l/polkit-0.116-i586-1.txz:  Upgraded.
...
Note the record this is needed for polkit-0.116. I installed the package mozjs60 (mozjs60-60.9.0esr-i586-1.txz) and that was it. I was able to mount USB sticks just as before and without any issues. Now, I started looking for a similar clue concerning DBus, but I couldn't find any. And guess what, It was not needed. After rebooting, wm-logout also works as before. I did something similar for my Slackel 64-bit installation. No problems whatsoever. Thank you Dimitri for your invaluable help!

Now, mozjs60 is just Mozilla's Javascript engine. I would never guess that is needed for polkit to work properly. As for wm-logout, I am guessing what I was initially suspecting was true. Judging from the error messages I was getting and the fact both problems (USB and wm-logout) started to appear at the same time, I was suspecting the two problems are related somehow. That is also the reason I posted both problems in the same thread. It seems to be true: polkit wasn't working, and since it is related to user privileges, it prevented normal users to have access to DBus (or, more precisely, it limited access to DBus). That's why wm-logout wasn't working either (see the error messgae while trying to run wm-logout in the first post).

Conclusions: (1) Never underestimate a Javascript engine; If the proper version is not installed, it can cause more problems than what you might think. (2) When using a rolling distribution, never leave fixing a problem for later, even if it is not a serious one. The more you delay it, the more effort it might need to be fixed.

Recommendation to djemos: Since Slackware doesn't have dependency resolution, I guess it is a good idea to add mozjs60 as a dependency for polkit-0.116?
djemos
Site Admin
Posts: 676
Joined: 15 Apr 2016 06:03

Re: [SOLVED] Unable to use "Exit" menu and mount USB as normal user.

Post by djemos »

Recommendation to djemos: Since Slackware doesn't have dependency resolution, I guess it is a good idea to add mozjs60 as a dependency for polkit-0.116?
Done.

When i do an upgrade in slackware current i always look at Changelog to see what files added and removed. Because if i do not then it will be more difficult to solve a problem.
Since you found the problem, all are fine. :D
Papasot
Posts: 231
Joined: 13 May 2016 22:32
Location: Patras, Greece

Re: [SOLVED] Unable to use "Exit" menu and mount USB as normal user.

Post by Papasot »

I am still wondering why no version of mozjs was installed on my 32-bit system. On the other hand, the previous outdated version, mozjs52, was still installed on the 64-bit system - and it wasn't upgraded to mozjs60 when I did a system update. Weird.
djemos wrote:
Since you found the problem, all are fine. :D
I wouldn't find the reason of the problem without your help. Thank you again.
Post Reply