5
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

snippet:proxmox

Last updated at Posted at 2015-09-19

apt dist-upgrade でエラーが出る場合

The following packages have unmet dependencies:
pve-firmware : Conflicts: firmware-linux-free but 3.4 is to be installed
E: Broken packages

firmware-linux-free is not installed

apt autoremove

をしてから再度apt dist-upgradeをするとよい。

ディスプレイの解像度を800x600以外も選べるようにする

  • Default のままだとゲストOSからは 800x600 以外選べない。
  • SPICE に変更することで変更可能になる。

スクリーンショット_2018-01-06_06-26-10.png

スクリーンショット_2018-01-06_06-27-10.png

proxy設定

/etc/apt/apt.conf
Acquire::http::Proxy "http://192.168.0.9:8888";

bondingするには ifenslave パッケージが必要。

  • ネットに繋がずにdebian8 netinstのisoでインストールを完了するとifenslaveが含まれないので注意。

LXCでのエラー

  • GNUSparseFile.xxxxx(数字)

というフォルダができ不完全なファイルになることを2回経験した。
そのため自分はlxcを使わずqemuを使うようにする。

kvmが起動しない場合

kvm: -vnc unix:/var/run/qemu-server/100.vnc,x509,password: Failed to start VNC server: The server certificate /etc/pve/local/pve-ssl.pem is not yet active
TASK ERROR: start failed: command '/usr/bin/kvm -id 100 -chardev 'socket,id=qmp,path=/var/run/qemu-server/100.qmp,server,nowait' -mon 'chardev=qmp,mode=control' -pidfile /var/run/qemu-server/100.pid -daemonize -smbios 'type=1,uuid=2a96e9bf-f609-4d7a-89b7-e3909762a81d' -name test4 -smp '1,sockets=1,cores=1,maxcpus=1' -nodefaults -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' -vga cirrus -vnc unix:/var/run/qemu-server/100.vnc,x509,password -cpu kvm64,+lahf_lm,+sep,+kvm_pv_unhalt,+kvm_pv_eoi,enforce -m 512 -k ja -device 'pci-bridge,id=pci.1,chassis_nr=1,bus=pci.0,addr=0x1e' -device 'pci-bridge,id=pci.2,chassis_nr=2,bus=pci.0,addr=0x1f' -device 'piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2' -device 'usb-tablet,id=tablet,bus=uhci.0,port=1' -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3' -iscsi 'initiator-name=iqn.1993-08.org.debian:01:a17fc34cf2f2' -drive 'if=none,id=drive-ide2,media=cdrom,aio=threads' -device 'ide-cd,bus=ide.1,unit=0,drive=drive-ide2,id=ide2,bootindex=200' -drive 'file=/mnt/sdb1/images/100/vm-100-disk-1.qcow2,if=none,id=drive-virtio0,format=qcow2,cache=none,aio=native,detect-zeroes=on' -device 'virtio-blk-pci,drive=drive-virtio0,id=virtio0,bus=pci.0,addr=0xa,bootindex=100' -netdev 'type=user,id=net0,hostname=test4' -device 'virtio-net-pci,mac=8A:96:3C:CA:DE:D8,netdev=net0,bus=pci.0,addr=0x12,id=net0,bootindex=300'' failed: exit code 1
rm /etc/pve/pve-root-ca.pem /etc/pve/priv/pve-root-ca.key

pvecm updatecerts -f

qm start 100
# 起動することを確認。

KVMのバックアップが時間がかかる場合

  • DISKイメージがrawフォーマットだとバックアップに時間がかかる。qcow2に変換。
KVM側で最初に0埋めしておく。
dd if=/dev/zero of=a.img bs=1M
sync;sync
rm -f a.img
poweroff
ホスト側
$ cd /var/lib/vz/images/188
$ sudo -s
% ls -lh
合計 29G
-rw-r----- 1 root root 60G  3月  5 06:12 vm-188-disk-1.raw

# rawをqcow2に変換
% qemu-img convert -O qcow2 vm-188-disk-1.raw vm-188-disk-1.qcow2
/etc/pve/qemu-server/188.conf
- virtio0: local:188/vm-188-disk-1.raw,size=60G
+ virtio0: local:188/vm-188-disk-1.qcow2,size=60G

ホスト名を数字にしてはいけない

error.png

  • 66.my-networkというホスト名で進めていたらインストール最後でエラーになった。

XPをvirtioでインストール

FDDを指定
sudo qm set <VMID> \
 -args '-fda /var/lib/vz/template/iso/virtio-win-0.1.173_x86.vfd'
/etc/pve/qemu-server/307.conf
# もしくは以下を追記
args: -fda /var/lib/vz/template/iso/virtio-win-0.1.173_x86.vfd
  • XPセットアップ中 viostor.sys, viostor.ini が無いと出て再起動するとブルースクリーンエラーになった。(virtio-win.iso の viostor\xp\ に含まれている?)

7をvirtio指定

他リンク

Proxmox4.1でvirtualboxは動かない

エラー
systemctl status virtualbox
● virtualbox.service - LSB: VirtualBox Linux kernel module
   Loaded: loaded (/etc/init.d/virtualbox)
   Active: failed (Result: exit-code) since Tue 2016-02-02 05:21:11 JST; 1min 25s ago
  Process: 1441 ExecStart=/etc/init.d/virtualbox start (code=exited, status=1/FAILURE)

CPU Units


backup,restore

KVMのBackupが時間かかるようになった場合

ゼロ埋め
dd if=/dev/zero of=zero bs=1M; rm -f zero

ゼロ埋めをした後にバックアップを取れば早くなった。

backupを中断した場合ロックがかかる件

ロック解除方法
qm unlock `vmid`

リストア時のエラー

trying to aquire lock...TASK ERROR: can't lock file '/run/lock/lxc/pve-config-307.lock' - got timeout

ぎょっとするが2重起動をした場合上記エラーに遭遇。
落ち着いて、restore完了していることを確認。

KVMのdumpリストア

qmrestore
qmrestore vzdump-qemu-123.vma.lzo 123 -storage local

手動バックアップ

proxmox4でもこのコマンド
vzdump 100 -compress lzo -dumpdir /var/lib/vz/dump/

LXCにてsuspend vmから先に進まない場合、WebUIからLXCコンテナを停止(stop)してから再度試してみるとよい。

LXCのdiskイメージマウント

cd /var/lib/vz/images/100/
mkdir a
mount -o loop,ro vm-100-disk-1.raw a

その他

proxmox4のlxcでnfsを使う

create another apparmor profile which includes the lxc-container-default file and has an allow mount fstype=nfs line, run apparmor_parser on it to load it if you don't want to restart, and specify an lxc.aa_profile line in the VM config with that profile.
Note that apparmor comes with a secondary profile to allow mounting in general (not just nfs) which you can use if you don't need to restrict it to NFS-only. (That would be lxc.aa_profile = lxc-container-default-with-mounting)

zfsが超遅い場合

zfs set sync=disabled rpool

nfsサーバでの権限

  • nobody:nogroup に書き込み権限を与えること。
/etc/exportfs
/mnt/storage1/nfs 192.168.33.3(rw,sync,no_subtree_check)
chown nobody:nogroup /mnt/storage1/nfs

sshfs

  • サーバ側の設定が面倒なのでちょっとしたdumpの転送であればsshfsのほうが早い

インストール時に入力したメールアドレスの修正方法

/etc/pve/user.cfg
- user:root@pam:1:0:::user1@myserver.com::
+ user:root@pam:1:0:::user2@myserver.com::

CentOS7テンプレート


USBパススルー

接続しているUSBデバイスのIDを検索
# lsusb
Bus 002 Device 002: ID 0bda:817f Realtek Semiconductor Corp. RTL8188RU 802.11n WLAN Adapter
/etc/pve/nodes/ホスト名/qemu-server/仮想マシンID.conf
+ usb0: host=0bda:817f

kvmの自動restore

rsync_dump.sh
# !/bin/sh
set -eu

# user1
rsync -a --delete --bwlimit=4096 server1:/var/lib/vz/dump/ ~/rsync_server1/dump/
rsync -a --delete --bwlimit=4096 server2:/var/lib/vz/dump/ ~/rsync_server2/dump/

du -h ~/rsync_server[12]/dump/*lzo | sed -e 's@/home/user1/rsync_@@'
rsync_restore.sh
# !/bin/sh
DATE=$(date "+%m_%d")

# rootで実行すること
vzrestore() {
        cd $1
        DUMPFILE=$(find -name "vzdump-qemu-$3-*${DATE}-*.lzo")

        # serverが停止中か確認
        ISRUNNING=$(qm list | grep $2 | grep running)
        if [ "$ISRUNNING" != "" ];then
            echo "[quit] $2 is running!"
            exit 1
        fi

        # restore
        qmrestore ${DUMPFILE} $3 --force
        # OS起動時の自動bootを無効化
        sed -i -e 's@onboot: 1@onboot: 0@' /etc/pve/qemu-server/$3.conf
}

vzrestore /home/user1/rsync_pve1/dump server1.local 101
vzrestore /home/user1/rsync_pve2/dump server2.local 102
5
3
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
5
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?