snapd-generated systemd units cause etckeeper with bzr backend to fail

Bug #1575627 reported by James Tait
24
This bug affects 4 people
Affects Status Importance Assigned to Milestone
snapd (Ubuntu)
Invalid
Medium
Unassigned

Bug Description

I use etckeeper to track changes to my /etc/ directory for easy rollback, backup and traceability. I use the bzr backend, because it's the supported VCS I'm most familiar with. Since installing snapd and the ubuntu-core and ubuntu-calculator-app snaps, bzr has been failing to commit the new systemd units generated for those snaps:

bzr: ERROR: bzrlib.errors.InvalidEntryName: Invalid entry name: snap-ubuntu\x2dcalculator\x2dapp-5.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\x2dcalculator\x2dapp-5.mount

bzr 2.7.0 on python 2.7.11 (Linux-4.4.0-21-generic-x86_64-with-
    Ubuntu-16.04-xenial)
arguments: ['/usr/bin/bzr', 'add', '-q', '.']
plugins: bash_completion[2.7.0], builddeb[2.8.6], bzrtools[2.6.0],
    changelog_merge[2.7.0], colo[0.4.0], etckeeper[unknown], grep[2.7.0],
    launchpad[2.7.0], netrc_credential_store[2.7.0], news_merge[2.7.0],
    pipeline[1.5.0], po_merge[2.7.0], qbzr[0.23.1], search[1.7.0dev],
    weave_fmt[2.7.0], webdav[1.12.2], xmloutput[0.8.8]
encoding: 'utf-8', fsenc: 'UTF-8', lang: 'en_GB.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

ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: snapd 2.0.2
ProcVersionSignature: Ubuntu 4.4.0-21.37-generic 4.4.6
Uname: Linux 4.4.0-21-generic x86_64
ApportVersion: 2.20.1-0ubuntu2
Architecture: amd64
CurrentDesktop: Unity
Date: Wed Apr 27 12:50:27 2016
InstallationDate: Installed on 2014-07-04 (662 days ago)
InstallationMedia: Ubuntu 14.04 LTS "Trusty Tahr" - Release amd64 (20140417)
SourcePackage: snapd
UpgradeStatus: Upgraded to xenial on 2016-04-25 (2 days ago)

Revision history for this message
James Tait (jamestait) wrote :
Revision history for this message
Samuele Pedroni (pedronis) wrote :

afaiu those units have such names because systemd mandates that format, also they are managed by snapd, as workaround wouldn't a .bzrignore or some etckeeper level equivalent help?

Revision history for this message
James Tait (jamestait) wrote :

Possibly, yes, but is that desirable? I suppose these files are worthless without the corresponding files in /var/lib/snapd/snaps?

If that's the case, maybe this bug should be reassigned to etckeeper, which seems to manage the list of ignored files itself and not export a way for other packages to add to that list. I'd be willing to be there are other packages that generate similar files.

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

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in snapd (Ubuntu):
status: New → Confirmed
Changed in snapd (Ubuntu):
importance: Undecided → Medium
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'
```

Revision history for this message
John Lenton (chipaca) wrote :

I'm setting the bug task of snapd to invalid, as it's not snapd's bug if etckeepter falls over because snapd creates files named in a way required by systemd.

Changed in snapd (Ubuntu):
status: Confirmed → Invalid
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.