Unable to Run su -s /bin/sh -c "glance-manage db_sync" glance

Ralf Mardorf silver.bullet at zoho.com
Thu Jul 14 11:39:05 UTC 2016


On Thu, 14 Jul 2016 16:07:45 +0530, jiten jha wrote:
>root at controller:/home/fs# su -s /bin/sh -c "glance-manage db_sync"
>glance /usr/lib/python2.7/dist-packages/oslo_db/sqlalchemy/enginefacade.py:1056:
>OsloDBDeprecationWarning: EngineFacade is deprecated; please use
>oslo_db.sqlalchemy.enginefacade
>  expire_on_commit=expire_on_commit, _conf=conf)
>2016-07-14 16:05:13.649 12758 WARNING oslo_db.sqlalchemy.engines [-]
>SQL connection failed. 10 attempts left.
>
>
>how to solve it.

Hi,

I don't know what "glance-manage db_sync" is for or what it requires.
However, why do you run the shell with "su"? Why not running the shell
and then sudo command option/s?

If you take a look at your approach you'll notice a mismatch between
$USER and id [1]. If you run "dash sudo" $USER and id are the same [2].

Maybe your issue is somehow related to this.

Regards,
Ralf

[1]
[weremouse at moonstudio ~]$ lsb_release -rc
Release:	16.04
Codename:	xenial
[weremouse at moonstudio ~]$ ls -Gg /bin/sh 
lrwxrwxrwx 1 4 Feb 17 21:25 /bin/sh -> dash
[weremouse at moonstudio ~]$ su -s /bin/sh -c "echo $USER; id"
Password: 
weremouse
uid=0(root) gid=0(root) groups=0(root)
[weremouse at moonstudio ~]$ su -s /bin/sh -c "ls -l /root/.bashrc" 
Password: 
-rw-r--r-- 1 root root 3603 Aug  6  2015 /root/.bashrc

[2]
[weremouse at moonstudio ~]$ dash -c "sudo apt-get autoremove"
[sudo] password for weremouse: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
[weremouse at moonstudio ~]$ dash -c "sudo echo $USER; id"
weremouse
uid=1000(weremouse) gid=1000(weremouse)
groups=1000(weremouse),4(adm),24(cdrom),27(sudo),29(audio),30(dip),46(plugdev),116(lpadmin),117(sambashare)
[weremouse at moonstudio ~]$ dash -c "su -c \"echo $USER; id\""
Password: 
weremouse
uid=0(root) gid=0(root) groups=0(root)






More information about the ubuntu-users mailing list