You are not logged in.

#1 2014-09-09 08:07:42

Pilsbert
Member
From: Germany
Registered: 2014-09-09
Posts: 6

[SOLVED] root .bash_history unexpectedly reset to 0 bytes

Hi there,

yesterday evening I turned off my machine (using GNOME). Currently, I was logged in as root on a console and in parallel in my usually GNOME session. Today a logged in as root again to peform updates and I recognized that the root history is empty. That is, the .bash_history file is empty and was last modified at the exact time I turned off my machine yesterday. So what's the reason? Was this a bug or some sort of race condition during shutdown? I'm  a little bit afraid someone modified something on the system and maybe tried to delete his traces by deleting the root bash history.

Kind regards

Last edited by Pilsbert (2014-09-11 09:33:31)

Offline

#2 2014-09-09 08:29:10

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] root .bash_history unexpectedly reset to 0 bytes

Anything in your journal? Logs?


Not a Sysadmin issue, moving to NC...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2014-09-09 09:18:10

Pilsbert
Member
From: Germany
Registered: 2014-09-09
Posts: 6

Re: [SOLVED] root .bash_history unexpectedly reset to 0 bytes

Thanks for your reply.

By scrolling over the journal entries since yesterday I did not recognize something special... An output of ps -ax also lists no abnormal process name.

I also performed an update yesterday, but only 5 packages were updated (ntp, colord, libqmi, libtracker-sparql, tracker).

So maybe it was only a bug that the content of the history was deleted.

Offline

#4 2014-09-09 09:21:33

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] root .bash_history unexpectedly reset to 0 bytes

What are your history settings in root's bashrc?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#5 2014-09-09 09:37:13

Pilsbert
Member
From: Germany
Registered: 2014-09-09
Posts: 6

Re: [SOLVED] root .bash_history unexpectedly reset to 0 bytes

Actually, there is no .bashrc file in the /root directory. The /etc/bash.bashrc file looks like this

#
# /etc/bash.bashrc
#

# If not running interactively, don't do anything
[[ $- != *i* ]] && return

PS1='[\u@\h \W]\$ '
PS2='> '
PS3='> '
PS4='+ '

case ${TERM} in
  xterm*|rxvt*|Eterm|aterm|kterm|gnome*)
    PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"'

    ;;
  screen)
    PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }'printf "\033_%s@%s:%s\033\\" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"'
    ;;
esac

[ -r /usr/share/bash-completion/bash_completion   ] && . /usr/share/bash-completion/bash_completion

Offline

#6 2014-09-09 10:18:50

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] root .bash_history unexpectedly reset to 0 bytes

Please use code tags when pasting to the boards: https://wiki.archlinux.org/index.php/Fo … s_and_Code


See `man bash` for details on history settings, but if HISTFILE is not set, no history is saved when the shell exits.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#7 2014-09-09 10:33:39

Pilsbert
Member
From: Germany
Registered: 2014-09-09
Posts: 6

Re: [SOLVED] root .bash_history unexpectedly reset to 0 bytes

I'll use the code tag for posting code in the future.

But my installation exists for 1.5 years and I neither changed any bashrc file nor edited the HISTFILE environment variable. If I execute

 declare -p 

as root in both gnome-terminal and a VT HISTFILE and HISTFILESIZE are correctly set (although root still hasn't any .bashrc file)

Offline

#8 2014-09-09 19:15:38

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] root .bash_history unexpectedly reset to 0 bytes

Have you tried to replicate? You could run a strace while doing so to see if that turns up anything.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#9 2014-09-11 08:17:13

Pilsbert
Member
From: Germany
Registered: 2014-09-09
Posts: 6

Re: [SOLVED] root .bash_history unexpectedly reset to 0 bytes

I tried to replicate it two times. First by being logged in as root in a VT and in gnome-terminal at a time, and second being logged in as root only in a VT. Then  i turned off the computer (using gnome-shell poweroff). Result: In both cases the root history was not deleted.

Offline

#10 2014-09-11 09:01:48

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] root .bash_history unexpectedly reset to 0 bytes


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#11 2014-09-11 09:13:38

Pilsbert
Member
From: Germany
Registered: 2014-09-09
Posts: 6

Re: [SOLVED] root .bash_history unexpectedly reset to 0 bytes

Thanks a lot!

You can mark this thread as solved wink

Last edited by Pilsbert (2014-09-11 09:15:06)

Offline

#12 2014-09-11 09:21:45

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] root .bash_history unexpectedly reset to 0 bytes

Well, actually, you can... by editing your first post and prepending it to the title.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB