You are not logged in.

#1 2014-02-22 07:13:20

hydrosIII
Member
Registered: 2013-04-04
Posts: 127

Arch linux lxc in debian host.

Hi. I have been playing with lxc recently. Im running them on a debian host. I have created a couple of debian lxc and a centos lxc inside the host. Now im trying to create an arch lxc. There is an arch linux template provided by the debian package but it requires pacman installed on the host system in order to work. This is a production server and i dont want to install binaries untracked, so compiling pacman with make, is not an option.
I decided to create an Arch linux chroot as the wiki says by dowloading a tarball.
Im able to chroot sucessfully to it and install some packages. I have created the lxc dev/  files by following the arch wiki, and reading the archlinux template. Then i created a config file for the linux container and a fstab file. I got these from the archlinux template and copying other lxc config and fstab files (debian and centos one).

However hen i try to boot the container with lxc-start i got

 
lxc-start: File exists - failed to symlink '/dev/pts/ptmx'->'/dev/ptmx'
lxc-start: failed to setup the new pts instance
lxc-start: failed to setup the container
lxc-start: invalid sequence number 1. expected 2
lxc-start: failed to spawn 'arch'

So i remove /dev/ptmx  into the lxc.
Then i got:

lxc-start: No such file or directory - failed to exec /sbin/init
lxc-start: invalid sequence number 1. expected 2
lxc-start: failed to spawn 'arch

And here im trapped, i cant find /sbin/init, it doesn't exist, in a normal arch installation /sbin/init is pointing to /lib/systemd/systemd .

What to do now?? Is it impossible to setup a lxc with arch inside  a systemv hosts system?????

here is my config file:

xc.utsname=arch
lxc.tty=4
lxc.pts=1024
lxc.rootfs=/srv/lib/lxc/arch/rootfs
lxc.mount=/srv/lib/lxc/arch/fstab
#networking
#lxc.network.type=${lxc_network_type}
#lxc.network.flags=up
#lxc.network.link=${lxc_network_link}
#lxc.network.name=eth0
#lxc.network.mtu=1500
#cgroups
lxc.cgroup.devices.deny = a
# /dev/null and zero
# /dev/null and zero
lxc.cgroup.devices.allow = c 1:3 rwm
lxc.cgroup.devices.allow = c 1:5 rwm
# consoles
lxc.cgroup.devices.allow = c 5:1 rwm
lxc.cgroup.devices.allow = c 5:0 rwm
lxc.cgroup.devices.allow = c 4:0 rwm
lxc.cgroup.devices.allow = c 4:1 rwm
# /dev/{,u}random
lxc.cgroup.devices.allow = c 1:9 rwm
lxc.cgroup.devices.allow = c 1:8 rwm
# /dev/pts
lxc.cgroup.devices.allow = c 136:* rwm
# rtc
lxc.cgroup.devices.allow = c 254:0 rwm

and fstab

proc proc proc nodev,noexec,nosuid 0 0
sysfs sys sysfs defaults  0 0

Offline

#2 2014-02-22 17:39:17

Lone_Wolf
Forum Moderator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 12,178

Re: Arch linux lxc in debian host.

to get around the /sbin/init/init errror try starting a container like this :

lxc-start -n arch /usr/lib/systemd/systemd

Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#3 2014-02-27 09:28:20

hydrosIII
Member
Registered: 2013-04-04
Posts: 127

Re: Arch linux lxc in debian host.

Hi. Thank you for the reply. I suspect i have to install systemd that is not installed.

However after playing a little with lxc i just moved to openvz in debian with openvz kernel. Sadly lxc is not mature enough for now, i dont doubt that in no little time it will be perfected, but for debian should be two years or more. I know that it is perfectly usable, but it is just too much hassle for now.
So now i have moved to openvz, there's an arch template i will try it later, i have read the wiki and there's some documentation about it, so i think it should be easy. Also openvz will update kernel to 3.10 anytime soon.

That said, i dont understand why openvz and lxc people work together.

Offline

#4 2014-02-27 23:08:38

hydrosIII
Member
Registered: 2013-04-04
Posts: 127

Re: Arch linux lxc in debian host.

I have succesfully installed arch linux template into openvz container using the provided template from 2013-10  provided in the openvz official page (http://openvz.org/Download/template/precreated). Arch linux besides all the remarks in the wiki is working. I just have one problem, i cannnot login into container trough tty's, using the

 vzctl console 

command, i always get rejected because of the password, however i can login succesfully using ssh and using

 vzctl enter 

. The contianer otherwise is booting fine.
Looking at the template more deeply it appears to be some kind of memory leak in the container, since it is using 400 MB of memory just for running. WTF?? So for this usage i think is better to create a full KVM, or other type of virtualization.
I'd like to use arch to deploy some personal projects but  i cannot use it as the main server OS. I'd like to deploy a lightweight container, for this , im thinking in symply using a chroot, or the full virtualization. Is there an easy way tho fix this issues?

Note: I dont know if to start another thread or to just update the title of this one. Since they are similar technologies. Maybe a moderator could clarify this issue. Thank you

Offline

#5 2014-02-27 23:26:57

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: Arch linux lxc in debian host.

I'm not sure if you've tried Docker yet, but it took about 3 minutes to have a working Arch Docker container on my Ubuntu 12.04 server:

# docker pull base/arch
# docker run -i -t base/arch /bin/bash
[root@c21eea45fb46 /]# pacman -Syu
:: Synchronizing package databases...
 core                                                    106.7 KiB   617K/s 00:00 [###############################################] 100%
 extra                                                  1533.7 KiB  2.15M/s 00:01 [###############################################] 100%
 community                                                 2.1 MiB  2022K/s 00:01 [###############################################] 100%
:: Starting full system upgrade...
resolving dependencies...
looking for inter-conflicts...

Packages (11): archlinux-keyring-20140220-1  curl-7.35.0-1  e2fsprogs-1.42.9-1  gcc-libs-4.8.2-8  glibc-2.19-2  libgcrypt-1.6.1-1
               libldap-2.4.39-1  libsasl-2.1.26-7  linux-api-headers-3.13.2-1  pam-1.1.8-3  util-linux-2.24.1-1

Total Download Size:    14.53 MiB
Total Installed Size:   60.52 MiB
Net Upgrade Size:       0.35 MiB

:: Proceed with installation? [Y/n] 
:: Retrieving packages ...
 archlinux-keyring-20140220-1-any                        432.6 KiB   968K/s 00:00 [###############################################] 100%
 curl-7.35.0-1-x86_64                                    471.5 KiB  2.19M/s 00:00 [###############################################] 100%
..............

Scott

Offline

#6 2014-02-27 23:46:33

hydrosIII
Member
Registered: 2013-04-04
Posts: 127

Re: Arch linux lxc in debian host.

i looked at the docker project a while ago when i decided to go for lxc, i surfed their webpage, but i didn't understand what docker do and what docker is. I guess is some kind of wrapper script sorrounding lxc. Searching for documentation i even get more confused. I don't like to deploy thing that i don't understand and docker seems pretty complicated. So maybe you can explian firecat53 ??
I was also seeing projects like juju and lxc-webpanel both working for ubuntu. Lxc-webpanel was the only one that i did understand but it is not working in debian. I won't migrate to ubuntu, but the though of working lxc makes me think about it.
That is the problem with linux too many good alternatives XD, but now im fine using debian + openvz, recently installed the proxmox ui.
The thing is that i have to make the server usable to other people, who have never seen a commandline.
Maybe i will set up an ubuntu virtual machine and try docker, also you can make it work in debian jessie, i really don't understand what it is, but i can start to learn, in the meantime im going to seek for a solution for arch into openvz and if not move to KVM that comes shipped with proxmox, or just surrender and just use arch as my main desktop ( which currently is).

Thanks

Offline

#7 2014-02-28 00:00:23

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: Arch linux lxc in debian host.

Docker is basically just a wrapper around LXC to remove some of the configuration headaches. It allows you to build and store reproducible containers either via the Dockerfile, where the image is built from scratch or via the public or private image registry, where you can use pre-built images for your own containers. It really helps to think of containers as running a _single_ application instead of using them as a virtual machine replacement running multiple applications. You can definitely do that, but in my opinion by doing that  you lose a lot of the benefits and flexibility of containers. Another key point that kept tripping me up at first is to remember to run an application in the foreground and _not_ daemonize it! For example, if you want to run sshd inside the container, you would have to specifically set the flag to run it in the foreground. Dockerfile example:

CMD ["/usr/sbin/sshd -D"]

I haven't messed with trying to run systemd inside a container, as my needs are pretty basic: python webapp, sabnzbd, plex, etc. Each of these has it's own container. Networking can be a challenge sometimes if you have more complex needs.

It is a learning curve, that's for sure! Docker works great on Arch and is in [community].

Good luck!
Scott

Offline

#8 2014-02-28 08:57:03

hydrosIII
Member
Registered: 2013-04-04
Posts: 127

Re: Arch linux lxc in debian host.

Actually my goal at setting up lxc where just to isolate applications, i didnt even had a network. But then as i said i needed other people to be able to backup the machines and to do other simple task without using the commandline. that was the thing that decided me to use proxmox a "finished" solution. Mostly because of the UI, though i think that lxc in simpler.

Just a question, how do you run arch without systemd?? i mean how do you boot the lxc machine?, or it is like using a chroot, so no boot process???

I will try docker in my arch desktop and play with it for a little time, (im installing it right now). OOhh, seems pretty straight forward, (just installed ubuntu lxc) i guess is just the webpage that is overwhelming and with a lot of information.
As to my needs with server as are basic as yours. But they run in production for a small company (really small). So it needs to be stable, that is why im using debian as the main distro, i would not use arch, but i'd love to try arch for fun and testing.

Do you know if there some kind of Webui for docker???

Edit, asnwering my own question, there is a web ui.

https://github.com/crosbymichael/dockerui

Thanks

Last edited by hydrosIII (2014-02-28 09:01:57)

Offline

Board footer

Powered by FluxBB