`su` 和 `sudo bash` 给出一个 root 提示符,不会执行任何命令

`su` 和 `sudo bash` 给出一个 root 提示符,不会执行任何命令

这种情况发生在 CentOS 6.7 服务器上,我可以以 root 或普通用户身份 ssh 到该服务器。

以普通用户身份打开 ssh 会话并在会话中切换到 root 会得到预期的提示,但任何命令都会返回到之前的状态:

ordinary@server [~]# su
Password: 
root@server [/home/ordinary]# ls
ordinary@server [~]# sudo bash
[sudo] password for root: 
root@server [/home/ordinary]# ls
ordinary@server [~]# 

su -做同样的事情。添加set -xv到 的末尾/root/.bashrc会生成一些额外的输出:

ordinary@server [~]# su
Password: 
history -a
__rvm_date "+%s.%N" 2>/dev/null) ${BASH_SOURCE##${rvm_path:-}} : ${FUNCNAME[0]:+${FUNCNAME[0]}()}  ${LINENO} > 
__rvm_date "+%s.%N" 2>/dev/null
++   :   0 > history -a
root@server [/home/ordinary]# ls
ordinary@server [~]# su -
Password: 

# User specific environment and startup programs

PATH=$PATH:$HOME/bin
+ PATH=/usr/local/jdk/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/lib/courier-imap/sbin:/usr/lib/courier-imap/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/X11R6/bin:/root/bin

export PATH
+ export PATH
history -a
++ history -a
root@server [~]# ls
ordinary@server [~]# sudo bash
[sudo] password for root: 
history -a
++ history -a
root@server [/home/ordinary]# ls
ordinary@server [~]# 

这里发生了什么?看起来身份验证正在工作,bash 正在给出提示并等待命令,但在运行它得到的命令之前退出。有什么地方可以查找错误消息吗?


以下是 root 的启动文件:

.profile不存在

.bash_配置文件:

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH

.bashrc:

#################################################
# interactive failsafes and general aliasing
#################################################
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias grep='grep --color'

############################
# Source global definitions
############################
if [ -f /etc/bashrc ]; then
    . /etc/bashrc
fi

############################
# Important history hacks
############################
#how many lines to keep in the history FILE
export HISTFILESIZE=500000
#how many lines to keep in memory for this SESSION.
export HISTSIZE=200000
#how to make it oh so very pretty.
HISTTIMEFORMAT="(%m/%d/%y) %T "
export HISTTIMEFORMAT
#append the history for all terminals
shopt -s histappend
export PROMPT_COMMAND='history -a'

###########################
# give some terminal <3
###########################
#set check window resize
shopt -s checkwinsize 

#######################
# vim defaults
#######################
alias vi=vim
export EDITOR=vim

# EOF

#set -xv

sudo bash --norc做同样的事情。这是来自的日志sudo strace -o bash--norc.strace bash --norc

execve("/bin/bash", ["bash", "--norc"], [/* 17 vars */]) = 0
brk(0)                                  = 0x28d0000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb8d4ce2000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=54952, ...}) = 0
mmap(NULL, 54952, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fb8d4cd4000
close(3)                                = 0
open("/lib64/libtinfo.so.5", O_RDONLY)  = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0@\310\0k<\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=134792, ...}) = 0
mmap(0x3c6b000000, 2228832, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x3c6b000000
mprotect(0x3c6b01d000, 2093056, PROT_NONE) = 0
mmap(0x3c6b21c000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1c000) = 0x3c6b21c000
mmap(0x3c6b220000, 608, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x3c6b220000
close(3)                                = 0
open("/lib64/libdl.so.2", O_RDONLY)     = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\340\r\200d<\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=22536, ...}) = 0
mmap(0x3c64800000, 2109696, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x3c64800000
mprotect(0x3c64802000, 2097152, PROT_NONE) = 0
mmap(0x3c64a02000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x3c64a02000
close(3)                                = 0
open("/lib64/libc.so.6", O_RDONLY)      = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0p\356Ad<\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1926520, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb8d4cd3000
mmap(0x3c64400000, 3750152, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x3c64400000
mprotect(0x3c6458a000, 2097152, PROT_NONE) = 0
mmap(0x3c6478a000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x18a000) = 0x3c6478a000
mmap(0x3c6478f000, 18696, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x3c6478f000
close(3)                                = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb8d4cd2000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb8d4cd1000
arch_prctl(ARCH_SET_FS, 0x7fb8d4cd2700) = 0
mprotect(0x3c64a02000, 4096, PROT_READ) = 0
mprotect(0x3c6478a000, 16384, PROT_READ) = 0
mprotect(0x3c6421f000, 4096, PROT_READ) = 0
munmap(0x7fb8d4cd4000, 54952)           = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
open("/dev/tty", O_RDWR|O_NONBLOCK)     = 3
close(3)                                = 0
brk(0)                                  = 0x28d0000
brk(0x28f1000)                          = 0x28f1000
open("/usr/lib/locale/locale-archive", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=99154480, ...}) = 0
mmap(NULL, 99154480, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fb8cee41000
close(3)                                = 0
getuid()                                = 0
getgid()                                = 0
geteuid()                               = 0
getegid()                               = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
ioctl(0, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B9600 opost isig icanon echo ...}) = 0
ioctl(2, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B9600 opost isig icanon echo ...}) = 0
open("/proc/meminfo", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb8d4ce1000
read(3, "MemTotal:        8048372 kB\nMemF"..., 1024) = 1024
close(3)                                = 0
munmap(0x7fb8d4ce1000, 4096)            = 0
rt_sigaction(SIGCHLD, {SIG_DFL, [], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGCHLD, {SIG_DFL, [], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGQUIT, {SIG_DFL, [], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGQUIT, {SIG_DFL, [], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGTERM, {SIG_DFL, [], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGTERM, {SIG_DFL, [], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGHUP, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGINT, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGILL, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGTRAP, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGABRT, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGFPE, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGBUS, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGSEGV, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGSYS, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGPIPE, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGALRM, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGTERM, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGXCPU, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGXFSZ, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGVTALRM, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGUSR1, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGUSR2, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
rt_sigaction(SIGQUIT, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGINT, {0x452880, [], SA_RESTORER, 0x3c644326a0}, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGTERM, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGWINCH, {0x452410, [], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGINT, {0x452880, [], SA_RESTORER, 0x3c644326a0}, {0x452880, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGTSTP, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGTTOU, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGTTIN, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], 0}, 8) = 0
uname({sys="Linux", node="server", ...}) = 0
socket(PF_LOCAL, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3
connect(3, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = 0
sendto(3, "\2\0\0\0\v\0\0\0\7\0\0\0passwd\0", 19, MSG_NOSIGNAL, NULL, 0) = 19
poll([{fd=3, events=POLLIN|POLLERR|POLLHUP}], 1, 5000) = 1 ([{fd=3, revents=POLLIN}])
recvmsg(3, {msg_name(0)=NULL, msg_iov(2)=[{"passwd\0", 7}, {"\270O\3\0\0\0\0\0", 8}], msg_controllen=24, {cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=SCM_RIGHTS, {4}}, msg_flags=MSG_CMSG_CLOEXEC}, MSG_CMSG_CLOEXEC) = 15
mmap(NULL, 217016, PROT_READ, MAP_SHARED, 4, 0) = 0x7fb8cee0c000
close(4)                                = 0
close(3)                                = 0
getcwd("/home/ordinary", 4096)       = 18
getpid()                                = 24450
open("/usr/lib64/gconv/gconv-modules.cache", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=26060, ...}) = 0
mmap(NULL, 26060, PROT_READ, MAP_SHARED, 3, 0) = 0x7fb8cee05000
close(3)                                = 0
getppid()                               = 24447
stat(".", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
stat("/sbin/bash", 0x7fff1c54f990)      = -1 ENOENT (No such file or directory)
stat("/bin/bash", {st_mode=S_IFREG|0755, st_size=941768, ...}) = 0
stat("/bin/bash", {st_mode=S_IFREG|0755, st_size=941768, ...}) = 0
geteuid()                               = 0
getegid()                               = 0
getuid()                                = 0
getgid()                                = 0
access("/bin/bash", X_OK)               = 0
stat("/bin/bash", {st_mode=S_IFREG|0755, st_size=941768, ...}) = 0
geteuid()                               = 0
getegid()                               = 0
getuid()                                = 0
getgid()                                = 0
access("/bin/bash", R_OK)               = 0
stat("/bin/bash", {st_mode=S_IFREG|0755, st_size=941768, ...}) = 0
stat("/bin/bash", {st_mode=S_IFREG|0755, st_size=941768, ...}) = 0
geteuid()                               = 0
getegid()                               = 0
getuid()                                = 0
getgid()                                = 0
access("/bin/bash", X_OK)               = 0
stat("/bin/bash", {st_mode=S_IFREG|0755, st_size=941768, ...}) = 0
geteuid()                               = 0
getegid()                               = 0
getuid()                                = 0
getgid()                                = 0
access("/bin/bash", R_OK)               = 0
getpgrp()                               = 24446
dup(2)                                  = 3
getrlimit(RLIMIT_NOFILE, {rlim_cur=1024, rlim_max=4*1024}) = 0
fcntl(255, F_GETFD)                     = -1 EBADF (Bad file descriptor)
dup2(3, 255)                            = 255
close(3)                                = 0
ioctl(255, TIOCGPGRP, [24446])          = 0
setpgid(0, 24450)                       = 0
rt_sigprocmask(SIG_BLOCK, [CHLD TSTP TTIN TTOU], [], 8) = 0
ioctl(255, SNDRV_TIMER_IOCTL_SELECT or TIOCSPGRP, [24450]) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
ioctl(255, TIOCGPGRP, [24450])          = 0
fcntl(255, F_SETFD, FD_CLOEXEC)         = 0
rt_sigaction(SIGCHLD, {0x43f5a0, [], SA_RESTORER, 0x3c644326a0}, {SIG_DFL, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
ioctl(255, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B9600 opost isig icanon echo ...}) = 0
getrlimit(RLIMIT_NPROC, {rlim_cur=62714, rlim_max=62714}) = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
fcntl(0, F_GETFL)                       = 0x8002 (flags O_RDWR|O_LARGEFILE)
open("/root/.bash_history", O_RDONLY)   = 3
fstat(3, {st_mode=S_IFREG|0600, st_size=49948, ...}) = 0
read(3, "screen -S ded_setup\nexit\n#137414"..., 49948) = 49948
close(3)                                = 0
stat("/root/.bash_history", {st_mode=S_IFREG|0600, st_size=49948, ...}) = 0
open("/root/.bash_history", O_RDONLY)   = 3
fstat(3, {st_mode=S_IFREG|0600, st_size=49948, ...}) = 0
read(3, "screen -S ded_setup\nexit\n#137414"..., 49948) = 49948
close(3)                                = 0
brk(0x2912000)                          = 0x2912000
ioctl(255, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B9600 opost isig icanon echo ...}) = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
rt_sigaction(SIGINT, {0x452880, [], SA_RESTORER, 0x3c644326a0}, {0x452880, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
ioctl(1, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B9600 opost isig icanon echo ...}) = 0
stat("/root/.terminfo", 0x7fff1c54dae0) = -1 ENOENT (No such file or directory)
stat("/etc/terminfo", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
access("/etc/terminfo/s/screen-256color-bce", R_OK) = -1 ENOENT (No such file or directory)
stat("/usr/share/terminfo", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
access("/usr/share/terminfo/s/screen-256color-bce", R_OK) = 0
open("/usr/share/terminfo/s/screen-256color-bce", O_RDONLY) = 3
read(3, "\32\0017\0+\0\20\0i\1\325\2screen-256color-bce|"..., 4097) = 1840
close(3)                                = 0
ioctl(1, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B9600 opost isig icanon echo ...}) = 0
ioctl(1, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B9600 opost isig icanon echo ...}) = 0
ioctl(1, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B9600 opost isig icanon echo ...}) = 0
ioctl(1, TIOCGWINSZ, {ws_row=51, ws_col=209, ws_xpixel=1254, ws_ypixel=663}) = 0
ioctl(0, TIOCGWINSZ, {ws_row=51, ws_col=209, ws_xpixel=1254, ws_ypixel=663}) = 0
ioctl(0, TIOCGWINSZ, {ws_row=51, ws_col=209, ws_xpixel=1254, ws_ypixel=663}) = 0
ioctl(0, SNDRV_TIMER_IOCTL_STATUS or TIOCSWINSZ, {ws_row=51, ws_col=209, ws_xpixel=1254, ws_ypixel=663}) = 0
ioctl(0, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B9600 opost isig icanon echo ...}) = 0
stat("/etc/inputrc", {st_mode=S_IFREG|0644, st_size=942, ...}) = 0
open("/etc/inputrc", O_RDONLY)          = 3
read(3, "# do not bell on tab-completion\n"..., 942) = 942
close(3)                                = 0
brk(0x2933000)                          = 0x2933000
rt_sigprocmask(SIG_BLOCK, [CHLD TSTP TTIN TTOU], [], 8) = 0
ioctl(255, SNDRV_TIMER_IOCTL_SELECT or TIOCSPGRP, [24450]) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigaction(SIGINT, {0x452880, [], SA_RESTORER, 0x3c644326a0}, {0x452880, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigprocmask(SIG_BLOCK, [INT], [], 8) = 0
ioctl(0, TIOCGWINSZ, {ws_row=51, ws_col=209, ws_xpixel=1254, ws_ypixel=663}) = 0
ioctl(0, SNDRV_TIMER_IOCTL_STATUS or TIOCSWINSZ, {ws_row=51, ws_col=209, ws_xpixel=1254, ws_ypixel=663}) = 0
ioctl(0, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B9600 opost isig icanon echo ...}) = 0
ioctl(0, SNDCTL_TMR_STOP or SNDRV_TIMER_IOCTL_GINFO or TCSETSW, {B9600 opost isig -icanon -echo ...}) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [INT QUIT ALRM TERM TSTP TTIN TTOU], [], 8) = 0
rt_sigaction(SIGINT, {0x495aa0, [], SA_RESTORER, 0x3c644326a0}, {0x452880, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGTERM, {0x495aa0, [], SA_RESTORER, 0x3c644326a0}, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGTERM, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, {0x495aa0, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGQUIT, {0x495aa0, [], SA_RESTORER, 0x3c644326a0}, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGQUIT, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, {0x495aa0, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGALRM, {0x495aa0, [], SA_RESTORER, 0x3c644326a0}, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGTSTP, {0x495aa0, [], SA_RESTORER, 0x3c644326a0}, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGTSTP, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, {0x495aa0, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGTTOU, {0x495aa0, [], SA_RESTORER, 0x3c644326a0}, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGTTOU, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, {0x495aa0, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGTTIN, {0x495aa0, [], SA_RESTORER, 0x3c644326a0}, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGTTIN, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, {0x495aa0, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigaction(SIGWINCH, {0x4959a0, [], SA_RESTORER|SA_RESTART, 0x3c644326a0}, {0x452410, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigprocmask(SIG_BLOCK, [INT], [], 8) = 0
fstat(2, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb8cee04000
write(2, "bash-4.1# ", 10)              = 10
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
read(0, "l", 1)                         = 1
rt_sigprocmask(SIG_BLOCK, [INT], [], 8) = 0
write(2, "l", 1)                        = 1
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
read(0, "s", 1)                         = 1
rt_sigprocmask(SIG_BLOCK, [INT], [], 8) = 0
write(2, "s", 1)                        = 1
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
read(0, "\r", 1)                        = 1
write(2, "\n", 1)                       = 1
rt_sigprocmask(SIG_BLOCK, [INT], [], 8) = 0
ioctl(0, SNDCTL_TMR_STOP or SNDRV_TIMER_IOCTL_GINFO or TCSETSW, {B9600 opost isig icanon echo ...}) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
rt_sigaction(SIGINT, {0x452880, [], SA_RESTORER, 0x3c644326a0}, {0x495aa0, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGTERM, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGQUIT, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGALRM, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, {0x495aa0, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGTSTP, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGTTOU, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGTTIN, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, {SIG_IGN, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
rt_sigaction(SIGWINCH, {0x452410, [], SA_RESTORER, 0x3c644326a0}, {0x4959a0, [], SA_RESTORER|SA_RESTART, 0x3c644326a0}, 8) = 0
socket(PF_NETLINK, SOCK_RAW, 9)         = 3
sendmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(2)=[{"\23\0\0\0d\4\1\0\0\0\0\0\0\0\0\0", 16}, {"ls\0", 3}], msg_controllen=0, msg_flags=0}, 0) = 19
close(3)                                = 0
rt_sigaction(SIGINT, {0x452880, [], SA_RESTORER, 0x3c644326a0}, {0x452880, [], SA_RESTORER, 0x3c644326a0}, 8) = 0
getuid()                                = 0
getuid()                                = 0
ioctl(0, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B9600 opost isig icanon echo ...}) = 0
ioctl(0, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B9600 opost isig icanon echo ...}) = 0
readlink("/proc/self/fd/0", "/dev/pts/1", 4095) = 10
access("/var/run/utmpx", F_OK)          = -1 ENOENT (No such file or directory)
open("/var/run/utmp", O_RDONLY|O_CLOEXEC) = 3
fcntl(3, F_GETFD)                       = 0x1 (flags FD_CLOEXEC)
lseek(3, 0, SEEK_SET)                   = 0
alarm(0)                                = 0
rt_sigaction(SIGALRM, {0x3c64524720, [], SA_RESTORER, 0x3c644326a0}, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, 8) = 0
alarm(10)                               = 0
fcntl(3, F_SETLKW, {type=F_RDLCK, whence=SEEK_SET, start=0, len=0}) = 0
read(3, "\2\0\0\0\0\0\0\0~\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\1\0\0\0003\0\0\0~\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\6\0\0\0\221\37\0\0tty3\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\6\0\0\0\225\37\0\0tty5\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\6\0\0\0\217\37\0\0tty2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\6\0\0\0\223\37\0\0tty4\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\6\0\0\0\215\37\0\0tty1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\6\0\0\0\227\37\0\0tty6\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\7\0\0\0\247]\0\0pts/0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0%,\0\0pts/1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0J<\0\0pts/2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0002V\0\0pts/3\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0\275\t\0\0pts/5\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0\275\f\0\0pts/7\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0\263\22\0\0pts/9\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0?M\0\0pts/10\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0\244t\0\0pts/11\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0\352\n\0\0pts/13\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0\23\"\0\0pts/15\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0\213>\0\0pts/17\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0x)\0\0pts/6\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0\377G\0\0pts/8\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0\3051\0\0pts/12\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0\352\f\0\0pts/14\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0\311,\0\0pts/16\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0yA\0\0pts/19\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0A\10\0\0pts/5\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0\323\36\0\0pts/4\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0\rY\0\0pts/3\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0ll\0\0pts/1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0=&\0\0pts/4\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0}*\0\0pts/6\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "\10\0\0\0\317\25\0\0pts/8\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 384) = 384
read(3, "", 384)                        = 0
fcntl(3, F_SETLKW, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0}) = 0
alarm(0)                                = 10
rt_sigaction(SIGALRM, {0x4525f0, [HUP INT ILL TRAP ABRT BUS FPE USR1 SEGV USR2 PIPE ALRM TERM XCPU XFSZ VTALRM SYS], SA_RESTORER, 0x3c644326a0}, NULL, 8) = 0
socket(PF_LOCAL, SOCK_DGRAM|SOCK_CLOEXEC, 0) = 4
connect(4, {sa_family=AF_LOCAL, sun_path="/dev/log"}, 110) = 0
open("/etc/localtime", O_RDONLY)        = 5
fstat(5, {st_mode=S_IFREG|0644, st_size=3519, ...}) = 0
fstat(5, {st_mode=S_IFREG|0644, st_size=3519, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb8cee03000
read(5, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\4\0\0\0\4\0\0\0\0"..., 4096) = 3519
lseek(5, -2252, SEEK_CUR)               = 1267
read(5, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5\0\0\0\5\0\0\0\0"..., 4096) = 2252
close(5)                                = 0
munmap(0x7fb8cee03000, 4096)            = 0
sendto(4, "<151>Nov 17 10:30:55 bash: No UT"..., 63, MSG_NOSIGNAL, NULL, 0) = 63
close(4)                                = 0
exit_group(0)                           = ?
+++ exited with 0 +++

我不知道足够多的信息来发现此日志中的问题,但我确实看到它尝试写入/dev/log以“bash:No UT”开头的消息。我猜测这与 utmp 有关,并尝试清除/var/run/utmp,但没有效果。

答案1

尝试sudo -s。这应该可以解决它。

相关内容