1830407 Members
3683 Online
110002 Solutions
New Discussion

utmp file cleaning

 
Wenth Leopold
Occasional Advisor

utmp file cleaning

dear all
i have in /etc/ the file utmp
with the command who -u i can see that in this
file there are processes which in fact do not
exist anymore
what is the best way to clean that utmp
file , so that i have the correct who -u display
stay small think large
8 REPLIES 8
T G Manikandan
Honored Contributor

Re: utmp file cleaning

If you dont need to preserve data:
# cat /dev/null > /var/adm/wtmp

If you want to preserve :
# /usr/sbin/acct/fwtmp < /var/adm/wtmp > /tmp/wtmp_data
Edit & make changes, then
# /usr/sbin/acct/fwtmp -ic < /tmp/wtmp_data > /var/adm/wtmp

James R. Ferguson
Acclaimed Contributor

Re: utmp file cleaning

Hi Wenth:

A reboot is the simplest, cleanest choice.

Regards!

...JRF...
T G Manikandan
Honored Contributor

Re: utmp file cleaning

Please ignore my previous post.
T G Manikandan
Honored Contributor

Re: utmp file cleaning

I had given the steps to fix the corrupt wtmp file.
I have never tried fwtmp with utmp, but should follow the procedure to fix it. Make sure you backup the current file before any changes.

Thanks.
Dennis Handly
Acclaimed Contributor

Re: utmp file cleaning

>T G Manikandan: I had given the steps to fix the corrupt wtmp file.

It seems to work fine for me:
$ /usr/sbin/acct/fwtmp < /etc/utmp > utmp_t
$ /usr/sbin/acct/fwtmp -ic < utmp_t > utmp_t.bin
$ cmp -l utmp_t.bin /etc/utmp
1055 0 162
1056 0 162

But it depends on the OS since utmpd(1m) is being used on 11.23. And that uses /etc/utmpx.

Wenth Leopold
Occasional Advisor

Re: utmp file cleaning

dear all

reboot is in my case not possible
the "lost processesnumcbers " is see i
in my utmp are mainly processes with
the name gold -- which is in fact goglobalux version 2.2.6 -- maybe one of you have same programm with the same troubles -
by troubles i mean - that if i have these many "ghost processes" new users cannot start
the apllication any more -- only stopping and starting of goglobalux solves my problems
-- maybe these gold processes are execeeding also som kernelparameters --
stay small think large
Wenth Leopold
Occasional Advisor

Re: utmp file cleaning

hallo
i forgot to post my hp ux version

B.11.11 U 9000/800
stay small think large
Dennis Handly
Acclaimed Contributor

Re: utmp file cleaning

>reboot is in my case not possible

Then try using fwtmp to remove these phantom processes.