The officially official Devuan Forum!

You are not logged in.

#1 2020-09-12 16:26:51

Altoid
Member
Registered: 2017-05-07
Posts: 1,415  

openbox menu issue

Hello:

I'm (slowly) installing Devuan3 on a spare drive in my ascii box so I can eventually migrate without any headaches.
One of the things I want to do is use Openbox instead of Xfce of which I have grown rather tired.

I have it on a skeleton VM installation albeint on a single screen (vis-a-vis my 3-screen ascii)  and it works well enough form the time being.

I can start gparted there via lxterminal -e su - gparted but I would like to avoid using sudo.
Same with synaptic, which I keep to use as a GUI to look for applications as I am getting used to apt or apt-get.

So I try using lxterminal -e su - gparted but I only get a flicker on the screen.

My DM is SLiM and I wonder if this is not due to its starting X as root?

If I open the terminal and try to start gparted I get this:

~$ su -
Password: 
~# gparted

(gpartedbin:3660): Gtk-WARNING **: 16:23:29.432: cannot open display: 
~# 

Is there a way around this or do I have to install sudo and a set up sudoers?

Thanks in advance.

A.

Offline

#2 2020-09-12 17:20:05

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 3,125  
Website

Re: openbox menu issue

For gparted just run the wrapper script at /usr/sbin/gparted directly from the menu entry.

For synaptic run the /usr/bin/synaptic-pkexec wrapper script from the menu entry and also install a graphical polkit authentication agent such as mate-polkit and then add this line to ~/.config/openbox/autostart:

/usr/lib/x86_64-linux-gnu/polkit-mate/polkit-mate-authentication-agent-1 &

*Do not* use su or sudo to launch graphical applications with elevated permissions, it is stupid and dangerous.


Brianna Ghey — Rest In Power

Offline

#3 2020-09-12 20:06:21

Altoid
Member
Registered: 2017-05-07
Posts: 1,415  

Re: openbox menu issue

Hello:

Head_on_a_Stick wrote:

... run the wrapper script at /usr/sbin/gparted directly from the menu entry.

obmenu -> /usr/sbin/gparted in the 'Execute' box does not work.

Head_on_a_Stick wrote:

... install a graphical polkit authentication agent ...

Looking around I found /etc/xdg/autostart/polkit-gnome-authentication-agent-1.desktop and the the executable is there.

groucho@devuan3:~$ locate gnome-authentication-agent
/etc/xdg/autostart/polkit-gnome-authentication-agent-1.desktop
/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1
groucho@devuan3:~$ 

I also came upon lxpolkit on the web which in 2010 replaced gnome-polkit in LXDE.
Seems it is leaner and more suited to LXDE.

Head_on_a_Stick wrote:

*Do not* use su or sudo to launch graphical applications with elevated permissions, it is stupid and dangerous.

Good to know.
But it was the only way I got synaptic and gparted to run in my VM with Openbox.

I now have the same problem ...

Thanks for your input.

A.

Offline

#4 2020-09-12 21:35:39

F_Sauce
Member
From: Noreg
Registered: 2017-07-07
Posts: 87  

Re: openbox menu issue

Hello.

A bit on the side, but if you want to learn parted, from cli that is, you may find this useful: https://www.gnu.org/software/parted/manual/parted.html, it's not too hard really; neither is fdisk for that matter.

Olav

Offline

#5 2020-09-12 21:42:17

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 3,125  
Website

Re: openbox menu issue

Altoid wrote:

obmenu -> /usr/sbin/gparted in the 'Execute' box does not work.

Works for me. Do you see any error messages if you run /usr/sbin/gparted directly in a terminal?

Can we see

grep -A2 gparted ~/.config/openbox/menu.xml
Altoid wrote:

Looking around I found /etc/xdg/autostart/polkit-gnome-authentication-agent-1.desktop and the the executable is there.

But it's not being run:

/usr/lib/x86_64-linux-gnu/openbox-xdg-autostart --list
pgrep -a polkit

Brianna Ghey — Rest In Power

Offline

#6 2020-09-12 22:22:09

Altoid
Member
Registered: 2017-05-07
Posts: 1,415  

Re: openbox menu issue

Hello:

Head_on_a_Stick wrote:

... any error messages if you run /usr/sbin/gparted directly in a terminal?

Yes.

groucho@devuan3:~$ /usr/sbin/gparted
localuser:root being added to access control list
Error executing command as another user: No authentication agent found.
localuser:root being removed from access control list
groucho@devuan3:~$ 
groucho@devuan3:~$ su
Password: 
root@devuan3:/home/groucho# /usr/sbin/gparted
sh: 1: dmidecode: not found
======================
libparted : 3.2
======================

In this last instance, via su (not su -), gparted ran. 

root@devuan3:/home/groucho# su -
root@devuan3:~# /usr/sbin/gparted

(gpartedbin:2414): Gtk-WARNING **: 21:52:42.365: cannot open display: 
root@devuan3:~# 
Head_on_a_Stick wrote:

Can we see

grep -A2 gparted ~/.config/openbox/menu.xml

Of course ...

groucho@devuan3:~$ grep -A2 gparted ~/.config/openbox/menu.xml
		<item label="gparted">
			<action name="Execute">
				<execute>/usr/sbin/gparted</execute>
			</action>
		</item>
groucho@devuan3:~$ 
Altoid wrote:

Looking around I found /etc/xdg/autostart/polkit-gnome-authentication-agent-1.desktop and the the executable is there.

Head_on_a_Stick wrote:

But it's not being run:

/usr/lib/x86_64-linux-gnu/openbox-xdg-autostart --list pgrep -a polkit

Hmm ...

groucho@devuan3:~$ /usr/lib/x86_64-linux-gnu/openbox-xdg-autostart --list pgrep -a polkit

ERROR: openbox-xdg-autostart requires PyXDG to be installed

groucho@devuan3:~$ 

Interesting ...

But I previously ran apt-update, apt-upgrade and apt install -f and everything seemed to be right.

Seems the Openbox package needs to add this missing package to the depends list?

root@devuan3:~# apt update && apt upgrade && apt install -f
Hit:1 http://pkgmaster.devuan.org/merged beowulf InRelease
Hit:2 http://pkgmaster.devuan.org/merged beowulf-security InRelease
Hit:3 http://pkgmaster.devuan.org/merged beowulf-updates InRelease
Hit:4 http://pkgmaster.devuan.org/merged beowulf-backports InRelease
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@devuan3:~# 
groucho@devuan3:~$ su -
Password: 
root@devuan3:~# apt install python-xdg
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  python-xdg
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 35.9 kB of archives.
After this operation, 169 kB of additional disk space will be used.
Get:1 http://pkgmaster.devuan.org/merged beowulf/main amd64 python-xdg all 0.25-5 [35.9 kB]
Fetched 35.9 kB in 1s (35.7 kB/s)
Selecting previously unselected package python-xdg.
(Reading database ... 64424 files and directories currently installed.)
Preparing to unpack .../python-xdg_0.25-5_all.deb ...
Unpacking python-xdg (0.25-5) ...
Setting up python-xdg (0.25-5) ...
root@devuan3:~# 

Right, now that python-xdg is installed, we continue and get this:

groucho@devuan3:~$ /usr/lib/x86_64-linux-gnu/openbox-xdg-autostart --list pgrep -a polkit
[ ] 
	  File: /home/groucho/.config/autostart/xscreensaver.desktop
	* Excluded by: Missing Exec field

[*] 
	  File: /home/groucho/.config/autostart/xfce4-clipman-plugin-autostart.desktop
	  Executes: xfce4-clipman

[*] User folders update
	  File: /etc/xdg/autostart/xdg-user-dirs.desktop
	  Executes: xdg-user-dirs-update

[*] Wicd Network Manager Tray
	  File: /etc/xdg/autostart/wicd-tray.desktop
	  Executes: wicd-gtk --tray

[*] PulseAudio Sound System
	  File: /etc/xdg/autostart/pulseaudio.desktop
	  Executes: start-pulseaudio-x11

[ ] PolicyKit Authentication Agent
	  File: /etc/xdg/autostart/polkit-gnome-authentication-agent-1.desktop
	  Executes: /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1
	* Excluded by: OnlyShowIn (XFCE, Unity, X-Cinnamon)

[*] AT-SPI D-Bus Bus
	  File: /etc/xdg/autostart/at-spi-dbus-bus.desktop
	  Executes: /usr/lib/at-spi2-core/at-spi-bus-launcher --launch-immediately

[ ] gnome-disk-utility notification plugin for GNOME Settings Daemon
	  File: /etc/xdg/autostart/org.gnome.SettingsDaemon.DiskUtilityNotify.desktop
	  Executes: /usr/lib/gnome-disk-utility/gsd-disk-utility-notify
	* Excluded by: OnlyShowIn (GNOME)

[ ] Xfsettingsd
	  File: /etc/xdg/autostart/xfsettingsd.desktop
	  Executes: xfsettingsd
	* Excluded by: OnlyShowIn (XFCE)

groucho@devuan3:~$ 

I removed XFCE to see if I could just use Openbox, which is probably the cause of what is happening.

Thanks for your input.

Cheers,

A.

Offline

#7 2020-09-12 22:39:02

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 3,125  
Website

Re: openbox menu issue

Altoid wrote:
groucho@devuan3:~$ /usr/sbin/gparted
localuser:root being added to access control list
Error executing command as another user: No authentication agent found.
localuser:root being removed from access control list
groucho@devuan3:~$

So is the policykit-1 package installed?

Altoid wrote:
[ ] PolicyKit Authentication Agent
	  File: /etc/xdg/autostart/polkit-gnome-authentication-agent-1.desktop
	  Executes: /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1
	* Excluded by: OnlyShowIn (XFCE, Unity, X-Cinnamon)

That OnlyShowIn bit indicates that the program will only be autostarted for the listed desktops so you need to add this line to ~/.config/openbox/autostart:

/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 &

Both the policykit-1 package and a graphical authentication agent need to be running for a graphical password prompt to be presented.

Polkit is the modern way to run graphical applications with elevated privileges and minimises the security risks in comparison to su &sudo or gksu & gksudo (the latter two have been removed from beowulf because of the inherent risks).

It is possible to get gparted running with su but I'm not telling you how tongue


Brianna Ghey — Rest In Power

Offline

#8 2020-09-12 23:48:10

Altoid
Member
Registered: 2017-05-07
Posts: 1,415  

Re: openbox menu issue

Hello:

Head_on_a_Stick wrote:

So is the policykit-1 package installed?

Yes.
The gnome version.

Head_on_a_Stick wrote:

That OnlyShowIn bit indicates that the program will only be autostarted for the listed desktops ...
... policykit-1 package and a graphical authentication agent need to be running ...

Both gparted and synaptic are working now.

Would it be better to run lxpolkit instead of this one?

Head_on_a_Stick wrote:

Polkit is the modern way to run graphical applications ...
... minimises the security risks in comparison to su &sudo or gksu & gksudo.

Yes, I understand.

But the 'Custom actions' I hace set up in Thunar, such as "Edit as root" or "Open root Thunar here" use gksudo.

Command: gksu -l pluma %f and Command: gksu thunar %f in 'Edit' -> 'Configure custom actions ...'

How do I get them working with polkit?

Head_on_a_Stick wrote:

... gparted running with su but ...

Why would I want to do that?
It is stupid! 8-D!

Thanks for your input.

Cheers,

A.

Offline

#9 2020-09-13 02:06:53

Altoid
Member
Registered: 2017-05-07
Posts: 1,415  

Re: openbox menu issue

Hello:

Altoid wrote:

But the 'Custom actions' I hace set up in Thunar, such as "Edit as root" or "Open root Thunar here" use gksudo.

Command: gksu -l pluma %f and Command: gksu thunar %f in 'Edit' -> 'Configure custom actions ...'

How do I get them working with polkit?

Found it:  Command: pkexec -l pluma %f and Command: pkexec thunar %f in 'Edit' -> 'Configure custom actions ...'

A question remains:

Would it be better to run lxpolkit instead of gnome-polkit?

Thanks for your input.

Cheers,

A.

Offline

#10 2020-09-13 10:05:03

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 3,125  
Website

Re: openbox menu issue

Altoid wrote:

Command: gksu -l pluma %f and Command: gksu thunar %f in 'Edit' -> 'Configure custom actions ...'

A better solution for the editor might be to use gedit with the GVFS admin:// backend (gedit admin://%f), which can also be used with thunar in the latest (4.14) version (thunar admin://%f, not available for the beowulf package though).

Altoid wrote:

Would it be better to run lxpolkit instead of gnome-polkit?

Meh. Perhaps use ps_mem to see which one uses less memory but I really don't think it's critical.

Last edited by Head_on_a_Stick (2020-09-13 10:10:08)


Brianna Ghey — Rest In Power

Offline

#11 2020-09-13 22:12:08

Altoid
Member
Registered: 2017-05-07
Posts: 1,415  

Re: openbox menu issue

Hello:

Altoid wrote:

Found it:  Command: pkexec pluma %f ...

... does not work.

According to the xfce page it should work:

Edit file as root

Name: Edit as root
Command: gksu put-your-favourite-text-editor-here %f
File pattern: *
Appears if selection contains: Text files

Note: You'll need to replace put-your-favourite-text-editor-here with your favourite text editor (e.g. mousepad or geany). Also, see previous note about gksu.   -> Note: Some distributions no longer include gksu. Use pkexec instead.

https://docs.xfce.org/xfce/thunar/custo … le_as_root

What am I missing?

Thanks in advance,

A.

Offline

#12 2020-09-14 18:26:08

Head_on_a_Stick
Member
From: London
Registered: 2019-03-24
Posts: 3,125  
Website

Re: openbox menu issue

Altoid wrote:

What am I missing?

The pluma package doesn't supply a polkit rule so you'll have to roll your own, see /usr/share/polkit-1/actions/org.gnome.gparted.policy for an example of this.

Another alternative would be Command: x-terminal-emulator -e sudoedit %f and then add this line to ~/.config/openbox/environment:

export SUDO_EDITOR=pluma

That would open a terminal so that you could enter the user's password and then pluma would be run under sudoedit(8) which opens the GUI under the normal user and only invokes root privileges to actually save the file. This solution needs the sudo package but it is the best way (IMO).

Last edited by Head_on_a_Stick (2020-09-14 18:27:14)


Brianna Ghey — Rest In Power

Offline

Board footer