2022 Developer Survey is open! Take survey.

Questions tagged [strace]

strace is a debugging utility for tracing system calls and signals under Linux.

Filter by
Sorted by
Tagged with
1 vote
0 answers
25 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 ...
user avatar
0 votes
0 answers
39 views

Hundereds of instances of a process are spawning per second. How can I find out why?

I have a situation where hundreds instances of the lsof process are spawning briefly, and I'm trying to find a way to trace why. Here is an example of capturing the whole tree of one of the short ...
user avatar
2 votes
1 answer
20 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 -...
user avatar
1 vote
0 answers
26 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 ...
user avatar
  • 63
1 vote
1 answer
36 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 =...
user avatar
22 votes
1 answer
2k 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 ...
user avatar
2 votes
0 answers
51 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 ...
user avatar
  • 121
1 vote
1 answer
448 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 ...
user avatar
  • 223
1 vote
0 answers
35 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 ...
user avatar
  • 111
11 votes
1 answer
619 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 ...
user avatar
  • 147
0 votes
0 answers
45 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 ...
user avatar
0 votes
0 answers
143 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>&...
user avatar
  • 123
1 vote
1 answer
60 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, ...
user avatar
  • 151
3 votes
0 answers
66 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 ...
user avatar
  • 151
0 votes
0 answers
92 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 ...
user avatar
  • 223
2 votes
1 answer
213 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 ...
user avatar
0 votes
1 answer
162 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 ...
user avatar
3 votes
1 answer
285 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 ...
user avatar
3 votes
2 answers
1k 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, ...
user avatar
  • 141
1 vote
1 answer
128 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, ...
user avatar
0 votes
1 answer
451 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) = ...
user avatar
  • 155
0 votes
0 answers
72 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 ...
user avatar
  • 155
2 votes
1 answer
7k 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 ./...
user avatar
  • 155
1 vote
1 answer
74 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 ...
user avatar
  • 109
-5 votes
2 answers
109 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 ...
user avatar
  • 156
2 votes
2 answers
713 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 ...
user avatar
  • 31
0 votes
1 answer
76 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 ...
user avatar
9 votes
2 answers
14k 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 ...
user avatar
1 vote
1 answer
49 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|...
user avatar
0 votes
1 answer
40 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]; ...
user avatar
0 votes
1 answer
348 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 ...
user avatar
  • 260
1 vote
1 answer
614 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....
user avatar
  • 171
1 vote
0 answers
770 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("./...
user avatar
  • 11
0 votes
2 answers
248 views

How to find which program is executing given program?

Is there way how to find out which program is executing my script? I'm runnig I3 as my window manager and I want to use sxkhd to bynd keys instead of i3config but something keep replacing my sxkhd ...
user avatar
  • 25
0 votes
1 answer
76 views

How to find out what function is runnng when reading /proc

I am trying to write a kernel module that hides some sockets from netstat. I checked how netstat is working and saw that it's reading from /proc/net/tcp. Now I am stuck. I am trying to figure out ...
user avatar
3 votes
1 answer
167 views

strace all but specified system calls

How can I run strace, and record all of syscall , but not read and not write?
user avatar
2 votes
3 answers
3k views

strace write calls to stdout

Is there a way to use strace to just show a process's stdout? I know I can do strace -p pid -e write but that shows calls to write(2) to multiple file descriptors. When reading the man page I also ...
user avatar
  • 217
3 votes
1 answer
2k views

How to correctly use strace -e read=fd option?

I'm trying to monitor read activity on a particular file descriptor in a running process. Here is the C++ test bench I'm testing various solutions on: #include <fcntl.h> #include <unistd.h&...
user avatar
  • 2,949
0 votes
2 answers
186 views

strace command with line num

I want to use strace command to know the system calls in a file for a particular line numbers for example line 9 in example.c .Does anyone have an idea how to do it ?
user avatar
  • 1
1 vote
0 answers
489 views

why are there so many mmap system call in strace?

I am trying to understand strace command. I started by using strace on some basic commands as shown below. [root@localhost]# strace ls execve("/bin/ls", ["ls"], 0x7ffd79175190 /* 27 vars */) = 0 brk(...
user avatar
1 vote
0 answers
118 views

Pulseaudio doesn't start correctly unless I run it with strace

So here's a weird problem that I've been experiencing. I've been using PulseAudio to create a fake loopback interface on a Virtual Machine for music streaming purposes. A few days ago the server ...
user avatar
  • 129
11 votes
1 answer
977 views

Bash attempts to write two shell prompts?

I am looking at the strace output of a running bash process connected to a terminal, for educational purposes. My bash process has PID 2883. I type [OP@localhost ~]$ strace -e trace=openat,read,...
user avatar
  • 1,073
0 votes
0 answers
430 views

ERR_CONNECTION_REFUSED: how to show the cause

I am running an application (over and over again in a for loop) which is very heavyweight. I attempt to start the application via a python script. Sometimes when I do that, I get a ...
user avatar
  • 103
3 votes
0 answers
969 views

Why is this Linux process running so slow?

I've got a Python process on my Ubuntu 19.04 system that doesn't seem to be memory starved, yet is running a lot slower than I expect. The system has 96 GB of RAM plus 96 GB of swap. This process is ...
user avatar
0 votes
1 answer
114 views

How to control trimming of strace messages?

strace likes to trim messages, for example: sendto(4, "\4\356\1\0\0\1\0\0\0\0\0\0\4[more content]"..., 44, MSG_NOSIGNAL, NULL, 0) = 44 Can I tell strace to print N bytes (or even all bytes) rather ...
user avatar
  • 46.9k
3 votes
1 answer
586 views

Debugging a slow thumbnailer process

I am trying a debug a peculiar performance behavior in the thumbnail-generating process for eog, specifically gdk-pixbuf. The minimal files to reproduce are here: https://github.com/nbeaver/gdk-...
user avatar
1 vote
1 answer
69 views

Can I trace a program that "broke out of jail"?

If a process can actually interfere with the others, is it possible to trace it down? By breaking the jail, I mean it overcame the virtualization that prevents one process to interact with the others ...
user avatar
  • 23
0 votes
2 answers
143 views

Find the short-lived process that is polling my port?

I've noticed one of the headless computers in my network is constantly polling the VNC port on another computer. My problem is, that when I see the port from which it has connected (with tcpdump) and ...
user avatar
2 votes
2 answers
356 views

Why does strace show that syscall =?

I made a system call and recompiled the kernel, however upon running the system call it returned Killed. So, to trace it, I used strace, which shows the following message: syscall_0x224(0x7ffda7199738,...
user avatar
2 votes
1 answer
255 views

I have a tab completion that hangs, is it possible to use strace to find out what is going on?

In my example I start typing sudo su dkay...<tab>... and the command hangs for about a minute before tab completing to sudo su dkayton. I got advised to use strace to find out what is happening....
user avatar
  • 223