Bug 1997065

Summary: During provisioning anaconda postinstall is running on the background instead of showing logs
Product: Red Hat Satellite Reporter: Ahmed Eladawy <aeladawy>
Component: ProvisioningAssignee: Lukas Zapletal <lzap>
Status: CLOSED ERRATA QA Contact: Ondrej Gajdusek <ogajduse>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.10.0CC: ahumbe, inecas, ktordeur, lzap, sadas, sshtein, zhunting
Target Milestone: 6.10.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: foreman-2.5.2.11-1,foreman-2.5.2.13-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-16 14:13:28 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
anaconda prompt none

Description Ahmed Eladawy 2021-08-24 11:04:54 UTC
Created attachment 1817132 [details]
anaconda prompt

Description of problem:

During the provisioning , after generating initramfs , the screen is changed to [anaconda root@hostname /]# instead of showing the postinstall steps while the postinstall steps are running on the background.

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

satellite 6.10

How reproducible:

100%

Steps to Reproduce:
1. Provision and new machine and monitor the installation from the machine console


Actual results:

Screen with prompt [ anaconda root@HOSTNAME /] #

Screenshot attached.

Expected results:

The log of postinstall scripts (finish template) 

Additional info:

- On the satellite the provisioned machine state is error until the anaconda reboot is done.
- It caused confusion that the provisioning is failed while it is still running on the background which will occur with the customer as well.
- On previous satellite versions (6.9) kickstart default contains the following :

-----
%post --log=/root/install.post.log
logger "Starting anaconda HOSTNAME postinstall"
exec < /dev/tty3 > /dev/tty3
#changing to VT 3 so that we can see whats going on....
/usr/bin/chvt 3
-----

Which is removed on 6.10


----
%post --log=/root/install.post.log
logger "Starting anaconda HOSTNAME postinstall"
----

Comment 1 Brad Buckingham 2021-08-26 14:41:27 UTC
Lukas,

Is this expected behavior with Satellite 6.10?

Comment 2 Lukas Zapletal 2021-08-30 07:36:43 UTC
Hello,

we haven't removed chvt command, it was just refactored in https://projects.theforeman.org/issues/28521 but it stayed in the same place as it was. Instead of changing to 3 and back to 1 for both post and no root post, it is changed just once.

It is possible that Anaconda changes order of execution of post scripts, in that case, we would need to change twice.

This will not work for RHEL8 tho, there is tmux in use.

If you add chvt 1 before the %end and then add chvt 3 and chvt 1 to the %post section, does it work?

Comment 3 Ahmed Eladawy 2021-08-30 10:40:50 UTC
(In reply to Lukas Zapletal from comment #2)
> Hello,
> 
> we haven't removed chvt command, it was just refactored in
> https://projects.theforeman.org/issues/28521 but it stayed in the same place
> as it was. Instead of changing to 3 and back to 1 for both post and no root
> post, it is changed just once.
> 
> It is possible that Anaconda changes order of execution of post scripts, in
> that case, we would need to change twice.
> 
> This will not work for RHEL8 tho, there is tmux in use.
> 
> If you add chvt 1 before the %end and then add chvt 3 and chvt 1 to the
> %post section, does it work?


Hello,

1) Adding the following did not fix the issue :

"""
If you add chvt 1 before the %end and then add chvt 3 and chvt 1 to the %post section, does it work?
"""

2) On https://projects.theforeman.org/projects/foreman/repository/revisions/bb4633bcd4facc339a8099f4a8e89312323d8b61/diff i can find that the following lines have been removed :

- before %end
"""
/usr/bin/chvt 1
) 2>&1 | tee /mnt/sysimage/root/install.postnochroot.log
<%= section_end -%>
"""

- %post section

"""
exec < /dev/tty3 > /dev/tty3
#changing to VT 3 so that we can see whats going on....
/usr/bin/chvt 3
<%= snippet_if_exists(template_name + " custom post") %>
"""

Comment 4 Lukas Zapletal 2021-09-07 10:12:39 UTC
Right,

I filed https://projects.theforeman.org/issues/33426 and made a patch https://github.com/theforeman/foreman/pull/8765

Can you test it for me please?

Comment 5 Bryan Kearney 2021-09-07 12:05:45 UTC
Upstream bug assigned to lzap

Comment 6 Bryan Kearney 2021-09-07 12:05:48 UTC
Upstream bug assigned to lzap

Comment 7 Ahmed Eladawy 2021-09-09 12:34:24 UTC
(In reply to Lukas Zapletal from comment #4)
> Right,
> 
> I filed https://projects.theforeman.org/issues/33426 and made a patch
> https://github.com/theforeman/foreman/pull/8765
> 
> Can you test it for me please?

Using the patch https://github.com/theforeman/foreman/pull/8765 works as expected for both RHEL 7 and 8.

Thanks Lukas

Comment 8 Lukas Zapletal 2021-09-10 08:53:12 UTC
Thanks a bunch.

Comment 14 Ondrej Gajdusek 2021-10-07 16:03:45 UTC
VERIFIED

on both RHEL 7 and RHEL 8. The output of the %post script is now visible to the user and is present in the respective files in /root on the installed system.

foreman-2.5.2.13-1.el7sat.noarch

Comment 17 errata-xmlrpc 2021-11-16 14:13:28 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 (Moderate: Satellite 6.10 Release), and where to find the updated
files, follow the link below.

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

https://access.redhat.com/errata/RHSA-2021:4702

Comment 18 Lukas Zapletal 2022-03-01 09:40:50 UTC
*** Bug 1785063 has been marked as a duplicate of this bug. ***

Comment 19 Red Hat Bugzilla 2023-09-15 01:14:11 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 500 days