stack.sh script failed with Permission error

Bug #1103037 reported by sajuptpm
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
devstack
Expired
Undecided
Unassigned

Bug Description

Hi,

I followed http://devstack.org/guides/single-vm.html
I am using : Ubuntu 12.04 LTS

Ran following commands as user "saju"

git clone https://github.com/openstack-dev/devstack.git
cd devstack
echo ADMIN_PASSWORD=password > localrc
echo MYSQL_PASSWORD=password >> localrc
echo RABBIT_PASSWORD=password >> localrc
echo SERVICE_PASSWORD=password >> localrc
echo SERVICE_TOKEN=tokentoken >> localrc

Then i ran following script as user "saju" and it asked for password of saju and I gave it, and failed with Permission error .

./stack.sh

==== Error =====

+ iniuncomment /etc/glance/glance-cache.conf DEFAULT auth_password
+ local file=/etc/glance/glance-cache.conf
+ local section=DEFAULT
+ local option=auth_password
+ sed -i -e '/^\[DEFAULT\]/,/^\[.*\]/ s|[^ \t]*#[ \t]*\(auth_password[ \t]*=.*$\)|\1|' /etc/glance/glance-cache.conf
+ iniset /etc/glance/glance-cache.conf DEFAULT admin_password password
+ local file=/etc/glance/glance-cache.conf
+ local section=DEFAULT
+ local option=admin_password
+ local value=password
+ grep -q '^\[DEFAULT\]' /etc/glance/glance-cache.conf
+ ini_has_option /etc/glance/glance-cache.conf DEFAULT admin_password
+ local file=/etc/glance/glance-cache.conf
+ local section=DEFAULT
+ local option=admin_password
+ local line
++ sed -ne '/^\[DEFAULT\]/,/^\[.*\]/ { /^admin_password[ \t]*=/ p; }' /etc/glance/glance-cache.conf
+ line='admin_password = password'
+ '[' -n 'admin_password = password' ']'
+ sed -i -e '/^\[DEFAULT\]/,/^\[.*\]/ s|^\(admin_password[ \t]*=[ \t]*\).*$|\1password|' /etc/glance/glance-cache.conf
+ cp -p /opt/stack/glance/etc/policy.json /etc/glance/policy.json
cp: cannot create regular file `/etc/glance/policy.json': Permission denied
++ failed
++ local r=1
+++ jobs -p
++ kill
++ set +o xtrace

Yaguang Tang (heut2008)
Changed in devstack:
status: New → Invalid
Revision history for this message
Yaguang Tang (heut2008) wrote :

ensure the user has sudo privilege or run stack.sh with root and the script will create a stack account.

Revision history for this message
swapk (sk90) wrote :

I am also getting the same error.i checked the file,the user has the sudo privileges.
-------------------------------------------------------------
root@vmfolsom67:/etc/glance# ls -la
total 84
drwx------ 2 stack glance 4096 Feb 8 19:08 .
drwxr-xr-x 108 root root 4096 Feb 8 18:41 ..
-rw-r--r-- 1 stack stack 12200 Feb 8 19:08 glance-api.conf
-rw-r--r-- 1 glance glance 8493 Aug 24 15:35 glance-api.conf.dpkg-dist
-rw-rw-r-- 1 glance glance 2380 Aug 24 15:35 glance-api-paste.ini
-rw-rw-r-- 1 glance glance 1956 Feb 7 14:42 glance-api-paste.ini.dpkg-old
-rw-r--r-- 1 stack stack 5380 Feb 8 19:08 glance-cache.conf
-rw-r--r-- 1 glance glance 5380 Feb 8 14:20 glance-cache.conf.dpkg-old
-rw-r--r-- 1 glance glance 528 Aug 24 15:35 glance-cache-paste.ini
-rw-r--r-- 1 stack stack 2887 Feb 8 19:08 glance-registry.conf
-rw-rw-r-- 1 glance glance 626 Feb 7 14:42 glance-registry-paste.ini
-rw-r--r-- 1 glance glance 1080 Aug 24 15:31 glance-scrubber.conf
-rw-r--r-- 1 glance glance 125 Aug 24 15:35 glance-scrubber-paste.ini
-rw-rw-r-- 1 glance glance 66 Feb 8 18:44 policy.json
-rw-rw-r-- 1 glance glance 62 Feb 7 14:42 policy.json.dpkg-old
----------------------------------------------------------------------------------
so i gave glance and stack also sudo privilages.
but it is giving the same error.any suggestions?

Revision history for this message
xu hongna (hongnax-xu) wrote :

i encounter the same problem, no business with sudo privileges, neither with the privilege of /opt/stack/glance. i run succeed a few days ago. swapk, how could you solve it?

Revision history for this message
RitzCarltn (ritzcarltn) wrote :

I also exactly same issue, is there any solution for this issue?

Revision history for this message
Aleksandar Janicijevic (ajanicij) wrote :

Here is a workaround that worked for me:

The problem is in the script lib/glance: even though the user has sudo privileges, the script doesn't use sudo but tries to execute command as you see in the output:

cp -p /opt/stack/glance/etc/policy.json /etc/glance/policy.json

So edit the file lib/glance and find the very last command of function configure_glance(). Change it to

sudo cp -p $GLANCE_DIR/etc/policy.json $GLANCE_POLICY_JSON

Revision history for this message
xiaohanyu (xiaohanyu1988) wrote :

same problem here

Revision history for this message
-None- (mike-nycmoma) wrote :

i'v got this error when run stack.sh multiple times from different users (or using sudo)
I found that files in /etc/glance/ has wrong permissions, so i simply remove /etc/glance/:
$ sudo rm -rf /etc/glance/
this solves the issue.

Revision history for this message
Hailu Ju (linuxcpp-org) wrote :

I have solve this problems, just:
cd /dir-to-devopenstack/..
chown -R stack:stack devopenstack/
now just run
$ devopenstack/stack.sh

no issue will be show now!!
:-) ! enjoy!

Revision history for this message
Isaac Beckman (isaacb) wrote :

Same problem here.
I solved it by the workaround suggested by Aleksandar Janicijevic (ajanicij)

Isaac Beckman (isaacb)
Changed in devstack:
status: Invalid → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for devstack because there has been no activity for 60 days.]

Changed in devstack:
status: Incomplete → Expired
Revision history for this message
zouyee (zoues) wrote :

because u have install the stack second times, so the file or dir has exist, you should use 'sudo rm -rf /etc/[*your components*]'

Revision history for this message
Bharath kumar (bharath-kumar3) wrote :

change cp /opt/stack/nova/etc/nova/policy.json /etc/nova/policy.json
command in function-common file in devstack folder to
sudo cp /opt/stack/nova/etc/nova/policy.json /etc/nova/policy.json
as you are not running this with su , you need to put sudo there..
hope it will work for you also . Thank you

Revision history for this message
addishiwot tadesse (addishiwot-tadesse) wrote :

Like Zouyee said, the files exist as you are doing reinstallation. remove that directory and re install it. Give the permissions as well to the stack user

sudo rm -rf /etc/glance
 sudo chown -R stack:stack "pathToYourDevstackFolder"
./stack.sh

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.