我正在尝试遵循snapcraft 教程在 Ubuntu 22.04 上。
我已经安装并初始化了 lxd 和 snapcraft。当我运行 snapcraft 命令时,它似乎挂在实例设置上并最终失败。以下是运行时的一些输出--verbosity=trace
:
2023-11-09 07:16:22.734 Executing on host: lxc --project snapcraft config get local:base-instance-snapcraft-buildd-base-v30--ebe48dea8e0ee8ae59ed user.craft_providers.status
2023-11-09 07:16:22.797 Instance status: PREPARING
2023-11-09 07:16:22.797 Executing on host: lxc --project snapcraft config get local:base-instance-snapcraft-buildd-base-v30--ebe48dea8e0ee8ae59ed user.craft_providers.timer
2023-11-09 07:16:22.865 Timer: 2023-11-09T14:00:53.448461+00:00
2023-11-09 07:16:25.867 Executing on host: lxc --project snapcraft info local:base-instance-snapcraft-buildd-base-v30--ebe48dea8e0ee8ae59ed
2023-11-09 07:16:25.929 Instance info: {'Name': 'base-instance-snapcraft-buildd-base-v30--ebe48dea8e0ee8ae59ed', 'Status': 'RUNNING', 'Type': 'container', 'Architecture': 'x86_64', 'PID': '1025872', 'Created': '2023/11/09 06:59 MST', 'Last Used': '2023/11/09 06:59 MST', 'Resources': {'Processes': '5', 'CPU usage': {'CPU usage (in seconds)': '0'}, 'Memory usage': {'Memory (current)': '20.95MiB'}, 'Network usage': {'eth0': {'Type': 'broadcast', 'State': 'UP', 'Host interface': 'veth25d71a31', 'MAC address': '00:16:3e:c3:4d:46', 'MTU': '1500', 'Bytes received': '184.77kB', 'Bytes sent': '12.63kB', 'Packets received': '2805', 'Packets sent': '151', 'IP addresses': {'inet': '10.13.134.100/24 (global)', 'inet6': 'fe80::216:3eff:fec3:4d46/64 (link)'}}, 'lo': {'Type': 'loopback', 'State': 'UP', 'MTU': '65536', 'Bytes received': '0B', 'Bytes sent': '0B', 'Packets received': '0', 'Packets sent': '0', 'IP addresses': {'inet': '127.0.0.1/8 (local)', 'inet6': '::1/128 (local)'}}}}}
2023-11-09 07:16:25.930 Executing on host: lxc --project snapcraft config get local:base-instance-snapcraft-buildd-base-v30--ebe48dea8e0ee8ae59ed user.craft_providers.status
2023-11-09 07:16:25.997 Instance status: PREPARING
2023-11-09 07:16:25.997 Executing on host: lxc --project snapcraft config get local:base-instance-snapcraft-buildd-base-v30--ebe48dea8e0ee8ae59ed user.craft_providers.timer
2023-11-09 07:16:26.077 Timer: 2023-11-09T14:00:53.448461+00:00
2023-11-09 07:16:29.080 Executing on host: lxc --project snapcraft info local:base-instance-snapcraft-buildd-base-v30--ebe48dea8e0ee8ae59ed
2023-11-09 07:16:29.154 Instance info: {'Name': 'base-instance-snapcraft-buildd-base-v30--ebe48dea8e0ee8ae59ed', 'Status': 'RUNNING', 'Type': 'container', 'Architecture': 'x86_64', 'PID': '1025872', 'Created': '2023/11/09 06:59 MST', 'Last Used': '2023/11/09 06:59 MST', 'Resources': {'Processes': '5', 'CPU usage': {'CPU usage (in seconds)': '0'}, 'Memory usage': {'Memory (current)': '20.95MiB'}, 'Network usage': {'eth0': {'Type': 'broadcast', 'State': 'UP', 'Host interface': 'veth25d71a31', 'MAC address': '00:16:3e:c3:4d:46', 'MTU': '1500', 'Bytes received': '185.02kB', 'Bytes sent': '12.63kB', 'Packets received': '2811', 'Packets sent': '151', 'IP addresses': {'inet': '10.13.134.100/24 (global)', 'inet6': 'fe80::216:3eff:fec3:4d46/64 (link)'}}, 'lo': {'Type': 'loopback', 'State': 'UP', 'MTU': '65536', 'Bytes received': '0B', 'Bytes sent': '0B', 'Packets received': '0', 'Packets sent': '0', 'IP addresses': {'inet': '127.0.0.1/8 (local)', 'inet6': '::1/128 (local)'}}}}}
2023-11-09 07:16:29.154 Executing on host: lxc --project snapcraft config get local:base-instance-snapcraft-buildd-base-v30--ebe48dea8e0ee8ae59ed user.craft_providers.status
2023-11-09 07:16:29.192 Instance status: PREPARING
2023-11-09 07:16:29.192 Executing on host: lxc --project snapcraft config get local:base-instance-snapcraft-buildd-base-v30--ebe48dea8e0ee8ae59ed user.craft_providers.timer
2023-11-09 07:16:29.277 Timer: 2023-11-09T14:00:53.448461+00:00
2023-11-09 07:16:32.280 craft-providers error: Instance setup failed. Check LXD logs for more details.
2023-11-09 07:16:32.281 Full execution log: '/home/tyler/.local/state/snapcraft/log/snapcraft-20231109-071527.770857.log'
如果我尝试手动运行这些 lxc 命令,则输出如下:
> lxc --project snapcraft config get local:base-instance-snapcraft-buildd-base-v30--ebe48dea8e0ee8ae59ed user.craft_providers.status
PREPARING
> lxc --project snapcraft info local:base-instance-snapcraft-buildd-base-v30--ebe48dea8e0ee8ae59ed
Name: base-instance-snapcraft-buildd-base-v30--ebe48dea8e0ee8ae59ed
Status: RUNNING
Type: container
Architecture: x86_64
PID: 1025872
Created: 2023/11/09 06:59 MST
Last Used: 2023/11/09 06:59 MST
Resources:
Processes: 5
CPU usage:
CPU usage (in seconds): 0
Memory usage:
Memory (current): 20.95MiB
Network usage:
eth0:
Type: broadcast
State: UP
Host interface: veth25d71a31
MAC address: 00:16:3e:c3:4d:46
MTU: 1500
Bytes received: 350.75kB
Bytes sent: 13.45kB
Packets received: 5454
Packets sent: 158
IP addresses:
inet: 10.13.134.100/24 (global)
inet6: fd42:a260:2383:2fef:216:3eff:fec3:4d46/64 (global)
inet6: fe80::216:3eff:fec3:4d46/64 (link)
lo:
Type: loopback
State: UP
MTU: 65536
Bytes received: 0B
Bytes sent: 0B
Packets received: 0
Packets sent: 0
IP addresses:
inet: 127.0.0.1/8 (local)
inet6: ::1/128 (local)
我确实在 lxd 日志中找到了一个日志文件,这是我发现的唯一可疑的东西:
Nov 09 08:12:36 snapcraft-my-snap-name-on-amd64-for-amd64-25328813 systemd-journald[34]: Runtime Journal (/run/log/journal/a6a2964c01d142b58bcfed58764c138e) i>
Nov 09 08:12:36 snapcraft-my-snap-name-on-amd64-for-amd64-25328813 systemd[35]: [email protected]: Executable /sbin/modprobe missing, skipping: No suc>
Nov 09 08:12:36 snapcraft-my-snap-name-on-amd64-for-amd64-25328813 systemd[36]: [email protected]: Executable /sbin/modprobe missing, skipping: No such fi>
Nov 09 08:12:36 snapcraft-my-snap-name-on-amd64-for-amd64-25328813 systemd-remount-fs[40]: mount: /: cannot remount /dev/root read-write, is write-protected.
Nov 09 08:12:36 snapcraft-my-snap-name-on-amd64-for-amd64-25328813 systemd-remount-fs[38]: /bin/mount for / exited with exit status 32.
Nov 09 08:12:36 snapcraft-my-snap-name-on-amd64-for-amd64-25328813 systemd[1]: systemd-remount-fs.service: Main process exited, code=exited, status=1/FAILURE
Nov 09 08:12:36 snapcraft-my-snap-name-on-amd64-for-amd64-25328813 systemd[1]: systemd-remount-fs.service: Failed with result 'exit-code'.
Nov 09 08:12:36 snapcraft-my-snap-name-on-amd64-for-amd64-25328813 systemd[1]: Failed to start Remount Root and Kernel File Systems.
答案1
我刚刚遇到了同样的问题。您是否--edge
按照教程安装了 snapcraft?
这给我带来了问题,因此我执行以下操作,然后可以再次构建快照:
sudo snap remove snapcraft
sudo snap install snapcraft --classic
答案2
对于将来读到这篇文章的任何人来说,上述行为还可能还有其他原因。
如果您的机器上安装了 Docker,请注意 Docker 的不当行为并尝试以下操作来修复网络:预防 LXD 和 Docker 的连接问题。
您可以通过 ping 8.8.8.8 从 LXD 容器快速检查修复是否有效。