Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AixPB: Put /usr/bin at the front of PATH for AIX #2288

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Haroon-Khel
Copy link
Contributor

@Haroon-Khel Haroon-Khel commented Aug 3, 2021

  • commit message has one of the standard prefixes
  • faq.md updated if appropriate
  • other documentation is changed or added (if applicable)
  • playbook changes run through VPC or QPC (if you have access)
  • for inventory.yml changes, bastillion/nagios/jenkins updated accordingly

Copy of #2057, but that wont merge due to the owner of that pr not having eclipse authorisation.

I've also removed the /etc/shells addition from #2057 since it was unrelated to the initial reason for the pr and was preventing it from being merged. It can be added later in another pr

The changes here have been tested already in #2057

Copy link
Member

@sxa sxa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Haroon-Khel Have we tested this on any of the machines with some builds and test jobs to ensure nothing breaks as a result if picking up the AIX system tools by default? If so I'm happy to merge.

@sxa
Copy link
Member

sxa commented Sep 7, 2021

See also #1979 which adjusts the perl symlink in /usr/bin so we'd ideally want to verify both of these together.

@Haroon-Khel
Copy link
Contributor Author

@Haroon-Khel Have we tested this on any of the machines with some builds and test jobs to ensure nothing breaks as a result if picking up the AIX system tools by default? If so I'm happy to merge.

This pr was tested in #2057 (comment)

Copy link
Member

@sxa sxa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok with this, but we need a plan for updating the existing machines as well since I don't think these regexs will adjust the existing machines.

@aixtools
Copy link
Contributor

:)

Copy link
Contributor

@aixtools aixtools left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I have been playing around with how to do this in an idempotent way. See this as a template for what the change could be.

  • key point is to 'slurp' the file, search the shells variable for bash and append it, if it is missing - do nothing if it already exists.
# Playbook to test slurp module/builtin
---
- hosts: localhost
  gather_facts: no

  pre_tasks:
    - name: Examine login.cfg
      slurp:
        src: /etc/security/login.cfg
      register: logincfg
    - name: extract shells setting in login.cfg
      set_fact:
        shells: "{{ logincfg['content'] | b64decode | regex_search('shells = (.*)') }}"
    - name: check for bash in shells setting
      set_fact:
        bash_in_shells: "{{ shells.find('bash') }}"

  tasks:
    - name: "Add bash to shells variable, if missing."
      block:
      - name: "Add bash to shells variable, if missing."
        replace:
          path: /etc/security/login.cfg
          regexp: '(shells = [^ \n]+)'
          replace: '\1,/usr/bin/bash,/bin/bash'
        tags: login_shell
      - name: "Add bash to /etc/shells"
        blockinfile:
          path: /etc/shells
          block: |
            /usr/bin/bash
            /bin/bash
        tags: login_shell
      when: bash_in_shells == "-1"

@sxa
Copy link
Member

sxa commented Oct 6, 2021

Just occurred to me - why do we need bash in the available shells? Is it just a "nice to have" because we've installed it? Seems unrelated to putting /usr/bin at the start of the PATH

@sxa
Copy link
Member

sxa commented Nov 17, 2021

I'm ok with this, but we need a plan for updating the existing machines as well

@Haroon-Khel Is this ready to go in? Have you put together such a plan yet, and if not can we make sure this is done please.

@sxa sxa added this to the December 2021 milestone Dec 1, 2021
@sxa sxa modified the milestones: December 2021, 2022-01 (January) Jan 6, 2022
@aixtools
Copy link
Contributor

Just occurred to me - why do we need bash in the available shells? Is it just a "nice to have" because we've installed it? Seems unrelated to putting /usr/bin at the start of the PATH

  • bash is not needed as a user shell.
  • bash is needed by gmake

@aixtools
Copy link
Contributor

I'm ok with this, but we need a plan for updating the existing machines as well

@Haroon-Khel Is this ready to go in? Have you put together such a plan yet, and if not can we make sure this is done please.

You want a plan? Just say do it - and -

  • I'll manually edit /etc/environment.

  • change all jenkins default shell to 'ksh'

  • check AIX systems are idle and restart jenkins.

  • the hardest bit will be tracking which nodes have been done - guess, rather than just re-cycle jenkins, reboot (then I can use uptime to see if they have been updated and re-cycled.

Copy link
Contributor

@aixtools aixtools left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • remove /opt/freeware/bin from PATH.
  • having /opt/freeware/bin in, or not in, the PATH seems to have no effect on jenkins jobs (see adopt04 PATH).
  • my expectation is that the build commands going to jenkins are modifying the PATH variable anyway (e.g., as for xlc16 jobs).
  • Better to ALWAYS rely on the build-scripts to setup/verify the environment variables - rather than expect a variable to be provided by /etc/environment and/or /etc/profile

e.g., the current Adoptium/AIX PATH variable definitions:

root@nim.bak:[/home/root]dsh-adopt.ksh "echo \$PATH"
adopt01:
/opt/freeware/bin:/opt/IBM/xlC/13.1.3/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java6/jre/bin:/usr/java6/bin
==============
adopt02:
/opt/freeware/bin:/opt/IBM/xlC/13.1.3/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java6/jre/bin:/usr/java6/bin
==============
adopt03:
/usr/bin:/opt/IBM/xlC/13.1.3/bin:/opt/freeware/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java8_64/jre/bin:/usr/java8_64/bin:/opt/bin
==============
adopt04:
/opt/IBM/xlC/13.1.3/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java7_64/jre/bin:/usr/java7_64/bin
==============
adopt05:
/opt/freeware/bin:/opt/IBM/xlC/13.1.3/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java6/jre/bin:/usr/java6/bin
==============
adopt06:
/opt/freeware/bin:/opt/IBM/xlC/13.1.3/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java6/jre/bin:/usr/java6/bin:/opt/bin
==============
adopt07:
/opt/freeware/bin:/opt/IBM/xlC/13.1.3/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java6/jre/bin:/usr/java6/bin:/opt/bin
==============
adopt08:
/opt/freeware/bin:/opt/IBM/xlC/13.1.3/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java8_64/jre/bin:/usr/java8_64/bin:/opt/bin
==============

@sxa
Copy link
Member

sxa commented Jan 10, 2022

Just occurred to me - why do we need bash in the available shells? Is it just a "nice to have" because we've installed it? Seems unrelated to putting /usr/bin at the start of the PATH

* bash is not needed as a user shell.
* bash is needed by gmake

Hmmm in what sense is bash explcitly needed by gmake? Even if we reuqire bash in some of the makefils I'm still unclear on why that would require it to be listed in the shells.

@sxa
Copy link
Member

sxa commented Jan 10, 2022

Implementing this is going to have to wait at the moment - we've got a release starting next week and I don't want to risk any stability issues.

@aixtools
Copy link
Contributor

ok.

@aixtools
Copy link
Contributor

Just occurred to me - why do we need bash in the available shells? Is it just a "nice to have" because we've installed it? Seems unrelated to putting /usr/bin at the start of the PATH

* bash is not needed as a user shell.

* bash is needed by gmake

Just occurred to me - why do we need bash in the available shells? Is it just a "nice to have" because we've installed it? Seems unrelated to putting /usr/bin at the start of the PATH

* bash is not needed as a user shell.
* bash is needed by gmake

Hmmm in what sense is bash explcitly needed by gmake? Even if we reuqire bash in some of the makefils I'm still unclear on why that would require it to be listed in the shells.

  • bash is not needed in the shells
  • the make scripts make use of special i/o redirects (fifo redirects, which is why we have the /tmp/sh* garbage) that only work when bash is used to execute them.
  • Again - bash is not needed in the list of valid user shells (for the command chsh)

@aixtools
Copy link
Contributor

Implementing this is going to have to wait at the moment - we've got a release starting next week and I don't want to risk any stability issues.

  • Please assign to me. I'll be testing that /opt/freeware/bin is not even needed in PATH, not bash in shells.
  • testing outside of osuosl btw.

@aixtools
Copy link
Contributor

aixtools commented Mar 2, 2022

You can leave this open, but as I am re-writing most of these things - and even have a plan for not needing to modify PATH in /etc/profile - I recommend - DO Not merge.

Copy link
Contributor

@aixtools aixtools left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, my request is to not do anything, better, close the PR and tag won't fix' or something like that.

We are a year along, nearly, and I have a way to do this without modifying the global PATH environment variable.

@sxa sxa removed this from the 2022-02 (February) milestone Mar 3, 2022
@sxa
Copy link
Member

sxa commented May 27, 2022

and I have a way to do this without modifying the global PATH environment variable.

@aixtools what is your current planned solution? I believe we currently run into problems if the default make in the path is not GNU make so we'd need to resolve that everywhere we invoke it as a minimum before implementing such a change

@aixtools
Copy link
Contributor

a) use this to get back onto the program.
b) regarding make, my proposal will be to create an additional directory with commands that must come first, such as GNU make. And have this directory be first in PATH.
c) for GNU make, and other commands, as they arise - if any, would have symbolic links placed here to the regular command.

  • Why? This way AIX and GNU packages can update themselves normally without being impacted. Trying to rename programs, e.g., rename AIX make to make.aix - to disable/downgrade preference it may break after applying an update.
  • If you see this as an acceptable solution, I'll get started with it.

@sxa
Copy link
Member

sxa commented Feb 6, 2023

I'm wondering if we can get away without that. In the build scripts we have https://github.com/adoptium/temurin-build/blob/feb021cc605840022713485062a7cebe6f4be9b0/configureBuild.sh#L281 which should make it invoke gmake for AIX so the PATH issue disappears.

Which leaves the test jobs. There is already some handling of this in https://github.com/adoptium/aqa-tests/blob/b60d63cdff92c0ef8079cb5a537ceca28df81b42/buildenv/jenkins/JenkinsfileBase#L429 to force it to invoke gmake, and outside jenkins it's also included in compile.sh

@smlambert as far as you're aware does this mean there should no longer be a dependency on make being GNU make on AIX, since that appears to be what the lines referenced above should achieve - the only question would be whether they are invoked somewhere that doesn't use those definitions.

@aixtools If we can verify that some examples of openjdk/sanity/perf runs run ok on the machines with the AIX make in the path first and gmake somewhere later then this will probably make life a lot easier....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants