FS#34166 - [unetbootin] Various fixes

Attached to Project: Community Packages
Opened by Balló György (City-busz) - Wednesday, 06 March 2013, 07:01 GMT
Last edited by Alexander F. Rødseth (xyproto) - Sunday, 17 March 2013, 10:34 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Alexander F. Rødseth (xyproto)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

I would like to propose the following changes in unetbootin packaging (see the attachment):

- Use pkexec only in the desktop file. There is no reason to modify the binary name, since command line users could able to run as root either with 'pkexec unetbootin' or 'sudo unetbootin'.

- Move polkit-gnome to opdepends, since it's only needed to launch unetbootin from menu. And GNOME Shell and KDE users are don't need to install this package, since they contain an authentication agent.

- Use --disable-internal-agent option on pkexec to avoid X freeze in case of no graphical authentication agent available.

- Remove desktop-file-utils dependency and update-desktop-database from install file, because the unetbootin.desktop file does not contain MIME types.

- Use xdg-icon-resource instead of gtk-update-icon-cache, so we can remove this dependency.

- It looks for me that xorg-xmessage is not used by unetbootin, so remove it from depends.
This task depends upon

Closed by  Alexander F. Rødseth (xyproto)
Sunday, 17 March 2013, 10:34 GMT
Reason for closing:  Fixed
Comment by Alexander F. Rødseth (xyproto) - Wednesday, 06 March 2013, 16:21 GMT
I like these suggestions, I'll implement them. Thank you.
Comment by Alexander F. Rødseth (xyproto) - Friday, 08 March 2013, 22:16 GMT
After applying the diff, building and installing, unetbootin does not start from the menu here anymore.

polkit-gnome is installed.

My windowmanager is PekWM, and I'm using xfce4-panel for testing if GUI-applications starts from the menu.

I really like the intention behind these changes, so hopefully there is a way to fix this.
Comment by Balló György (City-busz) - Friday, 08 March 2013, 23:30 GMT
Oh, it's a bug in xfce4-panel:
Upstream report: https://bugzilla.xfce.org/show_bug.cgi?id=9373
Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=690339
Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=879922

But there is an easy workaround: add the following line to the end of the package() function:
echo 'StartupNotify=true' >> "${pkgdir}/usr/share/applications/unetbootin.desktop"
Comment by Balló György (City-busz) - Saturday, 09 March 2013, 10:09 GMT
I tested in some desktop environments, and the results are:
- GNOME Shell: works well both from the menu and with the Alt+F2 launcher
- GNOME Panel (in fallback mode): works well both from the menu and with the Alt+F2 launcher
- Cinnamon: works well from the menu, but doesn't work with the Alt+F2 launcher
- Unity: doesn't work either from the menu or with the Alt+F2 launcher
- Xfce: works from the menu with the 'StartupNotify' workaround, but doesn't work the Alt+F2 launcher
- LXDE: doesn't work either from the menu or with the Alt+F2 launcher

File managers, which could able to launch applications from .desktop files:
- Nautilus: doesn't work
- Nemo: doesn't work
- Thunar: works with the 'StartupNotify' workaround
- PCManFM: doesn't work

I haven't tested KDE, but as shown above, you are right, the wrapper script needs to be preserved, because many app launchers unable to handle pkexec directly.

In  FS#34168 , I requested to remove this wrapper script from gparted, but it was a mistake. But we need a consistent naming for these wrapper scripts. Other affected packages: gsmartcontrol, wifi-radar.
Comment by Balló György (City-busz) - Sunday, 10 March 2013, 05:21 GMT
I attached an updated diff file which keeps the wrapper script, and works in all DEs and file managers that I tested above.
Comment by Alexander F. Rødseth (xyproto) - Sunday, 10 March 2013, 11:58 GMT
Thanks for your work and for investigating this so thoroughly!

I have created "ponysu" for having a consistent way of running GUI applications: https://aur.archlinux.org/packages/ponysu/

It has a sligthly silly name, but I could give it a better one and move it to [community] if several packages could use it and if you think it's a good idea.

I'll look at the new patch too.
Comment by Balló György (City-busz) - Monday, 11 March 2013, 04:31 GMT
I see two problems with ponysu:

1. polkit added as a dependency, which results that the first condition (pkexec) is always true.

2. pkexec is not always enough to run the command, because if the user launch the application from application menu or Alt+F2 launcher, and no graphical authentication agent available, then it's unable to get password, and freezes the X server. So we need these checks:

a) Am I launched from a terminal emulator? Okay, then I can use the command line authentication agent of polkit.

b) Am I launched from somewhere else? Then check if a graphical authentication agent available and run (e.g. GNOME Shell, KDE, polkit-gnome, lxpolkit). If yes, then I can use pkexec. If not, I should fall back to something else (e.g. gksudo, kdesu).
Comment by Alexander F. Rødseth (xyproto) - Monday, 11 March 2013, 13:20 GMT
Good ideas, I'll try to implement them. Feel free to fork ponysu too, if you want to. :)
Comment by Alexander F. Rødseth (xyproto) - Friday, 15 March 2013, 21:27 GMT
Ok, created "guisu", does it work for you? https://github.com/xyproto/ponysu/tree/guisu

Do you think lxpolkit should be supported too, even though it's not in the repos?
Comment by Balló György (City-busz) - Saturday, 16 March 2013, 17:44 GMT
No, I still found various problems. I attached a rewritten guisu, which works for me in all cases. Major changes:
- Check if a polkit authentication agent is already running first, and don't try to launch an another one in this case.
- polkit-gnome-authentication-agent-1 is too long for pgrep, check for ^polkit-gnome instead.
- We should wait some time after a polkit authentication agent started to register itself.
- Add support for LXPolkit.
- pkttyagent doesn't need to be started manually.
- gksudo is only a symlink to gksu, so don't check it.
- polkit-kde is a dependency of KDE, so kdesudo and kdesu are never used, and they are not in the official repos. Don't use it.
- Use sudo if no polkit or gksu available, but we are in terminal.
- Always exit when we start an authentication, otherwise the user gets the authentication form multiple times, when he cancel the authentication.

I added an LXPolkit package into AUR, and I would like to move it into the [community] repository in the future:
https://aur.archlinux.org/packages/lxpolkit/
   guisu.sh (2.4 KiB)
Comment by Alexander F. Rødseth (xyproto) - Saturday, 16 March 2013, 21:03 GMT
Nice work, thank you!

Added your changes here: https://github.com/xyproto/guisu

However, I got this message when running guisu (that were running pkexec) from a terminal:

"""
Error executing command as another user: Not authorized
This incident has been reported.
"""

After changing the script to use "&& exit 0" instead of exit on a separate line, the fallbacks kicked in, so now it works for me too.

I also uploaded guisu to [community].

If everything works for you as well now, I'll change unetbootin to use guisu.

+1 for moving lxpolkit from AUR to [community].
Comment by Balló György (City-busz) - Saturday, 16 March 2013, 21:14 GMT
No, it should not fall back with '&& exit 0', because if the user cancel the authentication, it return false, and the user get another authentication. How did you get this message? Which step fails?

EDIT: maybe polkitd is not running?
Comment by Alexander F. Rødseth (xyproto) - Saturday, 16 March 2013, 21:23 GMT
When using PekWM, then using urxvt, then trying to start /usr/bin/unetbootin.elf with guisu, I get that message. Polkit is installed, but I don't think any agent is running. I'll check.

It's at this step:
pkexec --disable-internal-agent "$ELF" "$ARGS"
Comment by Alexander F. Rødseth (xyproto) - Saturday, 16 March 2013, 21:30 GMT
It was a problem with permissions on my system. It works now. (polkitd was running).

Updated the git repo to use exit 0 on separate lines again. Updated the guisu package and changed unetbootin in svn.

Would you mind testing if the newly released version of unetbootin (pkgrel 5) works for you? If it does, I'll close this bug.

Thank you.
Comment by Alexander F. Rødseth (xyproto) - Sunday, 17 March 2013, 10:34 GMT
Just to sum everything up, there's guisu here, that you now has full commit access to [0], there's the guisu package [1] and a new release of unetbootin that uses the guisu package [2].

Closing this bug. Please reopen if this should still be an issue.

[0] https://github.com/xyproto/guisu
[1] https://projects.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/guisu
[2] https://projects.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/unetbootin

Loading...