snaps with hyphens in their names get badly-named systemd mount definitions

Bug #1650261 reported by Barry Price
36
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Bazaar
Won't Fix
Undecided
Unassigned
snapd (Ubuntu)
Opinion
Undecided
Unassigned

Bug Description

e.g. installing the canonical-livepatch snap gives me:

/etc/systemd/system/snap-canonical\x2dlivepatch-17.mount
/etc/systemd/system/snap.canonical-livepatch.canonical-livepatchd.service
/etc/systemd/system/multi-user.target.wants/snap-canonical\x2dlivepatch-17.mount
/etc/systemd/system/multi-user.target.wants/snap.canonical-livepatch.canonical-livepatchd.service

The .service files are named sensibly, but the .mount files get a '\x2d' instead of a '-'.

This is particularly troublesome on hosts where /etc/ is kept in revision control, as e.g. bzr will crash on encountering these particular type of filenames.

Revision history for this message
Seth Arnold (seth-arnold) wrote :

Search for 'escape' on https://www.freedesktop.org/software/systemd/man/systemd.unit.html to discover the non-alphanumeric escaping algorithm; it's a bit involved. The https://www.freedesktop.org/software/systemd/man/systemd-escape.html tool can add and remove escaping as needed.

Thanks

Changed in snapd (Ubuntu):
status: New → Confirmed
Revision history for this message
Sean Sosik-Hamor (sciri) wrote :

The duplicate status of this bug is wrong. This bug is correctly reporting the actual cause and should be fixed. Duplicate bug #1598304 is reporting the workaround in etckeeper.

Revision history for this message
Zygmunt Krynicki (zyga) wrote :

This is a "feature" of systemd and as such it is unlikely to be fixed.

Changed in snapd (Ubuntu):
status: Confirmed → Opinion
Revision history for this message
John Lenton (chipaca) wrote :

Sciri, how is this not a dupe? In both cases it's bzr having an expecation about what's a valid filename that is not supported by systemd mount units.

Revision history for this message
Stuart Bishop (stub) wrote :

The Bazaar bug target is a duplicate of Bug #1035045

Changed in bzr:
status: New → Won't Fix
Revision history for this message
Sean Sosik-Hamor (sciri) wrote :

John, it was my assumption that snapd adding backslashes to the filename was the bug itself (the cause), not bzr's mishandling of the backslash. So that lead to my assumption that the bzr/etckeeper bug was a workaround for a bug in snapd and therefore not a duplicate.

If this is truly a feature of snapd as Zygmunt points out above then I guess it is a duplicate.

Revision history for this message
Sean Sosik-Hamor (sciri) wrote :

And bzr bug target Bug #1035045 was just set to WONTFIX because it would break Windows support. So where does that leave us who use straight bzr instead of etckeeper (where Bug #1598304 is still NEW)?

Revision history for this message
Seth Arnold (seth-arnold) wrote :

Sean, I understand there's a fork of bzr currently under development; they may be more willing to accept Windows-impossible names on Linux or Linux-impossible names on Windows: https://launchpad.net/brz

Further guessing, maybe it'd be possible to write a conversion tool that renames files back and forth into the subset of names that bzr accepts? (Ironically, a tool very much like the systemd-escape tool that started this bug.) Maybe it could be added as a bzr plugin, or a bzr hook, or just something that's run before every checkin/checkout?

I hope something here helps.

Thanks

Revision history for this message
JP Vossen (jp-jpsdomain) wrote :

The hack-around in https://bugs.launchpad.net/ubuntu/+source/bzr/+bug/1035045/comments/3 "worked" for me with `etckeeper` + BZR on Mint-18, in that it stopped the error messages. I don't actually know or care what omitting the affected snap files in `/etc/` might do later.

Note I needed 2 lines in `/etc/.bzrignore` and was confused when the first line failed to work. And you probably also need to:
```
# Be root
cd /etc
sudo vi .bzrignore
 systemd/system/snap*
 systemd/system/multi-user.target.wants/snap*
bzr rm --keep systemd/system/snap* systemd/system/multi-user.target.wants/snap*
etckeeper commit 'Ugly hack-around for bzr/etckeeper errors for snapd use of backslash in file names'
```

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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