2

我试图在另一台机器上运行交叉编译的 lxc 映像,如下所示:我通过命令在 ubuntu 14.04 上创建了一个 lxc 映像:

lxc-create -t /usr/share/lxc/templates/lxc-busybox -n customBusyBox

我检查了创建的图像customBusyBox在这台机器上运行良好。现在我创建了它的.tar.gz文件,即customBusyBox.tar.gz并通过scp命令将它复制到另一台具有相同版本 ubuntu 即 14.04 的机器上。然后我将 customBusyBox 图像提取到/var/lib/lxc文件夹。然后作为超级用户,我尝试通过以下命令运行图像:

lxc-start -F -n customBusyBox

然后我得到了这个错误:

lxc-start: utils.c: safe_mount: 1746 No such file or directory - Failed to mount /lib64 onto /usr/lib/i386-linux-gnu/lxc/lib64
                                                                                                                              lxc-start: conf.c: mount_entry: 1650 No such file or directory - failed to mount '/lib64' on '/usr/lib/i386-linux-gnu/lxc/lib64'
                                                         lxc-start: conf.c: lxc_setup: 3790 failed to setup the mount entries for 'openWrt'
                                                                                                                                           lxc-start: start.c: do_start: 826 Failed to setup container "openWrt".
            lxc-start: sync.c: __sync_wait: 57 An error occurred in another process (expected sequence number 3)
                                                                                                                lxc-start: start.c: __lxc_start: 1338 Failed to spawn container "openWrt".
                                                                                                                                                                                          lxc-start: tools/lxc_start.c: main: 360 The container failed to start.
lxc-start: tools/lxc_start.c: main: 364 Additional information can be obtained by setting the --logfile and --logpriority options.

我尝试在网上搜索它的解决方案但没有帮助:有人请提出一些解决方案。

谢谢

4

1 回答 1

0

我能够解决这个错误。

以下是在第一台主机上创建的customBusyBox容器的配置文件:

# Template used to create this container: /usr/share/lxc/templates/lxc-busybox
# Parameters passed to the template:
# For additional config options, please look at lxc.container.conf(5)
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = lxcbr0
lxc.network.hwaddr = 00:16:3e:1d:e5:8c
lxc.rootfs = /var/lib/lxc/OpenWrt/rootfs
lxc.haltsignal = SIGUSR1
lxc.utsname = OpenWrt
lxc.tty = 1
lxc.pts = 1
lxc.cap.drop = sys_module mac_admin mac_override sys_time

# When using LXC with apparmor, uncomment the next line to run unconfined:
#lxc.aa_profile = unconfined
lxc.mount.entry = /lib lib none ro,bind 0 0
lxc.mount.entry = /usr/lib usr/lib none ro,bind 0 0
lxc.mount.entry = /lib64 lib64 none ro,bind 0 0
lxc.mount.entry = /usr/lib64 usr/lib64 none ro,bind 0 0
lxc.mount.entry = /sys/kernel/security sys/kernel/security none ro,bind,optional 0 0
lxc.mount.auto = proc:mixed sys

我从另一台主机上的上述配置文件中删除了以下几行:

lxc.mount.entry = /lib64 lib64 none ro,bind 0 0
lxc.mount.entry = /usr/lib64 usr/lib64 none ro,bind 0 0

然后我试了一下,它也在那里成功运行。实际上,第二台主机上没有任何这样的目录,即/lib64 或 /usr/lib64 ,这就是为什么这些目录会出现挂载错误的原因。

配置文件存在于路径:/var/lib/lxc/<container-name>/

于 2017-02-10T07:53:01.350 回答