rancher / os

Tiny Linux distro that runs the entire OS as Docker containers
https://rancher.com/docs/os/v1.x/en/
Apache License 2.0
6.44k stars 655 forks source link

Not able to build custom rancher raw: install2disk missing #2543

Closed tech509201941 closed 5 years ago

tech509201941 commented 6 years ago

I try to build a custom rancher raw as described here in the official rancher docs:

https://rancher.com/docs/os/v1.2/en/custom-builds/custom-rancheros-iso/

Unfortunately, I am not able to successfully address this step over here:

packer build gce-qemu.json

Results in:

qemu-googlecompute output will be in this color.

1 error(s) occurred:

* Bad script '../scripts/install2disk': stat ../scripts/install2disk: no such file or directory

Where do I get this ../scripts/install2disk'? I can't find it in the repo: https://github.com/rancher/os/tree/master/scripts

Thanks a lot :)

niusmallnan commented 6 years ago

https://github.com/rancher/os-packer

tech509201941 commented 6 years ago

Thanks for your support. Unfortunately, I am now blocked by this error:

RANCHEROS_VERSION=v1.4.2 make test-build

Resulting in:

AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY must be set

How can I get the image as file?

I don't want to directly deploy to AWS or something like that. Thanks a lot :)

niusmallnan commented 6 years ago

If you want to build a GCE image, try this: PACKER_BOOT_WAIT=90s RANCHEROS_VERSION=vX.Y.Z make build-gce

tech509201941 commented 6 years ago

Thank you for your support @niusmallnan :)

I tried with: PACKER_BOOT_WAIT=90s RANCHEROS_VERSION=v1.4.2 make build-gce

but it fails at this step:

==> Builds finished but no artifacts were created.
2018/10/31 14:26:49 [INFO] (telemetry) Finalizing.
Build 'qemu-googlecompute' errored: Build was halted.

==> Some builds didn't complete successfully and had errors:
--> qemu-googlecompute: Build was halted.

==> Builds finished but no artifacts were created.
2018/10/31 14:26:50 waiting for all plugin processes to complete...
2018/10/31 14:26:50 /go/bin/packer: plugin process exited
2018/10/31 14:26:50 /go/bin/packer: plugin process exited
mv: cannot stat 'output-qemu-googlecompute/packer-qemu-googlecompute': No such file or directory
tar: disk.raw: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors
upload the GCE image using:
  gsutil cp dist/rancheros-v1.4.2.tar.gz gs://releases.rancher.com/os/latest/rancheros-gce.tar.gz
  gsutil cp dist/rancheros-v1.4.2.tar.gz gs://releases.rancher.com/os/v1.4.2/rancheros-gce.tar.gz
upload the github release:
  github-release upload  --user rancher --repo os --tag v1.4.2 --file dist/rancheros-v1.4.2.tar.gz --name rancheros-gce.tar.gz
INFO[0283] docker cp /source/dist .   

Is anyone able to investigate what is missing? Thanks a lot :)

niusmallnan commented 6 years ago

Missing logs, I cannot see the key errors.

However, there is one point to confirm that your host needs to support KVM.

tech509201941 commented 6 years ago

@niusmallnan 👍

I process the build on the newest version of macOS and I have installed QEMU via brew to enable support KVM. Is this sufficient?

Here is the full log at the step where it fails:

==> qemu-googlecompute: Overriding defaults Qemu arguments with QemuArgs...
2018/11/01 16:21:32 packer: 2018/11/01 16:21:32 Qemu stderr: Could not access KVM kernel module: No such file or directory
2018/11/01 16:21:32 packer: 2018/11/01 16:21:32 Qemu stderr: failed to initialize KVM: No such file or directory
2018/11/01 16:21:32 ui error: ==> qemu-googlecompute: Error launching VM: Qemu failed to start. Please run with PACKER_LOG=1 to get more info.
==> qemu-googlecompute: Error launching VM: Qemu failed to start. Please run with PACKER_LOG=1 to get more info.
==> qemu-googlecompute: Deleting output directory...
Build 'qemu-googlecompute' errored: Build was halted.
2018/11/01 16:21:33 [INFO] (telemetry) ending qemu
2018/11/01 16:21:33 ui error: Build 'qemu-googlecompute' errored: Build was halted.
2018/11/01 16:21:33 Builds completed. Waiting on interrupt barrier...
2018/11/01 16:21:33 machine readable: error-count []string{"1"}
2018/11/01 16:21:33 ui error: 
==> Some builds didn't complete successfully and had errors:
2018/11/01 16:21:33 machine readable: qemu-googlecompute,error []string{"Build was halted."}
2018/11/01 16:21:33 ui error: --> qemu-googlecompute: Build was halted.
==> Builds finished but no artifacts were created.
2018/11/01 16:21:33 [INFO] (telemetry) Finalizing.

==> Some builds didn't complete successfully and had errors:
--> qemu-googlecompute: Build was halted.

==> Builds finished but no artifacts were created.
2018/11/01 16:21:33 waiting for all plugin processes to complete...
2018/11/01 16:21:33 /go/bin/packer: plugin process exited
2018/11/01 16:21:33 /go/bin/packer: plugin process exited
mv: cannot stat 'output-qemu-googlecompute/packer-qemu-googlecompute': No such file or directory
tar: disk.raw: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors
upload the GCE image using:
  gsutil cp dist/rancheros-v1.4.2.tar.gz gs://releases.rancher.com/os/latest/rancheros-gce.tar.gz
  gsutil cp dist/rancheros-v1.4.2.tar.gz gs://releases.rancher.com/os/v1.4.2/rancheros-gce.tar.gz
upload the github release:
  github-release upload  --user rancher --repo os --tag v1.4.2 --file dist/rancheros-v1.4.2.tar.gz --name rancheros-gce.tar.gz
INFO[0008] docker cp /source/dist .       

Thanks a lot for your great support :) Have a great day!

niusmallnan commented 6 years ago
2018/11/01 16:21:32 packer: 2018/11/01 16:21:32 Qemu stderr: Could not access KVM kernel module: No such file or directory
2018/11/01 16:21:32 packer: 2018/11/01 16:21:32 Qemu stderr: failed to initialize KVM: No such file or directory

It seems like that KVM is not enabled on your setup.

tech509201941 commented 6 years ago

@niusmallnan

Thanks a lot this was my mistake :)

Do you have a idea on how to build a QCOW2 (QEMU Emulator) image or respectively is there an official way to accomplish this?

niusmallnan commented 6 years ago

You can refer to this script: https://github.com/rancher/os-packer/blob/master/cloudstack/cloudstack-qemu.json