View previous topic :: View next topic |
Author |
Message |
CaptainBlood Advocate
Joined: 24 Jan 2010 Posts: 3839
|
Posted: Fri Jun 14, 2024 10:05 pm Post subject: emacs GUI/pure-wayland fails from su - {anyone}[workaround] |
|
|
regular user runs emacs(pure-gtk) fine.
However afteremacs GUI throws: Code: | Gtk warning Can not open display: |
Seems like context is altered enough for emacs to try to launch under X where no xwayland allowed here.
Quite unfortunate as EDITOR=emacs is involved here to edit /etc/portage files.
EDITOR="emacs -nw" as a workaround...
Any idea how to fix?
Thks 4 ur attention, interest & support _________________ USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "
Last edited by CaptainBlood on Wed Aug 14, 2024 11:33 am; edited 6 times in total |
|
Back to top |
|
|
CaptainBlood Advocate
Joined: 24 Jan 2010 Posts: 3839
|
Posted: Sat Jun 15, 2024 3:10 am Post subject: Re: emacs/pure-wayland fails under root |
|
|
CaptainBlood wrote: | Seems like context is altered enough for emacs to try to launch under X where no xwayland allowed here. |
Could be a safety feature too....
Thks 4 ur attention, interest & support _________________ USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. " |
|
Back to top |
|
|
CaptainBlood Advocate
Joined: 24 Jan 2010 Posts: 3839
|
Posted: Sat Jun 15, 2024 6:17 am Post subject: Re: emacs/pure-wayland fails under root |
|
|
CaptainBlood wrote: | Could be a safety feature too.... |
Well, not really:
When launching pure wayland session as root, emacs GUI runs fine.
Problem remains how to run emacs GUI from EDIT, which runs fine in X.
Thks 4 ur attention, interest & support[/code] _________________ USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. " |
|
Back to top |
|
|
sMueggli Guru
Joined: 03 Sep 2022 Posts: 489
|
Posted: Sat Jun 15, 2024 8:38 am Post subject: |
|
|
The fix is: Do not run Emacs as user "root". You do not need to run an editor with elevated privileges. You just need elevated privileges to edit some files. You can run Emacs with normal user privileges and gain the elevated privileges with TRAMP (see https://www.gnu.org/software/tramp/#Inline-methods) |
|
Back to top |
|
|
CaptainBlood Advocate
Joined: 24 Jan 2010 Posts: 3839
|
Posted: Sat Jun 15, 2024 12:04 pm Post subject: |
|
|
@sMueggli,
As far as root account is concerned, I agree on GUI forbidden principle.
Title changed as any user account is concerned:
Assuming wayland session running for my_user account,
emacs GUI will run fine except if launched from terminal after running
This doesn't occur in X.
As far as /etc/portage is concerned, here are a few scripts with params to select file(s) to edit.
One file per package paradigm here, many lines within.
If an opened read only buffer by my_user could later gained writable status on demand, that would be fine
The alternative would be to port my scripts to elisp, which is a little far for my skills
Thks 4 ut attention, interest & support. _________________ USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. " |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 22602
|
Posted: Sat Jun 15, 2024 1:57 pm Post subject: |
|
|
That only works in X11 because a PAM hook propagates the required state. On my systems, I disabled that hook (pam_xauth.so) because I had no need of it and disagreed with some of its hardcoded defaults. Therefore, for me, root shells created by /bin/su - cannot run X11 programs - and I like it that way. Presumably, you need an equivalent pam_waylandauth.so (which may or may not exist, and probably does not have that specific name even if it does exist) to get this working in Wayland. |
|
Back to top |
|
|
CaptainBlood Advocate
Joined: 24 Jan 2010 Posts: 3839
|
Posted: Sat Jun 15, 2024 2:06 pm Post subject: |
|
|
@Hu,
Nice clarifications,
I'm currently investigating TRAMP /su::<absolute file path> instead.
Once working ask expected,, I'd just need to move my /usr/local/sbin scripts to /usr/local/bin.
Thks 4 ur attention, injterest and support. _________________ USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. " |
|
Back to top |
|
|
CaptainBlood Advocate
Joined: 24 Jan 2010 Posts: 3839
|
Posted: Wed Aug 14, 2024 10:48 am Post subject: |
|
|
Adding to non root init.el Code: | (defun edit-current-file-as-root ()
"Edit the file that is associated with the current buffer as root"
(interactive)
(let ((filep (buffer-file-name)))
(if filep (find-file (concat "/sudo::" filep))
(message "Current buffer does not have an associated file.")))) | from WikEmacs,
then replacing as a preferencebydid the trick here:
It allows to grant write to a read only file buffer.
Reminder: Code: | ;; No TRAMP saved password file
(connection-local-set-profile-variables 'remote-without-auth-sources '((auth-sources . nil)))
(connection-local-set-profiles '(:application tramp) 'remote-without-auth-sources) | may be required depending your security standards.
If you did TRAMP prior to this, you may have a file somewhere containing CLEAR text PASSWORD(S).
Can't recall its name. Maybe .tramp located in emacs config directory, e.g. where active init.el lies...
You may want to delete it.
Note: I likely may be missing a smarter way to prevent this.
Thks 4 ur attention, interest & support. _________________ USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. " |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|