Skip to content

Instantly share code, notes, and snippets.

@smoser
smoser / gist:4756561
Last active November 8, 2023 15:20
boot a cloud image in kvm
## Install a necessary packages
$ sudo apt-get install kvm cloud-utils genisoimage
## URL to most recent cloud image of 12.04
$ img_url="http://cloud-images.ubuntu.com/server/releases/12.04/release"
$ img_url="${img_url}/ubuntu-12.04-server-cloudimg-amd64-disk1.img"
## download the image
$ wget $img_url -O disk.img.dist
## Create a file with some user-data in it
@smoser
smoser / README.md
Last active October 26, 2023 16:39
upgrade [apt-get update/upgrade system and log / time ]

upgrade

This is a simple script (scripts) to run the typical apt-get upgrade, and collect the logs to a directory.

Also included here is 'purge-kernels' to get rid of old kernels in your /boot.

@smoser
smoser / README.md
Last active October 6, 2023 13:47
backup or truncate deleted files

Find open files that have been deleted.

I ran into a problem where deleted files were taking up a considerable amount of space, and ultimately leading to filesystem full problems.

stack-overflow provided me with a way to get a list of open filehandles on deleted files here.

The key response there covers lsof -a +L1 which filters output to files that have less than 1 name (link count) in the filesystem.

fixup

The tool 'fixup' provided here allows you to easily 'show', 'truncate', or 'backup' the files.

@smoser
smoser / README.md
Last active September 8, 2023 20:33
attempt to recreate squashfs / overlay / inode / curl issue

attempt to recreate curl issue

this was an attempt to recreate an issue where curl inside a container was acting as if it had missing libraries. The error seen would be:

$ lxc-attach -nran curl
   /usr/bin/curl: /lib/x86_64-linux-gnu/libcrypto.so.1.1: \
      version `HEIMDAL_ASN1_1.0' not found (required by /lib/x86_64-linux-gnu/libgssapi.so.3)
   /usr/bin/curl: /lib/x86_64-linux-gnu/libcrypto.so.1.1: \
 version `HEIMDAL_ASN1_1.0' not found (required by /lib/x86_64-linux-gnu/libkrb5.so.26)
@smoser
smoser / README.md
Last active August 3, 2023 11:52
make-maas-proposed-images make images for maas with proposed enabled

Make Proposed MAAS Images

Just run this script to build maas images with proposed enabled.

Run as root to avoid all sudo prompts.

By default it builds images for all supported LTS and the development release.

For information on how to add this to MAAS see maas documentation

Related Info

@smoser
smoser / README.md
Last active June 19, 2023 17:08
building and testing lvm2 package with autopkgtest

building and testing lvm2 package

I'm working with lvm2 package in order to get some autopkgtest tests run on ubuntu before merging.

I've submitted a pull request to debian at lvm2/#6.

My post to the linux-lvm2 mailing list asking about stability of the tests can be seen here.

building lvm2

lvm2 in debian uses gbp to build. Changes are made directly to the source and a debian delta patch is generated (debian/source/format shows 3.0 (gitarchive)).

@smoser
smoser / HelloWorld.efi
Last active May 26, 2023 12:08
demonstrate Ubuntu 22.04 (jammy) problem signing efi applications with snakeoil vars (uefi ovmf) including gen-esp
@smoser
smoser / README.md
Created August 27, 2020 16:13
golang (go) cmd.ExtraFiles example

This is an example of using cmd.ExtraFiles in golang with a os.Pipe()

There are 2 things that might be a bit tricky:

  • the order of closing the read and write side of the pipe. I got this right by reading the implementation of cmd.StderrPipe.
  • the number of the file descriptor for the child. I'm not sure of a good way to cleanly determine what that is. Golang cmd processes do not inherit all open filehandles, so you can't just use pipeWrite.Fd().

Ultimately, we did this because we were working with tssnvread which is possibly the worst user interface I've ever seen. We wanted to read the contents without writing to a file on the filesystem. To do so, we were able to tell it to write to /proc/self/fd/.

@smoser
smoser / README.md
Last active April 26, 2023 23:34
Running zot config and such

I run a local zot for use with stacker.

It is very useful to be able to publish oci images. It also can improve performance by acting as a caching proxy. See sync extension. This is especially useful due to docker.io's low bandwidth limits.

Quick start

To use this for localhost:

  • Download a zot from releases and make it executable (chmod 755 zot)
@smoser
smoser / README.md
Last active March 30, 2023 18:42
iscsi / ibft booting test

iscsi and iBFT test using qemu/kvm and ipxe

The general goal of this doc is to show how to use qemu, ipxe and tgt to test iscsi and iBFT.

There are loads of things that could be done to make this test environment. But for now, it just shows a simple case to show parameters necessary.

Setting up iscsi test environment

In examples here, the iscsi server is available at 192.168.1.10. The qemu host system is available at 192.168.1.11. We assume port 9999 is available to run a python simple web server.