“Device or resource busy” error during snap refresh when using layout with variable

Bug #1844496 reported by glancr team on 2019-09-18
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
snapd
High
Zygmunt Krynicki

Bug Description

Refreshing a snap that contains certain (valid) layouts aborts with this error:
```
error: cannot perform the following tasks:
- Setup snap "snapd-layouts-test" (unset) security profiles (cannot setup mount for snap "snapd-layouts-test": cannot update mount namespace of snap "snapd-layouts-test": cannot update preserved namespace of snap "snapd-layouts-test": cannot update snap namespace: device or resource busy)
- Setup snap "snapd-layouts-test" (unset) security profiles (cannot update mount namespace of snap "snapd-layouts-test": cannot update preserved namespace of snap "snapd-layouts-test": cannot update snap namespace: device or resource busy)
```

The layout which caused the error in my tests was this one:
```
layout:
  /usr/lib/$SNAPCRAFT_ARCH_TRIPLET/wpe-webkit-1.0:
    bind: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/wpe-webkit-1.0
```
The resulting snap.yaml has $SNAPCRAFT_ARCH_TRIPLET replaced by e.g. `x86_64-linux-gnu` if built on an amd64 machine. The layout itself works fine once the snap is installed/refreshed.

After discarding the namespace file with `sudo /usr/lib/snapd/snap-discard-ns <snap-name>`, refreshes run fine again.

Reference: https://forum.snapcraft.io/t/snap-does-not-start-after-reboot/5750

Zygmunt Krynicki (zyga) on 2019-09-18
Changed in snapd:
status: New → In Progress
assignee: nobody → Zygmunt Krynicki (zyga)
Zygmunt Krynicki (zyga) wrote :

I can no longer reproduce this on 2.42~pre1.1 using a simplified test. Perhaps the key to triggering this bug is to also keep something open (e.g. application actually using libraries from that spot). Can you please re-check with core/snapd from the edge channel to see if there is any improvement.

If you don't find any I will attempt to build a more comprehensive test that will trigger this.

Changed in snapd:
status: In Progress → Incomplete
Zygmunt Krynicki (zyga) wrote :

I've opened a draft pull request with the regression test I wrote https://github.com/snapcore/snapd/pull/7486

glancr team (glancr) wrote :

I refreshed the core snap to 16-2.42~pre1.1 (rev 7831) from the edge channel. Afterwards, I ran the same test as described in the forum post, but it still results in the same error.

My test snap does not contain any actual code, so I guess it's not related to application usage of the linked mount point – but my knowledge of this area is fairly limited :-)

You mentioned in your forum reply that you're testing on Ubuntu 19.10 with kernel 5.3.0-10-generic, I'm running Ubuntu 19.04 with kernel 5.0.0-29-generic. So I set up a multipass VM with 19.10 daily, refreshed core from edge channel – but still get the same error.

Zygmunt Krynicki (zyga) wrote :

This is now reproduced by the test case in https://github.com/snapcore/snapd/pull/7486

Changed in snapd:
status: Incomplete → Confirmed
importance: Undecided → High
status: Confirmed → In Progress
Zygmunt Krynicki (zyga) wrote :

I'm just stating for the record that this is still on my plate. I will attempt to spend some time on this issue after the next sprint. I'll update the state to Confirmed and flip back to In Progress once I have the time to fix it.

Changed in snapd:
status: In Progress → Confirmed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers