date int64 1,220B 1,719B | question_description stringlengths 28 29.9k | accepted_answer stringlengths 12 26.4k | question_title stringlengths 14 159 |
|---|---|---|---|
1,341,916,713,000 |
For some debugging purposes I enabled the command set -x. Now the output of my Bash shell looks like this:
$ ls
+ ls --color=auto
Certificates Desktop Documents Downloads Dropbox ...
How can I disable set -x so I won't see stuff like + ls --color=auto?
|
You just need to run set +x
From man bash:
Using + rather than - causes these options to be turned off.
| How to disable "set -x"? |
1,341,916,713,000 |
Is there a way to get a core dump (or something similar) for a process without actually killing the processes? I have a multithreaded python process running on an embedded system. And I want to be able to get a snapshot of the process under normal conditions (ie with the other processes required to be running), but I ... |
The usual trick is to have something (possibly a signal like SIGUSR1) trigger the program to fork(), then the child calls abort() to make itself dump core.
from os import fork, abort
(...)
def onUSR1(sig, frame):
if os.fork == 0:
os.abort
and during initialization
from signal import signal, SIGUSR1
from w... | Dump process core without killing the process |
1,341,916,713,000 |
In bash, I can write:
caller 0
and receive the caller context's:
Line number
Function
Script name
This is extremely useful for debugging. Given:
yelp () { caller 0; }
I can then write yelp to see what code lines are being reached.
I can implement caller 0 in bash as:
echo "${BASH_LINENO[0]} ${FUNCNAME[1]} ${BASH_S... |
I don't think there's a builtin command equivalent, but some combination of these four variables from the zsh/Parameter module can be used:
funcfiletrace
This array contains the absolute line numbers and corresponding file
names for the point where the current function, sourced file, or (if
EVAL_LINENO is set) e... | function's calling context in zsh: equivalent of bash `caller` |
1,341,916,713,000 |
When I work with Bash I love to do so with prominent debug mode, so each time I get a new machine I add to the end of ~/.profile the code set -x.
I consider adding eu as well, so to have set -eux as a "best-practice'.
If I understand the BR manual correctly
e gives me the benefit of not-executing code that would eve... |
This is a matter of opinion, but I think set -eu is a bad idea for interactive use. Here’s what each one does:
set -e causes the shell to exit whenever a pipeline, list, or compound command exits with non-zero status;
set -u causes the shell to exit whenever it attempts to expand a parameter which isn’t defined.
In ... | set -eux instead set -x in Bash profile for global debugging [closed] |
1,341,916,713,000 |
I am trying to debug a vagrant- or VirtualBox related problem (see taiga-vagrant fails to provide a working taiga environment #21).
The command VAGRANT_LOG=debug vagrant up --debug prints out plenty of, probably, useful information. Where is this log stored however?
Edit: VAGRANT_LOG=debug vagrant up is actually the ... |
Vagrant does not keep any logs. The output of, for example vagrant up --debug, can be redirected to a file like
vagrant up --provision --debug &> debug_log
Fragment from an IRC session in #vagrant at Freenode:
[18:29] <NikosA> ada: really, where is the debug "file" stored, by default? Isn't there any?
[18:29] <ad... | Where is vagrant's log file? |
1,341,916,713,000 |
Apologies in advance if this post is a bit dense/messy, but I'm having a hard time formulating it better... Basically, I would like to study what happens upon a hard disk write, and I'd like to know:
Is my understanding below correct - and if not, where am I going wrong?
Is there a better tool to "capture" log data, ... |
You've asked way too much in one question—well, technically not, as I guess "is this understanding correct" can be answered quickly: no. But that's not a useful answer.
First, you're right about ata_piix and sd_mod apparently being compiled-in to your kernel. That's a choice you make configuring the kernel—you can omi... | Observing a hard-disk write in kernel space (with drivers/modules) |
1,341,916,713,000 |
I like to use set -x in scripts to show what's going on, especially if the script is going to run in a CI/CD pipeline and I might need to debug some failure post-hoc.
One annoyance with doing this is that if I want to echo some text to the user (e.g., a status message or "I'm starting to do $X") then that message gets... |
This is a horrible kluge, and I feel dirty for suggesting it, but... you could do this with a magic alias. The key to this trick is that aliases are expanded as part of the parsing phase of command execution, so set -x won't make anything print as they expand (unlike a function). So you can make an alias that prepends... | Temporarily unset bash option -x |
1,341,916,713,000 |
Sometimes it is really handy to just add
set -x
to the top of your script to show all commands before they are executed.
There is only one drawback creating scripts with a decent output: I don't know how to add text output to the script this way. If I use
echo 'some comment'
it will result in printing it doubled:
+ ... |
One hacky way is just to write your comments as arguments to a no-op command. Particularly useful might be the : null utility:
set -x
: Some interesting notes on the following are ...
results in:
+ : Some interesting notes on the following are...
The colon command does nothing, accepts whatever arguments you give it... | Adding comments using 'set -x' |
1,341,916,713,000 |
I have a custom kernel module that I compiled from this patch that adds support for the logitech G19 keyboard among other G series devices. I compiled it just fine against Ubuntu's maverick kernel's master branch (2.6.35).
I can boot and load the module, but I'm running into a really strange situation. As soon as I lo... |
First things first, debug the module? Just see if you can load it up in gdb it might point you straight at a line that uses the relevant variable(or close to it).
oh, and you might find this article useful
| How do I debug a kernel module in which a NULL pointer appears? |
1,341,916,713,000 |
A colleague recently introduced me to bash -x for debugging my bash scripts without taking the echo $foo route.
$ bash -x hello-world.sh
+ echo 'Hello World'
Hello World
Internally -- how does bash accomplish this? I checked man bash and it (didn't seem to?) mention the -x flag when invoking the interpreter. I'... |
-x is the same as setting xtrace with the -o option to bash. From my copy of the bash manpage:
After expanding each simple command, for command, case command, select command, or arithmetic for command, display the expanded value of PS4, followed by the command and its expanded arguments or associated word list.
... | What is `bash -x` |
1,341,916,713,000 |
What strategy you use while tracking a memory-related issue? What tools do you use (open source as well as proprietary) to identify memory leaks, memory corruption etc? How would you track memory leaks if only gdb/dbx available on a system?
For me, fixing memory leaks with only a debugger is very hard.
|
If you can change the source code, Dmalloc is great; it will list which pointers were unfreed and (for code built with debugging symbols) exactly which line they were allocated on.
If you can't, Valgrind is pretty much the standard for that sort of thing. I generally find Valgrind somewhat harder to use, but it has wa... | How to track/fix a memory-related issue in a large C/C++ code on *nix systems |
1,341,916,713,000 |
I'm trying to set the debug level of wpa_cli using the level command.
It doesn't matter if I use interactive mode or direct commands the level command always fails.
wpa_cli -i wlan0 level 1
=> FAIL
And interactive mode:
wpa_cli
wpa_cli v2.3
Copyright (c) 2004-2014, Jouni Malinen <[email protected]> and contributors
... |
From the Interactive mode type log_level:
> log_level
Current level: INFO
Timestamp: 0
Then type log_level debug :
> log_level debug
OK
Verify using the command log_level :
> log_level
Current level: DEBUG
Timestamp: 0
| wpa_cli level command always fails |
1,341,916,713,000 |
Is there an equivalent of POSIX shells' set -x or set -o xtrace that cause the shell to display the commands being run in the fish shell?
|
Since fish 3.1.0, the fish_trace variable makes this functionality available:
> set fish_trace on; isatty; set -e fish_trace
++ source share/fish/functions/isatty.fish
++++ function isatty -d 'Tests if a file descriptor is a tty'
+ isatty
+++ set -l options h/help
+++ argparse -n isatty h/help --
+++ if
+++ set -q _fl... | xtrace equivalent in the fish shell |
1,328,709,532,000 |
Crashing bugs can be the most annoying ones, leading to data loss, downtime and frustrated users. It would be good if applications crashed less.
Because of the complexity of the machine context, crashes often can't be reproduced in reasonable time for an ordinary user. That doesn't mean that the bug is rare - It could... |
Put this:
ulimit -c unlimited
into file
/etc/profile
This may not work on all distros.
Also read this articles:
http://en.linuxreviews.org/HOWTO_enable_core-dumps
http://www.akadia.com/services/ora_enable_core.html
| How to enable crash reports/core dumps/stack trace logging globally? |
1,328,709,532,000 |
Is there a way to force enable or disable debug (xtrace) per command line in scripts ?
In Windows Shell ("ms-dos") is an "@" which can prefix a command line, disabling that line to be showed if the echo (lets say debug) is enabled (echo on).
Consider xtrace on (set -x), but we could ommit its effect in some lines pref... |
I'm not aware of any shell that has such an operator. However, with most shells (ksh being the exception) you can silently toggle xtrace with:
{
case $- in
(*x*) set +x;;
(*) set -x
esac
} 2> /dev/null
So you could make it an alias:
alias 'xx={
case $- in
(*x*) set +x;;
(*) set -x
esac
} 2> /d... | Inline debug (xtrace) in scripts |
1,328,709,532,000 |
I have 15 identical Linux RH 4.7 64-bit severs. They run cluster database (cluster is application level). On occasion (every month or so) a random box (never the same though) freezes.
I can ping the box and ping works. If I try to ssh in the box I get:
ssh_exchange_identification: Connection closed by remote host
SSH... |
It sounds like your kernel panicked in some way such that sshd couldn't send the server keys. Possibly, the kernel was wedged in such a way that the network stack was still up, but the vfs layer was unavailable.
When I experienced similar problems on a RHEL4 system, I set up the netdump and netconsole services, and a... | Debugging Linux machine freezes |
1,328,709,532,000 |
As Linux/Unix users, we run into problems frequently. And after long hours of problem solving, we develop the skill of debugging.
Now, what are good principles, methods or best practises when trying to debug general unix problems?
What tools should I have, as an average user, to make finding the cause of problems ea... |
The methods will depend on the kind of the problem.
In general "How To Ask Questions The Smart Way" by Eric S. Raymond and Rick Moen is sometimes a helpful advice to focus on the problem and to check if you have thought about important parts of the problem.
Your first source of information during debugging are the log... | Best practise to diagnose problems [closed] |
1,328,709,532,000 |
Debugging bash scripts on command line is complicated.
Is there a good GUI based debugger available for debugging bash scripts?
|
Download ShellEd eclipse plugin (update site didn't work for me) which allows editing bash scripts. Install this via Help -> Install new software -> Add -> Archive.
Download basheclipse and extract the contents to your eclipse plugins directory plugin.
Restart eclipse. Create a new Eclipse project BashTest.
Add a fil... | Is there a GUI debugger for shell scripts |
1,328,709,532,000 |
I have a long running (3 hours) shell script running on a CentOS 7 machine. The script runs a loop with an inner loop and calls curl in each iteration.
I'm starting the script with PM2 because it's already on the system and it's good for managing processes. However it seems that it might not be good for shell scripts.... |
sysdig can monitor for these using the evt.type=kill filter:
# terminal uno
perl -E 'warn "$$\n"; $SIG{INT}= sub { die "aaaaargh" }; sleep 999'
# terminal dos
sysdig -p '%proc.pname[%proc.ppid]: %proc.name -> %evt.type(%evt.args)' evt.type=kill
# terminal tres
kill -INT 11943 # or whatever
A more specific filter m... | Can I track down where a SIGINT came from if it's not from a user? |
1,328,709,532,000 |
GCC documentation says that the -g option produces debugging information in the operating system's native format (stabs, COFF, XCOFF, or DWARF 2).
So, what is Linux native debugging symbols format? What is it called?
Update: I've just found a 15-year old gcc mailing list discussion where it was said that the native f... |
On Linux the default is now Dwarf 2 and/or 4. To see this, run readelf --debug-dump=info on a binary containing debug symbols (or stripped symbols); for example, on Fedora, with glibc-debuginfo installed, running readelf --debug-dump=info /usr/lib/debug/bin/gencat.debug will give you something like
<1><ea>: Abbrev Nu... | What is Linux native debugging symbols format? |
1,328,709,532,000 |
When I use set -x to debug a command it output some extra lines.
% set -x
+precmd_update_git_vars:1> [ -n '' ']'
+precmd_update_git_vars:1> [ '!' -n '' ']'
+precmd_update_git_vars:2> update_current_git_vars
+update_current_git_vars:1> unset __CURRENT_GIT_STATUS
+update_current_git_vars:3> [[ python == python ]]
+updat... |
If you're trying to debug a script, then don't use set -x on the terminal (that's debugging the shell running in the terminal). You can instead start the script with the -x option to the interpreter (e.g., zsh -x <scriptname> [<args>]).
If, for example, you have a zsh script named ex.zsh, then you can do:
$ cat /tmp/... | `set -x` debugging my `.zshrc` |
1,328,709,532,000 |
I am studying Linux device drivers, my main focus is on wifi drivers.
I want to know how the code flows when I plugin my device.
Maybe, I can do something like add a printk line in every function.
The device I have is supported by ath9k_htc driver.
I want to make some changes in the driver code for learning purposes.... |
When I want to do this, I use the ftrace framework. Start by mounting the special file system:
mount -t tracefs nodev /sys/kernel/tracing
(as root; you should become root for all this, you’ll be doing everything as root anyway, and it’s easier to have a root shell than to use sudo).
Then change to that directory:
cd ... | How to know the code flow of a driver module? |
1,328,709,532,000 |
One of our devices froze today with the following kernel messages:
[79648.067306] BUG: unable to handle page fault for address: 0000000004000034
[79648.067315] #PF: supervisor read access in kernel mode
[79648.067318] #PF: error_code(0x0000) - not-present page
From the call trace (see below) it appears that this erro... |
[79648.067306] BUG: unable to handle page fault for address: 0000000004000034
[79648.067315] #PF: supervisor read access in kernel mode
[79648.067318] #PF: error_code(0x0000) - not-present page
These errors indicate kernel code tried to access an invalid pointer.
The kernel code tried to access the virtual memory add... | Kernel: BUG: unable to handle page fault for address |
1,328,709,532,000 |
I'm running LinuxMint12 with Gnome with Cario-Dock and I have a logitech G15 keyboard. I set up a bash script with the extra keys to take the active window, resize it, and move it to a specific location on one of my screens. But after a few days of usage when I restarted my computer the CTRL+F shortcut stopped working... |
I had the same problem on Linux Mint 13 and the same output on xev, namely Control_l + f was mapped to Control_l.
My solution:
I remembered that I have xbindkeys running to enable some exotic buttons on my tablet pc.
By running xbindkeys-config and checking all key mappings defined for xbindkeys I found an entry th... | How can I find what is interfering with CTRL+F? |
1,328,709,532,000 |
In zsh, is it possible to direct the trace output from set -x (set -o xtrace) to a file descriptor other than stderr?
I'm looking for an equivalent of $BASH_XTRACEFD or a way to emulate the same behaviour.
|
As of zsh 5.7, the answer is no. The trace output always goes to stderr.
Source: reading the source. The trace output is written to the file xtrerr, which looks promising, but the only assignments to xtrerr are to stderr, to a copy of it, or to NULL.
It should be possible to write a dynamically loadable module that se... | Direct xtrace output elsewhere than stderr in zsh |
1,328,709,532,000 |
(gdb)printf "Hello %d", 7
Hello 7
(gdb)set $MyVar = printf "Hello %d", 7 // ???
How to save the result of printf "Hello %d", 7 to $MyVar?
|
eval does a printf of its arguments and then runs it as a command. So you can take your printf argument list, insert set $MyVar = at the beginning, and eval it.
(gdb) eval "set $MyVar = \"Hello %d\"", 7
(gdb) print $MyVar
$2 = "Hello 7"
| How to save the result of printf to a variable in GDB? |
1,328,709,532,000 |
Ever since I have "upgraded" to systemd on Arch Linux, I keep losing logs when an unexpected lockup happens. I hit the same log-losing issue one month ago and just hit the issue again. There are also independent other confirmations.
Situation:
While doing some stuff in Java and with network-related utilities, I saw t... |
So I asked on the #systemd IRC channel and it turns out that journald (the logging daemon of systemd) does not periodically flush the logs to disk at all. This means that your logs are always at risk at any time.
Sending SIGUSR2 to the journald causes logs to be written to disk, but if you do this multiple times, many... | Debugging lock-up - systemd loses my logs |
1,328,709,532,000 |
This is the result of looking at virtual memory of a process in gdb; I have some questions regarding this:
Why are some parts of the virtual memory are repeated? For example, our program (stack6) and libc library is repeated 4 times; if they have partitioned them into different parts, then why? Why not just put the... |
There’s one important piece of information missing from gdb’s output: the pages’ permissions. (They’re shown on Solaris and FreeBSD, but not on Linux.) You can see those by looking at /proc/<pid>/maps; the maps for your Protostar example show
$ cat /proc/.../maps
08048000-08049000 r-xp 00000000 00:0f 2925 /opt/p... | Why some libraries and other parts get repeated in the linux virtual memory with gdb? |
1,328,709,532,000 |
I was trying to study the debugging of kernel using QEMU. I tried initially and failed due to the fact that there was no virtual file system. The answers to this post suggests that there should be a virtual file system. But it doesn't talk about how to create virtual FS for kernel debugging and how to pass it over to ... |
Depending on the distribution you'd like to use, there are various ways to create a file system image, e.g. this article walks you through the laborious way to a "Linux from Scratch" system.
In general, you'd either create a QEMU image using qemu-img, fetch some distribution's installation media and use QEMU with the ... | Debugging Linux Kernel with QEMU |
1,328,709,532,000 |
I am trying to run a distro in the virtual disk image with a custom kernel,so that I can experiment and debug the kernel. I followed this to make a disk image and then install Debian to it. Now I tried running distro with the following command:-
qemu-system-i386 -hda debian.img -kernel ../linux-3.6.11/arch/i386/boot/b... |
I don't think you would have to start debugging the kernel right away. This error message means that the kernel is unable to mount the partition you requested to be /. This would happen for example if you gave it an empty disk image (my hunch is this is your case) - the kernel in the VM sees an unpartitioned drive, th... | Kernel and QEMU : Unable to mount root fs error |
1,328,709,532,000 |
I'm trying to debug a Linux application that can receive commands via stdin, and it would be really useful to be able to see everything that gets written to stdin.
My first approach was to execute sudo cat /proc/$pid/fd/0, but it turns out that is an invalid approach, since both cat and my process are trying to consum... |
strace ?
Example below. Start a cat process which is reading stdin and writing to /tmp/foofile. Find the pid, strace it. And in the original cat window, enter some text, hey presto.
# cat >/tmp/foofile
# ps -ef|grep cat
steve 2134 1801 0 22:25 pts/2 00:00:00 cat
# strace -fp 2134
Process 2134 attached
re... | Peek at the contents of stdin |
1,328,709,532,000 |
According to tcpdump, my server receives the following TCP packet:
12:52:29.603233 00:19:e2:9e:df:f0
00:16:3e:6a:25:3f, ethertype IPv4 (0x0800), length 74: 10.10.10.65.38869
192.168.215.82.22: Flags [S], seq 567054335, win 5840, options [mss 1460,sackOK,TS val 2096335479 ecr 0,nop,wscale 0], length 0
As seen above,... |
However, are there any other clever tools/methods to see if process listening on TCP port receives a message?
You can use strace with -e trace=network. This is what it prints on accepting a TCP connection, receiving an HTTP request, sending an HTTP response and closing the connection:
$ strace -v -f -e trace=networ... | Is there a way to see if process listening on TCP port receives a message? |
1,328,709,532,000 |
How does a debugger work in Linux? How does it gets 'attached' to an already running executable or process. I understand that compiler translates code to machine language, but then how does debugger 'know' what it is being attached to?
|
There is a system call named ptrace. It takes 4 parameters: the operation, the PID of the target process, an address in the target process memory, and a data pointer. The way the last 2 parameters are used is dependent on the operation.
For example you can attach/detach your debugger to a process:
ptrace(PTRACE_ATTACH... | How does a debugger work in Linux? |
1,328,709,532,000 |
Specifying systemd.debug-shell=1 as kernel parameter kind of works: I can switch via Alt+F9 to a shell when systemd boot hangs.
But this shell is quite impossible because an animated
[ *** ] A start job is running for Create Volatile Files and
Directories (4min 23s / no limit)
banner is destroying my prompt... |
One way is to also set systemd.show_status as kernel parameter. For example, in total:
systemd.debug-shell=1 systemd.show_status=false
This makes the systemd debug shell usable again.
However, it kills all systemd boot console output, not just obstructing animations. Perhaps there is a better way - say - tell systemd... | Make systemd debug shell usable again |
1,328,709,532,000 |
I'm having a series of failing/sometimes failing SD cards. They either give one of the following dmesg outputs:
The completely dead ones (don't list at /dev/mmcblk0):
[ +0,000010] mmc0: error -110 whilst initializing SD card
[ +2,819983] mmc0: card never left busy state
The failing ones (can occasionally still be ... |
This seems more an hardware/use case problem than something else. I bet common sense might be more important than Linux skills here. Are you doing heavy I/O in the cards, MySQL/Apache/compiling stuff...syslog/frequent system updates? -- comment by Rui F Ribeiro
I can expand on the above. But I agree with the first ... | Defining a state of a failed SD cards by kernel tracing? |
1,328,709,532,000 |
I believe we are running into a possible bug with the GTX 1080 (driver) and PCI Passthrough.
My host is an Ubuntu 14.04 system.
My guest is an Ubuntu 14.04/16.04 system (both do the same thing).
I can see device inside the guest VM:
$ lspci -vnn | grep VGA
00:05.0 VGA compatible controller: NVIDIA Corporation Device 1... |
I had the same problem, I found the answer at https://www.evonide.com/non-root-gpu-passthrough-setup/. You need to add -cpu host,kvm=off to the qemu command line. I'm using ganeti, so the following fixed the problem:
gnt-instance modify -H cpu_type="host\,kvm=off"
If I understand correctly this flag does not switch o... | Driver for GTX 1080 doesn't work on guest when using KVM PCI Passthrough |
1,328,709,532,000 |
I'm trying to get the nearest to real-time processing I can with a Raspbian distribution on a Raspberry Pi for manipulating its GPIO pins. I want to get a "feel" for the kind of performance I can expect.
I was going to do this by writing a simple C program that toggles a pin repeatedly as fast as possible, and monitor... |
I don't have an answer but you might find one amongst the tools, examples and resources written or listed by
Brendan Gregg on the perf command and Linux kernel ftrace and debugfs.
On my Raspberry Pi these tools were in package perf-tools-unstable. The perf command was actually in /usr/bin/perf_3.16.
Of interest may ... | Record time of every process or thread context switch |
1,328,709,532,000 |
My Linux Mint system (17 Cinnamon, lenovo g565) hangs up frequently during work (say, 2-4 times a day). It may look different - white screen, black screen, screen freeze.
Checking syslog after hangs brought me the same lines just before system hanged: pastebin, last are:
08:26:34 wpa_supplicant[1069]: nl80211: send... |
This is a known bug, check this launchpad bug report. There is only one suggestion offered to fix it, message n.24:
Oops this has been going on since 2009 and a developer did respond that it is simply for roaming in corporate environments with multiple access points to connect to. If you only have one AP at home go i... | wpa_supplicant nl80211 hangs linux mint frequently |
1,328,709,532,000 |
I use od to print me the octal or hex of a file/stdin/string. This lets me see the ASCII, or UTF-8 encoded, values of my stdin.
But we don't live in ASCIIland anymore. Is there any command that will print out the unicode values/codepoints for the (presume) utf-8 encoded input? I want to know what unicode characters I'... |
You can use this if you are on a little endian system:
iconv -f utf-8 -t ucs-4le | od -tx4
or this if you are on a big endian system:
iconv -f utf-8 -t ucs-4be | od -tx4
| Print out unicode values of stdin? |
1,328,709,532,000 |
I am looking for such kind of a tool on either Unix/Linux platform which can achieve:
I have the source files and I compiled the application myself (the source code is in C, although I don't really think it matters here)
I want to run this application while every function calls are printed/logged to a stdout/file
Fo... |
Using gcov:
$ gcc -O0 --coverage square.c
$ ./a.out
$ gcov -i square.c
$ awk -F '[,:]' '$1 == "function" && $3 > 0 {print $3, $4}' square.c.gcov
1 square
1 main
(where the number is the number of times the function was called (we skip the ones that are never called with $3 > 0 in the awk part)).
That's typically used... | Tool to print out functions being called during run time? |
1,328,709,532,000 |
I want to detect errors in application's execution logic. E.g.:
forgot to call free() on address returned by malloc()
did not close file handle returned by open()
invalid flags passed to open()
invalid file handle passed to poll()
write() called on fd that wasn't opened for writing
pass invalid flags to open() e.g. o... |
forgot to call free() on address returned by malloc()
Well, malloc and free aren't kernel calls! What malloc() (which is a libc library function, normal user process code!) does
look up in the memory pool it keeps whether there's an available chunk of the requested size
if so, mark it as used and return it to the p... | Tool to detect errors in application's execution logic |
1,328,709,532,000 |
In a bash script I have a log() function that is used in several places, as well as a logs() function that diverts lots of line to log(). When I run parts of the script with set -x, obviously all commands within logs() and log() are traced too.
I would like to define logs() and log() such that at least their content, ... |
A quick and dirty hack that should work in all shells is to (temporarily) make your log an external script instead of a function.
In bash you could also use a trap '...' DEBUG and shopt -s extdebug combination, which is much more versatile than set -x. Example:
debug() {
local f=${FUNCNAME[1]} d=${#FUNCNAME[@]... | Define bash function which does not show up in xtrace (set -x) |
1,328,709,532,000 |
I have a Busybox/Linux system where a mystery program is segfaulting rarely. Is there a way to find which program is doing this?
|
If the segmentation fault produces a "core" file, you can run file <core-filename> to identify the executable. You can also use ddd or gdb to debug the core file for more information.
| Is there a way to find out which program is segfault-ing? |
1,319,498,458,000 |
I have been looking through the documentation for /proc and the "stack" object being a new'ish object in proc, I have also looked through the kernel commit to create it -- however the documentation does not detail exactly what is in the /proc/self/stack file -- and since I intuitively expected it to be the actual stac... |
The file /proc/$pid/stacks shows kernel stacks. On your system, memory addresses of the form ffffffff8xxxxxxx are in the space that's reserved for the kernel. There's not much documentation, you can check the source code. In contracst, the pstack program shows user-space stacks (using its knowledge of executable forma... | What is the difference between /proc/self/stack and output from pstack? |
1,319,498,458,000 |
First, a brief description of the situation: a computer sits hidden near a display in a gallery of some sort, acting as the silent workhorse for a piece. Despite its programmer's best intentions the piece may, well, crash, from time to time depending on the passerby's interactions with the display. The programmer ha... |
Run ulimit -c 1073741824 prior to starting the program. Next time the program crashes, a core dump will be created in the working directory (named core.<PID>). You can then use GDB to open this core at any time you like.
ulimit -c XXXXX sets the maximum size of the core dump file created when a program seg faults. By ... | Capture and log GDB backtraces without stopping the process |
1,319,498,458,000 |
I would like to debug a loaded kernel module I don't have the source code to; I suspect it's a virus. Is there a way to feed it into GDB for analysis?
|
From a debugging perspective, the kernel is a special "process", distinct from the user space processes, which communicate with the kernel via a sort of rpc mechanism (syscalls) or mapped memory..
I don't think you can see the kernel's data structure simply by inspecting some random user process.
Another problem is,... | How to debug an inserted kernel module? |
1,319,498,458,000 |
I understand that set -x gets a Bash user into debug mode and I feel that working full time in debug mode will help me handle possible problems better in Bash.
I experience a problem when working with set -x:
When I try to use the native tab completion of my distro (Ubuntu 16.04) to complete a directory's name, I get ... |
This is due to the programmable completion feature of the shell that you are using.
If you're happy with basic tab completion for commands and filenames in bash, then running
complete -r
in your ~/.bashrc will remove any "fancy" (programmable) completion that involves calling functions etc. in the current shell's env... | set -x: tab completion results in messy output when working in debug mode |
1,319,498,458,000 |
I am trying to adapt the instructions from here, here, and here to install the debug version of the flash player on my Ubuntu 13.04 installation such that Chrome 30.0.1599.66 can use it.
Interestingly, it appears that I already have the official Adobe flash plugin installed and useable by Chrome, so the problem change... |
I finally figured it out while trying to get it to work for Firefox! This is based from the direction I found here.
sudo apt-get install ia32-libs nspluginwrapper
sudo mkdir /usr/lib/flash-plugin/
wget http://fpdownload.macromedia.com/pub/flashplayer/updaters/11/flashplayer_11_plugin_debug.i386.tar.gz
tar xzvf flashpl... | Install debug flash player in Chrome? |
1,319,498,458,000 |
The command tail -f command is great for tracing, and in terminal it's very helpful to be able to, for example, hit enter, and type a comment like
-- after xyz change... --
For record purposes, I would like to be able to pipe the tail output to terminal, plus my annotations, to a second file. Is this possible (other... |
This does what you need:
sh -c 'tail -f file & cat' | tee file2
Note, it duplicates your comments for the terminal output when you press enter.
It works also with {...} and (...) instead of sh -c, but then tail -f won't stop running when you press ctrl+c.
| Linux: write tail -f output, plus comments, to a separate text file |
1,319,498,458,000 |
I can get a function myHandler() to execute before a bash command by doing the following:
function myHandler() {
...
}
trap 'myHandler' DEBUG
However, I'd like to be able to proceed with or abort the execution of the impending BASH_COMMAND based on a runtime condition within myHandler as follows:
function myHandle... |
You can, just enable extdebug and return a non-zero code (See the description of extdebug option) from myHandler:
$ function myHandler() {
if [[ $SKIP = "true" ]]; then return 1; fi;
echo 'myHandler execute'
}
$ trap 'myHandler' DEBUG
$ shopt -s extdebug
$ echo 1
myHandler execute
1
$ SKIP=true
myHandler execute
$... | bash: Cancelling the execution of 'trap handler DEBUG' |
1,319,498,458,000 |
My board continues to display the message below.
The terminal does not have any input.
What is it with the following message, which I know? (T, g, c, q ...)
What is the cause of this phenomenon?
How can I fix this phenomenon?
INFO: rcu_preempt detected stalls on CPUs/tasks: { 3} (detected by 0, t=3936547 jiffies, g=36... |
You probably have a real time application that is consuming all cpu (some bad implementation) and because of its realtime scheduling priority the system doesn't have enough resources available for other tasks.
I suggests that you remove realtime priority from your applications and check which one is consuming a lot of... | "rcu_preempt detected stalls on CPUs / tasks" message appears to continue |
1,319,498,458,000 |
How do I activate extra verbosity during boot, on Debian? I removed the quiet parameter and tried to add debug but it didn't help.
My problem is that my keyboard takes 2-3 min to activate so it slows my startup tremendously since I need to unlock a partition. I would like to get the message that pops out the moment m... |
There is a list of all possible boot parameters. I've never used it, but try adding ignore_loglevel:
Ignore loglevel setting - this will print /all/ kernel messages to the console. Useful for debugging. We also add it as printk module parameter, so users could change it dynamically, usually by /sys/module/printk/p... | How can I activate extra-verbose mode (debugging mode) during Debian boot? |
1,319,498,458,000 |
I'm trying to enable the kernel persistent storage (pstore) in order to help debug a module which malfunctions and freezes my laptop on suspend, but I'm having difficulties doing so.
My kernel (4.1.20) config with related parameters is
# gunzip -c /proc/config.gz | grep PSTORE
CONFIG_CHROMEOS_PSTORE=m
CONFIG_PSTORE=y
... |
You need to determine a piece of memory that survives a reboot. Then it's probably the easiest approach to pass that via kernel parameters, see
the ramoops Documentation in the kernel tree.
| How to enable kernel pstore? |
1,319,498,458,000 |
There are a plethora of websites that will try to deduce your location from your IP address. For example: https://nordvpn.com/what-is-my-ip/.
This is handy for debugging VPNs - if I visit one of these sites and the location corresponds to the reported server location, rather than where I actually am, then I'm reasonab... |
You can use ipinfo.io or ipstack.com services through curl:
curl --silent "https://ipinfo.io/ip"
similarly change ip to country to get your geographical location.
| Is there a command line program to check IP location (for VPN)? |
1,319,498,458,000 |
I'm trying to debug Linux kernel using qemu and gdb. The problem is that gdb won't stop at the breakpoint. I've searched about it and found that turning kASLR off may help because kASLR confuses gdb.
-- Install that kernel on the guest.
+- Install that kernel on the guest, turn off KASLR by adding "nokaslr" to
the k... |
Kernel boot parameters can be set temporarily per boot or always via some configuration file; how this is done depends on the bootloader which for current versions of Ubuntu is grub2;
$ grep GRUB_CMDLINE_LINUX_DEFAULT /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
$ sudo perl -i -pe 'm/quiet/ and s//quiet nokasl... | Turning off kASLR to debug linux kernel using qemu and gdb |
1,319,498,458,000 |
Is there a way to run scripts in bash that makes it so that it prints each line of the script before executing it? This would be really useful to me for debugging...
$./myscript.sh
echo "Hello"
Hello
I would be able to see exactly how far my script has gotten, and what it is doing.
|
You can enable/disable this feature through the use of the set command, and the option -x/+x.
-x - After expanding each simple command, for command, case command, select command, or arithmetic for command, display the expanded value of PS4, followed by the command and its expanded arguments or associated word list.... | Echo out lines of script before running them |
1,319,498,458,000 |
Let's say I use this command:
ssh -vvv user@server
I get an output similar to this:
send packet: type 21
ssh_set_newkeys: mode 1
receive packet: type 6
SSH2_MSG_SERVICE_ACCEPT received
receive packet: type 51
Permission denied (publickey,password)
What are all these packet-types?
Where can I read and learn about th... |
SSH is defined in IETF RFCs like
RFC4253 - The Secure Shell (SSH) Transport Layer Protocol (note
that there's errata and several updates)
RFC4250 - The Secure Shell (SSH) Protocol Assigned Numbers
In general the places to find out how things work are IEEE standards and IETF RFCs. They're not the easiest read, the la... | How to read and debug SSH verbose-mode? |
1,319,498,458,000 |
I'm trying to boot Linux from U-boot on an embedded ARM board using a filesystem on a remote machine served via NFS. It appears that the ethernet connection is not coming up correctly, which results in a failure to mount the NFS share. However, I know that the ethernet hardware works, because U-boot loads the kernel v... |
You can compile a initrd image into kernel (General Setup -> Initial RAM filesystem and RAM disk (initramfs/initrd) support -> Initramfs source file(s)). You specify file in special format like (my init for x86):
dir /bin 0755 0 0
file /bin/busybox /bin/busy... | Debugging ethernet before NFS boot |
1,319,498,458,000 |
I wonder if it is possible to compile individual software packages from FreeBSD source tree without compiling the whole kernel and world....Say,for example ex , which is included in the nvi (new vi) source code.
https://svnweb.freebsd.org/base/head/contrib/nvi/
My intention is to compile, if possible, individual softw... |
Sure, with the standard /usr/src installed it might run something like
# cat /etc/src.conf
CFLAGS=-pipe
DEBUG_FLAGS=-g
# cd /usr/src/usr.bin/vi
# make clean && make obj && make depend && make && make install
# gdb -d /usr/src/contrib/nvi/ex -d /usr/src/contrib/nvi/common -tui ex
| Is it possible to compile individual software from the FreeBSD source tree? |
1,319,498,458,000 |
The main server at my company has recently been having a lot of downtime. For reasons that neither I nor the other admins can determine, it has random (VERY sudden) explosions in memory. It becomes unresponsive because it exhausts all the memory, and then we have to reboot it. Very annoying. It's a Debian system, we h... |
atop is pretty good at monitoring and logging resource usage. It can be used interactively or as a service; the debian package sets it to log to /var/log/atop.log every ten minutes (edit /etc/init.d/atop for something more precise). You can then replay the logs with atop -r /var/log/atop.log -b hh:mm -mM; mM selects a... | Unpredictable memory explosions |
1,319,498,458,000 |
I am experience some problem in my zsh configuration which is based on oh-my-zsh, which I have described at Physical buffer in terminal is getting misaligned with display in oh-my-zsh configuration.
What I need to know if there is some kind of logging mode in which zsh can produce some information on what is happening... |
You have several options.
First of all, you can setopt xtrace or set -x to get trace info on all calls in the current shell or use zsh -x to start a new shell with that option set. This generates a lot of debug info, though. Plus, it might not even include all the things you are interested in.
If you know more specifi... | Does zsh have some kind of diagnostic mode? |
1,319,498,458,000 |
I am trying to debug a segfault without code a binary in a nonstandard path (specifically in /frs/alg/alg/bin/) and I was noticing that the decompiled code has fewer symbols than when debugging under gdb. I am assuming that the debug symbols are detached, but Where should I look to find them?
|
Presumably the binary has detached debug information; if gdb is able to find this without any particular configuration, it should be in one of
a build-id based file under /usr/lib/debug/.build-id;
a .debug file alongside the binary;
a .debug file in /frs/alg/alg/bin/.debug;
a .debug file in /usr/lib/debug/frs/alg/alg... | How do I find detached debug symbols for decompilation? |
1,319,498,458,000 |
Currently I am using gcc-4.3.6 and Eclipse IDE for c++ development. I want to debug my project in Eclipse with gdb. I am having a hard time debugging code when it contains STL containers. Also I am not using STL directly, I have wrappers for each container.
I know we have to use pretty printing for looking into STL c... |
the debugging features provided by gdb are based on the set of symbols that comes with your compiled code.
Actually there isn't a debug version available for the STL, but there are at least 2 portings that can add debug symbols to your code:
http://www.stlport.org/
http://code.google.com/p/stl-debug/
gdb without debug... | Unix/Linux C++ debugger that supports STL containers? |
1,319,498,458,000 |
While configuring kernel for debugging found this option:
CONFIG_X86_PTDUMP: Export kernel
pagetable layout to userspace via
debugfs
Does this mean RAM page-table layouts ? any guides on how to use debugfs and view this layout ?
|
Take a look at the following:
Page table management
Dumping kernel page tables
| Dump Page table layout (KERNEL CONFIG) |
1,319,498,458,000 |
I would like to study the flow of some linux device drivers and some minimal flow of kernel (threading cum context switching and interrupt management).
How can I debug the linux kernel? What are the basic steps for doing that?
Recently i successfully compiled and integrated new kernel (2.6.34.7) into my machine runnin... |
It depends on what you really need. Probably simple printk() function is gonna be OK for the beginning. There is also the /proc interface you can use to get useful information from kernel.
If you need something more complicated, use KGDB (kernel debugger).
| Kernel debugging |
1,319,498,458,000 |
I can provoke a race condition that gives output similar to this in dmesg:
[ 5432.541379] perl[408327]: segfault at 22 ip 0000564eb8af9cc2 sp 00007ffec318cea0 error 6 in perl[564eb8af7000+1a1000]
[ 5432.541402] Code: 83 f8 05 0f 87 cf 00 00 00 0f b7 6b 22 66 81 fd 00 04 77 64 01 ed 8d 7d 05 48 63 ff 48 c1 e7 03 be 01 ... |
A ps aux run during the test reveals lines like:
tange 1471203 0.0 0.0 264173920 3776 pts/1 T 20:54 0:00 sort --buffer-size=50% -k3r
264173920 is 50% of 500 GB, and there are 20 of those.
meminfo says:
$ grep Committ /proc/meminfo
Committed_AS: 5291525876 kB
So my assumption that 500GB would be enough w... | Debug segfault race condition |
1,319,498,458,000 |
So I've been debugging a hairy suspend-to-ram issue, where I get
Oct 12 15:41:23 arjundesktop dbus[2863]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service'
Oct 12 15:41:23 arjundesktop systemd[1]: Reached target Sleep.
Oct 12 15:41:23 arjund... |
I have no real answers, but I changed my graphics card from an AMD 7950 to a AMD Vega 64. Now suspend to ram works fine on the amdgpu driver, so I suspect it was a graphics driver issue.
| Debugging a suspend to ram issue with PM_TRACE |
1,319,498,458,000 |
I want to create an alias that can handle parameters ($1),
and can fall back to a default value if a parameter is not provided.
For example,
$ alias foo='NUM=${1:-42}; echo $NUM'
Invoked without params it works as I want:
$ foo
42
But invoked with a param, it prints both my value and default value:
$ foo 69
42 69
... |
aliases are just text replacement before another round of shell syntax interpretation, they don't take arguments, so after:
foo 69
The foo text is replaced with NUM=${1:-42}; echo $NUM and then the shell interprets the resulting text:
NUM=${1:-42}; echo $NUM 69
$1 is still not set, so that's NUM=42; echo 42 69
For a... | alias using `$1` and fallback default value prints both the param and the fallback value |
1,389,335,404,000 |
I know the basics of how to use gdb. But I would like to learn some advanced debugging techniques using gdb. What are the best resources - books, blogs, tutorials - that any of you use regularly. I did look at this question: Tips or resources for learning advanced debugging techniques GDB in xcode but what I'm lookin... |
Norman Matloff's book on debugging: The Art of Debugging is quite good, though I don't know if you would consider it advanced. There is also his online tutorial, Guide to Faster, Less Frustrating Debugging, which might be an earlier version of the book.
There is also a tutorial My debugging tutorial, linked from the p... | what are some of the best resources to learn advanced debugging techniques using gdb? [closed] |
1,389,335,404,000 |
I have a core file on a Debian system. I want to obtain a complete list of all debug symbol packages needed to generate a symbolic stack trace from that core dump.
By what means can I generate such a list?
|
As of Debian buster, you can use find-dbgsym-packages from the debian-goodies package.
find-dbgsym-packages lists all *-dbgsym packages required to properly debug processes given by a list of executables, libraries, core dumps or PID numbers.
| How can I find which dbgsym packages I need to obtain symbolic stack traces? |
1,389,335,404,000 |
A few days ago, my mouse button releases began sometimes not being recognised when I release two of the buttons simultaneously. The logical state of one button therefore gets stuck on "down", causing annoying unintended actions until I press it again to reset it.
I could reproduce the issue monitoring mouse events in ... |
The levels between USB events and X events are:
Unless your mouse is special and has its own driver, it's very likely a HID device. Find the corresponding hidraw device (check dmesg), and verify you get events there. USB to HID translation is done by the kernel.
All input events leave the kernel through the input-lay... | How can I debug X11 missing mouse ButtonRelease events that are present in usbmon? |
1,389,335,404,000 |
I am currently using Ubuntu 18.04 and VirtualBox GUI Version 5.2.18 and I faced the following bug:
Kernel driver not installed (rc=-1908)
The VirtualBox Linux kernel driver (vboxdrv) is either not loaded or
there is a permission problem with /dev/vboxdrv. Please reinstall
virtualbox-dkms package and load the kern... |
If your system has UEFI firmware and Secure Boot is enabled, that might explain why you aren't "permitted" to load (unsigned) kernel modules.
Ubuntu is supposed to have an automated the signing process for third-party modules, but it is possible that the process hasn't worked as expected. For example, if you've updat... | VirtualBox Error : Kernel Driver not installed(rc=-1908) |
1,389,335,404,000 |
I have Debian stable and I have found some weird bug which was already fix.
The fix were merged into the stable branch which version was
gnome-settings-daemon 3.32.1
but I have
gnome-settings-daemon 3.30.2-3
So, how can I use the patch without breaking my system? I have to install from where? Backports?
I check versi... |
According to the Debian Packages page for gnome-settings-daemon, the latest version for stable (buster) is 3.30.2-3 (which you already have installed).
However, for testing (bullseye) and unstable (sid), version 3.38.1-2 is available. Thus, you could install only the missing packages from those newer releases, as desc... | How to patch a debian package? |
1,389,335,404,000 |
A CentOS7 server is experiencing crashes. According to RHEL7's documentation, I should be able to view details using the crash utility:
crash /var/crash/<timestamp>/vmcore /usr/lib/debug/lib/modules/<kernel>/vmlinux
I see a few folders in /var/crash along with the respective vmcore files. I am missing is the /usr... |
The previous page of the RHEL documentation also tells you following:
In addition to crash, it is also necessary to install the kernel-debuginfo package that corresponds to your running kernel, which provides the data necessary for dump analysis.
So all you need is to install kernel-debuginfo package with the same v... | Unable to use crash utility due to missing /usr/lib/debug/lib/modules/ folder |
1,389,335,404,000 |
I have a machine where apt-get update hangs for ever with a "Waiting for headers" message, suggesting that one source is not responding. From this question I know I can do sudo apt-get -o Debug::Acquire::http=true update to identify the culprit. However, it is still complicated to find out which query is not respondin... |
Put this in your apt configuration file:
Acquire::Queue-Mode "access";
or use it on the command line like this:
apt-get -o Acquire::Queue-mode=access update
| How can I tell `apt-get update` to download only one file at a time? |
1,389,335,404,000 |
I followed the directions from:
http://www.rsyslog.com/doc/debug.html
I put the following in /etc/rsyslog.conf:
$DebugLevel 2
$DebugFile /root/RSYSLOG.txt
then I try:
kill -USR1 `cat /var/run/syslogd.pid`
kill -USR2 `cat /var/run/syslogd.pid`
It appears there isn't a rsyslogd.conf.
I check the RSYSLOG.txt, it remai... |
This article should show how the "debug on demand" function works in rsyslog. It has been tested and verified with rsyslog 6.1.0 (v6-Devel) on Fedora 13 (steps may vary on different OS). It is assumed, that rsyslog is already working on the system. On notes regarding the installation and configuration, please take a l... | How do I get debug information from rsyslog? |
1,389,335,404,000 |
I have a really strange audio problem on my Fedora distro (Fedora 35 Workstation Edition), installed on my laptop.
Previously I used Windows 10 on my laptop, and I had no audio problem whatsoever. Then I installed Fedora, and after approximately one month I stared having the following symptoms: Some days, not all days... |
I found the solution, thanks to this other answer! Turns out you just need to execute the following in terminal:
sudo dnf swap --allowerasing pulseaudio pipewire-pulseaudio
Problem gone!
Seems like it was a problem with Pipewire, I have really no idea why a bug like this is present in Fedora 35.. I have read online t... | Inconsistent Fedora 35 audio problem |
1,389,335,404,000 |
I would like to be able to use something like the BASH_ENV variable in zsh, however I can't find anything like it by Googling.
From man bash:
BASH_ENV
If this parameter is set when bash is executing a shell script, its value is
interpreted as a filename containing commands to initialize the shell, as in
~/.bashrc. T... |
The closest I can think of is ZDOTDIR. Zsh reads its user initialization files in the directory $ZDOTDIR, falling back to $HOME if ZDOTDIR is unset. When zsh is running a script, it loads the user initialization file .zshenv.
So if in bash you'd have a file /path/to/my-bash-env containing
wibble
and you'd run env BAS... | Does zsh have any equivalent to BASH_ENV? |
1,389,335,404,000 |
Normally I like to have all of the debug output of a script go to a file, so I will have something like:
exec 2> somefile
set -xv
This work very will in bash, but I have noticed in ksh it behaves differently when it comes to functions. I noticed when I do this in ksh, the output does not show the function trace, onl... |
From the documentation:
Functions defined by the function name syntax and called by name execute in the same process as the caller and
share all files and present working directory with the caller. Traps caught by the caller are reset to their
default action inside the function.
Whereas
Funct... | set -xv behavior in ksh vs bash |
1,389,335,404,000 |
I want to trace a running multi-threaded process's library calls. As of 5 November 2012, there's only one way to get ltrace to fully support tracing multi-threaded processes: you must check out and compile an ltrace 0.7.0 prerelease. So I've decided to use latrace instead. But, looking at the latrace documentation, I... |
It's impossible to attach latrace to a running process. The article "Using latrace" in the MeeGo 1.2 developer documentation makes it clear:
You must restart the process with latrace for the tracing to work.
Someone should send a feature request to the latrace mailing list.
| Is there any way to attach latrace to an already-running process? |
1,389,335,404,000 |
This is somewhat related to gdb set overwrite logging on should overwrite gdb.txt correct? .
Let's say I'm running a session of some application. For example purposes, let me take the example of qbittorrent again.
As shared before this is how a run happens -
$ gdb qbittorrent
(gdb) set logging overwrite on
(gdb) ... |
You can use signals for this. Before you start your program, set up USR1 or USR2 to break gdb without affecting the program:
handle SIGUSR1 nopass
Then you can run your program, and when you need to stop it, run kill -USR1 from another shell with the appropriate (child) pid. gdb will pause the application, and you ca... | How to quit an application running in gdb gracefully when the application isn't reponding. |
1,389,335,404,000 |
Background
I have a system that runs Linux. It's a NAS, and does not have any monitor, keyboard, or serial port. It does have a network port. I'm not happy with the software running on it, and am trying to get a different distro to run.
What I have
On the existing system, I can manage to get a new kernel and initrd bo... |
After starting an SSH session, other sessions can write there too, by writing to /dev/pts/<N>. So to see what is happening, since I'm already able to control what PID 1 will end up running, I just need to make it write there. Using exec 0<>/dev/pts/0 1<>/dev/pts/0 2<>/dev/pts/0 from PID 1 and making sure nothing else ... | How can I remotely debug a broken initrd? |
1,389,335,404,000 |
I'm trying to generate FTrace files inside an Android environment, using:
root@adroid:# echo 1 > /sys/kernel/debug/tracing/events/sched/sched_switch/enable
root@adroid:# echo 1 > /sys/kernel/debug/tracing/tracing_on
root@adroid:# cat /sys/kernel/debug/tracing/trace > mytracefile.txt
root@adroid:# echo 0 > /sys/kernel... |
Apparently this issue has nothing to do with Android. We have tested with our custom Linux version and we have still the same problem: FTrace produces milliseconds precision while other tools are able to produce microseconds precision. Maybe a FTrace module version problem?
Regards,
| How to increase ftrace precision to microseconds? |
1,389,335,404,000 |
Source file is having a special character in starting of each row.
File is double space delimited.
Sample data file:
âNAME ABC
âAGE 21
âADDRESS XYZ street ABC city
âCONTACT 13244235
âDOJ 20181212
I want to remove â as its first and special character in each line and convert file to ; (semicolon) delimited file.
... |
Since the â you are seeing is almost certainly an encoding issue, and assuming all of your lines are supposed to start with a capital letter, you could try this:
LC_ALL=C sed 's/^[^A-Z]*//; s/ */;/g' FILE1.txt > FILE2
That will run the command using the C locale which should ensure that whatever character your â is... | I want to remove 1st character from each line as its special and convert file to ; semicolon delimited file |
1,389,335,404,000 |
All of the following operations are no-effect operations:
echo bash | bash
echo dash | dash
echo "bash -c bash" | bash
echo "dash -c dash" | dash
Why? For the first line, for instance, I would assume that it would create a bash instance, and then it would create another bash instance waiting for input. But it does no... |
The second bash instance does wait for input on its stdin (which is the same pipe the bash string was read from), but it only gets an EOF as soon as the echo process has exited and the writing end of the pipe has been closed.
You could try to give some input to the second bash, too:
(echo bash; echo echo hjello) | bas... | Why does `echo bash | bash` take an immediate exit? |
1,389,335,404,000 |
When I run gdbserver on a device (like gdbserver :2345 myapp), gdbserver completely blocks the terminal. Neither adding an ampersand &, nor pressing ^z makes it running in background. I also checked: it is reproducible on Kubuntu too.
I really need to use shell commands, and since I've no idea how to execute these via... |
This seems to have worked for the OP.
gdbserver :2345 ls > /dev/null 2>&1 &
I think the reason for this is because when a program is daemonized it closes all the STDIO 0,1 & 2. The next IO to open will be 0. If the program tries to use 0,1 or 2 with things like printf or scanf it will be acting on the wrong IO or a c... | How to launch «gdbserver» in background? |
1,389,335,404,000 |
I am trying to parse a recursive directory of PHP files using the built in PHP linter, which works like this:
$ php -l good.php
No syntax errors detected in good.php
$ php -l bad.php
PHP Parse error: syntax error, unexpected ''foo'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in bad.php on line 3
Errors parsing bad.... |
To see whether xargs makes a difference, run the command lines that it runs. Here are a couple of ways to see exactly what it runs, while not risking changing what it runs:
Write a script called php in a temporary directory and put it at the beginning of $PATH. In this script, log the arguments (and optionally run th... | Who is eating data? Xargs? |
1,321,929,332,000 |
I come from Ubuntu and when things crashed I could collect the relevant information and submit a bug report. Is there an easy or preferred way to do this in Arch Linux after an application crashes?
|
Arch is a DIY distro: there is no automated tool for bug reporting. There is, however, comprehensive guidance on the Arch Wiki for reporting bugs.
The philosophy of Arch, the Arch Way, stresses self-sufficiency and a willingness to contribute solutions, which means actively participating in bug reporting and squashing... | Submitting bug reports for Arch Linux |
1,321,929,332,000 |
I got an embedded system trying to create a ppp connection using a GSM modem. However the connection is never established and all I get is this error message in syslog:
Oct 12 08:38:48 pppd[451]: pppd 2.4.4 started by root, uid 0
Oct 12 08:38:59 pppd[451]: Connect script failed
Oct 12 08:39:00 pppd[451]: Exit.
I now ... |
Somewhere in your ppp setup (probably either in /etc/ppp/options or at the command line), you have an option called connect followed by a command used to setup the modem for a connection. It's usually a chat script. You need to find out why that command is failing. If it is a chat script, you can make it verbose by ch... | How to proceed solving ppp connection problems? |
1,321,929,332,000 |
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.
Any ideas on how to pass the underlying commands of tab completion to strace?
What I tried:
I run top in one shell to monito... |
(Assuming you're using Linux) Use echo $$ to get the PID of your current shell. Open a new terminal, and run:
sudo strace -fp <PID> -o log
Switch back to the old shell, try tab completion. Then switch to the new terminal and press CtrlC to end strace. The output will be in the file named log. You could also run the s... | I have a tab completion that hangs, is it possible to use strace to find out what is going on? |
1,321,929,332,000 |
According to the bash manual (emphasis mine):
PS4
The value is the prompt printed before the command line is echoed when the -x option is set (see The Set Builtin). The first character of PS4 is replicated multiple times, as necessary, to indicate multiple levels of indirection. The default is ‘+ ’.
Is there a way... |
You can set PS4 to have its first character to be NUL, which takes no space on screen:
export PS4="\000 "
You will then have no visual indication of how deeply-nested the commands in question are.
| Preventing bash $PS4 from replicating first character |
1,321,929,332,000 |
Bash is able to trace execution script commands with the -x command line option. Each command is then output to stderr, prefixed by PS4 as stated in the man page.
-x After expanding each simple command, for command, case command,
select command, or arithmetic for command, display the expanded
... |
As an approximation, you could do:
trap '{ type -p -- "${BASH_COMMAND%% *}" >&3; } 3>&2 2> /dev/null' DEBUG
set -o functrace -o xtrace
The DEBUG trap is run before every command. During the execution of that trap, $BASH_COMMAND is set to the current command. That includes function calls, builtins, assignments... We c... | Bash option to get resolved executable path? |
1,321,929,332,000 |
I'm using menuconfig to setup a linux kernel for debugging, but why does it seem that DEBUG_STACKOVERFLOW only works for 32 bit systems?
As you can seen in the screenshot, enabling HAVE_DEBUG_STACKOVERFLOW requires the system to be 32 bit. Is this because it's enabled by default when compiling for 64 bit systems? Goo... |
x86_64 used to have stack overflow checks, but they were removed once guard pages were added to all the stack types. Guard pages provide reliable overflow protection, without needing extra checks, so the stack overflow checks were redundant.
| How come you can't enable "DEBUG_STACKOVERFLOW" when configuring a 64 bit kernel? |
1,321,929,332,000 |
I have a bash script which throws 100s of lines.
I can see which command doing this using set -x but it's difficult to find it on terminal.
If set -x option shows in color I can find it faster.
Is this possible in bash or zsh?
I tried trap but it's not working for file redirections
trap 'tput setaf 1;tput bold;echo $B... |
In zsh, you could define $PS4 to something like:
PS4='%F{blue}%B+%N:%i>%b%f '
To have the xtrace prompt in bold and blue for instance (+%N:%i> being the default value of $PS4, %F{blue} changes the foreground colour to blue and %B enables bold mode, %f/%b turning both off respectively).
| How to show bash set -x commands in colors? |
1,321,929,332,000 |
Assuming I have a core dump from a Debian system, where I know the build-ids of the libraries used in the dump, but don't know the exact versions, is there a way to find those files?
For example, the command eu-unstrip -n --core my-core-file gives me a list of build-ids from a core dump, like this:
0x7f09b7228000+0x2... |
As far as I’m aware there’s no tool to search for build-ids (but see further down).
You can use apt-file to search for packages providing the libraries in use. Install it, update the indexes, then run
apt-file search /lib/x86_64-linux-gnu/libpcre.so.3
apt-file search /lib/x86_64-linux-gnu/libz.so.1
apt-file search /li... | Debian: Find binary and debug files by build-id |
1,321,929,332,000 |
I have a kernel crash on this function: __rb_rotate_left().
Can someone explain what this function is meant for in simple terms?
PC is at __rb_rotate_left+0x24/0x78
LR is at rb_insert_color+0x108/0x134
pc : [<c41aef04>] lr : [<c41af0dc>] psr: a0000013
sp : cf2c9ddc ip : acc8089f fp : cf2c9dec
r10: d0800000 r... |
This function changes the structure of a binary tree without interfering with the order of the elements.
See:
the Wikipedia page on red-black trees;
the Wikipedia page on tree rotation;
the source code of __rb_rotate_left in rbtree.c.
| Use of __rb_rotate_left() |
1,321,929,332,000 |
I am running into an issue where I see command results in .zshrc being displayed twice; in trying to track down the issue I want to know how to check if .zshrc is being run (so I can tell whether it's a display issue or that .zshrc is actually ran twice).
So I am thinking some snippet that increment a counter each tim... |
Add this to your .zshrc:
echo "$(date) -- .zshrc executed" >> $HOME/.zshrc.log
You will then see a datestamp for every time the rc file is run, sourced, or otherwise executed in the file .zshrd.log in your home directory.
| Check if zshrc is being ran/sourced |
1,321,929,332,000 |
I'm fairly good with windows .bat scripts and normally use the pause command while developing them so I can see things step by step as the script runs in the command prompt. I am trying to do something similar with a Linux Bash file. I have a very simple bash, which can be seen below...
#!/bin/bash
echo Hello World!
r... |
You need to launch a terminal, which in turn launches the script.
Try this:
#!/bin/sh
xterm -e "echo Hello World; read -p 'Press [Enter] key to exit ..."
This is of course impractical for a longer script. But then you can simply do:
#!/bin/sh
xterm -e /home/user/scripts/thescript.sh
and thescript.sh contains all the... | Double click Linux Bash Script and debug with pause commands |
1,321,929,332,000 |
I use git to track my dotfiles across multiple machines. I wrote a pretty simple script in the repo, which backs up any outdated existing dotfiles and then creates symbolic links to each of the up-to-date dotfiles. Here is the script:
#!/bin/bash
############################
# makesymlinks.sh
# This script creates sym... |
Here's the output in your question annotated:
drakeprovost@shatterdome:~/RoverCoreOS$ git clone https://github.com/DrakeProvost/dotfiles.git
Cloning into 'dotfiles'...
remote: Enumerating objects: 42, done.
remote: Counting objects: 100% (42/42), done.
remote: Compressing objects: 100% (30/30), done.
remote: Total 42 ... | My dotfiles bash script somehow deleted its own directory? |
1,321,929,332,000 |
I have a dual booted system, and its been years since I have used the linux side. I am running Fedora15 and am trying to upgrade. I have tried
yum install preupgrade
and I get the error message
Error: Cannot retrieve repository metadata (repomd.xml) for repository: fedora. Please verify its path and try again
I have... |
EOL of Fedora 15 was 4 years before - on 2012-06-26 - so you are trying to update non-supported system. There are no updates nor security fixes. I'm afraid, that you are not able to upgrade your system to newest stable Fedora (24) easily and the best solution is to backup all and download and install stable system fro... | Fedora 15 updates |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.