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
>  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.


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.


[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"
uid=0(root) gid=0(root) groups=0(root)
[weremouse at moonstudio ~]$ su -s /bin/sh -c "ls -l /root/.bashrc" 
-rw-r--r-- 1 root root 3603 Aug  6  2015 /root/.bashrc

[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"
uid=1000(weremouse) gid=1000(weremouse)
[weremouse at moonstudio ~]$ dash -c "su -c \"echo $USER; id\""
uid=0(root) gid=0(root) groups=0(root)

More information about the ubuntu-users mailing list