Cannot start hello-world snap: mkdir: cannot create directory '/home/martin/snap/hello-world': Permission denied -- don't create $HOME/snaps as root

Bug #1618198 reported by Martin Pitt
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
snapd (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

I am currently following the tutorial at http://snapcraft.io/ and tried to install my first snap (under current yakkety amd64):

$ sudo apt install -y snapd
$ sudo snap install hello-world
74.08 MB / 74.28 MB [=================================================================>_] 99.73 % 2.12 MB/s

hello-world (stable) 6.3 from 'canonical' installed

$ LC_ALL=C /snap/bin/hello-world
mkdir: cannot create directory '/home/martin/snap/hello-world': Permission denied

strace shows:

[pid 14728] chdir("martin") = 0
[pid 14728] mkdir("snap", 0777) = -1 EEXIST (File exists)
[pid 14728] chdir("snap") = 0
[pid 14728] mkdir("hello-world", 0777) = -1 EACCES (Permission denied)
[pid 14728] chdir("hello-world") = -1 ENOENT (No such file or directory)

Indeed I have an already existing root-owned ~/snap directory, as I was asked a few days to install the ubuntu-device-flash beta snap. That program needs to run as root and was the first-ever snap that I installed.

I suggest to never create ~/snap with root privileges to avoid that, and also to avoid breaking backups etc.

ProblemType: Bug
DistroRelease: Ubuntu 16.10
Package: snapd 2.13+16.10
ProcVersionSignature: Ubuntu 4.4.0-9136.55-generic 4.4.16
Uname: Linux 4.4.0-9136-generic x86_64
ApportVersion: 2.20.3-0ubuntu7
Architecture: amd64
CurrentDesktop: i3
Date: Mon Aug 29 22:07:30 2016
EcryptfsInUse: Yes
SourcePackage: snapd
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Martin Pitt (pitti) wrote :
Changed in snapd (Ubuntu):
importance: Undecided → Low
description: updated
Changed in snapd (Ubuntu):
importance: Low → Medium
summary: Cannot start hello-world snap: mkdir: cannot create directory
- '/home/martin/snap/hello-world': Permission denied
+ '/home/martin/snap/hello-world': Permission denied -- don't create
+ $HOME/snaps as root
Changed in snapd (Ubuntu):
status: New → Triaged
Revision history for this message
Michael Vogt (mvo) wrote :

This was a bug in snap-confine/snap-run that is fixed now. I verified that it is no longer reproducible.

Changed in snapd (Ubuntu):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.