大网数据广告活动
服务器运维问答

Running systemd based container in LXC

· 52CE 我爱测

I'm currently trying to run an Arch Linux container using LXC on an Ubuntu 12.04 host. Arch Linux has recently migrated to systemd , which according to a variety of places has some problems operating as an LXC guest. However, man…

问题原文

原帖链接 · Impredicative · CC BY-SA 3.0

I'm currently trying to run an Arch Linux container using LXC on an Ubuntu 12.04 host. Arch Linux has recently migrated to systemd, which according to a variety of places has some problems operating as an LXC guest. However, many of these sources are substantially outdated, and I've seen various other sources suggesting that it is possible to run a systemd based guest, using things like lxc.autodev or devtmpfs.

As such, I'm trying to find out the following:

  1. Is it possible to run a systemd based guest inside an LXC container (as of February 2013)?
  2. Does anybody have an example template/config file to use with ```mkarchroot`` to get one running?

Currently using LXC version 0.7.5, but upgrading shouldn't be an issue if this is necessary.

已采纳解答

原帖链接 · Philippe · CC BY-SA 3.0

answering to myself. The lxc-archlinux template is available at https://github.com/dotcloud/lxc/blob/master/templates/lxc-archlinux.in but it does not include the migration to systemd (as of Feb 15 2013) .

there are usable rootfs part of archlinux (e.g http://www.gtlib.gatech.edu/pub/archlinux/iso/2013.02.01/arch/i686/root-image.fs.sfs for i686 there also is a 64 bit version)

I did not run an lxc guest out of it yet but I got a functional i686 chroot from inside ubuntu 12.04 x64. 1/ download and unsquash the root image, mount it somewhere.

2/ as root (sudo) cp -ar the root filesystem to your location and chroot into it

3/ edit /etc/pacman.conf and update the arch line (by default it is auto, which pulls the ar ch from uname, but ubuntu and arch do not use the same designation)

4/ mount /proc /dev/random and /dev/urandom (this is needed by pacman and pacman-key)

I could not get pacman to run without package signature properly setup

5/ pacman-key --init (here it needs a good source of entropy)

6/ pacman-key --populate archlinux

7/ optional: pacman-key --refresh-keys (needs a working internet connection)

8/ edit /etc/pacman.d/mirrorlist to activate mirrors relevant to you.

9/ pacman -Syy

ready to update or install new packages.

What's (direly) missing is the container startup. I'm not up to speed on systemd but if I understand correctly this is mostly a matter of starting dbus and systemd.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2013-02-06)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。