Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Huge (sparse) files /var/log/lastlog and /var/log/faillog trouble docker #2287

Closed
tornaria opened this issue Aug 12, 2017 · 4 comments
Closed

Comments

@tornaria
Copy link

tornaria commented Aug 12, 2017

The files /var/log/lastlog and /var/log/faillog store records per user offset by a multiple of user id. Since cocalc uses huge user ids for projects, they result in huge files, which are not in principle a problem (they are stored as files with holes).

However, this creates trouble with some docker functions (e.g. docker commit for sure, and maybe docker export as well), since they create a copy of the file sequentially which takes a long time and disk space (hundreds of gigabytes).

One possible solution:

  • use option -l for useradd to avoid initializing those files when project-user creation
  • configure the login process to avoid extending those files when login to a project via ssh (not tested: I think one can do this by removing pam_lastlog from /etc/pam.d/login)

Alternative (simpler) solution:

  • just remove /var/log/faillog and /var/log/lastlog as both useradd and pam_lastlog do not create the file if it doesn't exist

I think both solutions are functionally equivalent; the second one is trivial to do on a running container without any source changes (so it could just be a quick hint in the documentation).

What is lost: those files register the last login time, and failed login time, so the only thing missing seems to be the line "Last login time: xxxx" at login time, which won't show up.

It's very easy to reenable the feature: just touch /var/log/{last,fail}log to create empty files which will then be used (and thus extended to huge-files-with-holes).

Note that similar (and more) information can still be obtained using last and lastb commands which use the data from /var/log/wtmp and /var/log/btmp and don't suffer from this huge-file issue.

Edit: I think wtmp will still be updated as long as the second solution is used. With the first solution accounting will not be done at all, since it's the same pam_lastlog which updates wtmp. It'd be cool if pam_lastlog would print the information from wtmp if the other file is missing, but that doesn't seem to be the case.

@tornaria
Copy link
Author

@haraldschilly
Copy link
Contributor

Oh, good points, so, in essence, this is a problem with docker after such a user has been created. We should at least explain this in the documentation.

@williamstein
Copy link
Contributor

Move this to new Docker repo?

@williamstein
Copy link
Contributor

Closing — this should be at sagemathinc/cocalc-docker#6

openstack-gerrit pushed a commit to openstack/kolla that referenced this issue Nov 1, 2018
These two files are useless in container, and disable them will save
about 18MB size for image. More info please check[1].

[1] sagemathinc/cocalc#2287 (comment)

Change-Id: I1bba59260043782fd7c9306b194d144d027a29e0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants