Skip to content

Instantly share code, notes, and snippets.

View bdha's full-sized avatar
☂️
ಠ_ಠ

Bryan Horstmann-Allen bdha

☂️
ಠ_ಠ
View GitHub Profile
........................................
......... ..........
....... ........
..... ......
.... .....
... ....... ....
.. ....... .. ...
. .......... .. ..
. ....... .... .. .
. ..... ..... .
@bdha
bdha / gist:c456cf6e5484ea5ad256
Last active April 10, 2026 17:34
Building Haskell on SmartOS
@bdha
bdha / smartos_hackery.md
Last active April 7, 2018 10:10
Modify a SmartOS vmware platform image

Using OS X and vmware Fusion. Requires an actual Solarish system or VM to modify the boot_archive.

Why would you want to do this? Well, it's an easy way of modifying an excellent platform for your own nefarious ends. Maybe you want to inject some extra (or less) work into the install scripts. Or just add some extra default services. Or drop in some leet figlet into /etc/issue. Or more usefully: Drop your application bootstrapping code into the platform to create turnkey appliances.

Prep

Download and decompress the SmartOS VMware image.

Copy the boot image out of the VM directory and mount it.

#!/bin/bash
set -e
#set -x
TOKEN=$( cat /root/.github-token )
BASEURL="https://api.github.com/orgs/${1}/repos?type=owner&access_token=${TOKEN}&per_page=100"
BACKUPS_ZFS="zones/$( zonename )/data/backup/github"
Installing image 845480a6-ef02-11e4-a313-135b7a82221b (manta-moray@release-20150430-20150430T062614Z-g088ac51)
Provisioning Temporary moray VM moray0tmp
Wait (sleep) for moray instance ffa1e3c0-f762-4e0b-be60-8ba3bb7e417e to come up
Running vmadm lookup to get tmp instance UUID
Checking if tmp instace ffa1e3c0-f762-4e0b-be60-8ba3bb7e417e services have errors
Waiting until ffa1e3c0-f762-4e0b-be60-8ba3bb7e417e instance is in DNS
Update error: {"message":"error Getting VM info ffa1e3c0-f762-4e0b-be60-8ba3bb7e417e:\n\targv: [\"/opt/smartdc/bin/sdc-oneachnode\",\"-n 564d6390-f5b1-d9b7-68ec-50905e7eb627 \",\"-j\",\"/usr/sbin/vmadm get ffa1e3c0-f762-4e0b-be60-8ba3bb7e417e\"]\n\texit status: 10\n\tstdout:\n[]\n\tstderr:\nERROR: could not find all nodes\n\n missing nodes:\n 564d6390-f5b1-d9b7-68ec-50905e7eb627","we_cause":{"killed":false,"code":10,"signal":null},"code":"InternalError","exitStatus":1}
sdcadm update: error: error Getting VM info ffa1e3c0-f762-4e0b-be60-8ba3bb7e417e:
argv: ["/opt/smartdc/bin/sdc-one
[root@headnode (moya) ~]# sdcadm update --all -y
Finding candidate update images for 23 services (binder, papi, mahi, dhcpd, redis, ufds, adminui, cloudapi, sdc, ca, sapi, manatee, moray, amon, vmapi, napi, manta, imgapi, workflow, cnapi, amonredis, fwapi, assets).
Note: There are no "manta" instances. Only the service configuration will be updated.
This update will make the following changes:
download 23 images (1192 MiB):
image d6f341e4-ef02-11e4-8be7-2f79005449b8 (redis@release-20150430-20150430T063105Z-g0d6e5b9)
image c7565f0e-ef03-11e4-ab3b-d7ca277eb670 (sapi@release-20150430-20150430T063118Z-g983d6be)
image 43b44950-ef02-11e4-bcce-53d3affcacaa (amonredis@release-20150430-20150430T062628Z-g4bbca77)
image d95cb044-eeff-11e4-b61f-87a8efe4eebf (ufds@release-20150430-20150430T060525Z-g9d089af)
@bdha
bdha / 0.txt
Last active August 29, 2015 14:20
ResourceNotFoundError: Workflow with uuid 'workflow-check' does not exist
[2015-05-08T13:59:12.286Z] INFO: workflow-api/20171 on 89f64f42-3878-426a-987b-19f142af6b53: (req_id=67bf9be0-f58a-11e4-a6ea-5fcf7a54b72f)
evt: {
"ph": "b",
"name": "getworkflowsuuid010"
}
[2015-05-08T13:59:12.289Z] ERROR: workflow-api/wf-moray-backend/20171 on 89f64f42-3878-426a-987b-19f142af6b53: getWorkflow Error
ObjectNotFoundError: wf_workflows::workflow-check does not exist
at EventEmitter.<anonymous> (/opt/smartdc/moray/lib/objects/get.js:71:16)
[root@gp3 ~]# vmadm update 2f5a2302-6ca2-4f82-bade-34afdd8487ec <<EOF
> {"set_tags": {"hello": "world"}}
> EOF
Successfully updated VM 2f5a2302-6ca2-4f82-bade-34afdd8487ec
[root@gp3 ~]# vmadm get 2f5a2302-6ca2-4f82-bade-34afdd8487ec | json -aH tags
{
"hello": "world"
}
Recipe: build-essential::_smartos
* smartos_package[autoconf] action install
================================================================================
Error executing action `install` on resource 'smartos_package[autoconf]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '3'
### 13.3.1
# pkgin avail | grep vim-[0-9]
vim-7.3.1140 Vim editor (vi clone) without GUI
### 14.4.1
[root@41400479-e649-6ff6-ae10-f6733401d38b ~]# pkgin avail | grep vim-[0-9]
vim-7.4.430;Vim editor (vi clone) without GUI