読者です 読者をやめる 読者になる 読者になる

TenForward

技術ブログ。はてなダイアリーから移転しました

libvirt 経由で lxc を触ろうと思いハマる (2)

Container

前回 は iproute2 のバージョンのおかげで define が出来なかった libvirt 経由の lxc ですが,次に新たな問題が.

  1. 定義ファイルを libvirt: LXC container driver を参考に作成.

    debian
    32768

    exe
    /sbin/init

    1

    destroy
    restart
    destroy

    /usr/libexec/libvirt_lxc










  2. define
    # virsh --connect lxc:/// define debian.xml
  3. start は成功する.
    # virsh --connect lxc:/// start debian
    Domain debian started

start は成功するものの...

  • console に接続しようとしてもだんまり.
  • ping は通る.
  • sshd とか起動している風なし.
  • xinetd と cron と sendmail は起動しているっぽい.
  • getty はダメっぽい.
Oct 12 16:29:02 debian syslogd 1.5.0#5: restart.
Oct 12 16:29:02 debian xinetd[382]: attribute: disable should not be in default section [file=/etc/xinetd.conf] [line=12]
Oct 12 16:29:02 debian xinetd[382]: Reading included configuration file: /etc/xinetd.d/chargen [file=/etc/xinetd.conf] [line=15]
Oct 12 16:29:02 debian xinetd[382]: Reading included configuration file: /etc/xinetd.d/daytime [file=/etc/xinetd.d/daytime] [line=28]
Oct 12 16:29:02 debian xinetd[382]: Reading included configuration file: /etc/xinetd.d/discard [file=/etc/xinetd.d/discard] [line=26]
Oct 12 16:29:02 debian xinetd[382]: Reading included configuration file: /etc/xinetd.d/echo [file=/etc/xinetd.d/echo] [line=25]
Oct 12 16:29:02 debian xinetd[382]: Reading included configuration file: /etc/xinetd.d/time [file=/etc/xinetd.d/time] [line=26]
Oct 12 16:29:02 debian xinetd[382]: added service talk [file=/etc/inetd.conf] [line=1]
Oct 12 16:29:02 debian xinetd[382]: added service ntalk [file=/etc/inetd.conf] [line=2]
Oct 12 16:29:02 debian xinetd[382]: removing chargen
Oct 12 16:29:02 debian xinetd[382]: removing chargen
Oct 12 16:29:02 debian xinetd[382]: removing daytime
Oct 12 16:29:02 debian xinetd[382]: removing daytime
Oct 12 16:29:02 debian xinetd[382]: removing discard
Oct 12 16:29:02 debian xinetd[382]: removing discard
Oct 12 16:29:02 debian xinetd[382]: removing echo
Oct 12 16:29:02 debian xinetd[382]: removing echo
Oct 12 16:29:02 debian xinetd[382]: removing time
Oct 12 16:29:02 debian xinetd[382]: removing time
Oct 12 16:29:02 debian xinetd[382]: xinetd Version 2.3.14 started with libwrap loadavg options compiled in.
Oct 12 16:29:02 debian xinetd[382]: Started working: 2 available services
Oct 12 16:29:02 debian sm-mta[412]: starting daemon (8.14.3): SMTP+queueing@00:10:00
Oct 12 16:29:04 debian /usr/sbin/cron[442]: (CRON) INFO (pidfile fd = 3)
Oct 12 16:30:44 debian init: Id "c2" respawning too fast: disabled for 5 minutes
Oct 12 16:30:44 debian init: Id "c1" respawning too fast: disabled for 5 minutes
Oct 12 16:30:44 debian init: Id "c4" respawning too fast: disabled for 5 minutes
Oct 12 16:30:44 debian init: Id "c3" respawning too fast: disabled for 5 minutes

ググってたらこんなの見つけた... (;_;)

: (snip)

AFAIK libvirt still doesn't support /sbin/init as the init program.


In my case, I write up and use a script of 'fake' init which sets up
inside a container, e.g., assigning IP addresses, launching sshd,
etc. The script eventually 'exec /bin/bash', then the shell is shown
via virsh console. That's enough for my purpose.


Note that libvirt lxc driver is a different implementation from lxc tools
and doesn't use lxc tools internally. You may not be able to do what
you are doing with lxc tools. Especially, the driver doesn't take aware
of files and settings inside a container at all. You have to prepare them
by yourself in advance.

: (snip)

https://www.redhat.com/archives/libvirt-users/2010-August/msg00005.html