* ssh session with qemu-arm using busybox
@ 2019-03-11 14:34 Pintu Agarwal
2019-03-11 18:28 ` Nick Kossifidis
2019-03-11 19:33 ` BALATON Zoltan
0 siblings, 2 replies; 7+ messages in thread
From: Pintu Agarwal @ 2019-03-11 14:34 UTC (permalink / raw)
To: open list, kernelnewbies, linux-arm-kernel, linux-riscv,
qemu-devel, 전진영
Hi,
I have a qemu-arm setup with busybox which I normally use to test my
kernel changes.
I use this command to boot it:
QEMU-ARM$
qemu-system-arm -M vexpress-a9 -m 1024M -kernel
../KERNEL/linux/arch/arm/boot/zImage -dtb
../KERNEL/linux/arch/arm/boot/dts/vexpress-v2p-ca9.dtb -initrd
rootfs.img.gz -append "console=ttyAMA0 root=/dev/ram rdinit=/sbin/init
ip=dhcp" -nographic -smp 4
This includes, my own custom kernel and rootfs build.
For rootfs I use busybox and create cpio image and use it as initrd.
But, every time, if I have to copy some files inside qemu, I need to
create create roofs image.
This is painful.
So, now I am exploring how to transfer files from my ubuntu pc to
qemu-session using "ssh".
I know this is possible, but I am still not successful, and bit lazy
to explore these.
I am sure, many of you people would have explored already "how to use
ssh over qemu" and found a easy method.
So, if anybody have easy setup please share with me.
I could see that after adding "ip=dhcp" I get the eth0 interface like this:
/ # ifconfig
eth0 Link encap:Ethernet HWaddr 52:54:00:12:34:56
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2 errors:0 dropped:0 overruns:0 frame:0
TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1180 (1.1 KiB) TX bytes:1180 (1.1 KiB)
Interrupt:22
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 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:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
But I could not ping it from ubuntu PC.
Regards,
Pintu
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: ssh session with qemu-arm using busybox
2019-03-11 14:34 ssh session with qemu-arm using busybox Pintu Agarwal
@ 2019-03-11 18:28 ` Nick Kossifidis
2019-03-12 14:02 ` Pintu Agarwal
2019-03-11 19:33 ` BALATON Zoltan
1 sibling, 1 reply; 7+ messages in thread
From: Nick Kossifidis @ 2019-03-11 18:28 UTC (permalink / raw)
To: Pintu Agarwal
Cc: kernelnewbies, qemu-devel, open list, 전진영,
linux-riscv, linux-arm-kernel
Στις 2019-03-11 16:34, Pintu Agarwal έγραψε:
> Hi,
>
> I have a qemu-arm setup with busybox which I normally use to test my
> kernel changes.
> I use this command to boot it:
>
> QEMU-ARM$
> qemu-system-arm -M vexpress-a9 -m 1024M -kernel
> ../KERNEL/linux/arch/arm/boot/zImage -dtb
> ../KERNEL/linux/arch/arm/boot/dts/vexpress-v2p-ca9.dtb -initrd
> rootfs.img.gz -append "console=ttyAMA0 root=/dev/ram rdinit=/sbin/init
> ip=dhcp" -nographic -smp 4
>
> This includes, my own custom kernel and rootfs build.
> For rootfs I use busybox and create cpio image and use it as initrd.
>
> But, every time, if I have to copy some files inside qemu, I need to
> create create roofs image.
> This is painful.
>
> So, now I am exploring how to transfer files from my ubuntu pc to
> qemu-session using "ssh".
> I know this is possible, but I am still not successful, and bit lazy
> to explore these.
>
> I am sure, many of you people would have explored already "how to use
> ssh over qemu" and found a easy method.
> So, if anybody have easy setup please share with me.
>
> I could see that after adding "ip=dhcp" I get the eth0 interface like
> this:
> / # ifconfig
> eth0 Link encap:Ethernet HWaddr 52:54:00:12:34:56
> inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
> UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
> RX packets:2 errors:0 dropped:0 overruns:0 frame:0
> TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:1000
> RX bytes:1180 (1.1 KiB) TX bytes:1180 (1.1 KiB)
> Interrupt:22
>
> lo Link encap:Local Loopback
> inet addr:127.0.0.1 Mask:255.0.0.0
> UP LOOPBACK RUNNING MTU:65536 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:1000
> RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
>
> But I could not ping it from ubuntu PC.
>
>
> Regards,
> Pintu
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
You may use the hostfw argument on qemu, e.g...
-netdev user,id=unet,hostfwd=tcp::2222-:22 \
-net user \
and you 'll get guest's port 22 to be forwarded to hosts port 2222, so
you can do
ssh root@localhost:2222
from the host.
Regards,
Nick
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: ssh session with qemu-arm using busybox
2019-03-11 18:28 ` Nick Kossifidis
@ 2019-03-12 14:02 ` Pintu Agarwal
2019-03-12 14:11 ` Suzuki K Poulose
0 siblings, 1 reply; 7+ messages in thread
From: Pintu Agarwal @ 2019-03-12 14:02 UTC (permalink / raw)
To: Nick Kossifidis
Cc: qemu-devel, linux-riscv, open list, linux-arm-kernel, kernelnewbies
>
> -netdev user,id=unet,hostfwd=tcp::2222-:22 \
> -net user \
>
> and you 'll get guest's port 22 to be forwarded to hosts port 2222, so
> you can do
>
> ssh root@localhost:2222
>
> from the host.
>
I tried many different options, but unfortunately none worked for me.
1)
qemu-system-arm -M vexpress-a9 -m 1024M -kernel
../KERNEL/linux/arch/arm/boot/zImage -dtb
../KERNEL/linux/arch/arm/boot/dts/vexpress-v2p-ca9.dtb -initrd
rootfs.img.gz -append "console=ttyAMA0 root=/dev/ram rdinit=/sbin/init
ip=dhcp" -nographic -smp 4 -netdev user,id=unet,hostfwd=tcp::2222-:22
-net user
With this the eth0 interface is removed, and I see this message
(although login works):
qemu-system-arm: warning: hub 0 with no nics
qemu-system-arm: warning: netdev unet has no peer
Booting Linux on physical CPU 0x0
<skip>
NET: Registered protocol family 17
<skip>
Run /sbin/init as init process
ifconfig: SIOCSIFADDR: No such device
route: SIOCADDRT: Network is unreachable
But, ssh is still not working.
ssh root@localhost:2222
ssh: Could not resolve hostname localhost:2222: Name or service not known
2) if I give "-net nic" I get eth0 interface but still ssh does not work.
qemu-system-arm: warning: netdev unet has no peer
Booting Linux on physical CPU 0x0
3) With this there is no error, but still ssh not working
qemu-system-arm -M vexpress-a9 -m 1024M -kernel
../KERNEL/linux/arch/arm/boot/zImage -dtb
../KERNEL/linux/arch/arm/boot/dts/vexpress-v2p-ca9.dtb -initrd
rootfs.img.gz -append "console=ttyAMA0 root=/dev/ram
rdinit=/sbin/init" -nographic -netdev
user,id=net0,hostfwd=tcp::2222-:22 -device
virtio-net-device,netdev=net0 -net user -net nic
ssh root@localhost:2222
ssh: Could not resolve hostname localhost:2222: Name or service not known
4) I also followed the steps mentioned in the below document, but its
same result:
https://wiki.qemu.org/Documentation/Networking
-------------
So, I have some doubts:
- Do, I need anything to be configured on host PC as well ?
I am using Ubuntu 16.04 desktop, and it is connected to only one
office LAN network
- Do I need any network configuration changes on host ?
- Do I need to enable any thing in kernel side ?
- I am using minimal busybox and I see there is no "ssh" command
there. Do I need a different busybox or a dropbear ?
- Will it work easily with buildroot ?
- Is there any precompiled arm32-rootfs image present somewhere, which
which ssh can work by default ?
Because, I really don't care much about user side, so any arm-rootfs
should be fine for me
- I haven't really explored "bridge/tap" network yet. Is that worth to
try in these conditions.
Regards,
Pintu
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: ssh session with qemu-arm using busybox
2019-03-12 14:02 ` Pintu Agarwal
@ 2019-03-12 14:11 ` Suzuki K Poulose
2019-03-12 17:08 ` Pintu Agarwal
0 siblings, 1 reply; 7+ messages in thread
From: Suzuki K Poulose @ 2019-03-12 14:11 UTC (permalink / raw)
To: pintu.ping, mick
Cc: qemu-devel, linux-riscv, linux-kernel, linux-arm-kernel, kernelnewbies
On 12/03/2019 14:02, Pintu Agarwal wrote:
>>
>> -netdev user,id=unet,hostfwd=tcp::2222-:22 \
>> -net user \
>>
>> and you 'll get guest's port 22 to be forwarded to hosts port 2222, so
>> you can do
>>
>> ssh root@localhost:2222
>>
>> from the host.
>>
>
> I tried many different options, but unfortunately none worked for me.
> 1)
> qemu-system-arm -M vexpress-a9 -m 1024M -kernel
> ../KERNEL/linux/arch/arm/boot/zImage -dtb
> ../KERNEL/linux/arch/arm/boot/dts/vexpress-v2p-ca9.dtb -initrd
> rootfs.img.gz -append "console=ttyAMA0 root=/dev/ram rdinit=/sbin/init
> ip=dhcp" -nographic -smp 4 -netdev user,id=unet,hostfwd=tcp::2222-:22
> -net user
>
> With this the eth0 interface is removed, and I see this message
> (although login works):
> qemu-system-arm: warning: hub 0 with no nics
> qemu-system-arm: warning: netdev unet has no peer
> Booting Linux on physical CPU 0x0
> <skip>
> NET: Registered protocol family 17
> <skip>
> Run /sbin/init as init process
> ifconfig: SIOCSIFADDR: No such device
> route: SIOCADDRT: Network is unreachable
>
> But, ssh is still not working.
> ssh root@localhost:2222
> ssh: Could not resolve hostname localhost:2222: Name or service not known
man ssh
+
Make sure you have sshd in your custom rootfs and has been stared.
Cheers
Suzuki
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: ssh session with qemu-arm using busybox
2019-03-12 14:11 ` Suzuki K Poulose
@ 2019-03-12 17:08 ` Pintu Agarwal
2019-03-12 23:12 ` [Qemu-devel] " Dongli Zhang
0 siblings, 1 reply; 7+ messages in thread
From: Pintu Agarwal @ 2019-03-12 17:08 UTC (permalink / raw)
To: Suzuki K Poulose
Cc: kernelnewbies, qemu-devel, open list, Nick Kossifidis,
linux-riscv, linux-arm-kernel
On Tue, Mar 12, 2019 at 7:41 PM Suzuki K Poulose <suzuki.poulose@arm.com> wrote:
>
>
>
> On 12/03/2019 14:02, Pintu Agarwal wrote:
> >>
> >> -netdev user,id=unet,hostfwd=tcp::2222-:22 \
> >> -net user \
> >>
> >> and you 'll get guest's port 22 to be forwarded to hosts port 2222, so
> >> you can do
> >>
> >> ssh root@localhost:2222
> >>
> >> from the host.
> >>
> >
> > I tried many different options, but unfortunately none worked for me.
> > 1)
> > qemu-system-arm -M vexpress-a9 -m 1024M -kernel
> > ../KERNEL/linux/arch/arm/boot/zImage -dtb
> > ../KERNEL/linux/arch/arm/boot/dts/vexpress-v2p-ca9.dtb -initrd
> > rootfs.img.gz -append "console=ttyAMA0 root=/dev/ram rdinit=/sbin/init
> > ip=dhcp" -nographic -smp 4 -netdev user,id=unet,hostfwd=tcp::2222-:22
> > -net user
> >
> > With this the eth0 interface is removed, and I see this message
> > (although login works):
> > qemu-system-arm: warning: hub 0 with no nics
> > qemu-system-arm: warning: netdev unet has no peer
> > Booting Linux on physical CPU 0x0
> > <skip>
> > NET: Registered protocol family 17
> > <skip>
> > Run /sbin/init as init process
> > ifconfig: SIOCSIFADDR: No such device
> > route: SIOCADDRT: Network is unreachable
> >
> > But, ssh is still not working.
> > ssh root@localhost:2222
> > ssh: Could not resolve hostname localhost:2222: Name or service not known
>
> man ssh
>
> +
>
> Make sure you have sshd in your custom rootfs and has been stared.
>
My busybox is a very minimal rootfs. It hardly contains any commands.
Is there any precompiled busybox for arm (cpio image), available (with
ssh, scp and networking in-built), which I can use directly to boot ?
what else I am missing to make ssh/scp working on qemu ?
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] ssh session with qemu-arm using busybox
2019-03-12 17:08 ` Pintu Agarwal
@ 2019-03-12 23:12 ` Dongli Zhang
0 siblings, 0 replies; 7+ messages in thread
From: Dongli Zhang @ 2019-03-12 23:12 UTC (permalink / raw)
To: Pintu Agarwal
Cc: kernelnewbies, Suzuki K Poulose, open list, qemu-devel,
Nick Kossifidis, linux-riscv, linux-arm-kernel
On 3/13/19 1:08 AM, Pintu Agarwal wrote:
> On Tue, Mar 12, 2019 at 7:41 PM Suzuki K Poulose <suzuki.poulose@arm.com> wrote:
>>
>>
>>
>> On 12/03/2019 14:02, Pintu Agarwal wrote:
>>>>
>>>> -netdev user,id=unet,hostfwd=tcp::2222-:22 \
>>>> -net user \
>>>>
>>>> and you 'll get guest's port 22 to be forwarded to hosts port 2222, so
>>>> you can do
>>>>
>>>> ssh root@localhost:2222
>>>>
>>>> from the host.
>>>>
>>>
>>> I tried many different options, but unfortunately none worked for me.
>>> 1)
>>> qemu-system-arm -M vexpress-a9 -m 1024M -kernel
>>> ../KERNEL/linux/arch/arm/boot/zImage -dtb
>>> ../KERNEL/linux/arch/arm/boot/dts/vexpress-v2p-ca9.dtb -initrd
>>> rootfs.img.gz -append "console=ttyAMA0 root=/dev/ram rdinit=/sbin/init
>>> ip=dhcp" -nographic -smp 4 -netdev user,id=unet,hostfwd=tcp::2222-:22
>>> -net user
>>>
>>> With this the eth0 interface is removed, and I see this message
>>> (although login works):
>>> qemu-system-arm: warning: hub 0 with no nics
>>> qemu-system-arm: warning: netdev unet has no peer
>>> Booting Linux on physical CPU 0x0
>>> <skip>
>>> NET: Registered protocol family 17
>>> <skip>
>>> Run /sbin/init as init process
>>> ifconfig: SIOCSIFADDR: No such device
>>> route: SIOCADDRT: Network is unreachable
>>>
>>> But, ssh is still not working.
>>> ssh root@localhost:2222
>>> ssh: Could not resolve hostname localhost:2222: Name or service not known
>>
>> man ssh
>>
>> +
>>
>> Make sure you have sshd in your custom rootfs and has been stared.
>>
>
> My busybox is a very minimal rootfs. It hardly contains any commands.
> Is there any precompiled busybox for arm (cpio image), available (with
> ssh, scp and networking in-built), which I can use directly to boot ?
>
> what else I am missing to make ssh/scp working on qemu ?
>
When I was working on arm binary rewriting/instrumentation in the university, I
use the image created by Linaro.
http://releases.linaro.org/
One example would be
https://www.linaro.org/blog/linaro-16-04-release-available-for-download-2/
or
https://releases.linaro.org/archive/ubuntu/images/developer-arm64/15.12/linaro-vivid-developer-20151215-114.tar.gz
The license should be good for academia. I do not know if there is any
restrictions on commercial/industry usage.
Thank for Linaro again for providing those images which helped me a lot when I
was in the university!
Dongli Zhang
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] ssh session with qemu-arm using busybox
2019-03-11 14:34 ssh session with qemu-arm using busybox Pintu Agarwal
2019-03-11 18:28 ` Nick Kossifidis
@ 2019-03-11 19:33 ` BALATON Zoltan
1 sibling, 0 replies; 7+ messages in thread
From: BALATON Zoltan @ 2019-03-11 19:33 UTC (permalink / raw)
To: Pintu Agarwal
Cc: kernelnewbies, qemu-devel, open list, 전진영,
linux-riscv, linux-arm-kernel
On Mon, 11 Mar 2019, Pintu Agarwal wrote:
> I am sure, many of you people would have explored already "how to use
> ssh over qemu" and found a easy method.
> So, if anybody have easy setup please share with me.
>
> I could see that after adding "ip=dhcp" I get the eth0 interface like this:
> / # ifconfig
> eth0 Link encap:Ethernet HWaddr 52:54:00:12:34:56
> inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
> UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
> RX packets:2 errors:0 dropped:0 overruns:0 frame:0
> TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:1000
> RX bytes:1180 (1.1 KiB) TX bytes:1180 (1.1 KiB)
> Interrupt:22
>
> lo Link encap:Local Loopback
> inet addr:127.0.0.1 Mask:255.0.0.0
> UP LOOPBACK RUNNING MTU:65536 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:1000
> RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
>
> But I could not ping it from ubuntu PC.
This should already be documented here:
https://wiki.qemu.org/Documentation/Networking
The default QEMU network is -net user slirp based networking that provides
outbound connectivity from the virtual machine but no ping or inbound
connections. I.e. you can ssh from your guest to your host (so you could
use scp in your guest to copy files from your host) or use some other
networking (such as tap) that allows the host to connect to guest (but
then you'll need to arrange routing and dhcp if you want that on your
host otherwise your guest will only see your host). Hope this helps.
Regards,
BALATON Zoltan
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-03-13 20:40 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-11 14:34 ssh session with qemu-arm using busybox Pintu Agarwal
2019-03-11 18:28 ` Nick Kossifidis
2019-03-12 14:02 ` Pintu Agarwal
2019-03-12 14:11 ` Suzuki K Poulose
2019-03-12 17:08 ` Pintu Agarwal
2019-03-12 23:12 ` [Qemu-devel] " Dongli Zhang
2019-03-11 19:33 ` BALATON Zoltan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).