action-build icon indicating copy to clipboard operation
action-build copied to clipboard

Fails to connect to network when running on Ubuntu 22.04 image

Open verbit opened this issue 3 years ago • 2 comments

I don't know why #39 was closed but the issue still persists. And even this repo's CI [1] fails running on 22.04. Any ideas why this is happening?

[1] https://github.com/snapcore/action-build/runs/7064821398

verbit avatar Aug 16 '22 23:08 verbit

Seems that the same person that opened it, closed it. I suggest you reopen and add a comment for it to be looked at.

sergiusens avatar Oct 11 '22 08:10 sergiusens

This seems to be a problem with the state the lxd snap is in when Github's ubuntu-22.04 image boots up.

LXD is present on the image, with no updates needed::::::

2022-10-20T12:11:04.4060826Z Installing LXD...
2022-10-20T12:11:04.4077647Z [command]/usr/bin/sudo snap refresh lxd
2022-10-20T12:11:05.8066169Z snap "lxd" has no updates available
2022-10-20T12:11:05.8093491Z Initialising LXD...
2022-10-20T12:11:05.8112654Z [command]/usr/bin/sudo lxd init --auto

... but something is broken with the network config for the containers it launches:

2022-10-20T12:12:29.8811449Z * Command output: b'Ign:1 http://archive.ubuntu.com/ubuntu jammy InRelease\nIgn:2 http://archive.ubuntu.com/ubuntu jammy-updates InRelease\nIgn:3 http://archive.ubuntu.com/ubuntu jammy-backports InRelease\nIgn:4 http://security.ubuntu.com/ubuntu jammy-security InRelease\nIgn:1 http://archive.ubuntu.com/ubuntu jammy InRelease\nIgn:2 http://archive.ubuntu.com/ubuntu jammy-updates InRelease\nIgn:3 http://archive.ubuntu.com/ubuntu jammy-backports InRelease\nIgn:4 http://security.ubuntu.com/ubuntu jammy-security InRelease\nIgn:1 http://archive.ubuntu.com/ubuntu jammy InRelease\nIgn:2 http://archive.ubuntu.com/ubuntu jammy-updates InRelease\nIgn:3 http://archive.ubuntu.com/ubuntu jammy-backports InRelease\nIgn:4 http://security.ubuntu.com/ubuntu jammy-security InRelease\nErr:1 http://archive.ubuntu.com/ubuntu jammy InRelease\n  Could not connect to archive.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Could not connect to archive.ubuntu.com:80 (2620:2d:4000:1::16). - connect (101: Network is unreachable) Could not connect to archive.ubuntu.com:80 (2620:2d:4000:1::19). - connect (101: Network is unreachable) Could not connect to archive.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Could not connect to archive.ubuntu.com:80 (91.189.91.38), connection timed out Could not connect to archive.ubuntu.com:80 (185.125.190.36), connection timed out Could not connect to archive.ubuntu.com:80 (185.125.190.39), connection timed out Could not connect to archive.ubuntu.com:80 (91.189.91.39), connection timed out\nErr:2 http://archive.ubuntu.com/ubuntu jammy-updates InRelease\n  Unable to connect to archive.ubuntu.com:80:\nErr:3 http://archive.ubuntu.com/ubuntu jammy-backports InRelease\n  Unable to connect to archive.ubuntu.com:80:\nErr:4 http://security.ubuntu.com/ubuntu jammy-security InRelease\n  Could not connect to security.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (2620:2d:4000:1::16). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (2620:2d:4000:1::19). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (185.125.190.36), connection timed out Could not connect to security.ubuntu.com:80 (91.189.91.38), connection timed out Could not connect to security.ubuntu.com:80 (185.125.190.39), connection timed out Could not connect to security.ubuntu.com:80 (91.189.91.39), connection timed out\nReading package lists...\n'
2022-10-20T12:12:29.8819747Z * Command standard error output: b'E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy/InRelease  Could not connect to archive.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Could not connect to archive.ubuntu.com:80 (2620:2d:4000:1::16). - connect (101: Network is unreachable) Could not connect to archive.ubuntu.com:80 (2620:2d:4000:1::19). - connect (101: Network is unreachable) Could not connect to archive.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Could not connect to archive.ubuntu.com:80 (91.189.91.38), connection timed out Could not connect to archive.ubuntu.com:80 (185.125.190.36), connection timed out Could not connect to archive.ubuntu.com:80 (185.125.190.39), connection timed out Could not connect to archive.ubuntu.com:80 (91.189.91.39), connection timed out\nE: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy-updates/InRelease  Unable to connect to archive.ubuntu.com:80:\nE: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy-backports/InRelease  Unable to connect to archive.ubuntu.com:80:\nE: Failed to fetch http://security.ubuntu.com/ubuntu/dists/jammy-security/InRelease  Could not connect to security.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (2620:2d:4000:1::16). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (2620:2d:4000:1::19). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (185.125.190.36), connection timed out Could not connect to security.ubuntu.com:80 (91.189.91.38), connection timed out Could not connect to security.ubuntu.com:80 (185.125.190.39), connection timed out Could not connect to security.ubuntu.com:80 (91.189.91.39), connection timed out\nE: Some index files failed to download. They have been ignored, or old ones used instead.\n'

jhenstridge avatar Oct 20 '22 12:10 jhenstridge

I have seen this issue too, FTR I've tried (in a step prior to the build-action) to install lxd and disable ipv6 on the lxdbr0 network, but it doesn't seem to make a difference. No change even refreshing lxd from latest/stable (instead of the default 5.0/stable/ubuntu-22.04 track)

albertodonato avatar Nov 18 '22 22:11 albertodonato

Could be that GH runners include docker by default.

See

https://linuxcontainers.org/lxd/docs/master/howto/network_bridge_firewalld/#prevent-issues-with-lxd-and-docker https://github.com/canonical/lxd-cloud/blob/f20a64a8af42485440dcbfd370faf14137d2f349/test/includes/lxd.sh#L13-L23

tomponline avatar Nov 21 '22 10:11 tomponline

Yes, since last Friday all our runs are also failing; I was just about to experiment with that

sergiusens avatar Nov 21 '22 11:11 sergiusens

That seems to have done the trick https://github.com/snapcore/snapcraft/actions/runs/3514110491/jobs/5887722790, thanks @tomponline

sergiusens avatar Nov 21 '22 12:11 sergiusens

@sergiusens can this be added to the action?

albertodonato avatar Nov 21 '22 12:11 albertodonato

I assigned myself to fix it; just learning how to do list comprehension in type script

sergiusens avatar Nov 21 '22 13:11 sergiusens

I did some tests locally, and for me just adding this as part of the setup fixes the issue: sudo iptables -P FORWARD ACCEPT

albertodonato avatar Nov 21 '22 18:11 albertodonato

Could snapcraft detect this setup (docker breaking snapcraft) and give a warning?

I remember a bunch of people at the summit had the same issue.

merlijn-sebrechts avatar Nov 24 '22 22:11 merlijn-sebrechts

I actually logged https://github.com/canonical/craft-providers/issues/172 during the summit  😅 

sergiusens avatar Nov 24 '22 23:11 sergiusens

Fixed in #51

sergiusens avatar Nov 28 '22 19:11 sergiusens

I've cut a new release with Sergio's fixes in them, so workflows using snapcore/action-build@v1 should now work with the ubuntu-22.04 runner image.

jhenstridge avatar Nov 29 '22 03:11 jhenstridge