Changes between Version 2 and Version 3 of TroubleShooting

Jan 25, 2007, 4:41:00 AM (17 years ago)

Moved from my page


  • TroubleShooting

    v2 v3  
    1 = Troubleshooting mindi =
     1= Trouble-Shooting mindi =
    33Launch mindi using the verbose option of the shell:
    1010set -x
     14= Trouble-Shooting mondo =
     16mondo basically consists of two C programs, '''mondoarchive''' and '''mondorestore'''. To trouble-shoot mondo therefore may mean to debug. This sounds scarier than it is - just read on. ;-)
     18== Creating Backtraces ==
     19Backtraces can be very helpful when trouble-shooting issues like segmentation faults. To create a useful backtrace, you need gdb (the GNU Debugger) installed and an application (and possibly libraries) with debugging symbols built in. The following will explain how to do this.
     21=== gdb ===
     23gdb should be part of your distribution just use your favourite way to install the package, e.g.
     26apt-get install gdb
     29for Debian and friends (such as Ubuntu) or
     32yum install gdb
     35for Fedora/RedHat/Mandriva
     38=== mondoarchive/mondorescue with debugging symbols ===
     40To get '''mondoarchive''' and '''mondorescue''' with debugging symbols built in, you need to build from the source.
     42Get the latest stable mondo source package from '''''', e.g. '''mondo-2.0.9.tar.gz''', unpack:
     45tar xvzf mondo-2.0.9.tar.gz
     48enter into the new directory and build using make:
     51cd mondo-2.0.9
     52./configure --prefix=/usr
     56You will end up with binary in the following locations which are non-stripped, i.e. they contain debugging symbols:
     58file mondo/mondoarchive/mondoarchive
     59mondo/mondoarchive/mondoarchive: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.0, dynamically linked (uses shared libs), not stripped
     65file mondo/mondorestore/mondorestore
     66mondo/mondorestore/mondorestore: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.0, dynamically linked (uses shared libs), not stripped
     69Make backups of the original '''mondoarchive''' and '''mondorestore''' binaries and copy they newly created over the original ones.
     71== Trouble-Shooting mondoarchive ==
     73The best approach is to run the '''mondoarchive''' binary you just created with debugging symbols built in from its location in the built directory under gdb. So:
     76cd mondo/mondoarchive
     77gdb ./mondoarchive
     78run <usual arguments you use>
     81'''Note:''' Running it from within its build directory makes it so that more valuable information about source lines will be avilable in the backtrace.
     83When the segmentation fault happens, enter:
     89and send the output to the list.
     91== Trouble-Shooting mondorestore ==
     93If you do partial restore onto a live system, the same approach as described for '''mondoarchive''' can be used.
     95However, more likely you will experience a segmentation fault during restore. To run a backtrace in that situation proceeed as follows:
     97First, you need a '''mondorestore''' binary with debugging symbols. This should already been taken care of if you copied the newly compiled binaries as described above. Next, you need to make sure that gdb is available on your restore media. To achieve this, add this to '''/etc/mindi/deplist.txt''' before doing a mondoarchive run:
     104Boot the restore media into '''expert''' mode. Then start '''mondorestore''' like this:
     107gdb /usr/sbin/mondorestore
     111As described previously, once the segmentation fault happens, do:
     117and send the output to the list. (If you can't get the backtrace copied as text, you can use a photo of the screen as the last resort.
     119== Advanced Topics ==
     121=== Attaching to Running Processes ===
     123You can attach to a running process using:
     126gdb /usr/sbin/mondorestore <pid>
     129where <pid> is the process ID.
     131This can be particulary useful when running '''mondoarchive''' with the '-g' or when running '''mondorestore'''.
     133=== Using libraries with debugging symbols ===
     135The libraries used by a binary can be determined using the ldd command, e.g.:
     138ldd /usr/sbin/mondoarchive
     139       => /usr/lib/ (0xb7f8d000)
     140 => /usr/lib/ (0xb7f82000)
     141 => /usr/lib/ (0xb7f71000)
     142 => /lib/tls/ (0xb7f6e000)
     143 => /lib/tls/ (0xb7f5f000)
     144 => /lib/tls/ (0xb7e2a000)
     145 => /lib/ (0xb7db7000)
     146 => /lib/tls/ (0xb7d94000)
     147        /lib/ => /lib/ (0xb7fea000)
     150some of those libraries may come with debugging symbols built in as an alternative package, others can be buiolt from scratch and installed with debugging sysmbols installed. Using your distribtuion's standard built process is probably a good idea for this.
     152=== Worthwhile gcc Flags ===
     153-Wextra -Wshadow -Wstack-protector -fstack-protector
     155= Getting the entire kernel log on restore media =
     157The kernel ring buffer that '''dmesg''' reads defaults to 32k on recent kernels. This is not enough to capture the entire sequence of kernel message when Mondo Rescue boots off a restore media.
     159To increase the kernel ring buffer to 128k at boot time (and without recompilation) add the following kernel boot parameter:
     165expert log_buf_len=128k
     167'''dmesg''' needs to be told what buffer size to use to ensure that everything is displayed from the start. The '''-s''' parameter can be used for this like this:
     169dmesg -s 131072 | less