#27 post: Work around LVM archival conflicting with ostree
Closed 6 years ago by dustymabe. Opened 7 years ago by walters.
walters/fedora-atomic lvm-workaround  into  f25

file modified
+40
@@ -5,12 +5,52 @@ 

  # Work around https://bugzilla.redhat.com/show_bug.cgi?id=1265295

  echo 'Storage=persistent' >> /etc/systemd/journald.conf

  

+ # Now, we generate a utility that changes a config file, and *requires*

+ # that that change was made.  (Unlike sed)

+ cat >/tmp/assert-sed <<EOF

+ #!/usr/bin/python

+ import os,sys,re

+ pattern = sys.argv[1]

+ replacement = sys.argv[2]

+ filepath = sys.argv[3]

+ newfilepath = filepath + '.new'

+ r = re.compile(pattern)

+ nmatches = 0

+ with open(filepath) as fin:

+     with open(newfilepath, 'w') as fout:

+         for line in fin:

+             (newline, this_nmatches) = r.subn(replacement, line)

+ 	    nmatches += this_nmatches

+ 	    fout.write(newline)

+ if nmatches == 0:

+     sys.stderr.write('Failed to find pattern {} in {}\n'.format(pattern, filepath))	    

+     os.unlink(newfilepath)

+     sys.exit(1)

+ os.rename(newfilepath, filepath)

+ EOF

+ chmod a+x /tmp/assert-sed

+ assert-sed() {

+     /tmp/assert-sed "$@"

+ }

+ 

  # Work around https://github.com/systemd/systemd/issues/4082

  find /usr/lib/systemd/system/ -type f -exec sed -i -e '/^PrivateTmp=/d' -e '/^Protect\(Home\|System\)=/d' {} \;

  

+ # Work around https://bugzilla.redhat.com/show_bug.cgi?id=1365297

+ cat >/usr/lib/tmpfiles.d/ostree-lvm.conf<<EOF

+ d /var/lib/lvm 0755 0 0 - -

+ d /var/lib/lvm/backup 0755 0 0 - -

+ d /var/lib/lvm/archive 0755 0 0 - -

+ EOF

+ assert-sed '^(\s*backup_dir\s*=)(.*)' '\1 "/var/lib/lvm/backup"' '/etc/lvm/lvm.conf'

+ assert-sed '^(\s*archive_dir\s*=)(.*)' '\1 "/var/lib/lvm/archive"' '/etc/lvm/lvm.conf'

+ 

+ rm -f /tmp/assert-sed

+ 

  # See: https://bugzilla.redhat.com/show_bug.cgi?id=1051816

  KEEPLANG=en_US

  find /usr/share/locale -mindepth  1 -maxdepth 1 -type d -not -name "${KEEPLANG}" -exec rm -rf {} +

  localedef --list-archive | grep -a -v ^"${KEEPLANG}" | xargs localedef --delete-from-archive

  cp -f /usr/lib/locale/locale-archive /usr/lib/locale/locale-archive.tmpl

  build-locale-archive

+ 

is this needed still? it has conflicts currently

It's still valid. I may get back to it.

Would be nice to see this happen still. I'm sorely reminded of it every time I run ostree admin config-diff and have to swim through the output.

Yeah, but the priority for me dropped way way down since for Fedora now we don't use devicemapper by default for Docker, and that makes LVM make backups way less often.

I'm going to close this PR. Originally it was created to handle https://bugzilla.redhat.com/show_bug.cgi?id=1365297 but the fix that we're going to invest time in is a more generic fix for solving lost /etc/ changes that were done post upgrade but pre-reboot problems.

Pull-Request has been closed by dustymabe

6 years ago
Metadata