alexmurray / emacs-snap

GNU Emacs in a snap
https://snapcraft.io/emacs
72 stars 12 forks source link

AppArmor error message on WSL 2 #53

Closed michaelmhoffman closed 1 year ago

michaelmhoffman commented 1 year ago

Using Windows Subsystem for Linux 2 and this Snap:

Repro Steps

emacs --batch -Q

Expected Behavior

No output

Actual Behavior

grep: /proc/self/attr/current: Invalid argument

Software versions

emacs 28.2 snap r1855 snapd 2.58.3 WSL 1.1.3.0 kernel 5.15.90.1 Microsoft Windows [Version 10.0.19044.2604]

Diagnostic Logs

Output of sudo strace -ff -tt -o strace emacs --batch --quick && strace-log-merge strace is at https://gist.github.com/michaelmhoffman/f53d4463ed9a858127fa30fe1e6bf81d

Notes

Previously reported at microsoft/WSL#9769 where @elsaco noted the following:

# finally break out of AppArmor confinement to avoid issues like
# https://github.com/alexmurray/emacs-snap/issues/36 - we are a classic
# snap so snapd runs us under a complain mode profile anyway (which in
# general doesn't restrict anything) but it does cause some applications to
# get confused like the GNOME/Ubuntu dock
if grep -q "^snap.emacs.[a-z-]\+ (complain)" /proc/self/attr/current; then
  echo -n "changeprofile unconfined" > /proc/self/attr/current 2>/dev/null
fi

On WSL Ubuntu aa-status returns apparmor not present that's why if grep -q "^snap.emacs.[a-z-]\+ (complain)" /proc/self/attr/current ends up with Invalid argument

Originally posted by @elsaco in https://github.com/microsoft/WSL/issues/9769#issuecomment-1464193207

alexmurray commented 1 year ago

Hopefully should be fixed on all branches now (but I don't have Windows + WSL to test ) - new snaps should build and be published in an hour or so - so if you could switch to the beta channel and let me know how it fares that would be great.

alexmurray commented 1 year ago

I installed a Windows 11 VM, enabled WSL with Ubuntu and installed the emacs snap and can confirm that this is now fixed. Please refresh to the latest release of the emacs snap.