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

Investigate FreeBSD and SLES Vagrantfiles for testing the playbooks #1061

Closed
Willsparker opened this issue Dec 23, 2019 · 10 comments · Fixed by #1073
Closed

Investigate FreeBSD and SLES Vagrantfiles for testing the playbooks #1061

Willsparker opened this issue Dec 23, 2019 · 10 comments · Fixed by #1073
Assignees
Milestone

Comments

@Willsparker
Copy link
Contributor

At the request of @sxa555
It'd be useful to have FreeBSD and SLES vagrantfiles that can be used with the pbTestScripts to determine that the playbooks work with these OSs, and are able to build a JDK.

@Willsparker
Copy link
Contributor Author

Willsparker commented Dec 27, 2019

Hit a bit of a snag in which the two main Vagrant Boxes for FreeBSD12, that have any significant amount of downloads (https://app.vagrantup.com/boxes/search?utf8=%E2%9C%93&sort=downloads&provider=&q=freebsd12) both mount the shared folder with smb, (https://www.vagrantup.com/docs/synced-folders/smb.html) which, although not an issue within itself, will require user input of a Username and password. When attempting to use the fields found in the link, (i.e. smb_password ) within the Vagrantfile, the following error message is shown:

==> adoptopenjdkFBSD12: Preparing SMB shared folders...
Vagrant SMB synced folders require the account password to be stored
in an NT compatible format. Please update your sharing settings to
enable a Windows compatible password and try **again**

However, this seems to be only an issue on Mac host, as I didn't have this issue on the Ubuntu18 infra-vagrant-1 jenkins node.
It seems when running on the Jenkins node, it instead acts as if it's of an rsync file type:

==> default: Machine booted and ready!
==> default: Configuring and enabling network interfaces...
==> default: Installing rsync to the VM...
==> default: Rsyncing folder: /home/jenkins/ => /vagrant

@Willsparker
Copy link
Contributor Author

As of current, the vagrant boxes provided on the vagrant website don't have a version of SLES12SP4 , which I believe is the version of SLES used for our testing machines. I''ve tried with the SLES12SP2 vagrant box located here: https://app.vagrantup.com/suse/boxes/sles12sp2
However, this causes results in the following error:

localhost:ansible williamparker$ vagrant up
Bringing machine 'adoptopenjdkC6' up with 'virtualbox' provider...
==> adoptopenjdkC6: Importing base box 'suse/sles12sp2'...
==> adoptopenjdkC6: Matching MAC address for NAT networking...
==> adoptopenjdkC6: Checking if box 'suse/sles12sp2' version '0.0.1' is up to date...
==> adoptopenjdkC6: Setting the name of the VM: ansible_adoptopenjdkC6_1577454538499_56505
==> adoptopenjdkC6: Fixed port collision for 22 => 2222. Now on port 2202.
==> adoptopenjdkC6: Clearing any previously set network interfaces...
==> adoptopenjdkC6: Preparing network interfaces based on configuration...
    adoptopenjdkC6: Adapter 1: nat
    adoptopenjdkC6: Adapter 2: hostonly
==> adoptopenjdkC6: Forwarding ports...
    adoptopenjdkC6: 22 (guest) => 2202 (host) (adapter 1)
==> adoptopenjdkC6: Booting VM...
==> adoptopenjdkC6: Waiting for machine to boot. This may take a few minutes...
    adoptopenjdkC6: SSH address: 127.0.0.1:2202
    adoptopenjdkC6: SSH username: vagrant
    adoptopenjdkC6: SSH auth method: private key
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.

If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.

If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.

If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.

And when looking at the GUI of the VM, the error message is as follows:

initramfs unpacking failed: write error
failed to execute /init (error -2)
...
Kernel Offset: disabled
---[ end Kernel panic - not syncing: No working init found. Try passing init = option to kernel. See Linux Documentation/init.txt for guidance.

@Willsparker
Copy link
Contributor Author

Regarding the above SLES12 Vagrant box, the error message would point to an issue with the ISO image. As this is within the Vagrant box and isn't changeable without booting the VM, I have had to look for different boxes. The issue with other boxes is many of them have issues with the Guest Additions installed on them (or not installed at all). For example, in the case of the suse/sles12sp1 box (https://app.vagrantup.com/suse/boxes/sles12sp1), The following error message is output on vagrant up.

==> adoptopenjdkS12: Checking for guest additions in VM...
    adoptopenjdkS12: No guest additions were detected on the base box for this VM! Guest
    adoptopenjdkS12: additions are required for forwarded ports, shared folders, host only
    adoptopenjdkS12: networking, and more. If SSH fails on this machine, please install
    adoptopenjdkS12: the guest additions and repackage the box to continue.
    adoptopenjdkS12: 
    adoptopenjdkS12: This is not an error message; everything may continue to work properly,
    adoptopenjdkS12: in which case you may ignore this message.
==> adoptopenjdkS12: Setting hostname...
==> adoptopenjdkS12: Configuring and enabling network interfaces...
==> adoptopenjdkS12: Mounting shared folders...
    adoptopenjdkS12: /vagrant => /Users/williamparker/Documents/1061
Vagrant was unable to mount VirtualBox shared folders. This is usually
because the filesystem "vboxsf" is not available. This filesystem is
made available via the VirtualBox Guest Additions and kernel module.
Please verify that these guest additions are properly installed in the
guest. This is not a bug in Vagrant and is usually caused by a faulty
Vagrant box. For context, the command attempted was:

mount -t vboxsf -o uid=1000,gid=1000 vagrant /vagrant

The error output from the command was:

mount: unknown filesystem type 'vboxsf'

And when installing the vagrant-vbguest plugin which is meant to auto-install the guest additions for the box, this is output:

    adoptopenjdkS12: Removing insecure key from the guest if it's present...
    adoptopenjdkS12: Key inserted! Disconnecting and reconnecting using new SSH key...
==> adoptopenjdkS12: Machine booted and ready!
[adoptopenjdkS12] No Virtualbox Guest Additions installation found.
Warning: No repositories defined. Operating only with the installed resolvables. Nothing can be installed.

@Willsparker
Copy link
Contributor Author

Regarding FreeBSD, the VagrantFiles are able to specify the type of shared folder, therefore specifying rsync stops the issue above when on macOS. However, rsync folders don't have built in functionality to sync the host folder to the guest folder, so although the guest VM could create a hosts.tmp it wouldn't be accessible by the host machine. Some plugins are made to counteract this however- i.e. https://github.com/smerrill/vagrant-rsync-back

This seems to work in this context:

localhost:1061 williamparker$ vagrant up
Bringing machine 'adoptopenjdkFBSD12' up with 'virtualbox' provider...
==> adoptopenjdkFBSD12: Importing base box 'generic/freebsd12'...
==> adoptopenjdkFBSD12: Matching MAC address for NAT networking...
==> adoptopenjdkFBSD12: Checking if box 'generic/freebsd12' version '2.0.6' is up to date...
==> adoptopenjdkFBSD12: Setting the name of the VM: 1061_adoptopenjdkFBSD12_1577718378342_4655
==> adoptopenjdkFBSD12: Clearing any previously set network interfaces...
==> adoptopenjdkFBSD12: Preparing network interfaces based on configuration...
    adoptopenjdkFBSD12: Adapter 1: nat
    adoptopenjdkFBSD12: Adapter 2: hostonly
==> adoptopenjdkFBSD12: Forwarding ports...
    adoptopenjdkFBSD12: 22 (guest) => 2222 (host) (adapter 1)
==> adoptopenjdkFBSD12: Running 'pre-boot' VM customizations...
==> adoptopenjdkFBSD12: Booting VM...
==> adoptopenjdkFBSD12: Waiting for machine to boot. This may take a few minutes...
    adoptopenjdkFBSD12: SSH address: 127.0.0.1:2222
    adoptopenjdkFBSD12: SSH username: vagrant
    adoptopenjdkFBSD12: SSH auth method: private key
    adoptopenjdkFBSD12: Warning: Connection reset. Retrying...
    adoptopenjdkFBSD12: Warning: Remote connection disconnect. Retrying...
    adoptopenjdkFBSD12: 
    adoptopenjdkFBSD12: Vagrant insecure key detected. Vagrant will automatically replace
    adoptopenjdkFBSD12: this with a newly generated keypair for better security.
    adoptopenjdkFBSD12: 
    adoptopenjdkFBSD12: Inserting generated public key within guest...
    adoptopenjdkFBSD12: Removing insecure key from the guest if it's present...
    adoptopenjdkFBSD12: Key inserted! Disconnecting and reconnecting using new SSH key...
==> adoptopenjdkFBSD12: Machine booted and ready!
==> adoptopenjdkFBSD12: Setting hostname...
==> adoptopenjdkFBSD12: Configuring and enabling network interfaces...
==> adoptopenjdkFBSD12: Installing rsync to the VM...
==> adoptopenjdkFBSD12: Rsyncing folder: /Users/williamparker/Documents/1061/ => /vagrant
==> adoptopenjdkFBSD12: Running provisioner: shell...
    adoptopenjdkFBSD12: Running: inline script
localhost:1061 williamparker$ ls
Vagrantfile           Vagrantfile.FreeBSD12 Vagrantfile.SLES12
localhost:1061 williamparker$ vagrant rsync-back
==> adoptopenjdkFBSD12: Rsyncing folder: /vagrant/ => /Users/williamparker/Documents/1061
localhost:1061 williamparker$ ls
Vagrantfile           Vagrantfile.FreeBSD12 Vagrantfile.SLES12    hosts.tmp
localhost:1061 williamparker$ 

@Willsparker
Copy link
Contributor Author

Got FreeBSD12 to a point where the playbooks can run on it using vagrantPlaybookCheck.sh. The box doesn't come pre-installed with python, but that was easily rectified by putting pkg install -y python into the Vagrantfile, thereby allowing ansible to run on it.

@sxa
Copy link
Member

sxa commented Jan 3, 2020

There's a PR from @gdams that may resolve that going forward if we can stabilise it, but for now the Vagrant file modification sounds reasonable

@Willsparker
Copy link
Contributor Author

For now, in the above PR, I've made a symlink after installing Python. I know it's not the best thing to do, but if @gdams' PR resolves this, then it'll be taken out anyway :-)

(For future reference, the proper way of doing this is by adding ansible_python_interpreter=/usr/local/bin/python to the same line as the ip address in the hosts.unx file)

@gdams
Copy link
Member

gdams commented Jan 3, 2020

@Willsparker
Copy link
Contributor Author

@gdams I saw that. I'm not entirely sure how ansible.cfg decides if the host is freebsd or not, but in testing, it didn't pickup on it - it may be due to the hosts file format that vagrantPlaybookCheck creates, being just the VM's IP without any tags.

@sxa
Copy link
Member

sxa commented Jan 22, 2020

OpenSUSE now working after the merging of adoptium/temurin-build#1487 (comment)

@karianna karianna added this to the January 2020 milestone Jan 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants