-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
builders: move OpenBSD builder to GCE #8642
Comments
Is qemu usable to generate the image? At http://marc.info/?l=openbsd-misc&m=138757967321855&w=2 I posted my notes on how I was building VM images on Ubuntu when I was initially trying to get OpenBSD running on GCE. It can probably be cleaned up further / better streamlined, and also extended to install any extra third-party packages needed. I'll try to take a stab when I've got a chance, or I can help with any OpenBSD/GCE issues others run into if they beat me to it. |
Can it be done without any human interaction? I want to push a button and get a bootable image, ideally. If we _have_ to cheat and manually prep the image (like we're planning on doing for Windows in issue #8640) that's acceptable, as long as every step & complicated key press is documented in a text file in the go.tools/dashboard/env/openbsd/ directory. |
Summarizing Brad and my discussion about this just now: It should be possible to fully automate. I was running qemu in -nographic mode using stdin/stdout as a serial port, so worst case it should be possible to script the installer using something like "expect". (For simplicity when I was initially doing it, I was using a dumb script that blindly fed installer answers at certain time intervals.) OpenBSD's installer also supports an "autoinstall" option that uses response files (documented here: http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man8/autoinstall.8?query=autoinstall&sec=8), but I've never used those so not sure how suitable they are for this use case. One concern is they seem to want to be fetched from a DHCP server, whereas I suspect it's easier if we can configure qemu to run without a network connection. As a first step, I'll work on an Ubuntu-compatible script that fetches an OpenBSD install ISO and then creates a GCE-compatible image, and Brad says he can take it from there. |
If you want to do it first by hand and want to parallelize, I could get started with the manually-prepared bootable image while you work on expect-ifying it. Setting up a DHCP server inside the Docker container should be fine: each Docker container runs by default with its own isolated network. But avoiding it would be easier, unless it's too painful. |
Sounds good. Two images is fine. Another bit from talking to mdempsky earlier: we could even one day automate running the image generator to have an "OpenBSD nightly" or "Linux nightly" kernel. Btw, we've decided on a better name for what I called "buildmaster" above: "buildlet". The buildlet is the daemon that runs on each VM (be it Windows, *BSD, or Linux ARM in qemu (issue #8647)) and to which the Coordinator does RPCs (over HTTP). The buildlet doesn't yet exist. |
jsing: My approach was going to be to write a script to: - Download installXX.iso. - Create a siteXX.tgz with whatever custom scripts/tools the buildlet needs. - Add the siteXX.tgz to installXX.iso and also add "set tty com0" in boot.conf - Boot installXX.iso via qemu -nographic, and use a tool like "expect" to automate answering the questions. - Create the GCE-compatible .tgz file from the qemu disk image. Using an autoinstall(8) response file instead of expect is fine with me too, but it just seems like extra work because it requires configuring DHCP and TFTP servers to provide the install.conf file to the VM. |
Attached is an automated script that I believe should satisfy the initial request at least for constructing an OpenBSD/amd64 VM image from the latest snapshot install CD. Assuming that works, it should be easy to generalize to create i386 images and also using official release CDs instead. Just run "./make.bash" and about 6 minutes later you'll have openbsd-amd64-gce.tar.gz that *should* work on GCE (though I wasn't able to test that far yet). Attachments:
|
Thanks, I'm playing with this now. Can we prevent some of this unnecessary (X?) stuff from being installed? Select sets by entering a set name, a file name pattern or 'all'. De-select sets by prepending a '-' to the set name, file name pattern or 'all'. Selected sets are labelled '[X]'. [X] bsd [X] base56.tgz [X] game56.tgz [X] xfont56.tgz [X] bsd.rd [X] comp56.tgz [X] xbase56.tgz [X] xserv56.tgz [ ] bsd.mp [X] man56.tgz [X] xshare56.tgz [ ] site56.tgz Set name(s)? (or 'abort' or 'done') [done] +* [X] bsd [X] base56.tgz [X] game56.tgz [X] xfont56.tgz [X] bsd.rd [X] comp56.tgz [X] xbase56.tgz [X] xserv56.tgz [X] bsd.mp [X] man56.tgz [X] xshare56.tgz [X] site56.tgz Set name(s)? (or 'abort' or 'done') [done] done Directory does not contain SHA256.sig. Continue without verification? [no] yes Installing bsd 100% |**************************| 11559 KB 00:01 Installing bsd.rd 100% |**************************| 8878 KB 00:01 Installing bsd.mp 100% |**************************| 11603 KB 00:01 Installing base56.tgz 100% |**************************| 58189 KB 00:37 Extracting etc.tgz 100% |**************************| 164 KB 00:00 Installing comp56.tgz 100% |**************************| 46848 KB 00:31 Installing man56.tgz 100% |**************************| 8894 KB 00:07 Installing game56.tgz 100% |**************************| 2721 KB 00:01 Installing xbase56.tgz 100% |**************************| 16595 KB 00:09 Extracting xetc.tgz 100% |**************************| 9165 00:00 Installing xshare56.tgz 100% |**************************| 4449 KB 00:06 Installing xfont56.tgz 100% |**************************| 38994 KB 00:19 Installing xserv56.tgz 31% |******** | 6016 KB 00:06 ETA |
Also, the make.bash script doesn't seem to ever get to the final "tar" step. The "halt" command seems to just reboot it, and qemu-system-x86_64 seems to not ever exit. I see: Making all device nodes...done. quirks-2.10 signed on 2014-09-05T15:03:42Z quirks-2.10: ok bash-4.3.24:libiconv-1.14p1 (installing)ldconfig: /var/run/ld.so.hints: No such file or directory bash-4.3.24:libiconv-1.14p1: ok bash-4.3.24:gettext-0.19.1p0: ok Shell /usr/local/bin/bash appended to /etc/shells bash-4.3.24: ok curl-7.37.1:libidn-1.29: ok curl-7.37.1: ok Extracted 29633422 from 29636303 CONGRATULATIONS! Your OpenBSD install has been successfully completed! To boot the new system, enter 'reboot' at the command prompt. When you login to your new system the first time, please read your mail using the 'mail' command. # halt syncing disks... done The operating system has halted. Please press any key to reboot. rebooting... >> OpenBSD/amd64 BOOT 3.28 boot> booting hd0a:/bsd: 7698960+2124204+1092216+0+581376 [100+552720+367859]=0xfd7eb0 entry point at 0x10001e0 [7205c766, 34000004, 24448b12, 1c40a304] [ using 921520 bytes of bsd ELF symbol table ] Copyright (c) 1982, 1986, 1989, 1991, 1993 The Regents of the University of California. All rights reserved. Copyright (c) 1995-2014 OpenBSD. All rights reserved. http://www.OpenBSD.org OpenBSD 5.6-current (GENERIC) #345: Tue Sep 9 00:22:24 MDT 2014 [email protected]:/usr/src/sys/arch/amd64/compile/GENERIC real mem = 385863680 (367MB) avail mem = 367001600 (350MB) mpath0 at root scsibus0 at mpath0: 256 targets mainbus0 at root bios0 at mainbus0: SMBIOS rev. 2.4 @ 0xfd9c0 (10 entries) bios0: vendor Bochs version "Bochs" date 01/01/2007 bios0: Bochs Bochs acpi0 at bios0: rev 0 acpi0: sleep states S3 S4 S5 acpi0: tables DSDT FACP SSDT APIC HPET acpi0: wakeup devices acpitimer0 at acpi0: 3579545 Hz, 24 bits acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat cpu0 at mainbus0: apid 0 (boot processor) cpu0: QEMU Virtual CPU version 1.0, 2809.59 MHz cpu0: FPU,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,SSE3,CX16,POPCNT,NXE,LONG,LAHF,SVM,ABM,SSE4A cpu0: 64KB 64b/line 2-way I-cache, 64KB 64b/line 2-way D-cache, 512KB 64b/line 16-way L2 cache cpu0: ITLB 255 4KB entries direct-mapped, 255 4MB entries direct-mapped cpu0: DTLB 255 4KB entries direct-mapped, 255 4MB entries direct-mapped mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges cpu0: apic clock running at 1000MHz ioapic0 at mainbus0: apid 1 pa 0xfec00000, version 11, 24 pins ioapic0: misconfigured as apic 0, remapped to apid 1 acpihpet0 at acpi0: counter not incrementing acpiprt0 at acpi0: bus 0 (PCI0) acpicpu0 at acpi0 pci0 at mainbus0 bus 0 pchb0 at pci0 dev 0 function 0 "Intel 82441FX" rev 0x02 pcib0 at pci0 dev 1 function 0 "Intel 82371SB ISA" rev 0x00 pciide0 at pci0 dev 1 function 1 "Intel 82371SB IDE" rev 0x00: DMA, channel 0 wired to compatibility, channel 1 wired to compatibility pciide0: channel 0 disabled (no drives) atapiscsi0 at pciide0 channel 1 drive 0 scsibus1 at atapiscsi0: 2 targets cd0 at scsibus1 targ 0 lun 0: <QEMU, QEMU DVD-ROM, 1.0> ATAPI 5/cdrom removable cd0(pciide0:1:0): using PIO mode 4, DMA mode 2 piixpm0 at pci0 dev 1 function 3 "Intel 82371AB Power" rev 0x03: apic 1 int 10 iic0 at piixpm0 iic0: addr 0x18 00=00 01=00 02=00 03=00 04=00 05=00 06=00 07=00 08=00 words 00=0000 01=0000 02=0000 03=0000 04=0000 05=0000 06=0000 07=0000 iic0: addr 0x1a 00=00 01=00 02=00 03=00 04=00 05=00 06=00 07=00 08=00 words 00=0000 01=0000 02=0000 03=0000 04=0000 05=0000 06=0000 07=0000 iic0: addr 0x29 00=00 01=00 02=00 03=00 04=00 05=00 06=00 07=00 08=00 words 00=0000 01=0000 02=0000 03=0000 04=0000 05=0000 06=0000 07=0000 iic0: addr 0x2b 00=00 01=00 02=00 03=00 04=00 05=00 06=00 07=00 08=00 words 00=0000 01=0000 02=0000 03=0000 04=0000 05=0000 06=0000 07=0000 iic0: addr 0x4c 00=00 01=00 02=00 03=00 04=00 05=00 06=00 07=00 08=00 words 00=0000 01=0000 02=0000 03=0000 04=0000 05=0000 06=0000 07=0000 iic0: addr 0x4e 00=00 01=00 02=00 03=00 04=00 05=00 06=00 07=00 08=00 words 00=0000 01=0000 02=0000 03=0000 04=0000 05=0000 06=0000 07=0000 vga1 at pci0 dev 2 function 0 "Cirrus Logic CL-GD5446" rev 0x00 wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation) wsdisplay0: screen 1-5 added (80x25, vt100 emulation) virtio0 at pci0 dev 3 function 0 "Qumranet Virtio Network" rev 0x00: Virtio Network Device vio0 at virtio0: address 52:54:00:12:34:56 virtio0: apic 1 int 11 virtio1 at pci0 dev 4 function 0 "Qumranet Virtio Storage" rev 0x00: Virtio Block Device vioblk0 at virtio1 scsibus2 at vioblk0: 2 targets sd0 at scsibus2 targ 0 lun 0: <VirtIO, Block Device, > SCSI3 0/direct fixed sd0: 10240MB, 512 bytes/sector, 20971520 sectors virtio1: apic 1 int 11 isa0 at pcib0 isadma0 at isa0 com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo com0: console pckbc0 at isa0 port 0x60/5 pckbd0 at pckbc0 (kbd slot) pckbc0: using irq 1 for kbd slot wskbd0 at pckbd0: console keyboard, using wsdisplay0 pms0 at pckbc0 (aux slot) pckbc0: using irq 12 for aux slot wsmouse0 at pms0 mux 0 pcppi0 at isa0 port 0x61 spkr0 at pcppi0 lpt0 at isa0 port 0x378/4 irq 7 fdc0 at isa0 port 0x3f0/6 irq 6 drq 2 fd0 at fdc0 drive 0: density unknown fd1 at fdc0 drive 1: density unknown nvram: invalid checksum vscsi0 at root scsibus3 at vscsi0: 256 targets softraid0 at root scsibus4 at softraid0: 256 targets root on sd0a (280aa5820cbd97c0.a) swap on sd0b dump on sd0b clock: unknown CMOS layout Automatic boot in progress: starting file system checks. /dev/sd0a (280aa5820cbd97c0.a): file system is clean; not checking /dev/sd0k (280aa5820cbd97c0.k): file system is clean; not checking /dev/sd0d (280aa5820cbd97c0.d): file system is clean; not checking /dev/sd0f (280aa5820cbd97c0.f): file system is clean; not checking /dev/sd0g (280aa5820cbd97c0.g): file system is clean; not checking /dev/sd0h (280aa5820cbd97c0.h): file system is clean; not checking /dev/sd0j (280aa5820cbd97c0.j): file system is clean; not checking /dev/sd0i (280aa5820cbd97c0.i): file system is clean; not checking /dev/sd0e (280aa5820cbd97c0.e): file system is clean; not checking setting tty flags pf enabled starting network DHCPDISCOVER on vio0 - interval 3 DHCPOFFER from 10.0.2.2 (52:55:0a:00:02:02) DHCPREQUEST on vio0 to 255.255.255.255 DHCPACK from 10.0.2.2 (52:55:0a:00:02:02) bound to 10.0.2.15 -- renewal in 43200 seconds. openssl: generating isakmpd/iked RSA key... done. ssh-keygen: generating new host keys: RSA1 RSA DSA ECDSA ED25519 starting early daemons: syslogd pflogd. starting RPC daemons:. savecore: no core dump checking quotas: done. clearing /tmp kern.securelevel: 0 -> 1 creating runtime link editor directory cache. preserving editor files. starting network daemons: sshd smtpd sndiod. fw_update: No devices found which need firmware files to be downloaded. starting local daemons: cron. Tue Sep 9 08:27:45 PDT 2014 OpenBSD/amd64 (buildlet.my.domain) (tty00) login: syncing disks... done |
[re #13] We can omit the X sets, but unless it's really a space problem, I wouldn't recommend it. It's generally recommended to still install them even if you don't plan on running X, and some packages will include X dependencies for fonts, rendering libraries, etc. [re #14] The reboot is intentional so that the "first time" bootup steps can be done at image creation time rather than each VM bootup time. After the second "syncing disks... done", qemu *should* exit, and then you should just be waiting for the tar command on the host platform to run. (The script should probably add a message between qemu and tar.) If you're sure that qemu isn't exiting even a few minutes after "syncing disks... done", that seems like a bug and I'll try to reproduce it. [re #15] Yeah, that should be possible. Just let me know how you want the key generated or where it should come from, and I'll look into updating the script accordingly. |
I think I was impatient and it did finish. I haven't tried to boot it yet, though. I'd rather remove the X sets. I can't imagine what would depend on them and I'd rather start as minimal as possible and find any problems. If something accidentally depends on something, that's a bug. All the Linux builders don't have X or fonts, for instance. |
To allocate 1G of disk space to swap and then the remaining space for a single root partition, you can apply the changes below. If you want a smaller swap partition, just change "1G\n" to "256M\n" or something. -send "auto\n" +send "custom\n" + +expect "> " +send "z\n" + +expect "> " +send "a b\n" +expect "offset: " +send "\n" +expect "size: " +send "1G\n" +expect "FS type: " +send "swap\n" + +expect "> " +send "a a\n" +expect "offset: " +send "\n" +expect "size: " +send "\n" +expect "FS type: " +send "4.2BSD\n" +expect "mount point: " +send "/\n" + +expect "> " +send "w\n" +expect "> " +send "q\n" |
Attached "make.bash" script is an update of the one from #12 with the following changes: - includes a workaround for a recent change in GCE's DHCP server behavior. (See https://code.google.com/p/google-compute-engine/issues/detail?id=77 for details.) - uses a custom single disk partition. - only installs the "base" and "comp"[iler] sets. - enables the SMP kernel (which is tested to at least also work on n1-standard-4) - tested that with "--metadata=buildmaster-binary-url:http://storage.googleapis.com/go-builder-data/buildlet.openbsd-amd64" it downloads and runs the buildlet.openbsd-amd64 script Attachments:
|
I now see:
Note the curl failures. /cc @mdempsky |
Running it again, I see the error earlier:
|
This is now booting on GCE and working. |
Commit, since I messed up the issue syntax: golang/tools@b2523aa |
This is the basics: untar a tar.gz file to a directory, and execute a command. Update golang/go#8639 Update golang/go#8640 Update golang/go#8642 Change-Id: I5917ed8bd0e4c2fdb4b3fab34ca929caca95cc8a Reviewed-on: https://go-review.googlesource.com/2180 Reviewed-by: Andrew Gerrand <[email protected]>
This isn't used yet, but will be for the new-style builders (VMs on GCE running the buildlet, started by the coordinator). From the code's comments: cleanUpOldVMs periodically enumerates virtual machines and deletes any which have a "delete-at" attribute having a unix timestamp before the current time. These VMs are created to run a single build and should be shut down by a controlling process. Due to various types of failures, they might get stranded. To prevent them from getting stranded and wasting resources forever, we instead set the "delete-at" metadata attribute on them when created to some time that's well beyond their expected lifetime, and then this is the backup mechanism to delete them if they get away. Update golang/go#8639 Update golang/go#8640 Update golang/go#8642 Change-Id: I489e97926e7ab56487571c2bf0bd255cdf49570d Reviewed-on: https://go-review.googlesource.com/2199 Reviewed-by: Burcu Dogan <[email protected]>
Updates golang/go#8642 Change-Id: Ia11faeafb96a325ff62dcf95fedb5a6489e41bd4 Reviewed-on: https://go-review.googlesource.com/2263 Reviewed-by: Minux Ma <[email protected]>
This is now running and working at https://build.golang.org/ ... note the new |
We still need 32-bit. |
32-bit should be roughly just s/(amd64|x86_64)/i386/g, but maybe some of the installer questions differ slightly too. One other comment: it's probably worth double-checking that non-Gophers can't SSH to the host (e.g., by using GCE firewall rules?), since the make.bash script includes username/password credentials for root and the gopher user. |
@mdempsky, yes, these VMs are firewalled, including ssh. |
Currently this is running an OpenBSD amd64 builder, but other operating systems are now easy. Updates golang/go#8642 Updates golang/go#9492 Change-Id: I4e1026c49ee4d253dfcf78c7606767294784f02e Reviewed-on: https://go-review.googlesource.com/2264 Reviewed-by: Andrew Gerrand <[email protected]>
This uses the new JSON interface to the build dashboard (from golang.org/cl/2290) to find all work, and re-enables the OpenBSD builder[*], and can do multiple things at a time. Andrew and I just watched it fire up 8 OpenBSD VMs at once to catch up. [*] The OpenBSD builder was disabled because it would only report results for the main repo, not subrepos, and the old build.golang.org/todo interface didn't understand that was possible. Now the steps are considered separate. Update golang/go#8642 (OpenBSD) Update golang/go#9492 (builds in VMs) Change-Id: Ic6c2f73ee3da218dd54ef1a33f3afc97046ea3cc Reviewed-on: https://go-review.googlesource.com/2282 Reviewed-by: Andrew Gerrand <[email protected]>
This is the basics: untar a tar.gz file to a directory, and execute a command. Update golang/go#8639 Update golang/go#8640 Update golang/go#8642 Change-Id: I5917ed8bd0e4c2fdb4b3fab34ca929caca95cc8a Reviewed-on: https://go-review.googlesource.com/2180 Reviewed-by: Andrew Gerrand <[email protected]>
This isn't used yet, but will be for the new-style builders (VMs on GCE running the buildlet, started by the coordinator). From the code's comments: cleanUpOldVMs periodically enumerates virtual machines and deletes any which have a "delete-at" attribute having a unix timestamp before the current time. These VMs are created to run a single build and should be shut down by a controlling process. Due to various types of failures, they might get stranded. To prevent them from getting stranded and wasting resources forever, we instead set the "delete-at" metadata attribute on them when created to some time that's well beyond their expected lifetime, and then this is the backup mechanism to delete them if they get away. Update golang/go#8639 Update golang/go#8640 Update golang/go#8642 Change-Id: I489e97926e7ab56487571c2bf0bd255cdf49570d Reviewed-on: https://go-review.googlesource.com/2199 Reviewed-by: Burcu Dogan <[email protected]>
Updates golang/go#8642 Change-Id: Ia11faeafb96a325ff62dcf95fedb5a6489e41bd4 Reviewed-on: https://go-review.googlesource.com/2263 Reviewed-by: Minux Ma <[email protected]>
Currently this is running an OpenBSD amd64 builder, but other operating systems are now easy. Updates golang/go#8642 Updates golang/go#9492 Change-Id: I4e1026c49ee4d253dfcf78c7606767294784f02e Reviewed-on: https://go-review.googlesource.com/2264 Reviewed-by: Andrew Gerrand <[email protected]>
This uses the new JSON interface to the build dashboard (from golang.org/cl/2290) to find all work, and re-enables the OpenBSD builder[*], and can do multiple things at a time. Andrew and I just watched it fire up 8 OpenBSD VMs at once to catch up. [*] The OpenBSD builder was disabled because it would only report results for the main repo, not subrepos, and the old build.golang.org/todo interface didn't understand that was possible. Now the steps are considered separate. Update golang/go#8642 (OpenBSD) Update golang/go#9492 (builds in VMs) Change-Id: Ic6c2f73ee3da218dd54ef1a33f3afc97046ea3cc Reviewed-on: https://go-review.googlesource.com/2282 Reviewed-by: Andrew Gerrand <[email protected]>
The text was updated successfully, but these errors were encountered: