Bug 1327596 - systemd creates btrfs <container>/var/lib/machines snapshot inside the container
Summary: systemd creates btrfs <container>/var/lib/machines snapshot inside the container
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: systemd
Version: 23
Hardware: All
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: systemd-maint
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-04-15 13:04 UTC by Paul Alesius
Modified: 2016-04-15 13:29 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-04-15 13:29:56 UTC
Type: Bug


Attachments (Terms of Use)

Description Paul Alesius 2016-04-15 13:04:37 UTC
Description of problem:
I have a btrfs disk mounted to /var/lib/machines on the host (no subvol, just the root of the btrfs), and something creates additional snapshots inside /var/lib/machines

Version-Release number of selected component (if applicable):
systemd.x86_64                           222-14.fc23               @@commandline
kernel 4.5

How reproducible:
always

Steps to Reproduce:
1. mount btrfs to /var/lib/machines
2. create a subvolume,let's say "testcontainer", so you have /var/lib/machines/testcontainer
3. After some time, I don't know when or what's causing it, but issuing:
    "btrfs subvolume list -a /var/lib/machines"
  results in:
    ID 279 gen 5904 top level 5 path testcontainer
    ID 285 gen 5904 top level 277 path <FS_TREE>/testcontainer/var/lib/machines


Additional info:
Note the additional subvolume that exists inside the container, the snapshot is of /var/lib/machines/testcontainer/var/lib/machines

Comment 1 Michal Sekletar 2016-04-15 13:08:33 UTC
I think it is systemd-tmpfiles which creates sub-volume inside the container once you boot it.

Comment 2 Paul Alesius 2016-04-15 13:21:43 UTC
You're right, I think this fixed it:

  cp /usr/lib/tmpfiles.d/systemd-nspawn.conf /var/lib/machines/etc/tmpfiles.d/
  vim /var/lib/machines/etc/tmpfiles.d/systemd-nspawn.conf

And comment out the line "v /var/lib/machines 0700 - - -"

The "v" according to "man tmpfiles.d", makes it create a snapshot.

It still shouldn't be the default behavior to create snapshots, since it creates a btrfs subvolume mess with stuff you don't want.

Comment 3 Paul Alesius 2016-04-15 13:29:47 UTC
Creating the directory /var/lib/machines inside the container, seems to also fix it, since tmpfiles.d will see that the directory exists and not invoke a btrfs subvolume/snapshot create to create it.


Note You need to log in before you can comment on or make changes to this bug.