Skip to content

Instantly share code, notes, and snippets.

View mgerdts's full-sized avatar

Mike Gerdts mgerdts

View GitHub Profile
@mgerdts
mgerdts / chainload.md
Created February 12, 2020 21:19
ipxe chainload from qemu built-in to Joyent

I have a box running Fedora, which runs a bunch of VMs. I want to iPXE boot using a larger ipxe script than is allowed by the ipxe that is embedded in qemu's virtual nic. That is, a VM is booting with iPXE but not the right ipxe.

Let's consider two VMs, debian10 and debian-live-ipxe. The DHCP server is running debian10, the other is pxe booting.

The procedure followed is roughly:

Grab the .tar.gz from the manta directory mentioned by /Joyent_Dev/public/builds/ipxe/master-latest.

Copy boot/undionly.kpxe from that archive to /tftpboot/.

@mgerdts
mgerdts / README.md
Last active January 29, 2020 20:13
Colapse Confirmed

Collapse Confirmed

This user script may be used with Tamper Monkey or similar to add a "Collapsed Confirmed" button to github pull requests.

Why is this needed?

I have observed:

  • Large PRs can generate hundreds of comment threads.
  • There is no good for the submitter to mark "ok, I've done the work" and for the commenter to say "yep, looks good now".
@mgerdts
mgerdts / illumos-to-linux.md
Last active September 18, 2020 10:38
illumos to Linux observations

These are initially notes to myself about the things I had to look up while taking on a Linux project after a taking a decade or two hiatus from Linux to focus on Solaris, SmartOS, and illumos. Following my footsteps may find this useful.

systemd

This is the init system replacement, like SMF was for Solaris.

Equivalent of svcs

# systemctl list-unit-files
@mgerdts
mgerdts / lvn.md
Created December 9, 2019 20:42 — forked from mtds/lvn.md
Linux Virtual Networking

Virtual Networking on Linux

In the Linux Kernel, support for networking hardware and the methods to interact with these devices is standardized by the socket API:

                +----------------+
                |   Socket API   |
                +-------+--------+
                        |
User space              |
@mgerdts
mgerdts / README.md
Last active December 6, 2019 14:54
ipxe silently truncates boot module arguments

When SmartOS is pxe booted in a Triton cloud, the kernel args are on the order of 200 bytes, there is a kernel, a ramdisk, and at least one other boot module. This does not fit in 512 bytes and multiboot.c silently truncates the url to the boot module and does not have any space for the name of the boot module. If a system is booted with a non-Joyent ipxe, this means that the SmartOS instance cannot find the boot module.

This probblem was recognized and fixed many years ago and Joyent fixed it in our fork of ipxe. Can this be included upstream so that boot modules are more useful?

Related tickets I've filed at Joyent are:

  • OS-3770 ipxe silently truncates boot module arguments
  • OS-8062 boot modules appear at wrong path (I think I got the buffer details wrong in that ticket,
@mgerdts
mgerdts / README.md
Created October 18, 2019 11:56
Triton on Linux KVM

Triton on Linux KVM

I have a beefy Linux box that I use for development. One of the things this box does is run KVM instances that run a Triton headnode and several compute nodes.

Configuration

Networking

I have a single gigabit link to the outside world. All networks are able to reach the outside world via NAT.

@mgerdts
mgerdts / README.md
Last active August 8, 2019 17:27
boot modules in Triton

It seems that there should be a way to do this with sdc-cnapi. I've not had luck in getting any updates to flow from sdc-cnapi to booter, so I tried another approach.

root@headnode# sdc-login dhcpd
...
root@dhcpd0 ~ # cd /tftpboot/00505634604c
root@dhcpd0 /tftpboot/00505634604c # mkdir etc
root@dhcpd0 /tftpboot/00505634604c # cd etc
root@dhcpd0 /tftpboot/00505634604c/etc # echo "this is a test file" > testfile
root@dhcpd0 /tftpboot/00505634604c/etc # digest -a sha1 testfile > testfile.hash
@mgerdts
mgerdts / README.md
Created July 26, 2019 21:48
SmartLogin work-alike for bhyve, kvm, and lx

SmartLogin only works with SmartOS zones. Control of key-based access to bhyve, kvm, and lx isntances can be accomplished using OpenSSH's authorized keys command to fetch authorized keys from the metadata service.

Guest Setup

The guest OS needs to have the following added to {{/etc/ssh/sshd_config}}.

AuthorizedKeysCommand /usr/sbin/mdata-get "%u_authorized_keys"
AuthorizedKeysCommandUser mdataget
@mgerdts
mgerdts / README.md
Created July 18, 2019 20:50
create ubuntu 18.04 20190627 bhyve instance
[root@raidz /zones]# ssh-keygen -t rsa -P "" -f id_rsa
Generating public/private rsa key pair.
Your identification has been saved in id_rsa.
Your public key has been saved in id_rsa.pub.
The key fingerprint is:
MD5:58:e7:5e:2e:a5:05:95:58:da:97:06:f8:5f:60:b8:c4 root@raidz
The key's randomart image is:
+---[RSA 2048]----+
|           =+o   |
@mgerdts
mgerdts / Makefile
Last active July 18, 2019 13:48
can make handle % in file names?
THINGS = foo%bar foo.bar
SRCS = $(THINGS:%=src/%)
OBJS = $(THINGS:%=obj/%)
install: $(OBJS)
obj/%: src/%
@echo Making $@ from $<
rm -f $@