This repository provides a guide and related scripts for emulating a Raspberry Pi running Raspbian OS on an Intel-based macOS system. This setup is ideal for testing Ansible playbooks for Raspberry Pi without the need for actual hardware.
- Running headless Raspbian (No UI)
- Raspbian does not provide a default login since 2022
- QEMU setup can be complicated
- Docker image by Luke Childs simplifies the QEMU setup but requires user configuration
- Docker
- Vagrant
- xz (decompression utility)
-
Pull the Docker Image
docker pull lukechilds/dockerpi:vm
-
Download Raspberry Pi OS Lite Image
Download the image from Raspberry Pi OS.
-
Decompress the Image
xz -d 2023-02-21-raspios-bullseye-armhf-lite.img.xz
-
Configure User Settings with Vagrant
Use Vagrant to mount the image and set up a login user.
vagrant up sudo ./firstboot.sh .....img
-
Run the Emulated Raspbian
docker run -it --mount type=bind,source="$(pwd)"/2023-02-21-raspios-bullseye-armhf-lite.img,target=/sdcard/filesystem.img -p 5022:5022 lukechilds/dockerpi:vm
-
Reconfigure SSH
sudo dpkg-reconfigure openssh-server
-
Start SSH Service
sudo systemctl start ssh.service
-
SSH into Emulated Pi
ssh -p 5022 berryboot@localhost