Can't SSH / SCP on Qemu based powerpc VM

I want to transfer a file to a QEMU based PowerPC VM (Freescale MPC8544DS emulation). I used buildroot to build kernel and rootfs. I am calling VM like this:

qemu-system-ppc -nographic -M mpc8544ds -m 512 -kernel ~/CrossCompilation/zImage -hda ~/CrossCompilation/rootfs.cpio -append "root=/dev/sda rw" -redir tcp:2222::22

However, I was unable to transfer the file and it was throwing the following logs and errors:

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

      

I assumed that since my virtual machine does not have a physical adapter, the network connection would not be possible. So I call QEMU like this:

/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

Without sound. Infact does this without even adding any new physical ethernet adapter (as I thought). The only live adapter, as before, is the loopback adapter.

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)

      

Earlier I was under the impression that perhaps this is happening since there is no ssh deamon running on the VM, so I added Dropbear

to the list of target packages and starts when the VM boots (it shows up as part of the startup log). However, it fails with the same error. So obviously it doesn't seem like the culprit.

I'm not sure if this has to do with the networking setup in my VM or maybe something needs to be added to the rootfs (busybox).

Waiting to hear.

+3


source to share


2 answers


If you don't have a network adapter, your best bet is to map a shared drive. This page has information on creating and modifying disks using the ARM1176JZF-S system:



http://xecdesign.com/working-with-qemu/

+1


source


Tested on Buildroot 2016.05, QEMU 2.5.0 x86_64, host Ubuntu 16.04

I'm not into ppc, but that should work too. Let me know if not.

Start with qemu_x86_64_defconfig

and include the openssh package.

Start QEMU with

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

      

Then the guest:

vi /etc/ssh/sshd_config

      

Change the following settings:

PermitRootLogin yes
PermitEmptyPassword yes

      



And restart the server:

/etc/init.d/50sshd restart

      

It's because this file exists that sshd starts by default.

Then from the node:

ssh root@localhost -p 2222

      

In case of failure, also check the server logs on the guest page:

less /var/log/messages

      

Then on the final system, you should automate the creation of this log file with BR2_ROOTFS_OVERLAY

either BR2_ROOTFS_POST_BUILD_SCRIPT

: https://buildroot.org/downloads/manual/manual.html#rootfs-custom

0


source







All Articles