systemd services created by snappy breaks etckeeper

Bug #1598304 reported by Jay R. Wren
24
This bug affects 4 people
Affects Status Importance Assigned to Milestone
One Hundred Papercuts
New
Undecided
Unassigned
Snappy
Invalid
Undecided
Unassigned
etckeeper
New
Undecided
Unassigned
etckeeper (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

etckeeper uses bzr to version files in etc to allow for rollback on configuration changes.

The '\x2d' character prevents bzr from versioning this file and displays a very ugly error.

/etc/systemd/system/snap-ubuntu\x2dcore-122.mount

bzr: ERROR: bzrlib.errors.InvalidEntryName: Invalid entry name: snap-ubuntu\x2dcore-122.mount

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/bzrlib/commands.py", line 930, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/bzrlib/commands.py", line 1121, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.7/dist-packages/bzrlib/commands.py", line 673, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/python2.7/dist-packages/bzrlib/commands.py", line 697, in run
    return self._operation.run_simple(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/bzrlib/cleanup.py", line 136, in run_simple
    self.cleanups, self.func, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/bzrlib/cleanup.py", line 166, in _do_with_cleanups
    result = func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/bzrlib/builtins.py", line 842, in run
    no_recurse, action=action, save=not dry_run)
  File "/usr/lib/python2.7/dist-packages/bzrlib/mutabletree.py", line 52, in tree_write_locked
    return unbound(self, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/bzrlib/mutabletree.py", line 453, in smart_add
    adder.add(file_list, recurse=recurse)
  File "/usr/lib/python2.7/dist-packages/bzrlib/mutabletree.py", line 764, in add
    inv_path)
  File "/usr/lib/python2.7/dist-packages/bzrlib/mutabletree.py", line 628, in _add_one_and_parent
    file_id=file_id)
  File "/usr/lib/python2.7/dist-packages/bzrlib/inventory.py", line 2234, in make_entry
    return factory(file_id, name, parent_id)
  File "/usr/lib/python2.7/dist-packages/bzrlib/inventory.py", line 422, in __init__
    super(InventoryFile, self).__init__(file_id, name, parent_id)
  File "/usr/lib/python2.7/dist-packages/bzrlib/inventory.py", line 222, in __init__
    raise errors.InvalidEntryName(name=name)
InvalidEntryName: Invalid entry name: snap-ubuntu\x2dcore-122.mount

bzr 2.7.0 on python 2.7.11 (Linux-4.4.0-24-generic-x86_64-with-
    Ubuntu-16.04-xenial)
arguments: ['/usr/bin/bzr', 'add', '-q', '.']
plugins: bash_completion[2.7.0], builddeb[2.8.6], builder[0.7.3],
    bzrtools[2.6.0], changelog_merge[2.7.0], etckeeper[unknown], git[0.6.12],
    grep[2.7.0], launchpad[2.7.0], loggerhead[1.18.1],
    netrc_credential_store[2.7.0], news_merge[2.7.0], po_merge[2.7.0],
    search[1.7.0dev], weave_fmt[2.7.0]
encoding: 'utf-8', fsenc: 'UTF-8', lang: 'en_US.UTF-8'

*** Bazaar has encountered an internal error. This probably indicates a
    bug in Bazaar. You can help us fix it by filing a bug report at
        https://bugs.launchpad.net/bzr/+filebug
    including this traceback and a description of the problem.
etckeeper warning: bzr add failed

Revision history for this message
Jay R. Wren (evarlast) wrote :

A fix might be to write to /etc/.bzrignore or /etc/.gitignore if it exists

    systemd/system/snap-ubuntu*

Revision history for this message
Jamie Strandboge (jdstrand) wrote :

The bzr bug in question is bug #1035045. Since it seems the bug won't be fixed in bzr, it might be useful as Jay mentioned to adjust etckeeper to ignore these files.

Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

This is a bug in etckeeper. The "\x2d" character is inserted by systemd's escape routine itself:

    $ systemd-escape foo-bar
    foo\x2dbar

We'll likely stop using the escaping logic and use simpler names now that we're constraining application names further, but somebody else using systemd-escape will hit the same bug.

Changed in snappy:
status: New → Invalid
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'
```

Haw Loeung (hloeung)
Changed in etckeeper (Ubuntu):
status: New → Confirmed
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.