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

vagrant: Upgrade Fedora 35 vagrantfile to Fedora 40 #3663

Closed
wants to merge 19 commits into from

Conversation

Haroon-Khel
Copy link
Contributor

@Haroon-Khel Haroon-Khel commented Jul 9, 2024

  • 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)
  • VPC/QPC not applicable for this PR
  • for inventory.yml changes, bastillion/nagios/jenkins updated accordingly

Fixes #3662

@Haroon-Khel
Copy link
Contributor Author

Ive temporarily changed the config of the VPC to pull from this branch. Running a fedora40 job https://ci.adoptium.net/view/Tooling/job/VagrantPlaybookCheck/1910/console

Copy link
Contributor

@steelhead31 steelhead31 left a comment

Choose a reason for hiding this comment

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

Looks OK, VPC fails, I think due to a similar issue I've had with Ubuntu 24.04.. if an older version of Python is available, you could try setting that up on the Fedora Box as part of the Vagrant file, and specifying the perl interpreter.

Copy link
Contributor

@karianna karianna left a comment

Choose a reason for hiding this comment

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

LGTM, feel free to merge post VPC success.

@Haroon-Khel
Copy link
Contributor Author

Python2 seems to work but then I hit this error

19:09:50 TASK [logs : Update Log File] **************************************************
19:09:52 fatal: [127.0.0.1]: FAILED! => {"changed": false, "msg": "Aborting, target uses selinux but python bindings (libselinux-python) aren't installed!"}

The only available libselinux-python package on fedora40 is python3-libselinux which doesnt look like it helps if the default python is python2


$script = <<SCRIPT

# Install python2, make it the default python
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment seems incorrect?

@Haroon-Khel
Copy link
Contributor Author

Haroon-Khel commented Jul 30, 2024

I think ive hit a wall with this. I am not able to get passed the error in #3663 (comment)

@Haroon-Khel
Copy link
Contributor Author

Haroon-Khel commented Jul 30, 2024

Eventhough python3-libselinux is installed, python3.8 is having trouble finding it. Only python3.12 is able to find it

[root@fedora vagrant]# python3.8
Python 3.8.19 (default, Apr 17 2024, 00:00:00) 
[GCC 14.0.1 20240411 (Red Hat 14.0.1-0)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import selinux
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'selinux'
>>> exit()
[root@fedora vagrant]# python3
Python 3.12.2 (main, Feb 21 2024, 00:00:00) [GCC 14.0.1 20240217 (Red Hat 14.0.1-0)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import selinux
>>>
[root@fedora vagrant]# ls -la /usr/lib64/python3.12/site-packages/selinux
total 544
drwxr-xr-x.  3 root root    141 Jul 30 11:54 .
drwxr-xr-x. 17 root root   4096 Jul 30 11:54 ..
-rwxr-xr-x.  1 root root 255560 Jan 25  2024 audit2why.cpython-312-x86_64-linux-gnu.so
-rw-r--r--.  1 root root  39069 Jan 25  2024 __init__.py
drwxr-xr-x.  2 root root     76 Jul 30 11:54 __pycache__
-rwxr-xr-x.  1 root root 251880 Jan 25  2024 _selinux.cpython-312-x86_64-linux-gnu.so

[root@fedora vagrant]# ls -la /usr/lib64/python3.8/site-packages/selinux
ls: cannot access '/usr/lib64/python3.8/site-packages/selinux': No such file or directory

Trying the hack at https://dmsimard.com/2016/01/08/selinux-python-virtualenv-chroot-and-ansible-dont-play-nice/ of just copying the selinux directory over to the 3.8 library did not work

[root@fedora vagrant]# python3.8
Python 3.8.19 (default, Apr 17 2024, 00:00:00) 
[GCC 14.0.1 20240411 (Red Hat 14.0.1-0)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import selinux
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python3.8/site-packages/selinux/__init__.py", line 10, in <module>
    from . import _selinux
ImportError: cannot import name '_selinux' from partially initialized module 'selinux' (most likely due to a circular import) (/usr/lib64/python3.8/site-packages/selinux/__init__.py)

@Haroon-Khel
Copy link
Contributor Author

Haroon-Khel commented Jul 30, 2024

The wider solution is to update Ansible on the host, infrastructure-ibmcloud-vagrant-x64-1, so that it can use python3.12

@Haroon-Khel
Copy link
Contributor Author

Haroon-Khel commented Jul 30, 2024

Installing selinux via pip looks promising, with pip being installed with python 3.8

[root@fedora vagrant]# python3.8
Python 3.8.19 (default, Apr 17 2024, 00:00:00) 
[GCC 14.0.1 20240411 (Red Hat 14.0.1-0)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import selinux
>>>

@Haroon-Khel
Copy link
Contributor Author

Using selinux installed via pip and having /usr/bin/python3 point to /usr/bin/python3.8 I get as far as

14:41:16 TASK [Common : YUM upgrade all packages] ***************************************
14:41:18 fatal: [127.0.0.1]: FAILED! => {"changed": false, "cmd": "dnf install -y python3-dnf", "msg": "Could not import the dnf python module using /usr/bin/python3.8 (3.8.19 (default, Apr 17 2024, 00:00:00) [GCC 14.0.1 20240411 (Red Hat 14.0.1-0)]). Please install `python3-dnf` package or ensure you have specified the correct ansible_python_interpreter.", "rc": 1, "results": [], "stderr": "Traceback (most recent call last):\n  File \"/usr/bin/dnf\", line 61, in <module>\n    from dnf.cli import main\nModuleNotFoundError: No module named 'dnf'\n", "stderr_lines": ["Traceback (most recent call last):", "  File \"/usr/bin/dnf\", line 61, in <module>", "    from dnf.cli import main", "ModuleNotFoundError: No module named 'dnf'"], "stdout": "", "stdout_lines": []}
14:41:18 
14:41:18 PLAY RECAP *********************************************************************
14:41:18 127.0.0.1                  : ok=13   changed=3    unreachable=0    failed=1    skipped=24   rescued=0    ignored=1   

@sxa sxa mentioned this pull request Oct 4, 2024
2 tasks
@steelhead31
Copy link
Contributor

Superceded by #3761

@steelhead31 steelhead31 closed this Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade Fedora 35 on the VPC to Fedora 40
4 participants