go-debos / fakemachine

fake a machine
Apache License 2.0
34 stars 37 forks source link

Can fakemachine be Used to Make Modifications to a Debian .IMG Filesystem? #211

Closed abotelho-cbn closed 3 months ago

abotelho-cbn commented 3 months ago

Hi all!

We currently have a system that leverages debos to generate base Debian images.

These Debian images are then "configured" with Puppet (https://www.puppet.com/) using systemd-nspawn to generate "final" images which are flashed to client devices.

The problem with systemd-nspawn is that some functionality is handicapped slightly. Things that perform GRUB functions and other kernel-related manipulation don't work very well. So I figured considering debos uses fakemachine to build images and do things like install GRUB, it must be what I'm looking for.

If I run something like this: fakemachine --show-boot --image=/tmp/final-bookworm-24-05-28-142556.img the booted OS seems to be quite different from the image I've passed it via --image=, and any changes are not retained on final-bookworm-24-05-28-142556.img

Is the idea that I'm supposed to the chroot into an image from inside fakemachine to perform manipulations? Is there a way to have fakemachine directly boot an .img file so it can be manipulated and the changes saved back into the image?

Cheers

obbardc commented 3 months ago

The image is available under /dev/disk/by-fakemachine-label/*, you should mount the filesystems inside and chroot manually :-).

abotelho-cbn commented 3 months ago

Brilliant! I was able to do exactly what I was looking for. I may just trash nspawn for these images entirely in the future, and just use debos for the base image, and run the entire final image build using Puppet inside fakemachine.

Cheers! I appreciate your time. Closing the issue.

obbardc commented 3 months ago

No problem! Feel free to ask again ;-)