Ubuntu 23.10 snapcraft plugin dotnet cannot find build-package 'dotnet-sdk-8.0'

Hi guys

I’m trying to prepare my .Net 8 app for Ubuntu and stuck for 2 days already with making snapcraft to accept my snap.

That’s what I’ve got so far

  parts:
    app:
       plugin: dotnet
       dotnet-build-configuration: Release
       source: ./sources
       build-packages:
         - dotnet-sdk-8.0

During build it fails with error.

Launching instance...
Cannot find package listed in 'build-packages': dotnet-sdk-8.0

I don’t know how to fix it. I upgraded to Ubuntu 23.10, so this package exists in its repositories and available. But somehow snapcraft does not use OS repositories?

1 Like

Hi @siarhei_kuchuk .

When you execute this command, what do you get ?

snap find dotnet-sdk

~ @siarhei_kuchuk after executing the command above, make sure to use the correct version in your build-packages section of the snapcraft.yaml file.

As I understand snapcraft plugin dotnet does not support build-snaps. When I change build-packages to build-snaps and update it like this.

  build-snaps:
    dotnet-sdk-8.0.100

It seems like it does not see dotnet.

Environment validation failed for part 'app': 'dotnet' not found and part 'app' does not depend on a part named 'dotnet-deps' that would satisfy the dependency.

When I execute at Ubuntu 23.10 where I execute snapcraft the following command: apt search dotnet-sdk-8.0

It says: dotnet-sdk-8.0/mantic-uiodates,mantic-security,now 8.0.100-0ubuntu1-23.10.1 amd64

So if snapcraft for build-packages uses apt, it should find it.

Hi ! @siarhei_kuchuk

When you change build-snaps by build-packages, what do you get ?

For

build-packages:
         - dotnet-sdk-8.0
Cannot find package listed in 'build-packages': dotnet-sdk-8.0

For

build-packages:
         - dotnet-sdk-8.0.100
Cannot find package listed in 'build-packages': dotnet-sdk-8.0.100

Okay ! @siarhei_kuchuk

Do it to see :

build-packages:

- dotnet-sdk

It writes Cannot find package listed in 'build-packages': dotnet-sdk

However if I change it to previous version

build-packages:
         - dotnet-sdk-7.0

it finds it, but I will have to downgrade to previous .Net version.

According to documentation .Net 8 from Ubuntu feed is available since 23.10 (in 23.04 only .Net 7 is available) . My assumption that snapcraft uses some virtualization to build and did not update it to latest Ubuntu ?

Hmmm ! @siarhei_kuchuk

Your base core is(in the *yaml file) ?

base: core22

confinement: classic
compression: lzo

architectures:
  - build-on: [amd64]
    build-for: [all]

Try with the … :

base: core18

Seems like I’m unable to check with core18. Multipass writes that virtualization have to be enabled. When I enable it on my Ubuntu virtual machine, VmWare says that host does not support it.

I also tried to use dump plugin with prebuilt binaries, but it also does not work. It writes that it verifies dlls and unable to recognize them. And on Windows it does not do this check and produces .snap file. But on Windows it still can’t find .net-8 as stage-packages packages…

Do you know if devs of snapcraft have bug tracker or something. If they add support for .Net 8, i’ll just wait, if not - ill be considering downgrade to .Net 7.

Are you sure that the virtualization is enabled in your BIOS/UEFI ?

Yes, I use it to run docker and wsl-2. And sorry for taking so many of your time.

Okay ! @siarhei_kuchuk

I think you can enable core18 if you execute these commands before :

multipass delete --all

multipass purge

Make sure you have a backup before executing these commands.

You can even try this command before executing the above commands :

multipass launch core18

I did not try, but I think this command allows to switch the core(s).

multipass launch core18

I tried launch after this

multipass launch core18

and this

multipass delete --all
multipass purge

It writes

launch failed: KVM support is not enabled on this machine. Please ensure the following:
1.	The system’s CPU supports virtualization.
2.	Virtualization is enabled in the system BIOS.
3.	The KVM kernel modules are loaded.

Ill try in the evening to do it on wsl-2 and write resutls. Probably inside wsl-2 it will recognize virtualization.

Okay ! @siarhei_kuchuk

If the bug persists, I will invite @ogra to help you.