我使用 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/[电子邮件保护]/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)。
比我聪明的人可能会指出这将导致的可怕的副作用。
答案1
显然,seed.yml 文件指定在新操作系统安装时要安装的应用程序。
如果我们移除卡住的那些然后手动安装它们,这样做是可行的。
脚步:
将您的
/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
以查看快照任务的进度,并等待所有任务“完成”
手动安装您从 中删除的所有应用程序
/var/lib/snapd/seed/seed.yaml
,它们可能包括:gnome-calculator
gnome-characters
gnome-logs
gnome-system-monitor
重新安装这些的命令是:
snap install gnome-calculator gnome-characters gnome-logs gnome-system-monitor`
信用
谢谢斯蒂芬·贾里纳帮助解决这个问题!