Phockup link apparmor denied


#1

Hi there –

I’m getting an apparmor denied message on creating a hard link with the phockup snap.

dpb@helo:photos[]$ phockup flat by-date -l
bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
Using link strategy
flat/0000045044bbf7c64cf63da99915dbd4f12fb449.jpgTraceback (most recent call last):
  File "/snap/phockup/204/lib/phockup/phockup.py", line 88, in <module>
    main(sys.argv[1:])
  File "/snap/phockup/204/lib/phockup/phockup.py", line 82, in main
    timestamp=timestamp
  File "/snap/phockup/204/lib/phockup/src/phockup.py", line 36, in __init__
    self.walk_directory()
  File "/snap/phockup/204/lib/phockup/src/phockup.py", line 67, in walk_directory
    self.process_file(file)
  File "/snap/phockup/204/lib/phockup/src/phockup.py", line 162, in process_file
    os.link(file, target_file)
PermissionError: [Errno 13] Permission denied: 'flat/0000045044bbf7c64cf63da99915dbd4f12fb449.jpg' -> 'by-date/2017/02/20/20170220-104325359.jpg'

Mar 30 22:45:21 helo kernel: [97429.187072] audit: type=1400 audit(1554007521.925:4845): apparmor="DENIED" operation="link" profile="snap.phockup.phockup" name="/media/photos/by-date/2017/02/20/20170220-104325359.jpg" pid=13701 comm="python3" requested_mask="l" denied_mask="l" fsuid=1000 ouid=1000 target="/media/photos/flat/0000045044bbf7c64cf63da99915dbd4f12fb449.jpg"

Any suggestions?


#2

The removable-media interface does not currently allow hardlinking in /media. I’ve added a TODO to investigate this for 2.39.