Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1057239 - rhevm-dwh-setup fails because of unexpected output in login shell without reasonable error message
Summary: rhevm-dwh-setup fails because of unexpected output in login shell without rea...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine-dwh
Version: 3.3.0
Hardware: Unspecified
OS: Unspecified
urgent
high
Target Milestone: ---
: 3.4.0
Assignee: Yedidyah Bar David
QA Contact: Petr Beňas
URL:
Whiteboard: integration
: 1057233 (view as bug list)
Depends On: 1058012 1065730 1066459 1075665
Blocks: rhev3.4beta 1142926
TreeView+ depends on / blocked
 
Reported: 2014-01-23 17:02 UTC by Petr Beňas
Modified: 2014-09-18 12:24 UTC (History)
12 users (show)

Fixed In Version: ovirt-3.4.0-beta3
Doc Type: Bug Fix
Doc Text:
Previously, configuration of the Data Warehouse feature failed under certain circumstances. This occurred when the ovirt-engine-dwh-setup command was run in non-interactive mode and the user elected not to create a read-only user during the configuration process. Now, configuration of the Data Warehouse feature is handled by the engine-setup command, which uses different logic to detect the user used to perform the tasks involved in configuration, and the Data Warehouse feature is configured correctly.
Clone Of:
Environment:
Last Closed: 2014-06-09 15:17:59 UTC
oVirt Team: ---
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2014:0601 normal SHIPPED_LIVE rhevm-dwh 3.4 bug fix and enhancement update 2014-06-09 19:15:53 UTC

Description Petr Beňas 2014-01-23 17:02:54 UTC
Description of problem:
Unable to complete rhevm-dwh-setup. 

Version-Release number of selected component (if applicable):
rhevm-dwh.noarch 0:3.3.0-28.el6ev

How reproducible:
100%

Steps to Reproduce:
1. rhevm-dwh-setup
2. readonly DB user? no

Actual results:
[root@pb-rh33 ~]# rhevm-dwh-setup
Welcome to ovirt-engine-dwh setup utility


This utility can configure a read only user for DB access. Would you like to do so? (yes|no): no
Skipping creation of read only DB user.
Error encountered while installing rhevm-dwh, please consult the log file: /var/log/ovirt-engine/rhevm-dwh-setup-2014_01_23_17_58_44.log
[root@pb-rh33 ~]# tail -n 15 /var/log/ovirt-engine/rhevm-dwh-setup-2014_01_23_17_57_34.log
2014-01-23 17:57:36::DEBUG::common_utils::963::root:: stderr = ERROR:  role "engine_history" does not exist

2014-01-23 17:57:36::DEBUG::common_utils::964::root:: retcode = 1
2014-01-23 17:57:36::ERROR::rhevm-dwh-setup::691::root:: Exception caught!
2014-01-23 17:57:36::ERROR::rhevm-dwh-setup::692::root:: Traceback (most recent call last):
  File "/usr/bin/rhevm-dwh-setup", line 634, in main
    utils.createDB(db_dict['dbname'], db_dict['username'])
  File "/usr/share/ovirt-engine-dwh/common_utils.py", line 1174, in createDB
    runPostgresSuQuery(sql_query)
  File "/usr/share/ovirt-engine-dwh/common_utils.py", line 1493, in runPostgresSuQuery
    stdIn=stdIn,
  File "/usr/share/ovirt-engine-dwh/common_utils.py", line 967, in execCmd
    raise Exception(msg)
Exception: Return Code is not zero


Expected results:


Additional info:

Comment 1 Barak 2014-01-26 15:37:21 UTC
please attach logs

Comment 2 Petr Beňas 2014-01-27 08:52:36 UTC
*** Bug 1057233 has been marked as a duplicate of this bug. ***

Comment 3 Petr Beňas 2014-01-27 08:54:30 UTC
The problem was caused by custom bash startup script, which was running also in non-interactive mode and therefore confusing the rhevm-dwh-setup utility.

Comment 4 Petr Beňas 2014-01-29 09:06:46 UTC
Reopening, since I was told by pstehlik (CCed) this is a bug. 

If a login shell, which does not check for interactive/noninteractive mode is used, the dwh-setup fails in various ways without reporting the actual cause. 

Example of the original faulty script behaviour. 

[root@pb-rh33 ~]# su postgres -c 'echo hi'
hi
[root@pb-rh33 ~]# su - postgres -c 'echo hi'

CPU      => Intel Core 2 Duo P9xxx (Penryn Class Core 2)
uptime   => 10:06:14 up 26 days, 19:49, 1 user, load average: 0.05, 0.03, 0.00
RAM      => Total 4.7 GB  / Free 0.3 GB
swap     => Total 2.0 GB  / Free 2.0 GB
OS       => Red Hat Enterprise Linux Server release 6.5 (Santiago)
IP/s     => eth0: 10.34.63.70
Bridge/s =>
VDSM     => package vdsm is not installed
libvirt  => package libvirt is not installed
qemu     => package qemu-kvm-rhev is not installed


CPU      => Intel Core 2 Duo P9xxx (Penryn Class Core 2)
uptime   => 10:06:14 up 26 days, 19:49, 1 user, load average: 0.05, 0.03, 0.00
RAM      => Total 4.7 GB  / Free 0.3 GB
swap     => Total 2.0 GB  / Free 2.0 GB
OS       => Red Hat Enterprise Linux Server release 6.5 (Santiago)
IP/s     => eth0: 10.34.63.70
Bridge/s =>
VDSM     => package vdsm is not installed
libvirt  => package libvirt is not installed
qemu     => package qemu-kvm-rhev is not installed

hi

Comment 5 Yedidyah Bar David 2014-01-29 09:48:59 UTC
Well, I claim this is not a bug. Or at least not something we want to fix. Just this one is probably quite easy to fix - as I told Petr in private - we can e.g. check if the output of 'su - user -c /bin/true' is empty and err otherwise. But what if the admin changed /bin/su? What if there are some other complex changes we didn't think of?

In 3.4 this code was replaced with code that does seteuid instead of su, so this will not happen there. Backporting this will not be trivial and as I said I do not think it's worth it.

Besides, having /etc/profile output stuff for non-interactive shells will probably kill other things as well. I am pretty certain that host-deploy might be affected. Do we want to fix all of that?

Comment 6 Petr Beňas 2014-01-29 10:01:18 UTC
I was told there are bunch of such scripts around internet, so they are problably more common then /bin/su modifications. Wouldn't this issue be solved by using "su user -c command" instead of "su - user -c command"? 

It does not make sense to fix just dwh-setup. If such problems happen in other tools as well, it makes sense to fix them all or none of them.

Comment 7 Yedidyah Bar David 2014-01-29 10:11:03 UTC
(In reply to Petr Beňas from comment #6)
> I was told there are bunch of such scripts around internet,

Can you give me an example? Not for a script showing nice stuff on login, an example for a recommendation by an experienced unix professional to call such a script from /etc/profile without checking if it's an interactive shell?

> so they are
> problably more common then /bin/su modifications. Wouldn't this issue be
> solved by using "su user -c command" instead of "su - user -c command"? 

No.

'su user' without '-' has other issues. A trivial example: By default, /root is unreadable for normal users, and so you'll get this:

# su postgres -c 'psql -c "select 1"'
could not change directory to "/root"
 ?column? 
----------
        1
(1 row)

> 
> It does not make sense to fix just dwh-setup. If such problems happen in
> other tools as well, it makes sense to fix them all or none of them.

Indeed.

Comment 8 Yaniv Lavi 2014-01-29 16:20:20 UTC
Can we close this bug then?



Yaniv

Comment 9 Pavel Stehlik 2014-01-29 18:36:03 UTC
Exactly same happened on another setup - with NO clear explanation to user:

...
This utility can configure a read only user for DB access. Would you like to do so? (yes|no): no
Skipping creation of read only DB user.
Failed to backup database: 'pg_database_size'
Starting ovirt-engine...                              [ DONE ]
Starting oVirt-ETL...                                 [ DONE ]
Error encountered while installing rhevm-dwh, please consult the log file: /var/log/ovirt-engine/rhevm-dwh-setup-2014_01_24_09_41_52.log  


log:
2014-01-24 09:45:28:EBUG::common_utils::962::root:: output = Starting ovirt-engine-dwhd: at Fri Jan 24 09:45:18 CET 2014[  OK  ]^M

2014-01-24 09:45:28:EBUG::common_utils::963::root:: stderr =
2014-01-24 09:45:28:EBUG::common_utils::964::root:: retcode = 0
2014-01-24 09:45:28::ERROR::rhevm-dwh-setup::691::root:: Exception caught!
2014-01-24 09:45:28::ERROR::rhevm-dwh-setup::692::root:: Traceback (most recent call last):
  File "/usr/bin/rhevm-dwh-setup", line 607, in main
    sys.exit(0)
SystemExit: 0

Comment 13 Petr Beňas 2014-01-30 09:19:41 UTC
Clearing the needinfo flag since the question was answered.

Comment 18 Petr Beňas 2014-03-18 14:19:03 UTC
Verified in av3. Setup with dwh and reports configuration finished successfully with the same script, which caused problems in previous versions.

Comment 19 Yedidyah Bar David 2014-05-13 06:17:22 UTC
Andrew, I do not think this is significant enough to be mentioned in the release notes. If we do want to document it, might use something like:

In 3.3, rhevm-dwh-setup used the command /bin/su to run commands as another user. This was sensitive to custom shell startup/login scripts, which could fail it, or cause other unexpected behvior. In 3.4, its functionality was merged into engine-setup, which uses the function seteuid directly, and is thus not sensitive to such custom startup/login scripts.

As I wrote in other comments, we do not guarantee that such startup scripts will not break any other function of rhevm - users can make many kinds of changes to their systems which might break stuff. But this specific issue is now solved.

Comment 20 Andrew Dahms 2014-05-13 06:26:01 UTC
Hi Yedidyah,

Thank you for the clarification - I was actually hoping to ask you about this one myself. :)

I've placed the requires_doc_text flag on '-' for now, but please let me know if there is any need to document this in the advisory later on.

Kind regards,

Andrew

Comment 21 errata-xmlrpc 2014-06-09 15:17:59 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHEA-2014-0601.html


Note You need to log in before you can comment on or make changes to this bug.