Joey Hess: propelling disk images
Following up on Then and Now ...
In quiet moments at ICFP last August, I finished teaching
Propellor to generate disk images. With an emphasis on doing a
whole lot with very little new code and extreme amount of code reuse.
For example, let's make a disk image with nethack on it. First,
we need to define a chroot. Disk image creation reuses propellor's chroot
support, described back in propelling containers. Any propellor
properties can be assigned to the chroot, so it's easy to describe
the system we want.
nethackChroot :: FilePath -> Chroot
nethackChroot d = Chroot.debootstrapped (System (Debian Stable) "amd64") mempty d
& Apt.installed ["linux-image-amd64"]
& Apt.installed ["nethack-console"]
& accountFor gamer
& gamer hasInsecurePassword "hello"
& gamer hasLoginShell "/usr/games/nethack"
where gamer = User "gamer"
nethackImage :: RevertableProperty
nethackImage = imageBuilt "/srv/images/nethack.img" nethackChroot
MSDOS (grubBooted PC)
[ partition EXT2 mountedAt "/boot"
setFlag BootFlag
, partition EXT4 mountedAt "/"
addFreeSpace MegaBytes 100
, swapPartition (MegaBytes 256)
]
addFreeSpace and setSize. Other functions like setFlag and
extended can further adjust the partitions. I think that worked out
rather well; the partition specification is compact and avoids unecessary
hardcoded sizes, while providing plenty of control.
By the end of ICFP, I had Propellor building complete disk images,
but no boot loader installed on them.
Fast forward to today. After stuggling with some strange grub behavior, I found a working method to install grub onto a disk image. The whole disk image feature weighs in at: 203 lines to interface with parted
88 lines to format and mount partitions
90 lines for the partition table specification DSL and partition sizing
196 lines to generate disk images
75 lines to install grub on a disk image
652 lines of code total Which is about half the size of vmdebootstrap 1/4th the size of partman-base (probably 1/100th the size of total partman), and 1/13th the size of live-build. All of which do similar things, in ways that seem to me to be much less flexible than Propellor.
One thing I'm considering doing is extending this so Propellor can use qemu-user-static to create disk images for eg, arm. Add some u-boot setup, and this could create bootable images for arm boards. A library of configs for various arm boards could then be included in Propellor. This would be a lot easier than running the Debian Installer on an arm board. Oh! I only just now realized that if you have a propellor host configured, like this example for my dialup gateway,
leech --
leech = host "leech.kitenet.net"
& os (System (Debian (Stable "jessie")) "armel")
& Apt.installed ["linux-image-kirkwood", "ppp", "screen", "iftop"]
& privContent "/etc/ppp/peers/provider"
& privContent "/etc/ppp/pap-secrets"
& Ppp.onBoot
& hasPassword (User "root")
& Ssh.installed
hostProperties leech and reused to create a disk image with
the same properties as the host!
So, when my dialup gateway gets struck by lightning again, I could
use this to build a disk image for its replacement:
import qualified Propellor.Property.Hardware.SheevaPlug as SheevaPlug
laptop = host "darkstar.kitenet.net"
& SheevaPlug.diskImage "/srv/images/leech.img" (MegaBytes 2000)
(& propertyList "has all of leech's properties"
(hostProperties leech))
Yesterday we have released 
At DebConf14 in Portland, Oregon, USA, next year s DebConf team presented
their conference plans and announced the conference dates:
The first update to the
I still have a dual-boot installation because sometimes I need Windows for
something (usually consulting work), and I use a Bluetooth mouse.
Obviously, when I boot into Windows, it does not have the pairing
information for the mouse, so I have to redo the entire pairing process,
and repeat that when I get back to Linux.
So, dear lazyweb: is there a way to share Bluetooth pairing information
between multiple operating system installations?
What happened in the
Package reviews
103 