Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1785063 - Post-installation scripts in Kickstart are not logging the STDOUT messages in ks-post.log
Summary: Post-installation scripts in Kickstart are not logging the STDOUT messages in...
Keywords:
Status: CLOSED DUPLICATE of bug 1997065
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Provisioning
Version: 6.6.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact: Ondrej Gajdusek
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-12-19 03:16 UTC by Satyajit Das
Modified: 2024-12-20 18:57 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-03-01 09:40:50 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 5027471 0 None None None 2020-04-29 05:51:29 UTC

Description Satyajit Das 2019-12-19 03:16:42 UTC
Description of problem:

Post-installation scripts in Kickstart are not logging the STDOUT messages in ks-post.log

~~~~~~~~~
%post --log=/root/ks-post.log 
~~~~~~~~~

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

RHEL -8


How reproducible:

100%

Steps to Reproduce:

1. Built a Host with the below ks template.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lang en_US
keyboard us
timezone America/Cancun --isUtc
rootpw $1$T22cHjqs$LdtPVN8aDbqjYgrE32DOq/ --iscrypted
#platform x86, AMD64, or Intel EM64T
reboot
text
cdrom
bootloader --location=mbr --append="rhgb quiet crashkernel=auto"
zerombr
clearpart --all --initlabel
autopart
auth --passalgo=sha512 --useshadow
selinux --enforcing
firewall --enabled
skipx
firstboot --disable
%post --log=/root/ks-post.log 
useradd Test =====>  The user was created post provisioning.
%end
%packages
@standard
%end
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

2. The user was created post provisioning.
3.%post --log=/root/ks-post.log  ======> This file did not have the execution logs. 

Actual results:
~~~~~~~~~~~~~~~~~~~~
# cat ks-post.log

(Wed Dec 18 11:04:21:509214 2019) [sss_cache] [confdb_get_domains] (0x0010): No domains configured, fatal error!
Could not open available domains
useradd: sss_cache exited with status 2
useradd: Failed to flush the sssd cache.
(Wed Dec 18 11:04:21:518660 2019) [sss_cache] [confdb_get_domains] (0x0010): No domains configured, fatal error!
Could not open available domains
useradd: sss_cache exited with status 2
useradd: Failed to flush the sssd cache.
~~~~~~~~~~~~~~~~~~~~

Expected results:

It should contain the execution logs.

Additional info:

I use RedHat satellite to provision host, recently I observed post-installation scripts in Kickstart are not logging the STDOUT messages in ks-post.log, earlier it was logging all the details like( registration(subscription-manager output) and yum update output).

Comment 1 Jan Stodola 2020-01-17 14:28:34 UTC
What is the expected content of /root/ks-post.log from the example?

The command "useradd Test" doesn't print anything to stdout, so there is nothing to log:
[root@localhost ~]# useradd Test
[root@localhost ~]#

Comment 4 Stefan Heijman 2020-01-17 14:36:57 UTC
(In reply to Jan Stodola from comment #1)
> What is the expected content of /root/ks-post.log from the example?
I think you can look better at the Satellite Kickstart default %post section then the example here.

Comment 5 Jan Stodola 2020-01-17 15:50:17 UTC
I've tried it on RHEL-8.1 GA using the following kickstart file:

[root@localhost ~]# cat original-ks.cfg 
lang en_US.UTF-8
keyboard us
reboot
text
rootpw redhat
timezone --utc America/New_York

bootloader --location=mbr
zerombr
clearpart --all --initlabel
autopart

%packages
%end

%post --log=/root/ks-post.log
subscription-manager register --username=test --password=test
%end
[root@localhost ~]#


Logs from the %post script are present:

[root@localhost ~]# cat /root/ks-post.log 
Registering to: subscription.rhsm.redhat.com:443/subscription
HTTP error (401 - Unauthorized): Invalid user credentials
[root@localhost ~]#

Satyajit, could you please attach the kickstart file that's not working for you?

Comment 6 Stefan Heijman 2020-01-20 07:55:28 UTC
(In reply to Jan Stodola from comment #5)
> Satyajit, could you please attach the kickstart file that's not working for
Can you look at Support Case 02536726, there this BZ is created.

Comment 7 Jan Stodola 2020-01-20 09:21:51 UTC
The kickstart file in the ticket logs only one %post section:

%post --log=/mnt/sysimage/root/install.post.log
...
%end

The path for the log file doesn't seem correct and should be:
%post --log=/root/install.post.log


See RHEL documentation:
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/performing_an_advanced_rhel_installation/kickstart-script-file-format-reference_installing-rhel-as-an-experienced-user#post-script-in-kickstart-file_scripts-in-kickstart-file

--log=
    Logs the script’s output into the specified log file. Note that the path of the log file must take into account whether or not you use the --nochroot option. For example, without --nochroot:
    %post --log=/root/ks-post.log
    and with --nochroot:
    %post --nochroot --log=/mnt/sysimage/root/ks-post.log

Can you please retest with the correct path?

Comment 16 Lukas Zapletal 2022-03-01 09:40:50 UTC
Fixed in Satellite 6.10

*** This bug has been marked as a duplicate of bug 1997065 ***


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