diff --git a/selftest/export_test.go b/selftest/export_test.go
index 0df6601b115..1c669ce594a 100644
--- a/selftest/export_test.go
+++ b/selftest/export_test.go
@@ -20,7 +20,8 @@
package selftest
var (
- TrySquashfsMount = trySquashfsMount
+ TrySquashfsMount = trySquashfsMount
+ CheckKernelVersion = checkKernelVersion
)
func MockChecks(mockChecks []func() error) (restore func()) {
diff --git a/selftest/version.go b/selftest/version.go
new file mode 100644
index 00000000000..3f6a9ffffa1
--- /dev/null
+++ b/selftest/version.go
@@ -0,0 +1,38 @@
+// -*- Mode: Go; indent-tabs-mode: t -*-
+
+/*
+ * Copyright (C) 2018 Canonical Ltd
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ */
+
+package selftest
+
+import (
+ "fmt"
+
+ "github.com/snapcore/snapd/release"
+ "github.com/snapcore/snapd/strutil"
+)
+
+// checkKernelVersion looks for some unsupported configurations that users may
+// encounter and provides advice on how to resolve them.
+func checkKernelVersion() error {
+ if release.OnClassic && release.ReleaseInfo.ID == "ubuntu" && release.ReleaseInfo.VersionID == "14.04" {
+ if cmp, _ := strutil.VersionCompare(release.KernelVersion(), "3.13"); cmp <= 0 {
+ return fmt.Errorf("you need to reboot into a 4.4 kernel to start using snapd")
+ }
+ }
+ return nil
+}
diff --git a/selftest/version_test.go b/selftest/version_test.go
new file mode 100644
index 00000000000..e173d2b2a95
--- /dev/null
+++ b/selftest/version_test.go
@@ -0,0 +1,45 @@
+// -*- Mode: Go; indent-tabs-mode: t -*-
+
+/*
+ * Copyright (C) 2018 Canonical Ltd
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ */
+
+package selftest_test
+
+import (
+ . "gopkg.in/check.v1"
+
+ "github.com/snapcore/snapd/release"
+ "github.com/snapcore/snapd/selftest"
+)
+
+type versionSuite struct{}
+
+var _ = Suite(&versionSuite{})
+
+func (s *selftestSuite) TestFreshInstallOfSnapdOnTrusty(c *C) {
+ // Mock an Ubuntu 14.04 system running a 3.13 kernel
+ restore := release.MockOnClassic(true)
+ defer restore()
+ restore = release.MockReleaseInfo(&release.OS{ID: "ubuntu", VersionID: "14.04"})
+ defer restore()
+ restore = release.MockKernelVersion("3.13.0-35-generic")
+ defer restore()
+
+ // Check for the given advice.
+ err := selftest.CheckKernelVersion()
+ c.Assert(err, ErrorMatches, "you need to reboot into a 4.4 kernel to start using snapd")
+}