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
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.
Thanks for the quick reply, Richard, and for the 'glob rm-rf /tmp/*' hint.
Fixed upstream by: https://github.com/libguestfs/libguestfs/commit/c89ffbc15291e9418e36540e5e78311b6f39011b in libguestfs >= 1.25.14.
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]