天天看點

LXC 安裝 centos7 root 密碼錯誤

1 lxc 安裝 centos7

[[email protected] opt]# lxc-create -t centos -n contos  

Host CPE ID from /etc/os-release: cpe:/o:centos:centos:7

Checking cache download in /var/cache/lxc/centos/x86_64/7/rootfs ...

Cache found. Updating...

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

 * base: mirror.bit.edu.cn

 * extras: mirror.bit.edu.cn

 * updates: mirror.bit.edu.cn

No packages marked for update

Loaded plugins: fastestmirror

Cleaning repos: base extras updates

0 package files removed

Update finished

Copy /var/cache/lxc/centos/x86_64/7/rootfs to /var/lib/lxc/myhost1/rootfs ...

Copying rootfs to /var/lib/lxc/myhost1/rootfs ...

sed: can't read /var/lib/lxc/myhost1/rootfs/etc/init/tty.conf: No such file or directory

Storing root password in '/var/lib/lxc/myhost1/tmp_root_pass'

chpasswd: cannot open /etc/passwd

Expiring password for user root.

passwd: Libuser error at line: 425 - Error replacing `/etc/passwd': Permission denied.

passwd: Error

sed: can't read /var/lib/lxc/myhost1/rootfs/etc/rc.sysinit: No such file or directory

sed: can't read /var/lib/lxc/myhost1/rootfs/etc/rc.d/rc.sysinit: No such file or directory

Container rootfs and config have been created.

Edit the config file to check/enable networking setup.

The temporary root password is stored in:

        '/var/lib/lxc/myhost1/tmp_root_pass'

The root password is set up as expired and will require it to be changed

at first login, which you should do as soon as possible.  If you lose the

root password or wish to change it without starting the container, you

can change it from the host by running the following command (which will

also reset the expired flag):

        chroot /var/lib/lxc/myhost1/rootfs passwd

2 關閉 selinux

   root 使用者下

[[email protected] lxc]# setenforce 0

3再次安裝

[[email protected] lxc]# lxc-create -t centos -n centos

Host CPE ID from /etc/os-release: cpe:/o:centos:centos:7

Checking cache download in /var/cache/lxc/centos/x86_64/7/rootfs ...

Cache found. Updating...

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

 * base: mirror.bit.edu.cn

 * extras: mirror.bit.edu.cn

 * updates: mirror.bit.edu.cn

No packages marked for update

Loaded plugins: fastestmirror

Cleaning repos: base extras updates

0 package files removed

Update finished

Copy /var/cache/lxc/centos/x86_64/7/rootfs to /var/lib/lxc/centos/rootfs ...

Copying rootfs to /var/lib/lxc/centos/rootfs ...

sed: can't read /var/lib/lxc/centos/rootfs/etc/init/tty.conf: No such file or directory

Storing root password in '/var/lib/lxc/centos/tmp_root_pass'

Expiring password for user root.

passwd: Success

sed: can't read /var/lib/lxc/centos/rootfs/etc/rc.sysinit: No such file or directory

sed: can't read /var/lib/lxc/centos/rootfs/etc/rc.d/rc.sysinit: No such file or directory

Container rootfs and config have been created.

Edit the config file to check/enable networking setup.

The temporary root password is stored in:

        '/var/lib/lxc/centos/tmp_root_pass'

The root password is set up as expired and will require it to be changed

at first login, which you should do as soon as possible.  If you lose the

root password or wish to change it without starting the container, you

can change it from the host by running the following command (which will

also reset the expired flag):

        chroot /var/lib/lxc/centos/rootfs passwd

繼續閱讀