patriziobruno / grubreboot-gnome-shell-extension

gnome-shell extension to add a "Reboot" button to the end-session-dialog, that runs grub-reboot before restart
GNU General Public License v3.0
22 stars 8 forks source link

Permission denied to access /boot/efi #10

Open muradm opened 7 years ago

muradm commented 7 years ago

should be using sudo or alike?...

Dec 30 21:58:26 muradm-lws1 gnome-session-binary[1437]: GLib-GObject-CRITICAL: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
Dec 30 21:58:27 muradm-lws1 gnome-session[1437]: (gnome-shell:1624): GLib-GObject-WARNING **: /build/glib2.0-7IO_Yw/glib2.0-2.48.1/./gobject/gsignal.c:2635: instance '0x65913a0' has no handler with id '34262'
Dec 30 21:58:27 muradm-lws1 gnome-session[1437]: (gnome-shell:1624): St-CRITICAL **: st_widget_get_theme_node called on the widget [0x29ef790 StBin.popup-menu-boxpointer popup-menu] which is not in the stage.
Dec 30 21:58:27 muradm-lws1 gnome-session[1437]: (gnome-shell:1624): Gjs-WARNING **: JS ERROR: Gio.IOErrorEnum: Error opening directory '/boot/efi': Permission denied
Dec 30 21:58:27 muradm-lws1 gnome-session[1437]: findFile@/home/muradm/.local/share/gnome-shell/extensions/grubreboot@desertconsulting.net/extension.js:162
Dec 30 21:58:27 muradm-lws1 gnome-session[1437]: getFile@/home/muradm/.local/share/gnome-shell/extensions/grubreboot@desertconsulting.net/extension.js:151
Dec 30 21:58:27 muradm-lws1 gnome-session[1437]: populatePopup@/home/muradm/.local/share/gnome-shell/extensions/grubreboot@desertconsulting.net/extension.js:131
Dec 30 21:58:27 muradm-lws1 gnome-session[1437]: enable/button.action@/home/muradm/.local/share/gnome-shell/extensions/grubreboot@desertconsulting.net/extension.js:78
Dec 30 21:58:27 muradm-lws1 gnome-session[1437]: enable/Main.EndSessionDialog._endSessionDialog._updateButtons/<.action@/home/muradm/.local/share/gnome-shell/extensions/grubreboot@desertconsulting.net/extension.js:119
Dec 30 21:58:29 muradm-lws1 gnome-session-binary[1437]: Entering running state
Dec 30 21:58:29 muradm-lws1 gnome-session[1437]: Gjs-Message: JS LOG: Ignored exception from dbus method: Gio.IOErrorEnum: GDBus.Error:org.gtk.GDBus.UnmappedGError.Quark._g_2dio_2derror_2dquark.Code19: Operation was cancelled
detly commented 6 years ago

I'm getting this too, on the latest download from the Gnome Extensions site. Do I need to configure something differently?

patriziobruno commented 6 years ago

Your user should be able to read /boot/grub/grub.cfg or /boot/grub2/grub.cfg or to scan /boot/efi/ and all its content looking for grub.cfg, it depends on you operating system.

detly commented 6 years ago

I can read /boot/grub/... but not /boot/efi. Do I need both? I would have thought all the info required is in /boot/grub. One thing worth considering is using Polkit so the user doesn't have to mess around with their distro-set permissions, but I couldn't say how difficult or not that would be.

patriziobruno commented 6 years ago

I used PolKit to run grub-reboot, but to use it to synchronously populate a menu is not advisable. A DBus service exposing methods to list grub menu items and run grub-reboot would be the right solution, but out of scope for a gnome-shell extension project. If you want to take care of the DBus service, I will adapt the extension ;)

detly commented 6 years ago

I'll add it to my list... :/

indigoviolet commented 5 years ago

I commented out the lines in getFile() attempting to read /boot/efi, and this solved the problem in my case.

patriziobruno commented 5 years ago

@indigoviolet, does it still show the list of operating systems you can boot into?

indigoviolet commented 5 years ago

It only started showing the list of operating systems after I commented out /boot/efi -- the permissions for that directory weren't open, and for some (unknown to me) reason I couldn't chmod them to be broader.

synchrone commented 5 years ago

(On Ubuntu 18.04) It's because /boot/efi is formatted FAT32 (as per UEFI spec), mounted from fstab, so the owner is root, and umask=0077, so permissions are always 700 and cannot be changed.

@patriziobruno is it reasonable to try{}catch{} that error raised by findFile(Gio.file_new_for_path("/boot/efi")); and fall back to /boot/grub detection?

synchrone commented 5 years ago

oh, looks like it was fixed a long time ago in https://github.com/patriziobruno/grubreboot-gnome-shell-extension/commit/56ce40739e713baab8a877391581d7e91e547e53, but was not pushed to gnome extensions.

patriziobruno commented 5 years ago

@synchrone the commit is merged, but it doesn't solve the issue, it just handles the error in a nicer way and tries to work around, whenever possible

synchrone commented 5 years ago

Falling back to /boot/grub fixes the drop-down menu issue for me, I can see my grub options while booting UEFI.

However, this patch is not present when installing from https://extensions.gnome.org/extension/893/grub-reboot/, and my metadata.json contains "version": 13.

Are you suggesting there are configurations/distros where only querying /boot/efi would work, and boot/grub will not?