我在 Windows 10 上使用 Hyper-V 中的快速创建功能创建了一个新 VM。
设置 VM 后(我选择了语言设置,创建了密码等),然后我尝试安装 Visual Studio Code 并收到以下错误消息:
Unable to install "Visual Studio Code": too early for operation, device not yet seeded or device model not acknowledged
.
从调查来看,这似乎是一个快速问题。
这里有一些细节
snap --version
:
snap 2.38
snapd 2.38
series 16
ubuntu 18.04
kernel 4.15.0-50-generic
snap changes
:
ID Status Spawn Ready Summary
1 Doing today at 10:58 BST - Initialize system state
2 Done today at 10:58 BST today at 10:58 BST Initialize device
snap tasks --last=seed
:
Status Spawn Ready Summary
Done today at 10:58 BST today at 10:58 BST Ensure prerequisites for "core" are available
Done today at 10:58 BST today at 10:58 BST Prepare snap "/var/lib/snapd/seed/snaps/core_6673.snap" (6673)
Done today at 10:58 BST today at 10:58 BST Mount snap "core" (6673)
Done today at 10:58 BST today at 10:58 BST Copy snap "core" data
Done today at 10:58 BST today at 10:58 BST Setup snap "core" (6673) security profiles
Done today at 10:58 BST today at 10:58 BST Make snap "core" (6673) available to the system
Done today at 10:58 BST today at 10:59 BST Automatically connect eligible plugs and slots of snap "core"
Done today at 10:58 BST today at 10:59 BST Set automatic aliases for snap "core"
Done today at 10:58 BST today at 10:59 BST Setup snap "core" aliases
Done today at 10:58 BST today at 10:59 BST Run install hook of "core" snap if present
Done today at 10:58 BST today at 10:59 BST Start snap "core" (6673) services
Done today at 10:58 BST today at 10:59 BST Run configure hook of "core" snap if present
Done today at 10:58 BST today at 10:59 BST Ensure prerequisites for "gnome-3-26-1604" are available
Done today at 10:58 BST today at 10:59 BST Prepare snap "/var/lib/snapd/seed/snaps/gnome-3-26-1604_82.snap" (82)
Done today at 10:58 BST today at 10:59 BST Mount snap "gnome-3-26-1604" (82)
Done today at 10:58 BST today at 10:59 BST Copy snap "gnome-3-26-1604" data
Done today at 10:58 BST today at 10:59 BST Setup snap "gnome-3-26-1604" (82) security profiles
Done today at 10:58 BST today at 10:59 BST Make snap "gnome-3-26-1604" (82) available to the system
Done today at 10:58 BST today at 10:59 BST Automatically connect eligible plugs and slots of snap "gnome-3-26-1604"
Done today at 10:58 BST today at 10:59 BST Set automatic aliases for snap "gnome-3-26-1604"
Done today at 10:58 BST today at 10:59 BST Setup snap "gnome-3-26-1604" aliases
Done today at 10:58 BST today at 10:59 BST Run install hook of "gnome-3-26-1604" snap if present
Done today at 10:58 BST today at 10:59 BST Start snap "gnome-3-26-1604" (82) services
Done today at 10:58 BST today at 10:59 BST Run configure hook of "gnome-3-26-1604" snap if present
Doing today at 10:58 BST - Ensure prerequisites for "gnome-calculator" are available
Do today at 10:58 BST - Prepare snap "/var/lib/snapd/seed/snaps/gnome-calculator_352.snap" (352)
Do today at 10:58 BST - Mount snap "gnome-calculator" (352)
Do today at 10:58 BST - Copy snap "gnome-calculator" data
Do today at 10:58 BST - Setup snap "gnome-calculator" (352) security profiles
Do today at 10:58 BST - Make snap "gnome-calculator" (352) available to the system
Do today at 10:58 BST - Automatically connect eligible plugs and slots of snap "gnome-calculator"
Do today at 10:58 BST - Set automatic aliases for snap "gnome-calculator"
Do today at 10:58 BST - Setup snap "gnome-calculator" aliases
Do today at 10:58 BST - Run install hook of "gnome-calculator" snap if present
Do today at 10:58 BST - Start snap "gnome-calculator" (352) services
Do today at 10:58 BST - Run configure hook of "gnome-calculator" snap if present
Do today at 10:58 BST - Ensure prerequisites for "gnome-characters" are available
Do today at 10:58 BST - Prepare snap "/var/lib/snapd/seed/snaps/gnome-characters_206.snap" (206)
Do today at 10:58 BST - Mount snap "gnome-characters" (206)
Do today at 10:58 BST - Copy snap "gnome-characters" data
Do today at 10:58 BST - Setup snap "gnome-characters" (206) security profiles
Do today at 10:58 BST - Make snap "gnome-characters" (206) available to the system
Do today at 10:58 BST - Automatically connect eligible plugs and slots of snap "gnome-characters"
Do today at 10:58 BST - Set automatic aliases for snap "gnome-characters"
Do today at 10:58 BST - Setup snap "gnome-characters" aliases
Do today at 10:58 BST - Run install hook of "gnome-characters" snap if present
Do today at 10:58 BST - Start snap "gnome-characters" (206) services
Do today at 10:58 BST - Run configure hook of "gnome-characters" snap if present
Do today at 10:58 BST - Ensure prerequisites for "gnome-logs" are available
Do today at 10:58 BST - Prepare snap "/var/lib/snapd/seed/snaps/gnome-logs_57.snap" (57)
Do today at 10:58 BST - Mount snap "gnome-logs" (57)
Do today at 10:58 BST - Copy snap "gnome-logs" data
Do today at 10:58 BST - Setup snap "gnome-logs" (57) security profiles
Do today at 10:58 BST - Make snap "gnome-logs" (57) available to the system
Do today at 10:58 BST - Automatically connect eligible plugs and slots of snap "gnome-logs"
Do today at 10:58 BST - Set automatic aliases for snap "gnome-logs"
Do today at 10:58 BST - Setup snap "gnome-logs" aliases
Do today at 10:58 BST - Run install hook of "gnome-logs" snap if present
Do today at 10:58 BST - Start snap "gnome-logs" (57) services
Do today at 10:58 BST - Run configure hook of "gnome-logs" snap if present
Do today at 10:58 BST - Ensure prerequisites for "gnome-system-monitor" are available
Do today at 10:58 BST - Prepare snap "/var/lib/snapd/seed/snaps/gnome-system-monitor_70.snap" (70)
Do today at 10:58 BST - Mount snap "gnome-system-monitor" (70)
Do today at 10:58 BST - Copy snap "gnome-system-monitor" data
Do today at 10:58 BST - Setup snap "gnome-system-monitor" (70) security profiles
Do today at 10:58 BST - Make snap "gnome-system-monitor" (70) available to the system
Do today at 10:58 BST - Automatically connect eligible plugs and slots of snap "gnome-system-monitor"
Do today at 10:58 BST - Set automatic aliases for snap "gnome-system-monitor"
Do today at 10:58 BST - Setup snap "gnome-system-monitor" aliases
Do today at 10:58 BST - Run install hook of "gnome-system-monitor" snap if present
Do today at 10:58 BST - Start snap "gnome-system-monitor" (70) services
Do today at 10:58 BST - Run configure hook of "gnome-system-monitor" snap if present
Do today at 10:58 BST - Ensure prerequisites for "gtk-common-themes" are available
Do today at 10:58 BST - Prepare snap "/var/lib/snapd/seed/snaps/gtk-common-themes_1198.snap" (1198)
Do today at 10:58 BST - Mount snap "gtk-common-themes" (1198)
Do today at 10:58 BST - Copy snap "gtk-common-themes" data
Do today at 10:58 BST - Setup snap "gtk-common-themes" (1198) security profiles
Do today at 10:58 BST - Make snap "gtk-common-themes" (1198) available to the system
Do today at 10:58 BST - Automatically connect eligible plugs and slots of snap "gtk-common-themes"
Do today at 10:58 BST - Set automatic aliases for snap "gtk-common-themes"
Do today at 10:58 BST - Setup snap "gtk-common-themes" aliases
Do today at 10:58 BST - Run install hook of "gtk-common-themes" snap if present
Do today at 10:58 BST - Start snap "gtk-common-themes" (1198) services
Do today at 10:58 BST - Run configure hook of "gtk-common-themes" snap if present
Do today at 10:58 BST - Mark system seeded
......................................................................
Make snap "core" (6673) available to the system
2019-05-17T10:58:58+01:00 INFO Requested daemon restart.
......................................................................
Automatically connect eligible plugs and slots of snap "core"
2019-05-17T10:58:58+01:00 INFO Waiting for restart...
sudo systemctl status snapd.autoimport
:
● snapd.autoimport.service - Auto import assertions from block devices
Loaded: loaded (/lib/systemd/system/snapd.autoimport.service; enabled; vendor preset: enabled)
Active: inactive (dead)
Condition: start condition failed at Fri 2019-05-17 16:31:20 BST; 33min ago
└─ ConditionKernelCommandLine=snap_core was not met
Windows 详细信息:- Windows 10,版本 1809,(操作系统内部版本 17763.437)
我尝试过的事情
1 - 乱搞/var/lib/snapd/state.json
我在这里尝试了这个建议:https ://forum.snapcraft.io/t/cant-install-or-refresh-snaps-on-arch-linux/8690/28
看起来像这样:
sudo systemctl stop snapd
sudo cat /var/lib/snapd/state.json | \
jq 'delpaths([["data", "auth", "device"]])' > state.json-new
sudo cp state.json-new /var/lib/snapd/state.json
sudo systemctl start snapd
但是(这可能是我是一个 Ubuntu 菜鸟)我无法jq
安装,我不确定它到底在做什么,所以我不能手动安装。
2 - 使用 Ubuntu 19 映像
这显然有同样的问题。
3 - 一位同事尝试使用他的笔记本电脑
他有同样的问题
4 - 重新安装snapd
我运行了这个:sudo apt install --reinstall snapd
只是为了让安装卡在 67%。
5 - 乱搞/var/lib/snapd/seed/seed.yaml
根据这个错误:https ://www.mail-archive.com/[email protected]/msg5400922.html
我尝试重新排序 gtk-common-themes 部分并删除 gnome-calculator 部分(每次更改后重新启动),这似乎没有任何区别。该snap tasks --last=seed
命令仍然显示它卡在 gnome-calculator 任务上。
6 - 用头撞键盘
我感觉好多了,但问题仍然存在。
7 - 使用非快速启动图像
我下载了一个 Ubuntu 18.04.2 ISO 并使用了它。这有效(因为我可以安装 Visual Studio Code 并且 snap 命令看起来很健康)。然而,它没有所有漂亮的 hyper-v 东西,所以屏幕很糟糕,没有复制和粘贴,鼠标非常迟钝等等......
我可以安装各种位来使这个图像对 hyper-v 更友好,但我有一种感觉,我永远不会像官方的那样光滑。如果我能解决snap
这个问题,我想我最终会得到最好的用户体验。
8 - 这有效。玩弄/var/lib/snapd/seed/seed.yaml
第 2 部分
我从里面删除了一堆东西,/var/lib/snapd/seed/seed.yaml
所以现在看起来像这样:
snaps:
-
name: core
channel: stable
file: core_6673.snap
-
name: gtk-common-themes
channel: stable/ubuntu-18.04
file: gtk-common-themes_1198.snap
-
name: gnome-3-26-1604
channel: stable/ubuntu-18.04
file: gnome-3-26-1604_82.snap
然后确实snap abort --last=seed
紧随其后sudo systemctl restart snapd
。检查snap tasks --last=seed
- 它们都应该是完整的,您可以安装快照(例如 Visual Studio Code)。
比我聪明的人可能会指出这会导致可怕的副作用。
显然,seed.yml 文件指定了要在全新操作系统安装上安装的应用程序。
如果我们删除卡住的那些,然后手动安装它们,这是可行的。
脚步:
将您的文件更改
/var/lib/snapd/seed/seed.yaml
为如下所示:基本上我删除了所有导致快照任务卡住的条目。
中止当前正在运行的快照任务并重新启动服务:
snap abort --last=seed
sudo systemctl restart snapd
snap tasks --last=seed
以查看快照任务的进度并等待所有任务“完成”手动安装您从中删除的任何应用程序
/var/lib/snapd/seed/seed.yaml
,它们可能包括:gnome-calculator
gnome-characters
gnome-logs
gnome-system-monitor
重新安装这些的命令是:
信用
感谢Stefan Jarina帮助解决此问题!