OpenNebula / addon-context-linux

Linux VM Contextualization
Apache License 2.0
56 stars 73 forks source link

Onesysprep deletes `/var/log/wtmp` which prevents `last` command from working on CentOS/RHEL7 #253

Closed ospalax closed 2 years ago

ospalax commented 2 years ago

Running onesysprep command inside CentOS/RHEL 7 will delete /var/log/wtmp which is needed for last command to work on these systems.

Solution is to just truncate the file.

ospalax commented 2 years ago

On a second thought - preventing the deletion of wtmp and btmp files will record the current active session - which is not desired... and on reboot these files are recreated so last command starts working again...

I will close this as non-bug after a feedback from the sponsor.

ospalax commented 2 years ago

IMHO

This was not an actual error to be fixed - the behavior is correct as is - upon running the onesysprep command the aforementioned files are deleted, the system then should be power-offed and image saved.

Upon a reboot these files are correctly recreated and last command functions correctly.

If this workaround would be merged then it would leave the last session before power-off baked in the image and therefore it would not be properly cleaned up.

It can be reopened if it really does help on some systems which do fail to create these files on reboot.