当前位置: 首页 > 知识库问答 >
问题:

无法登录到lxc容器

徐洋
2023-03-14

我在fedora-20中创建了一个lxc容器,其中包含默认配置文件和默认fedora模板。

lxc-create -n root -t fedora

当我尝试启动容器时,我遇到了用户名和密码提示。

在ubuntu中,他们似乎使用默认的“ubuntu”作为用户名和密码。我尝试了不同的密码组合,如模板中指定的“root”,但无法登录。

这是输出:

[root@localhost ~]# lxc-start -n root
systemd 208 running in system mode. (+PAM +LIBWRAP +AUDIT +SELINUX +IMA +SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ)
Detected virtualization 'lxc'.

Welcome to Fedora 20 (Heisenbug)!

Set hostname to <root.localdomain>.
[  OK  ] Reached target Remote File Systems.
[  OK  ] Created slice Root Slice.
[  OK  ] Created slice User and Session Slice.
[  OK  ] Created slice System Slice.
[  OK  ] Reached target Slices.
[  OK  ] Created slice system-getty.slice.
[  OK  ] Listening on /dev/initctl Compatibility Named Pipe.
[  OK  ] Listening on Delayed Shutdown Socket.
Failed to open /dev/autofs: No such file or directory
Failed to initialize automounter: No such file or directory
[FAILED] Failed to set up automount Arbitrary Executable File...utomount Point.
See 'systemctl status proc-sys-fs-binfmt_misc.automount' for details.
Unit proc-sys-fs-binfmt_misc.automount entered failed state.
[  OK  ] Listening on udev Kernel Socket.
[  OK  ] Listening on udev Control Socket.
[  OK  ] Reached target Encrypted Volumes.
[  OK  ] Listening on Journal Socket.
         Starting Apply Kernel Variables...
         Mounting Debug File System...
         Starting udev Coldplug all Devices...
         Mounting Huge Pages File System...
         Mounting POSIX Message Queue File System...
         Mounting FUSE Control File System...
         Starting Create static device nodes in /dev...
         Mounting Configuration File System...
         Starting Journal Service...
[  OK  ] Started Journal Service.
[  OK  ] Reached target Paths.
[  OK  ] Reached target Swap.
         Starting Remount Root and Kernel File Systems...
         Mounting Temporary Directory...
[  OK  ] Started Apply Kernel Variables.
[  OK  ] Mounted Debug File System.
[  OK  ] Mounted Huge Pages File System.
[  OK  ] Mounted POSIX Message Queue File System.
[  OK  ] Mounted FUSE Control File System.
[  OK  ] Started Create static device nodes in /dev.
[  OK  ] Mounted Configuration File System.
[  OK  ] Started Remount Root and Kernel File Systems.
[  OK  ] Mounted Temporary Directory.
         Starting Load/Save Random Seed...
         Starting Configure read-only root support...
         Starting udev Kernel Device Manager...
[  OK  ] Reached target Local File Systems (Pre).
<30>systemd-udevd[24]: starting version 208
[  OK  ] Started Load/Save Random Seed.
[  OK  ] Started udev Kernel Device Manager.
[  OK  ] Started Configure read-only root support.
[  OK  ] Reached target Local File Systems.
         Starting Trigger Flushing of Journal to Persistent Storage...
         Starting Create Volatile Files and Directories...
[  OK  ] Started udev Coldplug all Devices.
[  OK  ] Started Create Volatile Files and Directories.
         Starting Update UTMP about System Reboot/Shutdown...
<46>systemd-journald[18]: Received request to flush runtime journal from PID 1
[  OK  ] Started Trigger Flushing of Journal to Persistent Storage.
[  OK  ] Started Update UTMP about System Reboot/Shutdown.
[  OK  ] Reached target System Initialization.
[  OK  ] Reached target Timers.
[  OK  ] Listening on D-Bus System Message Bus Socket.
[  OK  ] Reached target Sockets.
[  OK  ] Reached target Basic System.
         Starting System Logging Service...
         Starting Permit User Sessions...
         Starting Login Service...
         Starting D-Bus System Message Bus...
[  OK  ] Started D-Bus System Message Bus.
[  OK  ] Started Permit User Sessions.
         Starting Getty on tty3...
[  OK  ] Started Getty on tty3.
         Starting Getty on tty4...
[  OK  ] Started Getty on tty4.
         Starting Getty on tty2...
[  OK  ] Started Getty on tty2.
         Starting Getty on tty1...
[  OK  ] Started Getty on tty1.
         Starting Console Getty...
[  OK  ] Started Console Getty.
[  OK  ] Reached target Login Prompts.
         Starting Cleanup of Temporary Directories...
[  OK  ] Started System Logging Service.
[  OK  ] Started Cleanup of Temporary Directories.
[  OK  ] Reached target Sound Card.
[  OK  ] Started Login Service.
[  OK  ] Reached target Multi-User System.

Fedora release 20 (Heisenbug)
Kernel 3.11.10-301.fc20.x86_64 on an x86_64 (console)

root login: root
Password: 
Last failed login: Thu Jun  5 08:37:20 UTC 2014 on console
There were 3 failed login attempts since the last successful login.

Cannot make/remove an entry for the specified session

Fedora release 20 (Heisenbug)
Kernel 3.11.10-301.fc20.x86_64 on an x86_64 (console)

root login: 

共有2个答案

景哲
2023-03-14

对我来说lxc-附加-n root工作。它深入系统,您可以从那里设置root密码。

曹原
2023-03-14

试试 /var/lib/lxc/$container_name/

应该有一个名为tmp\u root\u pass的文件,它将在您首次成功登录时过期。

ls/var/lib/lxc/ovs/config rootfs tmp\u root\u pass

 类似资料:
  • 我通过C API使用LXC,并简单地复制和粘贴了示例代码(如链接所示,但用我自己的函数名替换了)。然后从程序中的另一个代码块中调用它,我无法使容器正常启动。 调用只会返回false。如果我将第二个参数更改为start为0(意味着应该使用而不是/sbin/init),则start“成功”,但容器状态立即设置为,因此我无法连接到容器。 正在尝试通过设置获取日志: 只生成空文件。 想到这可能与我看到的另

  • 我可以更改初始化和保存lxc容器的目录吗?现在它们是在/var/cache/lxc下创建的,我希望它们位于另一个目录中,在另一个分区中,我有更多的空间。Changint分区的安装点不是一个选项,因为它已经用于其他用途。

  • 我正在尝试使用PHPMyAdmin登录MySQL服务器,但它不起作用, 我插入了true和,但它仍然不起作用,我不知道原因是什么 错误: mysql_real_connect():(HY000/1045):配置中定义的控制用户“root”@“localhost”(使用密码“是”)连接的访问被拒绝失败 无法进入PHPMyAdmin

  • 我尝试使用这个简单的代码登录,但在我点击登录按钮后,else选项“无效用户名或密码!”总是出现,即使用户名和密码是匹配的 控制器:

  • 问题内容: 我通过Homebrew安装了MySQL和PhpMyAdmin。 当我尝试使用root及其密码登录时,出现以下错误: 我可以使用以下命令通过终端登录MySQL: PhpMyAdmin配置: 我正在 apache 上运行它。我在stackoverflow上尝试了所有解决方案,但它们似乎不起作用。谁能帮我? 问题答案: 您可以同时使用或作为主机声明。 您可以尝试使用它,它将起作用。

  • 每当我试图打开 致命错误:未捕获错误:调用C:\xampp\htdocs\wordpress\wp includes\wp db中未定义的函数mysql\u connect()。php:1668堆栈跟踪:#0 C:\xampp\htdocs\wordpress\wp includes\wp db。php(632):wpdb- 致命错误:未捕获错误:调用C:\xampp\htdocs\wordpre