1

Because I don't understand Ruby, but want to use the ruby based program mdl (markdownlint), I have installed it using snap.

While I can run the program, if I try and set up a customizations in a ~/.mdlrc file. I get the following error

 $ mdl README.md
 
 /snap/mdl/171/lib/ruby/gems/2.4.0/gems/mixlib-config-3.0.6/lib/mixlib/config.rb:63:in
 `read': Permission denied @ rb_sysopen - /home/mikeg/.mdlrc
 (Errno::EACCES)
         from /snap/mdl/171/lib/ruby/gems/2.4.0/gems/mixlib-config-3.0.6/lib/mixlib/config.rb:63:in
 `from_file'
         from /snap/mdl/171/lib/ruby/gems/2.4.0/gems/mdl-0.10.0/lib/mdl/cli.rb:122:in
 `run'
         from /snap/mdl/171/lib/ruby/gems/2.4.0/gems/mdl-0.10.0/lib/mdl.rb:16:in
 `run'
         from /snap/mdl/171/lib/ruby/gems/2.4.0/gems/mdl-0.10.0/bin/mdl:10:in `<top
 (required)>'
         from /snap/mdl/171/bin/mdl:23:in `load'
         from /snap/mdl/171/bin/mdl:23:in `<main>'

I don't understand where the permission issue comes from since

 $ ls -l ~/.mdlrc ~/.mdlrc.style.rb
 
 -rw-rw-r-- 1 mikeg mikeg 171 Aug 14 16:06 /home/mikeg/.mdlrc
 -rw-rw-r-- 1 mikeg mikeg   4 Aug 14 16:06 /home/mikeg/.mdlrc.style.rb

and

drwxr-xr-x 303 mikeg mikeg 65536 Aug 14 21:53 /home/mikeg

As a result, I can't figure out how to fix this. Can anyone help me.

Note that I'm running Mate 18.06. SELinux is not installed, but AppArmor is active and going through my /var/log/syslog* files I get

syslog.7.gz:Aug 17 09:08:40 XXXX kernel: [978608.742842] audit: type=1400 audit(1597669720.954:2800): apparmor="DENIED" operation="open" profile="snap.mdl.mdl" name="/home/mi/.mdlrc" pid=13189 comm="ruby" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000

Thanks,

Mike

6
  • Add the permissions of the parent directory to your question. – Nasir Riley Aug 15 '20 at 14:19
  • done. It's a personal machine. – mikemtnbikes Aug 15 '20 at 15:11
  • My mistake, I meant your home directory. Does /home/mikeg have 700 permissions? Add that to your question. – Nasir Riley Aug 15 '20 at 15:14
  • Is SELinux enabled? – Nasir Riley Aug 15 '20 at 15:57
  • Nope. Not even installed. ` $ getenforce Command 'getenforce' not found, but can be installed with: sudo apt install selinux-utils` – mikemtnbikes Aug 16 '20 at 13:27
0

@NasirRiely's question about SELinux was helpful in identifying the root cause of the issue which is a combination of apparmor permissions and snap. Apparently it can't read files in my home dir and installing the mdl snap --classic option didn't help (it was ignored for security reasons).

I started going down that rabbit hole, but decided to stop and simply install ruby and mdl using gems. That is,

$ sudo apt-get install ruby-full
$ gem install mdl

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.