将 ubuntu 18.04 升级到 20.04 后,简单的 hello world snap 不起作用
Posted
技术标签:
【中文标题】将 ubuntu 18.04 升级到 20.04 后,简单的 hello world snap 不起作用【英文标题】:Simple hello world snap is not working after upgrade of ubuntu 18.04 to 20.04 【发布时间】:2021-03-27 12:12:53 【问题描述】:最近,我开始研究捕捉。 我已经学会了在 Ubuntu 18.04 上使用简单的 hello-gnu 进行捕捉。
在那之后我搬到了 ubuntu 20.04。我遇到了很多问题。所以我决定在 ubuntu 20.04 上再次运行 hello-gnu snap。但它失败并出现以下错误
$snpacraft
Launching a VM.,
snap "snapd" has no updates available
core18 20201210 from Canonical✓ installed
"core18" switched to the "latest/stable" channel
snapd is not logged in, snap install commands will use sudo snap "core20" has no updates available
Skipping pull hello-world (already ran)
Skipping build hello-world (already ran)
Skipping stage hello-world (already ran)
Skipping prime hello-world (already ran)
Failed to generate snap metadata: The specified command 'bin/hello' defined in the app 'hello' does not exist.
Ensure that 'bin/hello' is installed with the correct path.
Run the same command again with --debug to shell into the environment if you wish to introspect this failure.
snapcraft.yaml 如下所示
name: hello-gnu # you probably want to 'snapcraft register <name>'
base: core20 # the base snap is the execution environment for this snap
version: '0.1' # just for humans, typically '1.2+git' or '1.3.2'
summary: Hello simple snap
description: |
This is my-snap's description. You have a paragraph or two to tell the
most important story about your snap. Keep it under 100 words though,
we live in tweetspace and your description wants to look good in the snap
store.
grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots
apps:
hello:
command: bin/hello
parts:
hello-world:
# See 'snapcraft plugins'
plugin: autotools
source: http://ftp.gnu.org/gnu/hello/hello-2.10.tar.gz
【问题讨论】:
【参考方案1】:对于Core20,如果您将命令路径设置为“usr/local/bin/hello”,它将起作用。
command:usr/local/bin/hello
【讨论】:
这对我有用,虽然一个简单的bin/app-name
可以解决问题,但我不需要usr/local
【参考方案2】:
添加
autotools-configure-parameters:
- --prefix=/
到您的 snapcraft.yaml 文件下方
plugin: autotools
行。
我遇到了同样的问题,当您进入 bash 步骤时,情况似乎变得更糟。如果您将基础更改为 core18,它会按照说明工作。
【讨论】:
以上是关于将 ubuntu 18.04 升级到 20.04 后,简单的 hello world snap 不起作用的主要内容,如果未能解决你的问题,请参考以下文章
将 ubuntu 18.04 升级到 20.04 后,简单的 hello world snap 不起作用
Ubuntu 18.04 LTS/19.10 升级到 Ubuntu 20.04 beta
Docker - Ubuntu 20.04 升级后没有路由到主机
Ubuntu 18.04/20.04 CV环境配置(上):CUDA11.1 + cudnn安装配置