redhat-iot / demo-kit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

vagrant fails to provision, as vagrant guest tools are missing from RHEL

ikke-t opened this issue · comments

Hi,

I had some time to try this again. It now fails due rhel does not come with the vagrant guest tools. That makes the file share /vagrant to be missing from guest, and this breaks the install. The sync method should be something else than the shared dir, or then the provision should install the required tools to rhel.

Bringing machine 'redhat-iot-demo' up with 'virtualbox' provider...
==> redhat-iot-demo: Running provisioner: kura (shell)...
redhat-iot-demo: Running: script: Kura Installation
==> redhat-iot-demo: Installing Kura from kura_2.1.0-SNAPSHOT_fedorapi_installer.sh
==> redhat-iot-demo: sudo: /vagrant/files/kura_2.1.0-SNAPSHOT_fedorapi_installer.sh: command not found
==> redhat-iot-demo: cp: cannot stat ‘/vagrant/files/snapshot_0.xml’: No such file or directory
==> redhat-iot-demo: cp: cannot stat ‘/vagrant/files/bluetooth.service’: No such file or directory
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

Virtualbox guest additions should be installed on every base box image that I have produced. I know several of us are using this VM daily without issues so it would be great if you could check the following things for me and post results:

  1. From the guest VM: lsmod | grep -i vbox
  2. From the host in the demo-kit directory: vagrant box update
  3. vagrant --version

1 Should show something like this if guest additions are installed:

vboxsf                 39741  1
vboxguest             297222  2 vboxsf

2 Should show that you are using the 0.1.5 base box, if not, it should ask you to update.
3 Should be Vagrant 1.8.6 or higher. I haven't tested with the 1.9.x releases yet so if you are using those I will test on those versions.

Let me know what you find. The main issues we have found are related to using older Vagrant versions and are all fixed by updating to 1.8.7.

Thanks for reply.

  • First, lsmod does not find the module.
  • Secondly, where do you get the image, there is no link on the README, nor does the link to instructions to get rhel box on the page work. I used basic rhel image, as it mentions on the README.

$ vagrant --version
Vagrant 1.8.7

.... I get it now. This required fixed RHEL box, not just normal RHEL box. As the topic at the end of README says: "Creating base RHEL box (only necessary if you need something other than the default RHEL VM images)", I assumed default RHEL box is fine. Apparently the broken link should point here:

https://github.com/redhat-iot/demo-tooling

Which does customize the RHEL installation. I see now, I need to build custom RHEL image.

The mention of default RHEL image is misleading, please change it to mention that RHEL image is specific to this project, not default.

I build a modified RHEL box now using the demo-tooling repo. It has a bug also, and leads to the very same result. There seems to be a script called scripts/virtualbox.sh, which should install
VBOX_ISO=/home/vagrant/VBoxGuestAdditions.iso
But there is no such iso in any of the scripts being downloaded, nor instructed to be downaloaded manually. So naturally that script can not install VBoxGuestAdditions.iso either.

I added this to virtualbox.sh:

curl -L http://download.virtualbox.org/virtualbox/5.0.32/VBoxGuestAdditions_5.0.32.iso -o $VBOX_ISO

let's see if it would work.

I see, the additions iso is being pushed by vagrant, that's why there is no download. For some reason those didn't get istalled however. still building

There is a problem with the tools. Even if the installation looks ok, they are not present at guest. Everything looks ok. I installed them again manually to instance, worked fine now. This is the vagrant box build time log, looks fine but won't work:

==> virtualbox-iso: Provisioning with shell script: scripts/virtualbox.sh
virtualbox-iso: + VBOX_ISO=/home/vagrant/VBoxGuestAdditions.iso
virtualbox-iso: ++ mktemp --tmpdir=/tmp -q -d -t vbox_mnt_XXXXXX
virtualbox-iso: + VBOX_MNTDIR=/tmp/vbox_mnt_p8i9Vc
virtualbox-iso: + curl -L http://download.virtualbox.org/virtualbox/5.0.32/VBoxGuestAdditions_5.0.32.iso -o /home/vagrant/VBoxGuestAdditions.iso
virtualbox-iso: % Total % Received % Xferd Average Speed Time Time Time Current
virtualbox-iso: Dload Upload Total Spent Left Speed
virtualbox-iso: 100 55.7M 100 55.7M 0 0 6533k 0 0:00:08 0:00:08 --:--:-- 9317k
virtualbox-iso: + mount -o loop /home/vagrant/VBoxGuestAdditions.iso /tmp/vbox_mnt_p8i9Vc
virtualbox-iso: mount: /dev/loop0 is write-protected, mounting read-only
virtualbox-iso: + yes
virtualbox-iso: + sh /tmp/vbox_mnt_p8i9Vc/VBoxLinuxAdditions.run
virtualbox-iso: Verifying archive integrity... All good.
virtualbox-iso: Uncompressing VirtualBox 5.0.32 Guest Additions for Linux............
virtualbox-iso: VirtualBox Guest Additions installer
virtualbox-iso: Copying additional installer modules ...
virtualbox-iso: Installing additional modules ...
virtualbox-iso: Removing existing VirtualBox non-DKMS kernel modules[ OK ]
virtualbox-iso: Building the VirtualBox Guest Additions kernel modules
virtualbox-iso: Building the main Guest Additions module[ OK ]
virtualbox-iso: Building the shared folder support module[ OK ]
virtualbox-iso: Building the graphics driver module[ OK ]
virtualbox-iso: Doing non-kernel setup of the Guest Additions[ OK ]
virtualbox-iso: Starting the VirtualBox Guest Additions Installing the Window System drivers
virtualbox-iso: Could not find the X.Org or XFree86 Window System, skipping.
virtualbox-iso: [ OK ]
virtualbox-iso: + umount /tmp/vbox_mnt_p8i9Vc
virtualbox-iso: + rm -rf /tmp/vbox_mnt_p8i9Vc
virtualbox-iso: + rm -f /home/vagrant/VBoxGuestAdditions.iso

Now the demo started to work, great. So for whatever reason, the vbox guest tools fail to install using the image builder in demo-tools repo. If I add them to guest manually using the same script, it works. Perhaps due kernel upgrade or something like that while building the image?

Anyhow, there was two problems. The system is not designed to work with unmodified RHEL box, like instructed on the README. Secondly guest tool failure must be fixed manually, unless problem fixed in demo-tools repo.

I upgraded both the vagrant and virtualbox to the latest versions before the latest try. Vagrant is now: 1.9.1

Ok, I think I know what the issue is after reading your messages above. You should never need to build the base box from the dev-tooling project. I am building those as needed and making them available on an S3 site, and the Vagrantfile in the project simply downloads the requested version for you. I suspect that you had built your own base box with the same name (but as you said, it did not contain all of the custom bits that are in the dev-tooling version) and Vagrant tried to use that box.

I suggest running vagrant box remove rhel-7.2 --all which will clean up all versions of the box on your machine, and then vagrant up one more time which will download the rhel-7.2 v0.1.5 box which is the latest that I uploaded. This version fixes all known issues and contains workarounds for older, broken Vagrant versions in case someone needs to use an older version.

I will review the documentation and make sure to clarify that you do not need to build the image from the dev-tooling project and that the image is downloaded for you automatically.