Bug 1039540 - virt-sysprep to delete more logfiles
Summary: virt-sysprep to delete more logfiles
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libguestfs
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Pino Toscano
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-12-09 11:49 UTC by Jan van Eldik
Modified: 2013-12-09 18:52 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-12-09 16:48:15 UTC
Embargoed:


Attachments (Terms of Use)

Description Jan van Eldik 2013-12-09 11:49:04 UTC
Description of problem:

After running virt-sysprep, there are a few files that I feel should be removed:

/root/anaconda-post.log 
/tmp/yum.log 
/tmp/ks-script-*
/var/log/anaconda.syslog 
/var/log/tuned/tuned.log
/var/log/sa/*

My image has been created using Oz with an input TDL and Kickstart files

Version-Release number of selected component (if applicable):

libguestfs-tools-c-1.20.11-2.el6

Comment 1 Richard W.M. Jones 2013-12-09 12:20:29 UTC
A few things to note in general:

(1) virt-sysprep upstream (since 1.25.2) has support for deleting
arbitrary files and directories.  You do:

  virt-sysprep --delete /foo/bar [etc]

It's the same as doing 'rm -rf'.

(2) Even if you don't want to upgrade virt-sysprep, you can post-process
your images with guestfish, eg:

  guestfish -a disk.img -i <<EOF
    rm-rf /root/anaconda-post.log
    glob rm-rf /tmp/*
  EOF

-----

About these particular files:

> /root/anaconda-post.log 

This needs to be added.

> /tmp/yum.log 
> /tmp/ks-script-*

Since virt-sysprep 1.24, /tmp, /var/tmp are emptied properly.

> /var/log/anaconda.syslog
> /var/log/tuned/tuned.log

Both need to be added.

> /var/log/sa/*

Added in virt-sysprep 1.24.

Comment 2 Jan van Eldik 2013-12-09 12:41:41 UTC
Thanks for the quick reply, Richard, and for the 'glob rm-rf /tmp/*' hint.

Comment 3 Richard W.M. Jones 2013-12-09 16:48:15 UTC
Fixed upstream by:
https://github.com/libguestfs/libguestfs/commit/c89ffbc15291e9418e36540e5e78311b6f39011b
in libguestfs >= 1.25.14.

Comment 4 Pino Toscano 2013-12-09 18:52:11 UTC
And with another upstream commit:
https://github.com/libguestfs/libguestfs/commit/ed4bcb119cb908e98ecc1107dcd8b740ee2f484f
(always in libguestfs >= 1.25.14) --delete supports globbing, so you can do things like:
  virt-sysprep --delete '/tmp/ks-script-*' [etc]


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