Does Snapcraft's Rust Plugin Respect the Cargo.lock File?

I have the automated builds setup for my snap, but it seems like the build is not respecting the Cargo.lock file for my project because it is updating dependencies that I have not told it to.

I am using a release of a crate that is one version older than the latest available release and my project will not compile with the latest one. When I compile locally or on my other automated builds Cargo will use the versions of the packages that are specified in the Cargo.lock file until I explicitly run cargo update to update the lock file.

Here is the build log from the Snapcraft CI server:

Here is the build log from my CI build:

Here is the commit from my project:

The snapcraft build updating the termimad crate from 0.8.4 to 0.8.5.

This is still happening for me and is breaking my snap builds whenever somebody updates a certain library I depend on because snapcraft isn’t respecting my Cargo.lock.

Is there somewhere I should create a bug for this?

1 Like

You can file bugs for snapcraft at I noticed this post is not in the snapcraft category and was originally made during holidays where folks may have missed it. Perhaps they will see it now, but regardless I recommend filing a snapcraft bug for this.


Thanks @ijohnson @zicklag!

I noticed this when I recently added support for rust workspaces. Workspaces should support Cargo.lock.

I just put together a PR to hopefully improve Cargo.lock support for all projects.

Once it’s done building, it should be available to install with: snap refresh snapcraft --channel edge/pr-2915

It would be awesome if you could give it a test run on your project!

FWIW I’m not really experienced with Rust, so if you have any thoughts on further improving the rust plugin, or this PR specifically, please let us know! :smiley:


Hey @cjp256 thanks for that! I’ll try it out when I can. :+1:

1 Like

@zicklag FYI, the fixes can be found in edge now that they’ve been merged.

1 Like

Awesome, thanks for your work on this. :slight_smile:

I’m going to try it out hopefully within the next couple of days and I’ll let you know how it goes.

1 Like