Bug 1803607

Summary: Service disabled after upgrading node
Product: [oVirt] imgbased Reporter: Le Anh Tuan <ltuan>
Component: GeneralAssignee: Lev Veyde <lveyde>
Status: CLOSED DEFERRED QA Contact: peyu
Severity: medium Docs Contact:
Priority: low    
Version: 1.2.7CC: bugs, cshao, lsurette, lsvaty, mavital, mtessun, peyu, qiyuan, sbonazzo, srevivo, weiwang, yaniwang, ycui
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-03-03 16:18:27 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Node RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
node after upgrading version 4.3.7 -> 4.3.8 none

Description Le Anh Tuan 2020-02-17 02:35:29 UTC
Created attachment 1663425 [details]
node after upgrading version 4.3.7 -> 4.3.8

Description of problem:
Service disabled after upgrading RHV version

Version-Release number of selected component (if applicable):
4.3.7 -> 4.3.8

How reproducible:
Upgrade to any RHV version

Steps to Reproduce:
1. Install custom components (example: node_exporter)
2. Enable service to startup with system: systemctl enable node_exporter
3. Upgrade to any RHV version

Actual results:
Service got disabled. 

Expected results:
Service should be enabled as defined

Additional info:

Comment 1 Ryan Barry 2020-02-17 15:15:43 UTC
How were the packages installed?

Comment 2 RHEL Program Management 2020-02-17 15:15:51 UTC
The documentation text flag should only be set after 'doc text' field is provided. Please provide the documentation text and set the flag to '?' again.

Comment 3 Le Anh Tuan 2020-02-17 16:25:14 UTC
(In reply to Ryan Barry from comment #1)
> How were the packages installed?

from rpm packages. In my case, I used this:
https://packagecloud.io/prometheus-rpm/release/packages/el/7/node_exporter-0.18.1-1.el7.centos.x86_64.rpm

Comment 4 Ryan Barry 2020-02-17 16:27:24 UTC
I meant: with "rpm -ivh" or yum?

Comment 5 Le Anh Tuan 2020-02-17 16:28:46 UTC
(In reply to Ryan Barry from comment #4)
> I meant: with "rpm -ivh" or yum?

yum, custom repos, not Red Hat repos

Comment 6 Ryan Barry 2020-02-17 17:31:42 UTC
The custom repo should not matter. Can you post an sosreport, please?

Comment 7 Le Anh Tuan 2020-02-17 17:52:06 UTC
(In reply to Ryan Barry from comment #6)
> The custom repo should not matter. Can you post an sosreport, please?

Please check my file, sorry it's over attachment size:
https://drive.google.com/open?id=1jM79GXgesfgGwm9fqQ4G9mdVlaHwIkbn

Thanks.

Comment 8 Ryan Barry 2020-02-18 00:22:40 UTC
So, imgbased repeatedly does try to reinstall this.

Le, can you please try "yum -y install /var/imgbased/persisted-rpms/node_exporter*" ?

2020-02-17 09:01:16,072 [DEBUG] (MainThread) Running ['systemd-nspawn', '--uuid', '93508011d7c54d6e81e626cdafdcd907', '--machine', 'nuc1.home.local', '-D', u'/tmp/mnt.m4ixC//', 'yum', 'install', '-y', '--noplugins', '/var/imgbased/persisted-rpms/node_exporter-0.18.1-1.el7.centos.x86_64.rpm']

Comment 9 Le Anh Tuan 2020-02-18 04:52:17 UTC
(In reply to Ryan Barry from comment #8)
> So, imgbased repeatedly does try to reinstall this.
> 
> Le, can you please try "yum -y install
> /var/imgbased/persisted-rpms/node_exporter*" ?
> 
> 2020-02-17 09:01:16,072 [DEBUG] (MainThread) Running ['systemd-nspawn',
> '--uuid', '93508011d7c54d6e81e626cdafdcd907', '--machine',
> 'nuc1.home.local', '-D', u'/tmp/mnt.m4ixC//', 'yum', 'install', '-y',
> '--noplugins',
> '/var/imgbased/persisted-rpms/node_exporter-0.18.1-1.el7.centos.x86_64.rpm']

Please check my output:

Examining /var/imgbased/persisted-rpms/node_exporter-0.18.1-1.el7.centos.x86_64.rpm: node_exporter-0.18.1-1.el7.centos.x86_64
/var/imgbased/persisted-rpms/node_exporter-0.18.1-1.el7.centos.x86_64.rpm: does not update installed package.
Error: Nothing to do
Uploading Enabled Repositories Report
Loaded plugins: product-id, subscription-manager, versionlock
Unable to upload Enabled Repositories Report

Thanks!

Comment 11 Sandro Bonazzola 2020-02-18 09:02:01 UTC
We need to check if this affects only this specific package or if it affects any 3rd party service on node.

Comment 12 Ryan Barry 2020-02-18 09:29:15 UTC
This looks like a subtle regression or missed case from https://bugzilla.redhat.com/show_bug.cgi?id=1380797

See also https://bugzilla.redhat.com/show_bug.cgi?id=1567908 which appears to be a case of a modified file in /etc not making it over

Comment 13 Yuval Turgeman 2020-02-18 09:49:25 UTC
Can you please share the imgbased.log ?

Comment 14 Ryan Barry 2020-02-18 12:08:38 UTC
Already part of the sosreport.

2020-02-17 09:00:37,297 [DEBUG] (migrate_etc) Calling binary: (['mount', u'/dev/rhvh/rhvh-4.3.8.1-0.20200126.0+1', u'/tmp/mnt.Hjdsy'],) {}
2020-02-17 09:00:37,297 [DEBUG] (migrate_etc) Calling: (['mount', u'/dev/rhvh/rhvh-4.3.8.1-0.20200126.0+1', u'/tmp/mnt.Hjdsy'],) {'close_fds': True, 'stderr': -2}
....
2020-02-17 09:00:40,114 [DEBUG] (migrate_etc) Calling binary: (['cp', '-a', '-r', u'/tmp/mnt.uDwNv///etc/systemd/system/multi-user.target.wants/node_exporter.service', u'/tmp/mnt.Hjdsy///etc/systemd/system/multi-user.target.wants/node_exporter.service'],) {}
2020-02-17 09:00:40,114 [DEBUG] (migrate_etc) Calling: (['cp', '-a', '-r', u'/tmp/mnt.uDwNv///etc/systemd/system/multi-user.target.wants/node_exporter.service', u'/tmp/mnt.Hjdsy///etc/systemd/system/multi-user.target.wants/node_exporter.service'],) {'close_fds': True, 'stderr': -2}

Comment 15 Qin Yuan 2020-02-19 04:56:50 UTC
From the log, we can see node_exporter was installed after node_exporter.service was copied:

2020-02-17 09:00:40,114 [DEBUG] (migrate_etc) Calling: (['cp', '-a', '-r', u'/tmp/mnt.uDwNv///etc/systemd/system/multi-user.target.wants/node_exporter.service', u'/tmp/mnt.Hjdsy///etc/systemd/system/multi-user.target.wants/node_exporter.service'],) {'close_fds': True, 'stderr': -2}

2020-02-17 09:01:16,072 [DEBUG] (MainThread) Running ['systemd-nspawn', '--uuid', '93508011d7c54d6e81e626cdafdcd907', '--machine', 'nuc1.home.local', '-D', u'/tmp/mnt.m4ixC//', 'yum', 'install', '-y', '--noplugins', '/var/imgbased/persisted-rpms/node_exporter-0.18.1-1.el7.centos.x86_64.rpm']


The scripts of node_exporter rpm are:

[root@dell-per740-28 ~]# rpm -q --scripts node_exporter
preinstall scriptlet (using /bin/sh):
getent group prometheus >/dev/null || groupadd -r prometheus
getent passwd prometheus >/dev/null || \
  useradd -r -g prometheus -d /var/lib/prometheus -s /sbin/nologin \
          -c "Prometheus services" prometheus
exit 0
postinstall scriptlet (using /bin/sh):

if [ $1 -eq 1 ] ; then 
        # Initial installation 
        systemctl preset node_exporter.service >/dev/null 2>&1 || : 
fi
preuninstall scriptlet (using /bin/sh):

if [ $1 -eq 0 ] ; then 
        # Package removal, not upgrade 
        systemctl --no-reload disable node_exporter.service > /dev/null 2>&1 || : 
        systemctl stop node_exporter.service > /dev/null 2>&1 || : 
fi
postuninstall scriptlet (using /bin/sh):

systemctl daemon-reload >/dev/null 2>&1 || :


As you can see, in postinstall script, it calls "systemctl preset node_exporter.service", node_exporter.service will be set to disabled when install.

Comment 16 Qin Yuan 2020-02-19 05:04:01 UTC
This issue shouldn't be specific to node_exporter, seems any service with disabled vendor preset will encounter this problem.

Comment 17 Martin Tessun 2020-09-08 07:53:24 UTC
We could simply revers the actions:

1. Install the rpm
2. Copy the systemd-files back.

That should solve the issue.

Comment 18 Sandro Bonazzola 2020-11-06 15:27:16 UTC
Moving out to 4.5 due to capacity.

Comment 22 Sandro Bonazzola 2021-03-24 08:55:39 UTC
Is this reproducible on RHV 4.4?

Comment 23 peyu 2021-03-25 01:50:09 UTC
(In reply to Sandro Bonazzola from comment #22)
> Is this reproducible on RHV 4.4?

QE can reproduce this issue on RHV 4.4.

Comment 25 Sandro Bonazzola 2022-03-03 16:18:27 UTC
Closing due to capacity. If we'll have capacity we can reopen it.