Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install and racket-run permission denied #654

Closed
ChristopherChmielewski opened this issue Mar 26, 2023 · 11 comments
Closed

install and racket-run permission denied #654

ChristopherChmielewski opened this issue Mar 26, 2023 · 11 comments

Comments

@ChristopherChmielewski
Copy link

Hello, I get the following error when installing racket-mode and when running racket-run on Ubuntu 22.04. Any help would be appreciated.

{racket-back-end-/-stderr} open-input-file: cannot open module file
module path: /home/chris/.emacs.d/elpa/racket-mode-1.0.20230321.113335/racket/main.rkt
path: /home/chris/.emacs.d/elpa/racket-mode-1.0.20230321.113335/racket/main.rkt
system error: Permission denied; errno=13

image

Thanks

P.S. here is the bug report:

Please copy all of the following lines and paste them into your bug report
at https://github.com/greghendershott/racket-mode/issues/.

((alist-get 'racket-mode package-alist)
 #s(package-desc racket-mode
		 (1 0 20230321 113335)
		 "Racket editing, REPL, and more"
		 ((emacs
		   (25 1)))
		 nil nil "/home/chris/.emacs.d/elpa/racket-mode-1.0.20230321.113335"
		 ((:url . "https://www.racket-mode.com/")
		  (:maintainer "Greg Hendershott")
		  (:authors
		   ("Greg Hendershott" . "racket-mode-author@greghendershott.com"))
		  (:commit . "HEAD"))
		 t))
((emacs-version "28.2")
 (system-type gnu/linux)
 (x-gtk-use-system-tooltips t)
 (major-mode messages-buffer-mode)
 (racket--el-source-dir "/home/chris/.emacs.d/elpa/racket-mode-1.0.20230321.113335/")
 (racket--rkt-source-dir "/home/chris/.emacs.d/elpa/racket-mode-1.0.20230321.113335/racket/")
 (racket-program "racket")
 (racket-command-timeout 10)
 (racket-path-from-emacs-to-racket-function UNDEFINED)
 (racket-path-from-racket-to-emacs-function UNDEFINED)
 (racket-browse-url-function racket-browse-url-using-temporary-file)
 (racket-documentation-search-location "https://docs.racket-lang.org/search/index.html?q=%s")
 (racket-xp-after-change-refresh-delay 1)
 (racket-xp-mode-lighter
  (:eval
   (racket--xp-mode-lighter)))
 (racket-xp-highlight-unused-regexp "^[^_]")
 (racket-repl-buffer-name-function nil)
 (racket-submodules-to-run
  ((test)
   (main)))
 (racket-memory-limit 2048)
 (racket-error-context medium)
 (racket-repl-history-directory "~/.emacs.d/racket-mode/")
 (racket-history-filter-regexp "\\`\\s *\\'")
 (racket-images-inline t)
 (racket-imagemagick-props nil)
 (racket-images-keep-last 100)
 (racket-images-system-viewer "display")
 (racket-pretty-print t)
 (racket-use-repl-submit-predicate nil)
 (racket-pretty-print t)
 (racket-indent-curly-as-sequence t)
 (racket-indent-sequence-depth 0)
 (racket-pretty-lambda nil)
 (racket-smart-open-bracket-enable nil)
 (racket-module-forms "\\s(\\(?:module[*+]?\\|library\\)")
 (racket-logger-config
  ((cm-accomplice . warning)
   (GC . info)
   (module-prefetch . warning)
   (optimizer . info)
   (racket/contract . error)
   (racket-mode-debugger . info)
   (sequence-specialization . info)
   (* . fatal)))
 (racket-show-functions
  (racket-show-pseudo-tooltip)))
(enabled-minor-modes
 (auto-composition-mode)
 (auto-compression-mode)
 (auto-encryption-mode)
 (auto-fill-mode)
 (auto-save-mode)
 (blink-cursor-mode)
 (buffer-read-only)
 (electric-indent-mode)
 (file-name-shadow-mode)
 (font-lock-mode)
 (global-eldoc-mode)
 (global-font-lock-mode)
 (indent-tabs-mode)
 (line-number-mode)
 (menu-bar-mode)
 (mouse-wheel-mode)
 (semantic-minor-modes-format)
 (shell-dirtrack-mode)
 (show-paren-mode)
 (tool-bar-mode)
 (tooltip-mode)
 (transient-mark-mode))
(disabled-minor-modes
 (abbrev-mode)
 (auto-fill-function)
 (auto-save-visited-mode)
 (buffer-face-mode)
 (button-mode)
 (cl-old-struct-compat-mode)
 (column-number-mode)
 (compilation-minor-mode)
 (compilation-shell-minor-mode)
 (completion-in-region-mode)
 (context-menu-mode)
 (defining-kbd-macro)
 (eldoc-mode)
 (electric-layout-mode)
 (electric-quote-mode)
 (global-prettify-symbols-mode)
 (global-semantic-highlight-edits-mode)
 (global-semantic-highlight-func-mode)
 (global-semantic-show-parser-state-mode)
 (global-semantic-show-unmatched-syntax-mode)
 (global-semantic-stickyfunc-mode)
 (global-visual-line-mode)
 (horizontal-scroll-bar-mode)
 (hs-minor-mode)
 (isearch-mode)
 (jit-lock-debug-mode)
 (lock-file-mode)
 (next-error-follow-minor-mode)
 (overwrite-mode)
 (paragraph-indent-minor-mode)
 (prettify-symbols-mode)
 (racket-smart-open-bracket-mode)
 (racket-xp-mode)
 (semantic-highlight-edits-mode)
 (semantic-highlight-func-mode)
 (semantic-mode)
 (semantic-show-parser-state-mode)
 (semantic-show-unmatched-syntax-mode)
 (semantic-stickyfunc-mode)
 (sh-electric-here-document-mode)
 (size-indication-mode)
 (tab-bar-history-mode)
 (tab-bar-mode)
 (temp-buffer-resize-mode)
 (text-scale-mode)
 (unify-8859-on-decoding-mode)
 (unify-8859-on-encoding-mode)
 (url-handler-mode)
 (use-hard-newlines)
 (view-mode)
 (visible-mode)
 (visual-line-mode)
 (window-divider-mode)
 (xref-etags-mode))
@capfredf
Copy link
Sponsor Contributor

what's the output of ls -l /home/chris/.emacs.d/elpa/racket-mode-1.0.20230321.113335/racket/main.rkt?

@ChristopherChmielewski
Copy link
Author

-rw-r--r-- 1 chris chris 1716 Mar 26 14:31 /home/chris/.emacs.d/elpa/racket-mode-1.0.20230321.113335/racket/main.rkt

image

@greghendershott
Copy link
Owner

greghendershott commented Mar 27, 2023

Hmm, that's weird; I haven't had this kind of report before.

I wonder if this is somehow related to Ubuntu 22.04 installing Emacs 28.2 as a snap in a "sandbox" instead of as a "normal" package -- IIUC -- and that affecting permissions somehow.

A few questions to maybe help figure this out:

  1. In Emacs if you M-x find-file and enter /home/chris/.emacs.d/elpa/racket-mode-1.0.20230321.113335/racket/main.rkt, does that at least work to show you the file contents, or do you also get some permissions error?

  2. How about opening a *shell* buffer in Emacs, and entering racket /home/chris/.emacs.d/elpa/racket-mode-1.0.20230321.113335/racket/main.rkt -- what happens? I would expect you to get, not a permissions error, but something like the following (which would be normal/expected and shows that at least the program ran):

Racket Mode back end: Bad command-line arguments:
'#()

  context...:
   body of (submod "/home/greg/src/elisp/racket-mode/racket/main.rkt" main)
  1. What version of Racket are you using and how did you install it? (I see you have racket-program set to the default "racket" (find racket via PATH, not some specific installation directory) which suggests you have the Ubuntu 22.04 Racket package. That's not necessarily bad, I'm just curious.)

@greghendershott
Copy link
Owner

p.s. I don't have detailed knowledge about Ubuntu 22.04, which packages it installs as Snaps, and the consequences. That might be N/A.

What made me think of this is another recent bug report: #620. However that seems to be about installing the web browser as a snap. What you're reporting now might be related to Emacs and/or Racket being installed as a snap... or it might not, I'm still at the just-guessing stage.

@greghendershott
Copy link
Owner

Trying to learn more about snap sandboxing:

  • This implies that if you run which emacs and which racket, we can see if each is a snap -- does it say /snap/bin/emacs or /snap/bin/racket. (That link also suggest that snap uses AppArmor as the building block for file permissions.)

  • For each one that's a snap, this talks about looking at permissions. As a rough guess, you'd want permissions for your home directory? (But to be honest, in my hasty reading, I'm also getting the idea that "strict" snaps can't get your real homedir, just a sandboxed shadow homedir. So... I don't really know, yet.)

@ChristopherChmielewski
Copy link
Author

Since you mentioned that the snap installation may be an issue I uninstalled the snap version of racket and installed version 8.8 via the racket .sh file (from https://racket-lang.org/download/) and now it works fine. Thanks for the help! :)

However, if you're still curious the answers to your questions (while I still had the snap store version of racket) are:

  1. Yes I am able to open main.rkt it using M-x find-file
  2. I get the same permission denied error when running the main.rkt file using the emacs *shell*
open-input-file: cannot open module file
  module path: /home/chris/.emacs.d/elpa/racket-mode-1.0.20230321.113335/racket/main.rkt
  path: /home/chris/.emacs.d/elpa/racket-mode-1.0.20230321.113335/racket/main.rkt
  system error: Permission denied; errno=13

image
3. I have racket version 8.7 installed through the Ubuntu store (the snap store)
image

Also note that my version of emacs is installed via the terminal snap package manager (i.e. using sudo snap install emacs --classic) and not the snap store (which seems to make a difference because the terminal snap manager has the newer emacs version 28.2 and the snap store has 27.1)

@greghendershott
Copy link
Owner

@ChristopherChmielewski Thank you for the additional information; I'm glad you were able to resolve it by using the "normal" Racket installer.


@samth re https://snapcraft.io/racket, linked to from Racket Downloads:

Do you have any ideas or tips about this, which I could add to the documentation? The TL;DR is that Racket installed this way seems unable to read files out of $HOME/.emacs/.

I don't know enough about snaps to understand this restriction, whether it can be relaxed, and if so how and by who.

  • Could an end user configure this?
  • Could you as the snap package creator?
  • Or not even you, it's imposed by the snapcraft.io technology and/or admins?

Depending on the answer, should there be some caveat/warning/tip on Racket Downloads (as well as whatever I might add for Racket Mode documentation)?

@samth
Copy link
Sponsor Contributor

samth commented Mar 28, 2023

Maybe installing it with --classic would help?

Maybe the snap needs https://snapcraft.io/docs/personal-files-interface to be set up for .emacs but I'm suspicious that it wants you to read the files elsewhere.

@greghendershott
Copy link
Owner

--classic might help if people use the command line to install, but I don't think that's available when people use the snap store?

If someone sticks with DrRacket, via its GUI file open/save dialogs IIUC it might work OK, even for $HOME. So as an option for students, Racket-from-snap-store is probably fine (or even wonderful!).

I'm not sure about the command-line Racket stuff, though.


On my "daily driver" laptop, I'm still on Ubuntu 18.04 -- partly out of inertia, but also out of reluctance to deal with "snapification" in newer Ubuntus. So although I can try some experiments, I'm not sure I have the latest snap-frastructure to give accurate results.

@greghendershott
Copy link
Owner

More info: https://racket.discourse.group/t/ubuntu-linux-racket-8-10-snap-emacs-racket-mode/2263/2 suggests the problem isn't the home dir per se, but dotfile dirs.

Although Snap racket can't read Racket Mode files under the default ~/.emacs.d/elpa/racket-mode-xxx, moving them under ~/site-lisp/racket-mode/ does work.

@greghendershott
Copy link
Owner

I wrote an FAQ and made it a pinned issue: #666.

I think that's the best I can do for now, so I'm going to close this.

Personally I think an even better resolution would be for the snap to change to use classic confinement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants