Questions tagged [strace]
strace is a debugging utility for tracing system calls and signals under Linux.
209
questions
0
votes
0
answers
34
views
Convinent way of making SystemCallFilter lists
Systemd unit hardening is pretty new to me, for SystemCallFilter in specific, I had to deal with it once in my distro because one of the units was crashing, and I had no idea why, but that is about it....
4
votes
1
answer
1k
views
Typing in the Terminal on Ubuntu takes seconds until the typed character appears
The problem: typing in the terminal on Ubuntu takes seconds until the typed character appears.
I first noticed this after I moved large chunks of data onto another LUKS encrypted HDD which I mounted ...
4
votes
1
answer
166
views
When (and how) are file permission/access decisions made in kernel space?
(I think) I have a relatively good understanding of how Linux permissions work - traditional Unix DAC permissions, and how they're represented, security context in relation to processes (i.e. cred ...
0
votes
1
answer
138
views
How to perform strace on shell without changing your current shell?
I use strace to trace the behavior of a bash process. The purpose is to find out the order bash loads its configuration files.
I am running the following command under zsh:
strace -e openat bash
...
3
votes
1
answer
706
views
How to parse strace recvfrom syscall?
I strace a curl command:
strace -s 2000 -f curl google.com
and see 2 DNS queries
recvfrom(3, "\302\325\201\200\0\1\0\1\0\0\0\0\6google\3com\0\0\34\0\1\6google\3com\0\0\34\0\1\0\0\0\362\0\20*\0\...
1
vote
1
answer
63
views
log out from slim, or slim restart results in blank screen for several minutes
I am using slim login manager.
when I log out from my session, or restart slim from the commandline:
service slim restart
I get blank console for couple of minutes, before the slim login screen ...
2
votes
1
answer
1k
views
Debugging strange EACCES (Permission denied) permission error
I have a symlink to a world-readable file that a c program is being unable to read. redshift is supposed to pick up configuration from $HOME/.config/redshift/redsihft.conf automatically, but it wasn't....
1
vote
1
answer
149
views
How to trace file descriptor duplication?
I am learning to use redirection. the typical operation is like below:
command > file 2>&1
Refer to APUE 3.10 and 3.12, I think the critical syscall sequence is like below:
open(...
0
votes
1
answer
842
views
How to trace on continuously running process?
So I wanted to know how files are opened by zsh like .xinitrc, .xprofile, .zprofile, and exactly in which order. So I have decided to strace on zsh process with the grep command to see how the open ...
0
votes
1
answer
902
views
How can I get a custom tmux.conf file to work with tmux 3.3a? `-f` flag not working as expected
I have tmux and wanted to set some custom configurations, but I cannot find a default tmux.conf file.
tmux -V
tmux 3.3a
According to the manpage:
-f file
Specify an alternative ...
0
votes
0
answers
302
views
Process stucked at recvfrom syscall
A process is stucked at recvfrom syscall.
> sudo strace -p 4146278
strace: Process 4146278 attached
recvfrom(9 ...
I looked up under /proc/4146278/fd.
fd 9 seems to be a socket.
> sudo ls -al /...
0
votes
1
answer
830
views
vim very slow over SSH connection
I have a non-stellar SSH connection to some machine; the echo time is... I don't know, 0.2 seconds or so.
Anyway, when I start vim, say with no input file, I experience a long delay, of about 3 to 4 ...
0
votes
1
answer
117
views
Why doesn't strace -f work on GNOME Terminal?
I tried running the command
strace -f gnome-terminal --wait |& grep write
and then in the terminal window that opened, I typed ls and pressed enter.
I expected to see write syscalls corresponding ...
4
votes
1
answer
228
views
terminal: Error occurred while reset 800b: errno=25
I have an extremely bizarre problem, occurring somewhere at the intersection of terminal, su, w3m and /dev/null:
when I su - from user1 to user2, following command does not work:
$ w3m zz.html 2>/...
1
vote
0
answers
244
views
Hint to investigate some SEGFAULT no longer happening when strace-ing
I get an application (webcamoid in its 8.8 version) that used to be working troublefree and which now segfaults systematically at startup (kde-plasma/X11 do not even get the opportunity to open some ...
0
votes
1
answer
131
views
Why top is not reporting high %wa on too many write sys calls
My HTTP application suddenly started taking extra time to start up. During this phase, it loads the data from the disk to the in-memory data structure.
I doubt it is due to the extensive logging ...
2
votes
0
answers
196
views
Minimal c program does more system-calls than expected
I am trying to learn more about strace. I use strace to understand the calls a c program makes.
The c program is:
void
_start ()
{
for (;;)
{
}
}
The program gets compiled with
clang -...
0
votes
2
answers
117
views
How is it possible that getcwd() takes sometimes half a second, according to strace?
As far as I understand it does not even touches the filesystem.
So what can be a cause for this, using strace -T:
0.481441 getcwd("/home/user/web/url.com/public_html", 4096) = some ...
2
votes
0
answers
165
views
What is the complete list of file functions equivalent to the "strace -e file" options?
According to man strace the -e file option traces all syscalls which take a file name as an argument. What is the whole set?
%file
file Trace all system calls which take a file ...
2
votes
1
answer
1k
views
How do I use perf trace record?
I can use perf trace as a low-overhead replacement for strace, e.g. to trace all Apache instances:
perf trace -p $(pidof apache2 | tr ' ' ',')
To run the trace only for up to 10 seconds:
perf trace -...
1
vote
0
answers
148
views
How to find all the unclosed files of a process?
I'm trying to debug if my app keeps opened files somewhere in the code. I thought of using strace for that but all of the previous topics (like this one) were talking about only opened files. While ...
1
vote
1
answer
743
views
Timing system call with ltrace: Adding `syscall` + `clock_gettime`?
I'm looking for some clarity in terms of the system calls. I tried avoiding the vDSO by calling a system call clock_gettime directly. Here is a snippet of a program named sys_clock_gettime.
int clock =...
27
votes
1
answer
7k
views
root cannot write to file that is owned by regular user
I create a file as regular user testuser:
$ cat > /tmp/zz
the file is owned by that user (as expected):
$ ls -lA /tmp/zz
-rw------- 1 testuser testuser 0 Feb 20 15:32 zz
Now when I try to ...
2
votes
0
answers
355
views
Debug & analyze pthread_mutex_lock issues
I've being recently facing some hardcore issues with Mutex lock for Linux, notably MySQL, memcache & APCu.
Example:
SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting ...
5
votes
1
answer
4k
views
strace top: EAGAIN (Resource temporarily unavailable)
On one of my ubuntu server, top command start very slow, when I run top command on terminal, it will display info after more than 10 seconds.
Then I use strace -yy top to analysis the problem, I ...
1
vote
0
answers
88
views
Output redirection ownership
When i execute cat file.txt > newfile.txt, which process or program is executing the syscall?
I've tried using strace cat file.txt > newfile.txt to identify this, but havent been successful in ...
10
votes
1
answer
894
views
Can I skip syscalls made by the dynamic loader in strace?
When I use strace to examine a program, I often have a hard time finding where the syscalls from the dynamic loader end and the syscalls from the program begin.
The output from strace ./hello where ...
0
votes
0
answers
98
views
`mpirun -n 2 ./a.x`, the two processes was stuck by epoll_wait, why?
I run a mpi progrem with mpirun -n 2 ./a.x. However, these two processes was stuck. And it is always get stuck and seldom(actually only once) pass through.
I find follow information by strace and ...
1
vote
0
answers
779
views
Strace displaying results in ASCII only at process ending and not runtime
I'm searching a way for strace to print the content of the write(...) syscall to ASCII and not useless bytes !
The Strace command I use :
sudo strace -e write=1 -e trace=write -s9999 -p 551 2>&...
1
vote
1
answer
471
views
Find the process command spawned by another process
I have a python script. This python script will attempt to execute Unix command via the system() command. I want to know what this command is.
This logic is hidden very deep inside many dependencies, ...
3
votes
0
answers
79
views
Firefox 87.0 starts slow on Linux 5.8.0
I have upgraded firefox to 87.0 several days ago, but it starts slowly since then.
It works fine after startup, but only takes more time to start.
firefox -safe-mode does not speed up the startup.
I ...
1
vote
0
answers
451
views
Linux top command hang about 25 seconds before works fine
On my Linux server, top command hang about 25 seconds before works fine:
$ time top -b -n 1
Output:
...
real 0m25.199s
user 0m0.018s
sys 0m0.014s
When top command is hang, I found the ...
3
votes
1
answer
2k
views
command 'top' and 'ps' take a long time to show result
Recently, I find when I run commands like top or ps -aux on a server, it is very slow to show the result (STDOUT). I have checked the usage of disk space, memory, and CPU, all of them are OK.
After ...
0
votes
1
answer
823
views
rmdir and rm -rf fail with Directory not empty, no hidden files; -1 EAGAIN (Resource temporarily unavailable) from strace of ls
On a RHEL 6.10 server there is a mounted NAS where I can't delete directories with neither rm -rf nor rmdir. Both fail with rm: cannot remove "backup/backup.1": Directory not empty. I made ...
3
votes
1
answer
1k
views
Strace shows that the time spent in syscalls is much longer than the total time elapsed. Why?
I am running an AI inference program based on Tensorflow-gpu.
By running /usr/bin/strace -c -f /usr/bin/time ./program, I got the following output:
<my program's output>
367.91user 1032.14system ...
8
votes
2
answers
6k
views
How can I use strace on a command executed as a specific, non-root user?
I'm trying to use strace to observe where a certain process searches for files. The locations this process searches will differ depending on the user and their unique environment variables. However, ...
1
vote
1
answer
981
views
strace calls from running process and count them
I have a background process that will run for many many hours. I would like to trace and count the number of write calls live.
sudo strace -p27861 -s50 -e write
It gives me lines like this:
write(1, ...
0
votes
1
answer
2k
views
What is the meaning of this strace message?
My program is crashing after some time on Ubuntu 18.04 and the last few lines of strace are like this:
6260 openat(AT_FDCWD, "/usr/share/locale/en_US.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = ...
0
votes
0
answers
340
views
What is the best way of finding library conflicts in a large application?
I have a large application (let's call it P) with lots of dependencies to boost, Qt, zlib, libpng, etc. Recently, I have added a feature to P that needs to dynamically load a new shared object (let's ...
2
votes
1
answer
16k
views
How to install libicui18n.so.58 on Ubuntu 18.04?
While running my application on Ubuntu 18.04, it fails. Using the trace command, I found that one library is missing on my machine:
user@user-Box:~/Debug$ strace -o log -f ./test_project
./...
2
votes
1
answer
195
views
strace and polkit
I have a program who refuse to run as root, he wants the "true user" to run it, but he wants privilege escalation during the execution to modify some protected paths
With strace it's okay as ...
-5
votes
2
answers
170
views
Hunting for a malware
I'm hunting a malware under my linux .mozilla folder. My first step is try to log all opened files during running of firefox. What do you advice me to use for this purpose ? Strace ? Are there other ...
3
votes
2
answers
1k
views
sshd disconnects after unknown syscall
I'm working on an embedded system (based on a Cortex-A8 CPU) running Linux kernel 4.19, OpenSSH_8.3p1, OpenSSL 1.1.1h, glibc 2.32, compiled with GCC 10.2 using buildroot.
When a client tries to ...
0
votes
1
answer
372
views
get pids/locks for lvm - source for opencount on dmsetup info
# dmsetup info
Name: ubuntu--vg-root
State: ACTIVE
Read Ahead: 256 <---- cat /sys/dev/block/253:0/bdi/read_ahead_kb gives 128 not 256
Tables present: LIVE
Open ...
20
votes
2
answers
43k
views
Write strace output to a file
I'm trying to write the output of strace ls to a file. I know that I need to use > in order to forward output of a command to a file, but it doesn't work. It creates a file but the command prints ...
2
votes
1
answer
92
views
grep does not colorize properly
I am trying to pipe a output from command to grep.
$ strace a.out | grep --color=always "mmap"
but it only outputs non-colorized output of strace:
...
mmap(NULL, 503808, PROT_READ|...
0
votes
1
answer
106
views
I seem to be getting strace info on every bash command. How do I stop it?
This is what I get when I type ls in a terminal:
(It doesn't happen when I login as root. Only when I am the js user.
js@hp-suse-laptop:~$ ls
7255:
7255: file=libselinux.so.1 [0]; ...
1
vote
1
answer
839
views
how to keep stty sane after piping strace to vim?
this makes vim madness:
$strace -o >(vim -; stty sane) file.out; stty sane
I have typed stty sane in processed substitution as well as in next command but none of them did their job. Once i piped ...
1
vote
1
answer
2k
views
strace reports a system call which is taking too long
The problem
The following code snippet shows the time it took to my system to open inkscape plus the time it took to me to immediately close the inkscape window.
$ /usr/bin/time -p inkscape
real 26....
1
vote
0
answers
1k
views
Linux Executable fails to run with error “/usr/bin/strace: exec: No such file or directory” on running strace
I need to analyse linux binary executable file using strace for capturing the system calls. On running the command:
/usr/bin/strace ./005f32fffe1da3bc100e7dcd8b2f8f2c
I got this error:
execve("./...