Category Archives: Virtualization

systemd[34]: Failed at step NAMESPACE spawning /usr/sbin/httpd: Operation not permitted

Process: 64 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=226/NAMESPACE)

If you have problems start centos 7 on docker running ssytemd without privileged containers rights:

sed -i s/PrivateTmp=True/PrivateTmp=False/ /lib/systemd/system/httpd.service
systemctl daemon-reload

and; systemctl start httpd

docker centos 7.1 systemd

cat Dockerfile
FROM docker.io/centos
MAINTAINER vitasis
ENV container docker
RUN yum clean all; yum -y install hostname tar git; yum -y update; yum clean all
# https://bugzilla.redhat.com/show_bug.cgi?id=1118740
RUN yum -y swap -- remove systemd-libs -- install systemd systemd-libs; yum clean all; \
#RUN yum -y install systemd systemd-libs; yum clean all; \
(cd /lib/systemd/system/sysinit.target.wants/ && for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \
rm -f /lib/systemd/system/multi-user.target.wants/*;\
rm -f /etc/systemd/system/*.wants/*;\
rm -f /lib/systemd/system/local-fs.target.wants/*; \
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/basic.target.wants/*;\
rm -f /lib/systemd/system/anaconda.target.wants/*;
VOLUME [ "/sys/fs/cgroup" ]
CMD ["/usr/sbin/init"]

sudo docker build --rm=true -t vitasis/centos7-systemd .
sudo docker run --name test --privileged -ti -v /sys/fs/cgroup:/sys/fs/cgroup:ro vitasis/centos7-systemd
sudo docker ps | grep test
sudo docker exec -i -t 63f43c4ccbba bash

Detected virtualization 'other'.

Welcome to CentOS Linux 7 (Core)!

Set hostname to <79251a373052>.
Cannot add dependency job for unit display-manager.service, ignoring: Unit display-manager.service failed to load: No such file or directory.
[ OK ] Reached target Paths.
[ OK ] Listening on Journal Socket.
[ OK ] Listening on Delayed Shutdown Socket.
[ OK ] Reached target Swap.
[ OK ] Created slice Root Slice.
[ OK ] Created slice System Slice.
[ OK ] Reached target Slices.
[ OK ] Reached target Local File Systems.
Starting Create Volatile Files and Directories...
Starting Journal Service...
[ OK ] Started Journal Service.
[ OK ] Started Create Volatile Files and Directories.
[ OK ] Reached target System Initialization.
[ OK ] Listening on D-Bus System Message Bus Socket.
[ OK ] Reached target Sockets.
[ OK ] Reached target Timers.
[ OK ] Reached target Basic System.
[ OK ] Reached target Multi-User System.
[ OK ] Reached target Graphical Interface.

If you want to deatech form docker session, you need to use a daemon:

sudo docker run --name test --cap-add SYS_ADMIN -d -ti -v /sys/fs/cgroup:/sys/fs/cgroup:ro vitasis/centos7-systemd

privileged or SYS_ADMIN is needed, because of using mount with selinux or apparmor.

decking create docker cluster simple

Decking json example:
vi decking.json
{
"containers": {
"centos7a": "milcom/centos7-systemd",
"centos7b": "milcom/centos7-systemd"
},
"clusters": {
"main": ["centos7a", "centos7b"]
}
}

And lets build:

sudo decking create main

centos7a ...
centos7b ...
centos7a creating...
centos7b ...
centos7a creating... ✔
centos7b ...
centos7a creating... ✔
centos7b creating...
centos7a creating... ✔
centos7b creating... ✔

sudo decking start main

centos7a ...
centos7b ...
centos7a starting...
centos7b ...
centos7a starting... ✔
centos7b ...
centos7a starting... ✔
centos7b starting...
centos7a starting... ✔
centos7b starting... ✔

sudo decking status main

centos7a ...
centos7b ...
centos7a ...
centos7b running 172.17.0.2
centos7a running 172.17.0.1
centos7b running 172.17.0.2

Lets check if its really running:

c4175064768b milcom/centos7-systemd:latest “/usr/sbin/init” 3 minutes ago Up About a minute centos7b
b4b1766eb4d8 milcom/centos7-systemd:latest “/usr/sbin/init” 3 minutes ago Up About a minute centos7a

I guess its better than FIG.
Next step use ansible to manage these VM, its quit fast.