ffx not detecting emulator

148 views
Skip to first unread message

fctorial

unread,
Jan 4, 2021, 6:50:09 PM1/4/21
to discuss
I'm unable to list the running emulator with `ffx target list`. I'm also getting an error when running any command other than shell builtins (cd, pwd):

$ ls
/boot/bin/sh: 2: Cannot create child process: -1 (ZX_ERR_INTERNAL): failed to resolve fuchsia-pkg://fuchsia.com/ls#bin/ls: -25

I'm using this build config:

    fx set core.qemu-x64 --ccache --auto-dir

This is the full log:

This error message doesn't appear when running via `fx qemu`.

Shai Barack

unread,
Jan 4, 2021, 6:51:41 PM1/4/21
to fctorial, discuss
Do you have `fx serve` running? This is the process that will serve packages to your emulator that include tools such as ls.

What guide are you following? Maybe we could clarify the instructions. 

--
All posts must follow the Fuchsia Code of Conduct https://fuchsia.dev/fuchsia-src/CODE_OF_CONDUCT or may be removed.
---
You received this message because you are subscribed to the Google Groups "discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss+u...@fuchsia.dev.
To view this discussion on the web visit https://groups.google.com/a/fuchsia.dev/d/msgid/discuss/5f78e5d7-ae95-410c-908c-b674fbb255fbn%40fuchsia.dev.

Brett Wilson

unread,
Jan 4, 2021, 8:21:30 PM1/4/21
to Shai Barack, fctorial, discuss
Hi!

I had a similar problem recently. Check the workaround in https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=66905 (comment 5) to see if it helps.

Brett

fctorial

unread,
Jan 4, 2021, 10:17:50 PM1/4/21
to discuss, Brett Wilson, fctorial, discuss, Shai Barack
@Shai

`fx serve` command gets stuck at 'Discovery...' phase. I was following this guide:


I didn't know it was needed for 'ls' utility.

Do I need to launch the emulator first or the update-server? (Same results in both cases)

@Brett

I'm seeing same results with this option.

`fx shell` and `fx list-devices` commands are also unable to connect to the emulator. 

Shai Barack

unread,
Jan 4, 2021, 10:19:36 PM1/4/21
to fctorial, discuss, Brett Wilson
I usually start `fx serve` before `fx qemu`, not sure if it matters.
I couldn't repro the issue that you or Brett are reporting.
You can get on the bug that Brett linked to and see if you could find help there. 🤞

Geevarghese V K

unread,
Jan 5, 2021, 12:24:22 AM1/5/21
to discuss, Shai Barack, discuss, Brett Wilson, fctorial
@fctorial. Are you getting any error after running just "fx shell" after running Emulator

Sagar Tiwari

unread,
Jan 5, 2021, 2:21:13 AM1/5/21
to Geevarghese V K, discuss, Shai Barack, Brett Wilson
$ fx shell
ERROR: Cannot find a device.
>>>>>> <https://groups.google.com/a/fuchsia.dev/d/msgid/discuss/5f78e5d7-ae95-410c-908c-b674fbb255fbn%40fuchsia.dev?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>> --
>>>>> All posts must follow the Fuchsia Code of Conduct
>>>>> https://fuchsia.dev/fuchsia-src/CODE_OF_CONDUCT or may be removed.
>>>>> ---
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "discuss" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>>
>>>>> an email to discuss+u...@fuchsia.dev.
>>>>>
>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/a/fuchsia.dev/d/msgid/discuss/CAK0PkCHXYs%3D-bUyvGNHyOaehyhMZ%3DqiC3LXxX0CHDBX9dDG-gg%40mail.gmail.com
>>>>>
>>>>> <https://groups.google.com/a/fuchsia.dev/d/msgid/discuss/CAK0PkCHXYs%3D-bUyvGNHyOaehyhMZ%3DqiC3LXxX0CHDBX9dDG-gg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>>

Geevarghese V K

unread,
Jan 5, 2021, 2:30:34 AM1/5/21
to discuss, fctorial, discuss, Shai Barack, Brett Wilson, Geevarghese V K
Can you use -N and retry?  fx set core.qemu-x64 -N --ccache --auto-dir  

fctorial

unread,
Jan 6, 2021, 2:03:52 AM1/6/21
to discuss, jince...@gmail.com, fctorial, discuss, Shai Barack, Brett Wilson
fx uses mdns to detect targets. Avahi daemon must be running on linux hosts for it to work. 

`fx serve` still doesn't work. It fails to register itself to the target as a package source:

    $ amberctl add_src -n devhost -f http://[fe80::e49a:deff:fe74:a9fb%25ethp0003]:8083/config.json
    2021/01/06 07:01:14 error adding source: failed to GET file: Get "http://[fe80::e49a:deff:fe74:a9fb%25ethp0003]:8083/config.json": dial tcp [fe80::e49a:deff:fe74:a9fb%ethp0003]:8083: errno(110)


fctorial

unread,
Jan 6, 2021, 6:01:05 AM1/6/21
to discuss, fctorial, jince...@gmail.com, discuss, Shai Barack, Brett Wilson
Setting up avahi and opening firewall to everything fixes this issue. Fuchsia devtools include this ufw configuration:

    dryer sudo ufw allow proto udp from fe80::/10 to any port 33331:33340 comment 'Fuchsia Netboot Protocol'
    dryer sudo ufw allow proto tcp from fe80::/10 to any port 8083 comment 'Fuchsia Package Server'
    dryer sudo ufw allow proto udp from fe80::/10 port 33340 comment 'Fuchsia Netboot TFTP Source Port'
    dryer sudo ufw allow proto udp from fe80::/10 port 5353 comment 'Fuchsia MDNS'

Can anyone translate these rules into simple language so that I could properly setup firewall on my system?

Also, emu command doesn't warn about firewall configuration if `ufw` command isn't available. Shall I submit a PR for it?

Thanks. 

fctorial

unread,
Jan 6, 2021, 6:07:55 AM1/6/21
to discuss, fctorial, jince...@gmail.com, discuss, Shai Barack, Brett Wilson
I tried these rules but they don't work:

TCP: 8083
UDP: 33331-33340, 33340, 5353

John Wittrock

unread,
Jan 6, 2021, 9:49:05 AM1/6/21
to fctorial, discuss, jince...@gmail.com, Shai Barack, Brett Wilson
You seem on the correct path with firewall configuration. I think MDNS is the thing you likely have to get working for device discovery to work. I don't know the specifics of how your firewall setup works, but our ufw configuration relies on the fact that Fuchsia devices will generally set up a Link-Local IPv6 address to communicate with the host (that link-local address is the fe80 address you see in our ufw configuration). 

This raises two questions:
- Does your firewall configuration require an interface to be specified on which to set rules?
- Can you set rules based on source IP address for incoming traffic?

The firewall rules we set up with `ufw` are (for example) "allow UDP traffic on any network interface from link-local IPs beginning with fe80 to ports 33331-33340 for the Fuchsia Netboot Protocol"

fctorial

unread,
Jan 6, 2021, 10:19:21 AM1/6/21
to discuss, John Wittrock, discuss, jince...@gmail.com, Shai Barack, Brett Wilson
Correction. Above firewall config fixes the issue.

John Wittrock

unread,
Jan 6, 2021, 10:23:28 AM1/6/21
to fctorial, discuss, jince...@gmail.com, Shai Barack, Brett Wilson
Great, thanks for the update. Can you get through the rest of the flow with `fx serve` and `ls` now?

fctorial

unread,
Jan 6, 2021, 10:32:26 AM1/6/21
to discuss, John Wittrock, discuss, jince...@gmail.com, Shai Barack, Brett Wilson, fctorial
Yes
Reply all
Reply to author
Forward
0 new messages