TritonDataCenter / sdc-imgapi

SDC internal API for managing OS images
Mozilla Public License 2.0
5 stars 18 forks source link

linux-prepare-image deletes /var/log/lastlog #9

Closed chorrell closed 8 years ago

chorrell commented 8 years ago

We actually don't want to delete this as it doesn't necessarily get recreated. It can lead to warnings like

Oct  7 19:54:07 bd642506-bacb-4f73-8692-dd1f1dc548e2 sshd[1376]: lastlog_openseek: Couldn't stat /var/log/lastlog: No such file or directory

I think what would be better is to have the cleanup_logs function cat /dev/null > the log files rather than delete them.

So instead of this:

find /var/log -type f | xargs rm -f

We do this:

find /var/log -type f -exec sh -c '>{}' \;

So that just empties the files and then we also don't need to do things like recreated /var/log/wtmp here:

https://github.com/joyent/sdc-imgapi/blob/master/tools/prepare-image/linux-prepare-image#L67