Skip to content

Using Transfer service on Windows fails due to wrong differ selected at plugin start up #8563

@jsturtevant

Description

@jsturtevant

Description

When using the transfer service to pull images on Windows the following error occurs:

 ctr i pull --local=false mcr.microsoft.com/windows/nanoserver:ltsc2022
mcr.microsoft.com/windows/nanoserver:lts        fetching image content
└──index (dffd1e0990e2)                         complete        |++++++++++++++++++++++++++++++++++++++|
   └──manifest (aa19d3ca6139)                   complete        |++++++++++++++++++++++++++++++++++++++|
      ├──config (8d8c1e713e14)                  complete        |++++++++++++++++++++++++++++++++++++++|
      └──layer (5178da1ca6af)                   waiting         |--------------------------------------|
Pulling from OCI Registry (mcr.microsoft.com/windows/nanoserver:ltsc2022)       elapsed: 0.4 s  total:  1.5 Ki  (4.2 KiB/s)
ctr: rpc error: code = Unknown desc = failed to extract layer sha256:14cf21987a8be92c5cd8ca93777bdf9535cd176cc50ff972ab8f93e884fe7e30: failed to mount C:\Users\jstur\AppData\Local\Temp\containerd-mount4084806450: no Files folder in layer 2081

This is due to the wrong differ being selected at plugin in registration. The walker plugin is selected instead of windows

for name, plugin := range diffPlugins {
var matched bool
for _, p := range plugin.Meta.Platforms {
if target.Match(p) {
matched = true
}
}

The cause is the serialization and deserialization done by the p, err := platforms.Parse(uc.Platform) and and Platform: platforms.Format(platforms.DefaultSpec()), which drops the OS version when parsing allowing the platform matcher to match that differ.

I can think of a couple ways to solve this:

  • fix platform.Parse/format to include the os version
  • don't include the walker plugin in the initialization. Is the walker plugin used on Windows for other scenarios or is it ok to remove?
  • repopluate the os version during parse (this feels fragile as we will have other version based work were it might not actually match - hyperv for example)

The platform.parse/format is used many different places so other similiar bugs might be out there. So I lean towards this but the parsing code is already very intertesing :-)

Steps to reproduce the issue

  1. ctr i pull --local=false mcr.microsoft.com/windows/nanoserver:ltsc2022

Describe the results you received and expected

The correct differ to be selected and used.

What version of containerd are you using?

main branch

Any other relevant information

Adding differ: "windows"` to the transfer config fixes the issue, since it doesn't try to find the appropriate differ:

func defaultConfig() *transferConfig {
	return &transferConfig{
		UnpackConfiguration: []unpackConfiguration{
			{
				Platform:    platforms.Format(platforms.DefaultSpec()),
				Snapshotter: containerd.DefaultSnapshotter,
				Differ:      "windows",
			},

Show configuration if it is related to CRI plugin.

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions