Zugriff auf LXC-Root-Benutzer

509
user371793

Ich bin neu in Containern und versuche sie herauszufinden.

Ich kann nicht herausfinden, wie ich mich als Root-Benutzer des Containers anmelden kann. Ich kann nicht das temporäre Passwort akzeptieren oder das Passwort ändern.

(Ja, ich bin zuversichtlich, dass ich das Passwort richtig eingegeben habe, obwohl es in der folgenden Ausgabe nur einmal angezeigt wird. Ich habe das temporäre Passwort in mich selbst eingegeben, hatte ein anderes Passwort eingegeben und das temporäre Passwort kopiert und eingefügt.) alle oben genannten wiederholt, ich lösche die anderen Versuche aus Gründen der Prägnanz.)

Kann mir jemand weiterhelfen?

Ich bin misstrauisch bezüglich eines Berechtigungsproblems, habe aber noch nicht herausgefunden, was die Berechtigungen sein sollen ...

sed: can't read /var/lib/lxc/centostest/rootfs/etc/init/tty.conf: No such file or directory Storing root password in '/var/lib/lxc/centostest/tmp_root_pass' chpasswd: cannot open /etc/passwd Expiring password for user root. passwd: Libuser error at line: 413 - Error replacing `/etc/passwd': Permission denied. passwd: Error 

Hier sind alle Terminalausgaben von der Containererstellung über Root-Zugriffsversuche und Kennwortrücksetzversuche ...

[root@centos01 ~]# lxc-create -n centostest -t 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: linorg.usp.br * extras: linorg.usp.br * updates: linorg.usp.br 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/centostest/rootfs ...  Copying rootfs to /var/lib/lxc/centostest/rootfs ... sed: can't read /var/lib/lxc/centostest/rootfs/etc/init/tty.conf: No such file or directory Storing root password in '/var/lib/lxc/centostest/tmp_root_pass' chpasswd: cannot open /etc/passwd Expiring password for user root. passwd: Libuser error at line: 413 - Error replacing `/etc/passwd': Permission denied. passwd: Error sed: can't read /var/lib/lxc/centostest/rootfs/etc/rc.sysinit: No such file or directory sed: can't read /var/lib/lxc/centostest/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/centostest/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/centostest/rootfs passwd  [root@centos01 ~]# vi /var/lib/lxc/centostest/tmp_root_pass [root@centos01 ~]# lxc-start -n centostest -d [root@centos01 ~]# lxc-console -n centostest -t 0  Connected to tty 0 Type <Ctrl+a q> to exit the console, <Ctrl+a Ctrl+a> to enter Ctrl+a itself  CentOS Linux 7 (Core) Kernel 3.10.0-693.17.1.el7.x86_64 on an x86_64  centostest login: root Password:  Login incorrect  centostest login: [root@centos01 ~]#  [root@centos01 ~]# lxc-stop -n centostest [root@centos01 ~]# chroot /var/lib/lxc/centostest/rootfs passwd Changing password for user root. New password:  Retype new password:  passwd: Authentication token manipulation error [root@centos01 ~]# lxc-start -n centostest -d [root@centos01 ~]# lxc-console -n centostest -t 0  Connected to tty 0 Type <Ctrl+a q> to exit the console, <Ctrl+a Ctrl+a> to enter Ctrl+a itself  CentOS Linux 7 (Core) Kernel 3.10.0-693.17.1.el7.x86_64 on an x86_64  centostest login: root Password:  Login incorrect 

Hardware...


Später...

Schauen Sie sich mit topShows systemd-journalzu 100% um. Wenn ich die LXC-Instanz herunterfahre, geht das weg.

Also ging ich hin journalctl. Das sehe ich, journalctl -fwenn ich die Instanz starte ...

Feb 28 13:11:15 centos01.lan kernel: virbr3: port 2(vethGC75VP) entered blocking state Feb 28 13:11:15 centos01.lan kernel: virbr3: port 2(vethGC75VP) entered disabled state Feb 28 13:11:15 centos01.lan kernel: device vethGC75VP entered promiscuous mode Feb 28 13:11:15 centos01.lan kernel: IPv6: ADDRCONF(NETDEV_UP): vethGC75VP: link is not ready Feb 28 13:11:15 centos01.lan NetworkManager[3741]: <info> [1519841475.4600] manager: (veth5WRBVL): new Veth device (/org/freedesktop/NetworkManager/Devices/31) Feb 28 13:11:15 centos01.lan NetworkManager[3741]: <info> [1519841475.4645] manager: (vethGC75VP): new Veth device (/org/freedesktop/NetworkManager/Devices/32) Feb 28 13:11:15 centos01.lan kernel: IPv6: ADDRCONF(NETDEV_CHANGE): vethGC75VP: link becomes ready Feb 28 13:11:15 centos01.lan kernel: virbr3: port 2(vethGC75VP) entered blocking state Feb 28 13:11:15 centos01.lan kernel: virbr3: port 2(vethGC75VP) entered forwarding state Feb 28 13:11:15 centos01.lan NetworkManager[3741]: <info> [1519841475.4936] device (vethGC75VP): link connected 

Was für mich nicht sinnvoll ist, ist, dass ich die LXC-Instanz sehen kann, die eine IP im LAN zieht.

0

1 Antwort auf die Frage

0
Marco Mazzucco

Ich hatte ein ähnliches Problem. Deaktivieren Sie selinux vorübergehend (setenforce 0) und führen Sie anschließend eine LXC-Zerstörung durch, gefolgt von Erstellen. Der Erstellungsprozess spielt mit Selinux nicht gut.