pai icon indicating copy to clipboard operation
pai copied to clipboard

sed: cannot rename /etc/sedLNnnDc: Device or resource busy

Open leonobrien opened this issue 8 years ago • 4 comments

Hi, i have big issues trying to complete cluster configuration on docker.

Using pai release v0.8.y docker version 17.06.2-ce

I have 5 different docker containers, Dev-Box, Master and three Member nodes.

My quick-start.yaml looks like;

machines:
  - 172.18.0.3
  - 172.18.0.4
  - 172.18.0.5
  - 172.18.0.6

ssh-username: pai
ssh-password: pai-password

ssh-keyfile-path: /root/.ssh/id_rsa
ssh-secret-name: pai-password

Generating configuration works as expected, the Dev box can access all nodes via ssh

python paictl.py config generate -i ./deployment/quick-start/quick-start-example.yaml -o /cluster-configuration -f
/usr/local/lib/python2.7/dist-packages/requests/__init__.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown. warnings.warn(warning, RequestsDependencyWarning)
2018-11-05 10:38:56,366 [INFO] - paramiko.transport : Connected (version 2.0, client OpenSSH_7.2p2) /usr/lib/python2.7/dist-packages/Crypto/Cipher/blockalgo.py:141: FutureWarning: CTR mode needs counter parameter, not IV self._cipher = factory.new(key, *args, **kwargs)
2018-11-05 10:38:56,562 [INFO] - paramiko.transport : Authentication (publickey) successful!
2018-11-05 10:38:56,649 [INFO] - deployment.k8sPaiLibrary.maintainlib.common : Executing the command on host [172.18.0.3]: cat /etc/resolv.conf | grep nameserver | cut -d ' ' -f 2 | head -n 1 127.0.0.11
2018-11-05 10:38:56,664 [INFO] - paramiko.transport : Connected (version 2.0, client OpenSSH_7.2p2)
2018-11-05 10:38:56,860 [INFO] - paramiko.transport : Authentication (publickey) successful!
2018-11-05 10:38:56,947 [INFO] - deployment.k8sPaiLibrary.maintainlib.common : Executing the command on host [172.18.0.3]: hostname 48cff661a0ae
2018-11-05 10:38:56,962 [INFO] - paramiko.transport : Connected (version 2.0, client OpenSSH_7.2p2)
2018-11-05 10:38:57,156 [INFO] - paramiko.transport : Authentication (publickey) successful!
2018-11-05 10:38:57,242 [INFO] - deployment.k8sPaiLibrary.maintainlib.common : Executing the command on host [172.18.0.4]: hostname 9ca63035a91b
2018-11-05 10:38:57,257 [INFO] - paramiko.transport : Connected (version 2.0, client OpenSSH_7.2p2)
2018-11-05 10:38:57,528 [INFO] - paramiko.transport : Authentication (publickey) successful!
2018-11-05 10:38:57,604 [INFO] - deployment.k8sPaiLibrary.maintainlib.common : Executing the command on host [172.18.0.5]: hostname 67807992a189
2018-11-05 10:38:57,641 [INFO] - paramiko.transport : Connected (version 2.0, client OpenSSH_7.2p2)
2018-11-05 10:38:57,884 [INFO] - paramiko.transport : Authentication (publickey) successful!
2018-11-05 10:38:57,958 [INFO] - deployment.k8sPaiLibrary.maintainlib.common : Executing the command on host [172.18.0.6]: hostname f8baef49f2c8

But starting the cluster causes an error;

python paictl.py cluster k8s-bootup -p /cluster-configuration

/usr/local/lib/python2.7/dist-packages/requests/__init__.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
  warnings.warn(warning, RequestsDependencyWarning)
2018-11-05 10:47:36,517 [INFO] - __main__ : Begin to initialize PAI k8s cluster.
2018-11-05 10:47:36,574 [WARNING] - deployment.k8sPaiLibrary.maintainlib.deploy : Begin to deploy a new cluster to your machine or vm.
2018-11-05 10:47:36,575 [INFO] - deployment.k8sPaiLibrary.maintainlib.deploy : Begin to deploy k8s on host 172.18.0.3, the node role is [ master ]
2018-11-05 10:47:36,644 [INFO] - paramiko.transport : Connected (version 2.0, client OpenSSH_7.2p2)
/usr/lib/python2.7/dist-packages/Crypto/Cipher/blockalgo.py:141: FutureWarning: CTR mode needs counter parameter, not IV
  self._cipher = factory.new(key, *args, **kwargs)
2018-11-05 10:47:36,842 [INFO] - paramiko.transport : Authentication (publickey) successful!
2018-11-05 10:47:36,928 [INFO] - deployment.k8sPaiLibrary.maintainlib.common : Executing the command on host [172.18.0.3]: getent passwd pai | cut -d: -f6
/home/pai
2018-11-05 10:47:36,963 [INFO] - paramiko.transport : Connected (version 2.0, client OpenSSH_7.2p2)
2018-11-05 10:47:37,161 [INFO] - paramiko.transport : Authentication (publickey) successful!
pai-password
2018-11-05 10:47:37,277 [INFO] - paramiko.transport : Connected (version 2.0, client OpenSSH_7.2p2)
2018-11-05 10:47:37,446 [INFO] - paramiko.transport : Authentication (password) successful!
2018-11-05 10:47:37,547 [INFO] - paramiko.transport.sftp : [chan 0] Opened sftp connection (server version 3)
2018-11-05 10:47:37,552 [INFO] - paramiko.transport.sftp : [chan 0] sftp session closed.
2018-11-05 10:47:37,564 [INFO] - paramiko.transport : Connected (version 2.0, client OpenSSH_7.2p2)
2018-11-05 10:47:37,760 [INFO] - paramiko.transport : Authentication (publickey) successful!
2018-11-05 10:47:37,847 [INFO] - deployment.k8sPaiLibrary.maintainlib.common : Executing the command on host [172.18.0.3]: tar -xvf master-deployment.tar
master-deployment/docker-daemon.json
master-deployment/docker-ce-install.sh
master-deployment/docker-config-update.py
master-deployment/kubelet.sh
master-deployment/hosts-check.sh
master-deployment/kubelet-start.sh
master-deployment/etc/kubernetes/config
master-deployment/etc/kubernetes/manifests/scheduler.yaml
master-deployment/etc/kubernetes/manifests/controller-manager.yaml
master-deployment/etc/kubernetes/manifests/apiserver.yaml
master-deployment/etc/kubernetes/manifests/etcd.yaml
2018-11-05 10:47:37,880 [INFO] - paramiko.transport : Connected (version 2.0, client OpenSSH_7.2p2)
2018-11-05 10:47:38,075 [INFO] - paramiko.transport : Authentication (publickey) successful!
2018-11-05 10:47:38,169 [INFO] - deployment.k8sPaiLibrary.maintainlib.common : Executing the command on host [172.18.0.3]: sudo ./master-deployment/hosts-check.sh 172.18.0.3
pai-password
sed: cannot rename /etc/sedlXim0b: Device or resource busy
sed: cannot rename /etc/sedPAzZKb: Device or resource busy
sed: cannot rename /etc/sedAC3fMc: Device or resource busy
sed: cannot rename /etc/sedLNnnDc: Device or resource busy

So looking at the script on the cluster master it is trying to replace the localhost address in /etc/hosts file to the hostname of the container.

# set host ip
hostip=$1

# Change 127.0.0.1 line to "127.0.0.1 localhost $hostname"
grep -q "127.0.0.1" /etc/hosts && \
    sed -i "/127.0.0.1/c\127.0.0.1 localhost $(hostname)" /etc/hosts || \
    sed -i "\$a127.0.0.1 localhost $(hostname)" /etc/hosts

# Comment 127.0.1.1 line
sed -i "/127.0.1.1/s/^/# /" /etc/hosts

# Comment hostip line
sed -i "/$hostip/s/^/# /" /etc/hosts

So I have tried many times and search widely to try to sort this help. I am assuming of course that each node of the cluster (Master and Member nodes) can be docker containers too.

Any help would be very appreciated.

leonobrien avatar Nov 05 '18 11:11 leonobrien

Hi, OpenPai based on kubernetes and docker, so I wonder whether what you are doing can work or not. The modify of /etc/hosts is grantee the working of hadoop. I think you can remove those line pasted in your issue.

ydye avatar Nov 07 '18 07:11 ydye

Thanks @ydye I may be tripping up on the install instructions for cluster. Should kubernetes be on physical host that I am running as Dev-Box?

leonobrien avatar Nov 08 '18 11:11 leonobrien

Hi @leonobrien

You'd better not run the dev-box container on the physical machine where you wanna deploy pai. And here is the answer. Following are 2 way to deploy OpenPai. And if you wanna achieve the DinD (Docker in Docker), that means running container in a container. Maybe you should refer to this link first. But we haven't test this scenario before.

Why dev-box shouldn't be on the same physical machine (Or the node runs docker-daemon?) of kubernetes, when deploy kubernetes by OpenPai.

This script is responsible for installing docker-ce and enable log-rotation. So the docker-daemon will be restart. If the dev-box container is running on one of the node The reason to enable log-ration is because that hadoop will ouput a large amount of log which may run out of the disk space.

Two different way.

Single-box

In this mode, you only need to deploy pai on the same machine. Those machine should be labeled with

pai-master = "true"
pai-worker = "true"
k8s-role = master

When deploying pai, please install the following dependency package on your host environment (Not in the container) and then instal OpenPai on the host environment.

    apt-get -y update && \
    apt-get -y install \
      nano \
      vim \
      joe \
      wget \
      curl \
      jq \
      gawk \
      psmisc \
      python \
      python-yaml \
      python-jinja2 \
      python-paramiko \
      python-urllib3 \
      python-tz \
      python-nose \
      python-prettytable \
      python-netifaces \
      python-dev \
      python-pip \
      python-mysqldb \
      openjdk-8-jre \
      openjdk-8-jdk \
      openssh-server \
      openssh-client \
      git \
      bash-completion \
      inotify-tools \
      rsync \
      realpath \
      net-tools && \
    mkdir -p /cluster-configuration &&\
    git clone https://github.com/Microsoft/pai.git &&\
    pip install python-etcd docker kubernetes GitPython

More detailed information, please refer to the link

distributed mode.

In this mode, you should have at least 2 node. And more detailed information, please refer to this Link

ydye avatar Nov 09 '18 09:11 ydye

thanks @ydye you are most helpful. I'm up and running with Kubernetes and progressing.

leonobrien avatar Nov 12 '18 10:11 leonobrien