Snapd fails to start (failed to parse /proc/self/mountinfo)

Bug #1763266 reported by Chris Halse Rogers
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
snapd (Ubuntu)
Expired
Undecided
Unassigned

Bug Description

snapd fails to start on my multi-device bcachefs volume, complaining about failing to parse /proc/self/mountinfo.

I've forked this from bug# 1760841, which looks to be a similar but distinct problem.

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: snapd 2.32+18.04
ProcVersionSignature: Ubuntu 4.15.0+bcachefs.git20180404.42e79d6-1-generic 4.15.15
Uname: Linux 4.15.0+bcachefs.git20180404.42e79d6-1-generic x86_64
NonfreeKernelModules: zfs zunicode zavl icp zcommon znvpair
ApportVersion: 2.20.9-0ubuntu4
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
Date: Thu Apr 12 14:49:18 2018
SourcePackage: snapd
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Chris Halse Rogers (raof) wrote :
Revision history for this message
Chris Halse Rogers (raof) wrote :
Revision history for this message
Michael Vogt (mvo) wrote :

Thanks for your bugreport. We improved the robustness of this code path - can you please try with snapd 2.32.5 which is available in bionic now.

Changed in snapd (Ubuntu):
status: New → Incomplete
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

I think this is still a TODO for me mvo. I fixed fstab without touching mountinfo IIRC. I will address this today.

Revision history for this message
Michael Vogt (mvo) wrote :

I looked into this issue and pushed a fix here: https://github.com/snapcore/snapd/compare/master...mvo5:lp-1763266?expand=1

However this looks like a bcachefs bug to me, most filesystems use "seq_show_option" to display stuff in mountinfo. And seq_show_options() will seq_escape() spaces: `seq_escape(m, value, ", \t\n\\");`.

Changed in snapd (Ubuntu):
status: Incomplete → In Progress
Revision history for this message
Michael Vogt (mvo) wrote :

I looked into this some more and I think this is a bcachefs bug. It does not do any escaping for the mountinfo options. This is done by other filesystems like ext4. The following might fix it:
"""
diff --git a/fs/bcachefs/opts.c b/fs/bcachefs/opts.c
index 8db8096e5ed4..4ebe557dfbaf 100644
--- a/fs/bcachefs/opts.c
+++ b/fs/bcachefs/opts.c
@@ -242,11 +242,11 @@ int bch2_opt_to_text(struct bch_fs *c, char *buf, size_t len,

        if (flags & OPT_SHOW_MOUNT_STYLE) {
                if (opt->type == BCH_OPT_BOOL)
- return scnprintf(out, end - out, "%s%s",
+ return scnprintf(out, end - out, "%pEc%s",
                                         v ? "" : "no",
                                         opt->attr.name);

- out += scnprintf(out, end - out, "%s=", opt->attr.name);
+ out += scnprintf(out, end - out, "%pEc=", opt->attr.name);
        }

        switch (opt->type) {
diff --git a/fs/bcachefs/util.c b/fs/bcachefs/util.c
index fa8537502fed..ca524bac27b0 100644
--- a/fs/bcachefs/util.c
+++ b/fs/bcachefs/util.c
@@ -115,7 +115,7 @@ ssize_t bch2_scnprint_string_list(char *buf, size_t size,

        for (i = 0; list[i]; i++)
                out += scnprintf(out, buf + size - out,
- i == selected ? "[%s] " : "%s ", list[i]);
+ i == selected ? "[%pEc] " : "%pEc ", list[i]);

        if (out != buf)
                *--out = '\0';
"""
Or it might crash your kernel. If it helps we should send it to the bcachefs mailing list. I think this should also be turned an upstream bcachefs bugreport (probably via the bcachefs mailinglist?).

Revision history for this message
Michael Vogt (mvo) wrote :

The first bit of the diff is wrong, but should not matter for the test, the bch2_scnprint_string_list() is what I suspect needs the escaping.

Changed in snapd (Ubuntu):
status: In Progress → Incomplete
Revision history for this message
Michael Vogt (mvo) wrote :

Note that this "fix" is incomplete issofar that the options should also escape the "=" char.

tags: added: patch
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for snapd (Ubuntu) because there has been no activity for 60 days.]

Changed in snapd (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.