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

learn more… | top users | synonyms

1
vote
1answer
60 views

Strace Hello World program

So I am trying to understand systemcalls with the following "Hello World!" program: #include <stdio.h> int main(){ printf("Hello World!\n"); return 0; } and then I run strace on the ...
6
votes
6answers
460 views

why strace ignores my alias for rm?

I have an alias set for my rm command. If I run alias command, this is what I get as output. alias rm='rm -i' Now, when I run the rm command it works fine as expected. rm ramesh rm: remove ...
-1
votes
2answers
52 views

How does rsync encode filenames?

By using strace on the active rsync process, I can see output like: read(4, "9\0\0\7\1\10\0\1\10\0\1\10\0\1\10\0\1\10\0\1\10\0\1\10\0\1\10\0\1\10\0\1"..., 16384) = 61 write(3, ...
2
votes
1answer
45 views

strace works for some builtin commands

I'm trying to understand some kernel level concepts in Linux. I was checking on the difference between shell builtin commands and the other executable commands. This wonderful answer clearly tells ...
4
votes
0answers
106 views

Tracing executable without read permissions

I found some surprising behavior on Ubuntu 14.04 when using strace on an executable, which I do not have read permission on. I wonder if this is a bug, or if some standard mandates this obscure ...
2
votes
3answers
148 views

Can strace/ptrace cause a program to crash?

So recently, I was discussing strace with somebody, and they were asking what would happen if you straced a running process just as it was creating a network socket or something similar. Could this ...
5
votes
2answers
260 views

How to determine what instructions a process is executing?

I know about strace and ltrace, but that only tells me what system calls and library calls a process is executing, respectively. I would like to know exactly what instructions a process is executing. ...
1
vote
1answer
68 views

How to use pv with dd?

I'm trying to use dd with pv to write an iso to a usb drive. I did: iso="myiso.iso"; dd if="$iso" bs=1M | pv --eta --size $(ls -l "$iso" | awk '{print $5}') --progress --bytes --rate --wait > ...
2
votes
2answers
89 views

running strace for specific period of time

How to run strace on a user process for specific period of time, say 1 minute, without terminating the user process and without using Ctrl+C? I want to create a script to automating strace execution ...
1
vote
1answer
37 views

Apache suexec won't work with strace

I have an Apache instance with mod_suexec enabled. I'm trying to debug a problem and am starting Apache with strace to try and see what's happening. However, when I start Apache like this: # strace ...
2
votes
1answer
75 views

Make sense of this strace output

Can anyone make sense of this strace output? [pid 25302] read(34, "}B\311\204\n\250\347$\220\266kRb\304a^^\2504\303k\235\227T\223\16\231\306\277\254\256\306", 32) = 32 It's from a Linux system ...
0
votes
0answers
134 views

How do I make strace “decode” AF_NETLINK comminucation like with ioctl?

strace usually "deciphers" ioctls, showing what do they mean, even resolving network interface names and so on. But the same operation performed using AF_NETLINK stays opaque in strace. How to teach ...
1
vote
0answers
55 views

How to debug a semop failure?

Using a 2.6.30-gentoo-r4 Linux a very complex system of php code is executed (with 4.4.9-pl0-gentoo and 5.2.10-pl0-gentoo), which occasionally runs into a semaphore blocking problem. The call to the ...
2
votes
0answers
418 views

How is it that I can attach strace to a process that isn't in the output of ps?

I'm trying to debug why our integration tests are taking so long and it looks like they're hanging part way through. I logged onto our test service and saw the following behaviour: root@colossus:~# ...
0
votes
1answer
42 views

MC and MCedit take long time to start

I recently discovered that my MidnightCommander takes around 40 seconds for every startup and the same goes for McEdit. I access my machine only via ssh and of course I'm not logging in as root, only ...
1
vote
1answer
300 views

Too Much System Time

I have observed that when running CESM (a weather modeling application), the top command shows a great deal of time is spent on system calls, about 25% to 60%, and only 40% to 75% is used in user ...
2
votes
1answer
19 views

Retrieve system commands without reading sources

Sometimes I wonder how Linux programs achieve certain results knowing that they internally use system calls (system() or exec() in C programs). Given a working binary I wonder if it is possible to ...
1
vote
1answer
249 views

strace got message — SIGIO (I/O possible) @ 0 (0) ---

I'm trying to monitor serial port communication using strace -s9999 -o serialtrace.log -eread,write,ioctl command. After few normal logging messages I got guge amount of message --- SIGIO (I/O ...
0
votes
1answer
235 views

Monitor com port with strace

I have done small application in Java that writes to com port two strings -'dddd' and 'ffff'. I decided to look how it writes with thelp of strace -s9999 -o serialtrace.log -eread,write,ioctl And I ...
3
votes
1answer
66 views

How (if possible) can I terminate a specific blocker hanging a program?

I have a number of files open in my editor (geany). I managed to hang it doing a sort on a large list that I should have saved and just sent through a pipe to sort via command-line (I mapped one of ...
4
votes
1answer
82 views

Is strace a suitable tool for finding out where a program wrote to the filesystem?

I'd like to determine where a certain app (as an example, surf) writes to the filesystem in order to make sure it leaves no traces. Without a dedicated sandboxing system this probably isn't easy, but ...
6
votes
2answers
569 views

Is it possible to strace the builtin commands to Bash?

Inspired by this question, titled: When are the built-in commands loaded to memory, while attempting to answer this I tried the following command and was a bit surprised that I couldn't run it: $ ...
3
votes
2answers
2k views

How to 'strace' a unix domain socket?

Kind of hard to explain but I noticed when straceing the PID that has the socket open I cannot see any of the communication. How can I sit in the middle of a socket file to watch communication?
0
votes
2answers
292 views

How does strace know to use /bin/echo instead of failing on a built-in

When I do strace echo hello, I see it is using /bin/echo, but built-in echo should be found first. Is it a functionality of strace to skip built-in commands? strace -- version 4.5.19 I understand ...
3
votes
1answer
782 views

Why is brk(0) called?

On a first shell I run the command tail with no argument. On a second shell I kill the first tail using strace to monitor the system calls. qdii@nomada ~ $ strace kill 1713 execve("/bin/kill", ...
3
votes
2answers
2k views

Measure disk IO latencies of a running process

I'm trying to measure the disk IO latencies of a running process to make a histogram. I could do this with DTrace in operating systems that provide it (e.g. as in this Joyent paper), but my ...
3
votes
3answers
949 views

Command to trace rsh server to check behaviour of particular system call

I am working with rsh. I want to check the whole process from beginning to end. For that I used strace. Os name is CentOS. I am working on single machine, server and client are on same machine. My ...
2
votes
1answer
1k views

Why can't I use strace with rsh?

If I run rsh, it works, but prints some strange “Connection refused” messages at the beginning: $ rsh localhost pwd connect to address 127.0.0.1 port 544: Connection refused Trying krb4 rsh... ...
0
votes
2answers
170 views

How to detect particular system call called or not in a whole workflow?

EDIT No. 1 My task is mirroring , i.e., copying updated data from master server to all mirrors, by using rsync and rsh. But during rsync and rsh, I found some delay. My thinking is , the reason for ...
1
vote
0answers
93 views

Android strace error: “strace: 2: Syntax error: ”&“ unexpected”

I was using built-in strace given in /system/xbin/ directory in the emulator and it was giving me wrong set of system calls such as msgget() and msgrecv() which are not supported by Android even. I ...
4
votes
3answers
1k views

Stracing su and ssh shows the password. Is this a security flaw or am I missing something?

I'm currently fascinated by strace so, being new to it, I decided to play around a little. As suggested by the question title, I tried both strace su and strace ssh. Both commands displayed the ...
6
votes
1answer
3k views

piping strace to grep

I'm trying to run strace trough ccze, and the pipe doesn't work as expected. The command-line I'm running to test is sudo strace -p $(pgrep apache2) | grep open, and all lines are output, ignoring ...
3
votes
1answer
389 views

Plotting the sleep/wait chain of a process

I often want to know why a process in the middle of a pipeline is sleeping and not busy processing data. My current method is: find the pid of interest sudo strace -pt pid to get the blocking ...
7
votes
1answer
155 views

Finding where a process reads in a file

Is there a way to attach to a process and find out, not only which files it is reading from, but what the read locations (byte offsets) of those reads are? I tried using strace for this, but it ...
4
votes
2answers
368 views

ls behaves differently under strace

I don't know how to debug this situation: 1) I try to execute: ls /home/user 2) ls blocks and does not print anything. I assume it is because /home/user contains /home/user/sshfs_files, which is ...
8
votes
3answers
540 views

How could running strace be fixing my OpenGL issue?

Since a recent major upgrade to my distribution (PLD Linux), I have been having trouble with a whole slew of programs. As best I can tell, anything that touches OpenGL or PulseAudio segfaults. I'm ...
6
votes
1answer
278 views

Unkillable apache2 processes

After upgrading from debian lenny to squeeze (apache2 2.2.16-6+squeeze4 and php 5.3.10-1~dotdeb.1), my apache processes started to exit with segmentation fault. It happens every 5-30 minutes (for 1 ...
15
votes
3answers
6k views

List the files accessed by a program

time is a brilliant command if you want to figure out how much CPU time a given command takes. I am looking for something similar that can list the files being accessed by a program and its children. ...
3
votes
1answer
583 views

Which processes should I NOT strace?

I've created a little function for strace'ing a set of the current user's processes by name: function pstrace() { local pattern="$1"; shift; prefixDashP $(pgrep -U $(whoami) $pattern) | ...
3
votes
1answer
140 views

Sample a few lines from an strace printout

I've got a process that I want to inspect with strace, but since it's printing out a lot of stuff, I would like to sample only a few lines every X seconds from it. Is there any way of doing that with ...