systemd: add support for squashfuse #1380

Merged
merged 3 commits into from Jun 25, 2016

Conversation

Projects
None yet
4 participants
Contributor

stgraber commented Jun 22, 2016

This attempts to detect cases where a straight squashfs mount won't work
and if squashfuse is available, uses that instead.

The motivation for this is to support snapd running inside containers.

Signed-off-by: Stéphane Graber stgraber@ubuntu.com

Contributor

stgraber commented Jun 22, 2016

This got tested inside an Ubuntu 16.04 container on the distro 4.4 kernel with unprivileged fuse mounts enabled (fuse module option).

It's not enough on its own to make snapd work, but it goes get us past the first problem which was that the snap wouldn't mount at all, and now instead gets us stuck on AppArmor profile loading (which @tych0 is working on as part of lxc/lxd#1942).

Contributor

stgraber commented Jun 22, 2016

I added the extra fstype argument to the systemd mount unit writer as there was nothing in the code that suggested that this function was squashfs-specific (despite it only being used for squashfs right now).

If you don't expect to ever use this code for anything but squashfs, then my change can be simplified quite a bit.

Contributor

stgraber commented Jun 22, 2016

squashfuse is currently in the review queue for the Ubuntu archive at https://launchpad.net/ubuntu/yakkety/+queue

An amd64 package can be found here: https://dl.stgraber.org/squashfuse_0.1.100-0ubuntu1_amd64.deb

Add support for squashfuse
This attempts to detect cases where a straight squashfs mount won't work
and if squashfuse is available, uses that instead.

The motivation for this is to support snapd running inside containers.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Collaborator

mvo5 commented Jun 22, 2016

add to whitelist

Contributor

zyga commented Jun 22, 2016

Looks okay

systemd/systemd.go
@@ -405,16 +406,45 @@ func (l Log) String() string {
return fmt.Sprintf("%s %s %s", l.Timestamp(), l.SID(), l.Message())
}
+// UseFuse detects if we should be using squashfuse instead
@niemeyer

niemeyer Jun 22, 2016

Contributor

This functionality is misplaced. The systemd package knows nothing about squashfs.

Actually, I take that back. Functionality is fine here. It'll be easier to test and as far as it works in every cases where squashfs works, it should be fine.

@niemeyer

niemeyer Jun 22, 2016

Contributor

The method also shouldn't be public (no reason to call it from outside), and it needs some tests covering its functionality, otherwise we'll break it and won't notice. Should be trivial by mocking the resources depended on (we need a test covering each) and verifying that the service file generated looks good.

@niemeyer

niemeyer Jun 22, 2016

Contributor

Sorry, changed opinion about the proper place. Please see updated comment above.

@stgraber

stgraber Jun 22, 2016

Contributor

Ok, so we could remove the squashfs logic from WriteMountUnitFile and just require all callers to pass the right fstype (fuse.squashfs if they need to use fuse), then make UseFuse a bit more generic and move it to osutil. Would that make sense or were you thinking about something else?

@stgraber

stgraber Jun 22, 2016

Contributor

Ok, will just make it private and add tests then.

Contributor

niemeyer commented Jun 22, 2016

Functionality looks fine. Needs to be moved on the proper place and needs tests.

@niemeyer niemeyer added the Reviewed label Jun 22, 2016

@niemeyer niemeyer changed the title from Add support for squashfuse to systemd: add support for squashfuse Jun 22, 2016

Make UseFuse private
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Contributor

stgraber commented Jun 22, 2016

I've now made UseFuse private (becomes useFuse) and I've added two tests that simulate the container and not-container case, checking the resulting unit.

Contributor

stgraber commented Jun 22, 2016

Looks like the test results are a bit confused:

  • autopkgtest: failed for what looks like an unrelated reason
  • continuous-integration/travis-ci/pr: 2/3 pass, the 3rd looks unrelated
  • integration tests: passed by failed to update Github with the result
Contributor

stgraber commented Jun 22, 2016

I'm going to push re-trigger them all, see if I get more lucky.

Add some tests for squashfuse support
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Contributor

stgraber commented Jun 22, 2016

Ok, that's better, just autopkgtest still failing for what looks like an unrelated reason now.

Contributor

niemeyer commented Jun 25, 2016

Thanks!

@niemeyer niemeyer merged commit dc96c3a into snapcore:master Jun 25, 2016

2 of 3 checks passed

autopkgtest Triggered
Details
Integration tests Success 17 tests run, 0 skipped, 0 failed.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment