Best of Tech
I compiled an application that causes a segfault when run. The expected size of allocated memory is expected to be large, less than 1000000. The offending line seems to be:
This is likely to result in the following:
The program compiles fine with:
gcc a2.c -o a2 -lm -lfftw3 -lz
When you allocate memory, you must check to be
sure you actually received the memory block you
requested. If not, the memory allocation functions,
such as calloc, return NULL. Dereferencing NULL
generates a segfault. It's possible you're hitting
a user quota limit. Run ulimit -a to see what your
limits are currently set to. See man ulimit for
information on how to change these values and man
calloc for more information about how these allocation
I suggest you arm yourself with gdb. Compile using
the -g option and run under the debugger. When your
program gets a segfault, you can do a trace-back. A
nice graphical interface to gdb, called ddd, is available.
Become familiar with these tools, and your life
will be much better.
Usman S. Ansari
I recently upgraded to KDE 3.3, and now find that I am having problems with my magic cookies whenever I run a graphical program with su. For example, here is what happens in a typical attempt to launch xadminmenu:
root@toad:/home/nathan/Desktop# xadminmenu root@toad:/home/nathan/Desktop# Xlib: connection to ":0.0" refused by server Xlib: Invalid MIT-MAGIC-COOKIE-1 key Gtk-WARNING **: cannot open display: :0.0
If I first copy .Xauthority from /home/nathan to /root/, it works. My
magic cookies are all happy. I have tried using xauth
add to make it
so that root's magic cookies match my own, but it fails each time for
toad:0 and unix:0 and works for toad:10 and unix:10. Am I missing
something obvious here, other than that I should break down and read up
on X? Is my only real choice to run a quick Perl script on login that
copies .Xauthority over so I don't have to do it manually? At present,
I'd really rather not use yet another hack to keep my system running.
Several situations can be the cause of your problem:
1) Make sure you have the DISPLAY variable set in your environment, it should be set to something like :0.0 or localhost:0.0.
2) Make sure your account has ownership permissions on the actual X display you are trying to use. That is, if your account is the one permitted to own/use the display. Use the xhost command to find out which user's client programs can use your display, including local ones. Do a man xhost to learn about the options for this command.
3) The Xlib: Invalid MIT-MAGIC-COOKIE-1 key message also may indicate that an X server already is running in your system as display 0. Before running xadminmenu or any other X command, do a ps ax to find out if there is an X process already running. If so, try changing to that display with Ctrl-Alt-Fx, Fx being one function key on your keyboard; F7 is commonly used for display 0.
4) Do a man startx to find options for starting X; there are many
options and combinations for doing so.
Felipe Barousse Boué
Where might I obtain the libmp3lame.so.0 library? I need it for mplayer.
When I tried to install the RPM packages for mplayer, it informed me that
I need this library, whatever it is.
David A. Barnett
I've been looking for information on how to set up a
Linux box as a VPN server and have it authenticate
against Microsoft Active Directory. I don't want
to maintain two separate lists of users and passwords.
Can you point to me any
sources you might know of on how to do it, assuming
The same question came up on the SourceForge mailing list for Poptop, a Linux VPN server that supports Windows clients. One user provided a collection of information resources that should get you started: sourceforge.net/mailarchive/forum.php?thread_id=5787492&forum_id=8250.
Before beginning this project, it would be a good
idea to get a simple Samba file server set up on the
machine and authenticate against your Microsoft
directory. Even if you later disable the services,
there are numerous guides for doing so, it will
provide the core support services that Poptop can
use to do the same thing.
The document on this Web page may prove useful to you:
Also, see this page,
although it talks about older software versions.
Felipe Barousse Boué
I recently got a new computer and decided to install Linux on the old one. I installed LinuxMandrake 10.0, and everything is working well so far except for accessing the Internet. There aren't any Linux USB drivers for the modem I use, so I tossed an old network card I had lying around into the computer. I think it's a Realtek 8139, but I'm not sure. The sticker on the back reads Farallon PN993, but Linux and Windows both recognize it as a Realtek 8139.
I found a tutorial for the card at www.scyld.com/rtl8139.html and thought, “Great, step-by-step instructions.” So, I downloaded the four files, moved them to my Linux PC and followed the instructions. When I got to the first compiling line:
make KERNVER=`uname +-r` rtl8139.o
I pressed Enter, but all I got was a ton of errors flying across the terminal. I tried the other compiling option:
gcc -DMODULE -Wall -Wstrict-prototypes -O6 -c rtl8139.c
and I got the same errors. I then tried the other suggested compile line:
gcc -DMODULE -D__KERNEL__ -O6 -c rtl8139.c
and again got the same errors. I even tried adding:
-I/usr/src/linux/include -include /usr/src/linux/include/linux/modversions.h
to every compile option. I'm new to Linux, and I
don't know where to go from here. I've tried using
the 8139too driver that came with LinuxMandrake,
but when I select it, it says it's installing,
but it actually goes back to the screen where I say
that I want to choose the driver manually. I'm in a
never-ending loop. Could anyone help? Thanks.
Unfortunately, the driver you referenced in the URL above was designed for 2.4 kernels, and Mandrake 10.0 includes a 2.6 kernel (2.6.3). The 2.6 kernel series included numerous changes to how driver modules are built, so many 2.4 drivers no longer work. Fortunately, the 8139 driver has long been a part of the kernel source tree, so you almost certainly don't need to go through these gyrations.
The real answer is to continue to pursue why Mandrake is putting you
into an endless installation loop for this driver. You probably would be best
off posing your question on the Mandrake support site, a free resource that
generally provides fast answers to most Mandrake-related problems
Mandrake Linux's Web site states that Realtek 8139 cards are supported; being RTL 8139 reported as supported hardware and RTL-8139C and RTL-8139D as officially tested LAN cards. Now, I would suggest that you use the appropriate driver as a loadable kernel module. There are actually three possible drivers, one is rtl8139, another is 8139too and lastly 8139cp, with the two latter ones used in most current Linux distributions.
Try issuing, as root, the command modprobe 8139too, modprobe 8139cp or modprobe rtl8139. There is a high probability that you already have the required kernel module compiled and ready to use from your stock installation of Mandrake 10. If all this works fine, you may need to add a line like the following to your /etc/modprobe.conf file for automatic loading of kernel modules at boot time (of course, use the working module, in the example 8130too):
alias eth0 8139too
Felipe Barousse Boué
Almost always when a network card is supported by the
distribution, you don't need to do anything to have
it work on boot. If you don't have any important
data on the system, simply re-install, and Mandrake
should detect the card automatically and choose its
|Privacy Is Personal||Jul 02, 2015|
|July 2015 Issue of Linux Journal: Mobile||Jul 01, 2015|
|July 2015 Video Preview||Jul 01, 2015|
|PHP for Non-Developers||Jun 30, 2015|
|A Code Boot Camp for Underprivileged Kids||Jun 30, 2015|
|Comprehensive Identity Management and Audit for Red Hat Enterprise Linux||Jun 29, 2015|
- Privacy Is Personal
- PHP for Non-Developers
- Secure Server Deployments in Hostile Territory
- Linux Kernel 4.1 Released
- July 2015 Issue of Linux Journal: Mobile
- Django Templates
- Comprehensive Identity Management and Audit for Red Hat Enterprise Linux
- A Code Boot Camp for Underprivileged Kids
- Attack of the Drones