0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【2025年10月版】macOS上のParallels上の Linux on Linux メモ【nested virtualization】

Posted at

はじめに

  • macOS上のParalles上の Linux で、qemuによる VM が動かせるということなのでやってみたメモ
  • 世にいう nested virtualization
  • Parallesは qmue で動いているそうなので、macOS 上で qemu 上の qemu という感じ

環境

  • MacbookPro M3 Max 64GB
  • macOS Sequoia 15.6.1
  • Parallels Desktop 26 fro Mac Pro Edition 26.1.1
  • Ubuntu 25.04
  • alpine standard 3.22.2

前提

Paralles 上に Ubuntu はすでにインストールされているとします。

手順

必要なパッケージをインストール

sudo apt update
sudo apt upgrade -y
sudo apt install qemu-system-aarch64 qemu-utils qemu-efi-aarch64

alpine linuxのダウンロード

使いたいバージョンをダウンロードしてください。大事なのは、aarch64 であること。

wget https://dl-cdn.alpinelinux.org/alpine/v3.22/releases/aarch64/alpine-standard-3.22.2-aarch64.iso

仮想ディスクの作成

qemu-img create -f qcow2 alpine.qcow2 2G

VMの起動(インストール時)

ヘッドレス/シリアル、4コア、I/O最適化、rng 追加、軽めCPU&GICv2 で起動

qemu-system-aarch64 \
  -machine virt,gic-version=2 \
  -accel tcg,thread=multi \
  -cpu cortex-a72 \
  -smp 4 \
  -m 3072 \
  -bios /usr/share/AAVMF/AAVMF_CODE.fd \
  -drive if=none,id=cd,file=alpine-standard-3.22.2-aarch64.iso,media=cdrom,format=raw \
  -device virtio-scsi-pci,id=scsi \
  -device scsi-cd,drive=cd \
  -drive if=none,id=vd,file=alpine.qcow2,format=qcow2,aio=io_uring,cache=writeback,discard=unmap \
  -device virtio-blk-pci,drive=vd,queue-size=1024 \
  -netdev user,id=n0 \
  -device virtio-net-pci,netdev=n0 \
  -object rng-random,filename=/dev/urandom,id=r0 \
  -device virtio-rng-pci,rng=r0 \
  -serial mon:stdio \
  -display none

ログインプロンプトが表示されたら成功

  Booting `Linux lts'



   OpenRC 0.62.6 is starting up Linux 6.12.51-0-lts (aarch64)

 * /proc is already mounted
 * Mounting /run ... [ ok ]
 * /run/openrc: creating directory
 * /run/lock: creating directory
 * /run/lock: correcting owner
 * Caching service dependencies ... [ ok ]
 * Remounting devtmpfs on /dev ... [ ok ]
 * Mounting /dev/mqueue ... [ ok ]
 * Mounting modloop  ... * Verifying modloop
 [ ok ]
 * Mounting security filesystem ... [ ok ]
 * Mounting debug filesystem ... [ ok ]
 * Mounting persistent storage (pstore) filesystem ... [ ok ]
 * Mounting efivarfs filesystem ... [ ok ]
 * Mounting bpf filesystem ... [ ok ]
 * Starting busybox mdev ... [ ok ]
 * Scanning hardware for mdev ... [ ok ]
 * Loading hardware drivers ... [ ok ]
 * Loading modules ... [ ok ]
 * Setting system clock using the hardware clock [UTC] ... [ ok ]
 * Checking local filesystems  ... [ ok ]
 * Remounting filesystems ... [ ok ]
 * Mounting local filesystems ... [ ok ]
 * Configuring kernel parameters ... [ ok ]
 * Creating user login records ... [ ok ]
 * Cleaning /tmp directory ... [ ok ]
 * Setting hostname ... [ ok ]
 * Starting busybox syslog ... [ ok ]
 * Starting firstboot ... [ ok ]

Welcome to Alpine Linux 3.22
Kernel 6.12.51-0-lts on aarch64 (/dev/ttyAMA0)

localhost login: 

インストール

root でログインしてから setup-alpine
vda にインストール

alpine のインストールについては、以下を参考にしてみてください。

【2023年7月版】ESXi7, 8 で Alpine Linux のインストールと実行

シャットダウン(インストール時)

localhost:~# poweroff

localhost:~#  * Stopping busybox syslog ... [ ok ]
 * Unmounting loop devices
 *   Remounting /.modloop read only ... [ ok ]
 * Unmounting filesystems
 *   Unmounting /media/cdrom ... [ ok ]
 * Setting hardware clock using the system clock [UTC] ... [ ok ]
 * Stopping busybox mdev ... [ ok ]
 [ ok ]
 * Terminating remaining processes ... [ ok ]
 * Killing remaining processes ... [ ok ]
 * /var/cache/rc: creating directory
 * Saving dependency cache ... [ ok ]
 * Remounting remaining filesystems read-only ... *   Remounting / read only ... [ ok ]
 [ ok ]
The system is going down NOW!
Sent SIGTERM to all processes
Sent SIGKILL to all processes
Requesting system poweroff
[   47.995427] reboot: Power down

NVRAMのコピー

cp /usr/share/AAVMF/AAVMF_VARS.fd ./AAVMF_VARS.alpine.fd

VMの起動(インストール後)

ディスクから起動

qemu-system-aarch64 \
  -machine virt,gic-version=2 \
  -accel tcg,thread=multi \
  -cpu cortex-a72 \
  -smp 4 \
  -m 3072 \
  -drive if=pflash,format=raw,readonly=on,file=/usr/share/AAVMF/AAVMF_CODE.fd \
  -drive if=pflash,format=raw,file=./AAVMF_VARS.alpine.fd \
  -drive if=none,id=vd,file=alpine.qcow2,format=qcow2,aio=io_uring,cache=writeback,discard=unmap \
  -device virtio-blk-pci,drive=vd,queue-size=1024 \
  -netdev user,id=n0 \
  -device virtio-net-pci,netdev=n0 \
  -object rng-random,filename=/dev/urandom,id=r0 \
  -device virtio-rng-pci,rng=r0 \
  -serial mon:stdio \
  -display none \
  -boot order=c

ログインプロンプトが出たら成功

  Booting `Alpine Linux v3.22, with Linux lts'

Loading Linux lts ...
Loading initial ramdisk ...

   OpenRC 0.62.6 is starting up Linux 6.12.51-0-lts (aarch64)

 * /proc is already mounted
 * Mounting /run ... [ ok ]
 * /run/openrc: creating directory
 * /run/lock: creating directory
 * /run/lock: correcting owner
 * Remounting devtmpfs on /dev ... [ ok ]
 * Mounting /dev/mqueue ... [ ok ]
 * Mounting security filesystem ... [ ok ]
 * Mounting debug filesystem ... [ ok ]
 * Mounting persistent storage (pstore) filesystem ... [ ok ]
 * Mounting efivarfs filesystem ... [ ok ]
 * Mounting bpf filesystem ... [ ok ]
 * Starting busybox mdev ... [ ok ]
 * Scanning hardware for mdev ... [ ok ]
 * Loading hardware drivers ... [ ok ]
 * Loading modules ... [ ok ]
 * Setting system clock using the hardware clock [UTC] ... [ ok ]
 * Setting up the Logical Volume Manager ...  Found volume group "vg0" using metadata type lvm2
  2 logical volume(s) in volume group "vg0" now active
 [ ok ]
 * Checking local filesystems  .../dev/vg0/lv_root: clean, 6770/87824 files, 72329/351232 blocks
fsck.fat 4.2 (2021-01-31)
/dev/vda1: 5 files, 708/322589 clusters
 [ ok ]
 * Remounting root filesystem read/write ... [ ok ]
 * Remounting filesystems ... [ ok ]
 * Activating swap devices ... [ ok ]
 * Mounting local filesystems ... [ ok ]
 * Configuring kernel parameters ... [ ok ]
 * Creating user login records ... [ ok ]
 * Setting hostname ... [ ok ]
 * Starting networking ... *   lo ... [ ok ]
 *   eth0 ...udhcpc: started, v1.37.0
udhcpc: broadcasting discover
udhcpc: broadcasting select for 10.0.2.15, server 10.0.2.2
udhcpc: lease of 10.0.2.15 obtained from 10.0.2.2, lease time 86400
 [ ok ]
 * Seeding random number generator ... * Seeding 256 bits and crediting
 * Saving 256 bits of creditable seed for next boot
 [ ok ]
 * Starting busybox syslog ... [ ok ]
 * Starting busybox acpid ... [ ok ]
 * Starting busybox crond ... [ ok ]
 * Starting busybox ntpd ... [ ok ]
 * Starting sshd ... [ ok ]

Welcome to Alpine Linux 3.22
Kernel 6.12.51-0-lts on aarch64 (/dev/ttyAMA0)

alpine login: 

さいごに

かんたんでしたね

リンク

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?