permission denied mkdir /root/.cache

Bug #1320313 reported by Peter Hultqvist
28
This bug affects 5 people
Affects Status Importance Assigned to Milestone
goget-ubuntu-touch (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Running as root:
# sudo ubuntu-emulator create u1

Creating "u1" from ubuntu-touch/devel revision 28
Downloading...
Cannot download https://system-image.ubuntu.com/pool/ubuntu-af0e050fca683dd4b7747b616952745496ed8542cece16ca5e6d13f00886d2de.tar.xz: mkdir /root/.cache: permission denied

First I thought that it might be because /root was a symlink so I moved it away and created a new /root dir
Same error

Then I ran mkdir /root/.cache
Followed by the same "ubuntu-emulator create u1" which now reported:
...
Creating "u1" from ubuntu-touch/devel revision 28
Downloading...
Cannot download https://system-image.ubuntu.com/pool/ubuntu-af0e050fca683dd4b7747b616952745496ed8542cece16ca5e6d13f00886d2de.tar.xz: mkdir /root/.cache/ubuntuimages: permission denied

And the same for: mkdir /root/.cache/ubuntuimages/pool

Now the error message reads:
Cannot download https://system-image.ubuntu.com/pool/ubuntu-af0e050fca683dd4b7747b616952745496ed8542cece16ca5e6d13f00886d2de.tar.xz: open /root/.cache/ubuntuimages/pool/ubuntu-af0e050fca683dd4b7747b616952745496ed8542cece16ca5e6d13f00886d2de.tar.xz_lock: permission denied

This is where I'm stuck right now

ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: ubuntu-emulator 0.2+14.04.20140416.2-0ubuntu1
ProcVersionSignature: Ubuntu 3.13.0-24.46-generic 3.13.9
Uname: Linux 3.13.0-24-generic x86_64
NonfreeKernelModules: fglrx
ApportVersion: 2.14.1-0ubuntu3
Architecture: amd64
Date: Fri May 16 19:35:09 2014
InstallationDate: Installed on 2014-02-13 (91 days ago)
InstallationMedia: Ubuntu 14.04 LTS "Trusty Tahr" - Alpha amd64 (20140211)
SourcePackage: goget-ubuntu-touch
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Peter Hultqvist (hultqvist) wrote :
Revision history for this message
Peter Hultqvist (hultqvist) wrote :

After changing the permissions for .cache/ from drwxr-xr-x to drwxrwxr-x It works, owner was all the time root.root

Revision history for this message
Peter Hultqvist (hultqvist) wrote :

After the ubuntu-emulator create finished downloading and exited with 0 there is now a followup issue.

root ~ # ubuntu-emulator create myinstance
Creating "myinstance" from ubuntu-touch/devel revision 28
Downloading...
root ~ # echo $?
0
root ~ # ubuntu-emulator run myinstance
This instance does not exist, use 'create myinstance' to create it
root ~ # echo $?
1

the content of .cache is
./ubuntuimages
./ubuntuimages/pool
./ubuntuimages/pool/device-13e1882a8e51bac70713ca39ed3a89c83f2a80800713add1ea656da62c6d90d9.tar.xz.asc
./ubuntuimages/pool/ubuntu-af0e050fca683dd4b7747b616952745496ed8542cece16ca5e6d13f00886d2de.tar.xz
./ubuntuimages/pool/device-13e1882a8e51bac70713ca39ed3a89c83f2a80800713add1ea656da62c6d90d9.tar.xz
./ubuntuimages/pool/ubuntu-af0e050fca683dd4b7747b616952745496ed8542cece16ca5e6d13f00886d2de.tar.xz.asc
./ubuntuimages/ubuntu-touch
./ubuntuimages/ubuntu-touch/devel
./ubuntuimages/ubuntu-touch/devel/generic
./ubuntuimages/ubuntu-touch/devel/generic/version-28.tar.xz
./ubuntuimages/ubuntu-touch/devel/generic/version-28.tar.xz.asc

Revision history for this message
Sergio Schvezov (sergiusens) wrote : Re: [Bug 1320313] [NEW] permission denied mkdir /root/.cache

On Fri, May 16, 2014 at 2:44 PM, Peter Hultqvist <email address hidden>wrote:

> Public bug reported:
>
> Running as root:
> # sudo ubuntu-emulator create u1
>
> Creating "u1" from ubuntu-touch/devel revision 28
> Downloading...
> Cannot download
> https://system-image.ubuntu.com/pool/ubuntu-af0e050fca683dd4b7747b616952745496ed8542cece16ca5e6d13f00886d2de.tar.xz:
> mkdir /root/.cache: permission denied
>

This is disturbing, you should not need to write to /root

Can you please provide the output of:
$ env
and
$ sudo env

Revision history for this message
Peter Hultqvist (hultqvist) wrote :
Revision history for this message
Peter Hultqvist (hultqvist) wrote :
Revision history for this message
Peter Hultqvist (hultqvist) wrote :

I have write access to root from the shell
I can successfully run every command that is reported as failed from ubuntu-emulator.

mount report
/dev/mapper/sda5_crypt on / type ext4 (rw,errors=remount-ro)

Revision history for this message
Sergio Schvezov (sergiusens) wrote :

If you must run as root, make sure you are real root; why are you running as root and not as $USER peter?

Revision history for this message
Peter Hultqvist (hultqvist) wrote :

If I run the following as my regular user I get an error:

$ ubuntu-emulator create u1
Creation requires sudo/pkexec (root)

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in goget-ubuntu-touch (Ubuntu):
status: New → Confirmed
Revision history for this message
Diddier A Hilarion B (didtux) wrote :

I have had the same problem recently, as a debian user who uses Ubuntu ocasionally i don't have familiarity with the way sudo works, i have noticed this problem doesn't happen when you have a shell obtained by the su command, so i think sudo su is not the same as obtaining the shell by su and sudo "command" is not the same as executing the command as root.

I solved the problem doing sudo su setting a password for root, entering as root with su and doing ubuntu-emulator create myinstance

Revision history for this message
aggelalex (aggelalex-ppa) wrote :

I found the cause of the problem:

When executing sudo, you *gain* some root previlages, but you are not root.
Which means that you don't have any access to /root by using sudo
But sudo sets $HOME to /root, so sudo's home is /root, but can't be accessed by sudo

to solve this just run this:
$ sudo -i
# HOME=/home/<your user name>

and continue with your commands. When done execute this:
# exit

and now you're out of root user.

Revision history for this message
Parmesh (parmesh-aavula) wrote :

I got following Error when creating a ubuntu emulator, please help me to get out of this error

Creating "UbuntuTouch" from ubuntu-touch/devel revision 2
Downloading...
Cannot download https://system-image.ubuntu.com/pool/ubuntu-25515e1c8e1c835c56967a78744cae98fba62da5212261dc31fb7afd92031f89.tar.xz: mkdir /root/.cache: permission denied

Revision history for this message
Luca Weiss (z3ntu) wrote :

Why does this bug still exist? It was reported over 2 years ago...

Revision history for this message
WESERTRAINER Flight Training (s-service) wrote :

Unfortunately this bug still exist:

Package: ubuntu-device-flash 0.33-0ubuntu1~xenial-staging i386

sudo ubuntu-device-flash --server=http://system-image.ubports.com touch --device=turbo --channel=ubports-touch/16.04/rc --bootstrap --recovery-image=./ubuntu-touch/recovery-turbo.img --wipe
2018/08/12 14:53:15 Device is |turbo|
2018/08/12 14:53:20 Flashing version 8 from ubports-touch/16.04/rc channel and server http://system-image.ubports.com to device turbo
2018/08/12 14:53:20 mkdir /home/myusername/.cache/ubuntuimages/pool: permission denied

Any solutions ?

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.