Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法将SSH/SCP连接到基于Qemu的powerpc VM_Ssh_Linux Kernel_Embedded Linux_Qemu_Buildroot - Fatal编程技术网

无法将SSH/SCP连接到基于Qemu的powerpc VM

无法将SSH/SCP连接到基于Qemu的powerpc VM,ssh,linux-kernel,embedded-linux,qemu,buildroot,Ssh,Linux Kernel,Embedded Linux,Qemu,Buildroot,我想将一个文件传输到基于QEMU的PowerPC虚拟机(模拟飞思卡尔的MPC8544DS)。我已经使用buildroot来构建内核和rootfs。我是这样调用VM的: qemu系统ppc-nographic-M mpc8544ds-M 512-kernel~/CrossCompilation/zImage-hda~/CrossCompilation/rootfs.cpio-append“root=/dev/sda rw”-redir-tcp:2222::22 但是,我无法传输该文件,它抛出了以下

我想将一个文件传输到基于QEMU的PowerPC虚拟机(模拟飞思卡尔的MPC8544DS)。我已经使用buildroot来构建内核和rootfs。我是这样调用VM的:

qemu系统ppc-nographic-M mpc8544ds-M 512-kernel~/CrossCompilation/zImage-hda~/CrossCompilation/rootfs.cpio-append“root=/dev/sda rw”-redir-tcp:2222::22

但是,我无法传输该文件,它抛出了以下日志和错误:

Executing: program /usr/bin/ssh host localhost, user root, command scp -v -t ~/.
OpenSSH_6.0p1 Debian-4+deb7u2, OpenSSL 1.0.1e 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to localhost [::1] port 2222.
debug1: connect to address ::1 port 2222: Connection refused
debug1: Connecting to localhost [127.0.0.1] port 2222.
debug1: Connection established.
debug1: identity file ~/.ssh/id_rsa type -1
debug1: identity file ~/.ssh/id_rsa-cert type -1
debug1: identity file ~/.ssh/id_dsa type -1
debug1: identity file ~/.ssh/id_dsa-cert type -1
debug1: identity file ~/.ssh/id_ecdsa type -1
debug1: identity file ~/.ssh/id_ecdsa-cert type -1
ssh_exchange_identification: Connection closed by remote host
lost connection
我推测,因为我的虚拟机似乎没有任何物理网络适配器,所以不可能联网。我这样调用QEMU:

/qemu-system-ppc-nographic-M mpc8544ds-M 512-kernel~/CrossCompilation/zImage-hda~/CrossCompilation/rootfs.cpio-netdev-user,id=network0-device e1000,netdev=network0-append“root=/dev/sda-rw”-redir-tcp:2222::22

我运气不好。事实上,这样做甚至不会添加任何新的物理以太网适配器(正如我所想)。与以前一样,唯一的“活动”适配器是环回适配器

ifconfig
lo    Link encap:Local Loopback
      inet addr:127.0.0.1  Mask:255.0.0.0
      inet6 addr: ::1/128 Scope:Host
      UP LOOPBACK RUNNING  MTU:16436  Metric:1
      RX packets:0 errors:0 dropped:0 overruns:0 frame:0
      TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0
      RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
我之前的印象是,这可能是因为VM上没有运行ssh deamon,因此我将
Dropbear
添加到目标包列表中,并在VM启动时启动(它显示为启动日志的一部分)。然而,它却以同样的错误失败了。所以很明显,这似乎不是罪魁祸首

我不确定这是否与我的虚拟机上的网络设置有关,或者可能需要向rootfs(busybox)添加一些内容


等待收听。

如果您没有网络适配器,最好安装一个共享驱动器。此页面包含有关使用ARM1176JZF-S系统创建和修改磁盘的一些信息:


在Buildroot 2016.05、QEMU 2.5.0 x86_64、Ubuntu 16.04主机上测试

我不喜欢ppc,但这也应该在那里起作用。如果没有,请告诉我

qemu_x86_64_defconfig
开始,并启用openssh包

从以下内容开始QEMU:

qemu-system-x86_64 \
  -M pc \
  -append root=/dev/vda \
  -drive file=output/images/rootfs.ext2,if=virtio,format=raw \
  -enable-kvm \
  -kernel output/images/bzImage \
  -m 512 \
  -net nic,model=virtio \
  -net user,hostfwd=tcp::2222-:22
然后是嘉宾:

vi /etc/ssh/sshd_config
less /var/log/messages
修改以下设置:

PermitRootLogin yes
PermitEmptyPassword yes
然后重新启动服务器:

/etc/init.d/50sshd restart
因为这个文件存在,sshd默认启动

然后从主机:

ssh root@localhost -p 2222
如果出现故障,还应检查guest上的服务器日志:

vi /etc/ssh/sshd_config
less /var/log/messages

然后在最终系统上,您应该使用
BR2\u ROOTFS\u OVERLAY
BR2\u ROOTFS\u POST\u BUILD\u SCRIPT

自动创建日志文件。谢谢链接,尽管它没有提到主机和来宾之间的互联。您需要在主机上创建一个驱动器,添加文件,然后卸载它,然后在VM上挂载它。我创建了新的磁盘映像并挂载了它。然后我将我的模块二进制文件复制到它,然后卸载它。我通过在命令行调用中包含一个
-hdb“name of disk”
向qemu VM添加了额外的磁盘。然而,我看不到它安装在任何地方。我也不能在
/dev
目录中的任何位置看到它。我认为它应该显示为
/dev/hdb
/dev/sdb
。我就在这里吗?可能出了什么问题?网络接口是在您的虚拟机下启动的吗?执行“ifconfig-a”而不是“ifconfig”。默认情况下,只显示eth0,我想您将您的网络接口命名为network0。实际上,我已经这样做了,它显示了很多适配器,但只显示了环回适配器。我尝试通过为eth0添加一个手动条目来处理
接口
文件。但很明显,虚拟机本身似乎没有实际的eth0。事实上,它的名称不同。然而,我不知道它是怎么命名的。也许您可以发布接口列表?您是否尝试过
-netnic-nettap
?这将在主机中创建一个
tapX
,您可以通过
ifconfig
进行配置……哦,太好了,我现在可以看到该界面了。那么,有人会告诉ssh通过这个新的TAP0iFace连接到端口2222吗?如果是的话,怎么办?