### SSH into running QEMU instance Source: https://github.com/bdrung/bdebstrap/blob/main/README.md Command to access the running virtual machine via SSH. The example uses port 2222 and disables host key checking. ```sh $ ssh -oUserKnownHostsFile=/dev/null -oStrictHostKeyChecking=no -p 2222 root@localhost ``` -------------------------------- ### Launch QEMU with squashfs image Source: https://github.com/bdrung/bdebstrap/blob/main/bdebstrap.1.md Starts QEMU with the generated kernel and initrd, forwarding port 8080 to the HTTP server and port 2222 to SSH. The -append parameter fetches the root.squashfs image from the HTTP server. ```shell $ cd example2 $ qemu-system-x86_64 -machine accel=kvm -m 1G -device virtio-net-pci,netdev=net0 -monitor vc \ -netdev user,id=net0,hostfwd=tcp::2222-:22,guestfwd=tcp:10.0.2.252:8080-tcp:localhost:8080,hostname=debian-live \ -kernel ./vmlinuz -initrd ./initrd.img -append "boot=live fetch=http://10.0.2.252:8080/root.squashfs quiet" ``` -------------------------------- ### Launch QEMU with squashfs image Source: https://github.com/bdrung/bdebstrap/blob/main/README.md Command to start QEMU with the generated image, passing TCP traffic on port 8080 to the webserver. The kernel and initrd are copied out of the squashfs image using customize hooks. ```sh $ cd example2 $ qemu-system-x86_64 -machine accel=kvm -m 1G -device virtio-net-pci,netdev=net0 -monitor vc \ -netdev user,id=net0,hostfwd=tcp::2222-:22,guestfwd=tcp:10.0.2.252:8080-tcp:localhost:8080,hostname=debian-live \ -kernel ./vmlinuz -initrd ./initrd.img -append "boot=live fetch=http://10.0.2.252:8080/root.squashfs quiet" ``` -------------------------------- ### Minimal Debian unstable tarball configuration Source: https://github.com/bdrung/bdebstrap/blob/main/README.md YAML configuration for building a minimal Debian unstable tarball. It specifies keyrings, mode, suite, target, and variant. The example assumes the configuration is stored in examples/Debian-unstable.yaml. ```yaml --- mmdebstrap: keyrings: - /usr/share/keyrings/debian-archive-keyring.gpg mode: unshare suite: unstable target: root.tar.xz variant: minbase ``` -------------------------------- ### Debian trixie live system configuration Source: https://github.com/bdrung/bdebstrap/blob/main/README.md YAML configuration for building a Debian 13 (trixie) live system. It includes hooks to copy kernel and initrd, set root password, and upload SSH key. The example assumes ~/.ssh/id_rsa.pub exists. ```yaml --- mmdebstrap: architectures: - amd64 cleanup-hooks: - cp /dev/null "$1/etc/hostname" - if test -f "$1/etc/resolv.conf"; then cp /dev/null "$1/etc/resolv.conf"; fi customize-hooks: - cp --preserve=timestamps -v "$1"/boot/vmlinu* "$1${BDEBSTRAP_OUTPUT_DIR?}/vmlinuz" - cp --preserve=timestamps -v "$1"/boot/initrd.img* "$1${BDEBSTRAP_OUTPUT_DIR?}/initrd.img" - mkdir -p "$1/root/.ssh" - upload ~/.ssh/id_rsa.pub /root/.ssh/authorized_keys # Set 'debian' as root password. Create a secure root password with "openssl passwd -6 $password"! - chroot "$1" usermod -p '$6$oj9MXU3tre8c/Ah$gBBIjy5zyhFMtJnQmK3YYXL8APHk9gTz.hlQP6AZnLV79bkQddUqOnTpcltEW.7l/OAq4u5.SMgDq1LL8u6BM/' root keyrings: - /usr/share/keyrings/debian-archive-keyring.gpg mode: unshare packages: - init - iproute2 # not required, just for convenience - less # not required, just for convenience - linux-image-cloud-amd64 - live-boot - locales - openssh-server - zstd # recommended by initramfs-tools-core suite: trixie target: root.squashfs variant: minbase ``` -------------------------------- ### Disable and enable systemd services with disable-units and enable-units hooks Source: https://github.com/bdrung/bdebstrap/blob/main/README.md YAML configuration for mmdebstrap that uses the disable-units and enable-units hook scripts to disable the apt-daily.timer and cron services and enable systemd-timesyncd. Service names or full systemd unit names can be specified. The example targets Debian bullseye with the important variant. ```yaml --- mmdebstrap: customize-hooks: - $BDEBSTRAP_HOOKS/disable-units "$1" apt-daily.timer cron - $BDEBSTRAP_HOOKS/enable-units "$1" systemd-timesyncd suite: bullseye target: root.tar variant: important ``` -------------------------------- ### Commit and tag a release Source: https://github.com/bdrung/bdebstrap/blob/main/README.md Commands to commit the version and NEWS changes and tag the release. The version is obtained from setup.py. ```bash git commit -m "Release bdebstrap $(./setup.py --version)" NEWS.md setup.py git tag v$(./setup.py --version) ``` -------------------------------- ### Serve squashfs image via HTTP Source: https://github.com/bdrung/bdebstrap/blob/main/README.md Command to expose the generated image via HTTP on localhost on port 8080. This is needed to launch the image locally with QEMU. ```sh $ python3 -m http.server -b localhost --directory example2 8080 ``` -------------------------------- ### Debian live system configuration (live.yaml) Source: https://github.com/bdrung/bdebstrap/blob/main/bdebstrap.1.md YAML configuration for building a Debian 11 (bullseye) live system. Assumes ~/.ssh/id_rsa.pub exists; it is copied to /root/.ssh/authorized_keys for SSH access. Outputs root.squashfs. ```yaml --- mmdebstrap: architectures: - amd64 cleanup-hooks: - cp /dev/null "$1/etc/hostname" - if test -f "$1/etc/resolv.conf"; then cp /dev/null "$1/etc/resolv.conf"; fi customize-hooks: - cp --preserve=timestamps -v "$1"/boot/vmlinu* "$1${BDEBSTRAP_OUTPUT_DIR?}/vmlinuz" - cp --preserve=timestamps -v "$1"/boot/initrd.img* "$1${BDEBSTRAP_OUTPUT_DIR?}/initrd.img" - mkdir -p "$1/root/.ssh" - upload ~/.ssh/id_rsa.pub /root/.ssh/authorized_keys keyrings: - /usr/share/keyrings/debian-archive-keyring.gpg mode: unshare packages: - init - iproute2 - less - libpam-systemd - linux-image-cloud-amd64 - live-boot - locales - openssh-server suite: bullseye target: root.squashfs variant: minbase ``` -------------------------------- ### Generate squashfs image and list output Source: https://github.com/bdrung/bdebstrap/blob/main/bdebstrap.1.md Commands to generate the squashfs image from live.yaml and list the output directory. The output shows config.yaml, initrd.img, manifest, root.squashfs, and vmlinuz. ```shell $ bdebstrap -c live.yaml --name example2 $ ls example2/ config.yaml initrd.img manifest root.squashfs vmlinuz ``` -------------------------------- ### SSH into running QEMU instance Source: https://github.com/bdrung/bdebstrap/blob/main/bdebstrap.1.md Connects to the running QEMU instance via SSH on port 2222. Disables host key checking for convenience. ```shell $ ssh -oUserKnownHostsFile=/dev/null -oStrictHostKeyChecking=no -p 2222 root@localhost ``` -------------------------------- ### Generate squashfs image with bdebstrap Source: https://github.com/bdrung/bdebstrap/blob/main/README.md Commands to generate the squashfs image and list the output files. The output includes config.yaml, initrd.img, manifest, root.squashfs, and vmlinuz. ```sh $ bdebstrap -c examples/Debian-trixie-live.yaml --name example2 $ ls example2/ config.yaml initrd.img manifest root.squashfs vmlinuz ``` -------------------------------- ### Generate tarball and list output Source: https://github.com/bdrung/bdebstrap/blob/main/bdebstrap.1.md Commands to generate the tarball from unstable.yaml and list the output directory. The output shows the generated files: config.yaml, manifest, and root.tar.xz. ```shell $ bdebstrap -c unstable.yaml --name example1 $ ls example1/ config.yaml manifest root.tar.xz ``` -------------------------------- ### Generate tarball with bdebstrap Source: https://github.com/bdrung/bdebstrap/blob/main/README.md Commands to generate the tarball using the YAML configuration and list the output files. The output includes config.yaml, manifest, and root.tar.xz. ```sh $ bdebstrap -c examples/Debian-unstable.yaml --name example1 $ ls example1/ config.yaml manifest root.tar.xz ``` -------------------------------- ### Generate xz-compressed release tarball and signature Source: https://github.com/bdrung/bdebstrap/blob/main/README.md Commands to create an xz-compressed tarball of the release and an armored detached GPG signature. The tarball is created from the git archive of the tagged commit. ```bash name="bdebstrap-$(./setup.py --version)" git archive --prefix="$name/" HEAD | xz -c9 > "../$name.tar.xz" gpg --output "../$name.tar.xz.asc" --armor --detach-sign "../$name.tar.xz" ``` -------------------------------- ### Minimal Debian unstable tarball configuration Source: https://github.com/bdrung/bdebstrap/blob/main/bdebstrap.1.md YAML configuration for building a minimal Debian unstable tarball. Stored in unstable.yaml, it uses the unshare mode and outputs root.tar.xz. ```yaml --- mmdebstrap: keyrings: - /usr/share/keyrings/debian-archive-keyring.gpg mode: unshare suite: unstable target: root.tar.xz variant: minbase ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.