
qemu を使用して Debian 10 の openstack イメージを起動しようとしていますが、ハードドライブの検出エラーが発生し、起動シーケンスの最後に次のメッセージが表示されます。
[ 0.989085] Run /init as init process
Loading, please wait...
Starting version 241
[ 1.068365] SCSI subsystem initialized
[ 1.073933] cryptd: max_cpu_qlen set to 1000
[ 1.085586] AVX2 version of gcm_enc/dec engaged.
[ 1.085699] PCI Interrupt Link [LNKA] enabled at IRQ 10
[ 1.086342] AES CTR mode by8 optimization enabled
[ 1.094169] scsi host0: ata_piix
[ 1.095524] scsi host1: ata_piix
[ 1.096120] ata1: PATA max MWDMA2 cmd 0x1f0 ctl 0x3f6 bmdma 0xc2c0 irq 14
[ 1.097198] ata2: PATA max MWDMA2 cmd 0x170 ctl 0x376 bmdma 0xc2c8 irq 15
[ 1.108170] PCI Interrupt Link [LNKB] enabled at IRQ 11
[ 1.120402] virtio_blk virtio0: [vda] 736 512-byte logical blocks (377 kB/368 KiB)
Begin: Loading essential drivers ... done.
Begin: Running /scripts/init-premount ... done.
Begin: Mounting root file system ... Begin: Running /scripts/local-top ... done.
Begin: Running /scripts/local-premount ... done.
Begin: Waiting for root file system ... Begin: Running /scripts/local-block ... done.
Begin: Running /scripts/local-block ... done.
Begin: Running /scripts/local-block ... done.
... line repeats ...
Begin: Running /scripts/local-block ... done.
Begin: Running /scripts/local-block ... done.
done.
Gave up waiting for root file system device. Common problems:
- Boot args (cat /proc/cmdline)
- Check rootdelay= (did the system wait long enough?)
- Missing modules (cat /proc/modules; ls /dev)
ALERT! UUID=77e3f255-2ef2-47bc-ad89-7cdbd65f5fbc does not exist. Dropping to a shell!
BusyBox v1.30.1 (Debian 1:1.30.1-4) built-in shell (ash)
Enter 'help' for a list of built-in commands.
initramfs プロンプトから、次の内容を確認できます。
(initramfs) cat /proc/cmdline
BOOT_IMAGE=/boot/vmlinuz-4.19.0-5-cloud-amd64 root=UUID=77e3f255-2ef2-47bc-ad89-7cdbd65f5fbc ro biosdevname=0 net.ifnames=0 console=tty0 console=ttyS0,115200 earlyprintk=ttyS0,115200 consoleblank=0 systemd.show_status=true
(initramfs) cat /proc/modules
ata_generic 16384 0 - Live 0xffffffffc00ba000
crc32c_intel 24576 0 - Live 0xffffffffc00b3000
virtio_blk 20480 0 - Live 0xffffffffc00ad000
aesni_intel 200704 0 - Live 0xffffffffc0156000
ata_piix 36864 0 - Live 0xffffffffc0147000
aes_x86_64 20480 1 aesni_intel, Live 0xffffffffc0135000
crypto_simd 16384 1 aesni_intel, Live 0xffffffffc0130000
libata 245760 2 ata_generic,ata_piix, Live 0xffffffffc00da000
cryptd 28672 2 aesni_intel,crypto_simd, Live 0xffffffffc00d2000
glue_helper 16384 1 aesni_intel, Live 0xffffffffc00cb000
scsi_mod 237568 1 libata, Live 0xffffffffc0072000
virtio_pci 28672 0 - Live 0xffffffffc0066000
virtio_ring 28672 2 virtio_blk,virtio_pci, Live 0xffffffffc005b000
virtio 16384 2 virtio_blk,virtio_pci, Live 0xffffffffc0053000
(initramfs) ls /dev
block tty18 tty5
char tty19 tty50
console tty2 tty51
core tty20 tty52
cpu_dma_latency tty21 tty53
disk tty22 tty54
fd tty23 tty55
full tty24 tty56
hpet tty25 tty57
input tty26 tty58
kmsg tty27 tty59
mem tty28 tty6
memory_bandwidth tty29 tty60
network_latency tty3 tty61
network_throughput tty30 tty62
null tty31 tty63
psaux tty32 tty7
ptmx tty33 tty8
pts tty34 tty9
random tty35 ttyS0
snapshot tty36 ttyS1
stderr tty37 ttyS2
stdin tty38 ttyS3
stdout tty39 urandom
tty tty4 vcs
tty0 tty40 vcs1
tty1 tty41 vcsa
tty10 tty42 vcsa1
tty11 tty43 vcsu
tty12 tty44 vcsu1
tty13 tty45 vda
tty14 tty46 vga_arbiter
tty15 tty47 zero
tty16 tty48
tty17 tty49
(initramfs) ls /dev/disk/by-label/
cidata
(initramfs) ls -al /dev/disk/by-uuid/
total 0
drwxr-xr-x 2 0 0 60 Jul 22 00:07 .
drwxr-xr-x 5 0 0 100 Jul 22 00:07 ..
lrwxrwxrwx 1 0 0 9 Jul 22 00:07 2019-07-21-20-02-09-00 -> ../../vda
このVMを再作成するには、まずダウンロードしたベースイメージ(OpenStack イメージサイト):
~/vm/deb10-test$ sha256sum ../base-debian-10/base.qcow2
d4c2966d996a3e08c198be41640d54b5d0c038cfc21b4d05e4b769824974daaf ../base-debian-10/base.qcow2
~/vm/deb10-test$ qemu-img create -f qcow2 -o "backing_file=../base-debian-10/base.qcow2" image.qcow2 20G
Formatting 'image.qcow2', fmt=qcow2 size=21474836480 backing_file=../base-debian-10/base.qcow2 encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16
seed.img
次に、以下を使用して cloud-init を設定しますcloud-localds
。
~/vm/deb10-test$ cat meta-data
instance-id: iid-deb10-test-20190721-193118
hostname: deb10-test
local-hostname: deb10-test
~/vm/deb10-test$ cat network-config
---
version: 1
config:
- type: physical
name: eth0
subnets:
- type: static
address: 192.168.237.42
netmask: 255.255.255.0
routes:
- network: 0.0.0.0
netmask: 0.0.0.0
gateway: 192.168.237.1
- type: nameserver
address: [192.168.234.10, 192.168.234.254, 8.8.8.8]
search: []
~/vm/deb10-test$ cat user-data
#cloud-config
users:
- default
chpasswd:
list: |
debian:passw0rd
expire: False
ssh_pwauth: True
package_update: true
packages:
- python
bootcmd:
# disable automatic dhcp
- sed -e '/^#/! {/eth0/ s/^/# /}' -i /etc/network/interfaces
~/vm/deb10-test$ cloud-localds -v ./seed.img --network-config network-config user-data meta-data
wrote ./seed.img with filesystem=iso9660 and diskformat=raw
最後に、次のように virt-install を実行しました。
~/vm/deb10-test$ virt-install \
--os-variant auto --virt-type kvm \
--name deb10-test --graphics none --import \
--disk path="./image.qcow2",format=qcow2,bus=scsi \
--disk path="./seed.img",bus=virtio \
--cpu host --vcpus 2 --memory 2048 \
--network network=routed
同様の手順が Debian 9 イメージでも機能し、 への変更はbus=virtio
他の多くの Linux イメージ (CentOS および Ubuntu) でも機能します。initramfs の残りの部分は動作しているように見えるのに、ハードドライブ デバイスが表示されないのはなぜかわかりません。Debian 10 で動作させるには、渡す必要のある別のオプションがあるのでしょうか?
編集: 以下の操作を試しても問題は解決しませんでした。
--machine q35
: 目に見える違いはありません。ドキュメントによると、KVM ではこれは必要ないようです。--disk path=./seed.img,device=cdrom,bus=sata
: 目に見える違いはありません--controller scsi,model=virtio-scsi
: これによって実際に起動がさらに中断され、空のコンソールでハングアップし、grub、カーネルの起動、initramfs プロンプトが表示されなくなりました。 を使用すると、model=auto
initramfs プロンプトに戻りました。
答え1
ダウンロードはこちらネットブート/initrd.gz
ダウンロードはこちらネットブート/vmlinuz
次のコマンドで空のディスク イメージを作成します。
qemu-img 作成 -f qcow2 hda.qcow2 10G
debian-installer
QEMU で次のコマンドを実行します:qemu-system-??????? -M virt -m 1024 -kernel vmlinuz -initrd initrd.gz -drive if=none、file=hda.qcow2、format=qcow2、id=hd -device virtio-blk-device、drive=hd -netdev user、id=mynet -device virtio-net-device、netdev=mynet -nographic -no-reboot
はdebian-installer
実行され、いくつかのテキスト メニューでいくつかの基本的な質問が行われ、仮想デバイスが検出され、その作業が実行され、完全に機能する Debian10 OS がディスクhda.qcow2
イメージに正常にインストールされます。ブート ローダーが見つからないというメッセージは無視してください...
さて、このイメージを実行するには、次の2つのファイルをイメージから
hda.qcow2
ホストOSのファイルシステム(たとえばQEMUディレクトリ)にコピーする必要がありますvmlinuz-4.19.????????
。initrd.img-4.19.?????
libguestfsLinux上のツールまたは ピージップWindowsの場合最後に、次のコマンドで新しくインストールした仮想マシンを実行します。
qemu-system-??????? -M virt -m 1024 -kernel vmlinuz-4.19.??????? -initrd initrd.img-4.19.??????? -append root=/dev/vda2 -drive if=none,file=hda.qcow2,format=qcow2,id=hd -device virtio-blk-device,drive=hd -netdev user,id=mynet,restrict=off,net=192.168.0.0/24,hostfwd=tcp:127.0.0.1:10022-192.168.0.15:22 -device virtio-net-device,netdev=mynet -nographic -no-reboot
Debian のインストール中に、Linux パーティションの仮想ディスク全体をフォーマットしないことを選択した場合は、を??????
システム上の特定のファイル名に変更し、 を他のデバイスに変更してください。-append root=/dev/vda2
- 最後に、VM を起動し、コンソールからログインします。
root
127.0.0.1:10022 の SSH 経由でこの仮想マシンにログインするには、/etc/ssh/sshd_config
ファイルを編集して次の行を追加する必要がありますPermitRootLogin yes
。
こちらもご覧くださいこの答えSSH サーバーが誤動作した場合には、私の責任になります。
答え2
コマンドで変更したい点がいくつかありますvirt-install
:
まず、非常に古い (Windows 95 時代) PC のハードウェアをエミュレートするデフォルトのマシン タイプを許可するのではなく、 を追加します--machine q35
。 で virtio-scsi コントローラーも追加する必要があることに注意してください--controller scsi,model=virtio-scsi
。
次に、ISOイメージのディスクタイプをCDROMに設定します(また、SATA経由で接続する必要があります)。--disk path=./seed.img,device=cdrom,bus=sata