This resource is generally for Mandrake or RedHat Linux users, but
should also benefit users of other distributions. I've collected
together a few tips and pointers gathered by myself and others over the
years. It is intentionally presented roughly - the content is more
important than the presentation. Another good site to look for similar
hints and tips is on www.mandrakeuser.org
Index
1. Installation
Nothing here.
2. Bootloader
Nothing here.
3. XFree86
3.1 The X windows display
is not centered on the screen
3.2 Start or stop X from
being run automatically on startup
3.3 Change the default
number of colours used by X
4. Hardware
4.1 Getting a soundcard working
4.2 Plug and play devices
4.3 PCI devices
4.4 Connecting a USB digital camera
5. Applications
5.1 Decoding a winmail.dat file
6. Improvements (speedups,
efficiency improvements, alterations...)
6.1 Netscape and/or other X apps display fonts that
are too small
3.1 The X windows display is not centered on the screen
This is common. It sometimes happens that linux, the console and windows (on dual-boot machines) all position the screen differently! One thing you can do is tell X where to locate it's screen next time you start up.
First of all centre the screen (using your monitor controls) for the console (if you are currently running X then press CTRL-ALT-F2 to switch to a virtual console, then centre the screen, and then switch back to X with CTRL-ALT-F7).
Now back in X, open a terminal and type:
xvidtune &
Click on the "Auto" button (to highlight
it) and then repeatedly click on the Left or Right buttons until the screen
position is correct. Finally click on "Show".
xvidtune will print out the current settings
- something like the following;
"1024x768"
65.00 1024 1064 1208 1344 768 771
777 807 -hsync -vsync
You want to copy and paste this later. If your mouse has 3 buttons (or you have middle button emulation by pressing both buttons together), then simply highlight the entire line - later position the mouse where you want to insert the text and press the middle button to paste it.
Next you need to discover what type of
X server you are running. To do that, type;
ls -l /etc/X11/X
which returns the symbolic link information,
something like;
lrwxrwxrwx 1 root root
31 Jun 8 01:48 /etc/X11/X -> ../../usr/X11R6/bin/XF86_Mach64
Basically you are looking for the last word on that line. In my case it is Mach64 (since my video card uses an ATI Rage IIc chip, aka Mach64), which is an accelerated chipset. You must classify your server into VGA (if you see XF86_VGA or similar) or SVGA (if you see XF86_SVGA) or accelerated (almost any other). This tells you which part of the X setup file to alter.
Next edit the file /etc/X11/XF86Config which is often quite long. Scroll down until you get to the Monitor section. This contains a number of modelines (which are the possible resolutions and refresh rates which X can run at). You want to add your own modeline to the bottom of the list (just before the EndSection command for your monitor config).
To add a modeline, start a new line and
write Modeline then insert the text
you copied earlier. Just make one small change to that line by adding
some unique text before the name of the mode (the name of the mode is the
text in the inverted commas - in this case 1024x768). You can see
below that I call the new mode my1024x768:
Modeline "my1024x768" 65.00 1024 1064 1208 1344
768 771 777 807 -hsync -vsync
Now we need to tell X to use the new mode we've defined. To do that we scroll down (still in the XF86Config file) until we get to the "screen sections". There are probably a few of these defined for different drivers such as VGA2, VGA16, SVGA, accel etc.. You should know which screen section defines your display because it's the one which matches the symbolic link that we found earlier. Mine was for Mach64, which is not VGA2, VGA16, SVGA etc.. so I need to edit the section which deals with the accel driver.
Now edit the settings, by making my new modeline names the default choice (in my case I remove all others, but I recommend you comment out the existig line and add a new one). If you have more than one listed, X will use the first allowable one (it knows what's allowable by cheking for any that exceed the horizontal and vertical refresh limits for your monitor). So mine now looks like;
Section "Screen"
Driver "accel"
Device "My Video Card"
Monitor "My Monitor"
Subsection "Display"
Depth 16
# Modes "1024x768" "800x600"
Modes "my1024x768"
ViewPort 0 0
EndSubsection
EndSection
Next, save this.
Note: before the next step, it may be useful to stop X being loaded by default on start up. That's because, if you have a problem when you restart X it will be difficult for you to correct it otherwise.
Restart X and check that everything is fine. If you have problems, then comment out your added line and reuse your existing configuration. You can always terminate an X session by pressing CTRL-ALT-F12.
3.2 Start or stop X from being run automatically on startup
In linux, the /etc/inittab file tells the kernel what to run on startup.
This is a very important file - damaging it could make your entire linux system unbootable (although it is possibe to repair the damage by booting from a floppy and restoring that file). However, please be very careful when you edit the file. I recommend using a command line editor!
OK now look inside inttab for something like the following (taken from mine);
# Default runlevel. The runlevels used by RHS are:The first few lines are comments that tell you what the runlevels actually mean. On a RedHat or Mandrake based system you probably only need to know the following:
# 0 - halt (Do NOT set initdefault to this)
# 1 - Single user mode
# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)
# 3 - Full multiuser mode
# 4 - unused
# 5 - X11
# 6 - reboot (Do NOT set initdefault to this)id:5:initdefault:
If your X windows is stable, you would normally boot into runlevel 5, otherwise, boot into runlevel 3.
The number in the id:5:initdefault: tells you which runlevel to boot into. You can change this to 5 or 3 and next time you boot that setting will be activated. If you have any questions look at the inittab man page.
Finally you can execute the command;
telinit q
to reexamine the inittab file to save
you from rebootin.
Alternative method 1:
You can execute telinit with a numeric
argument to switch you to a different runlevel. To move to runlevel
3, type;
telinit 3
Alternative method 2:
You can specify a parameter to lilo when
you boot. Instead of typing;
linux
at the lilo prompt you can type;
linux 1
and you will be booted up into runlevel
1. Note that on older distributions you would type "single" instead
of "1" or (I believe) "rescue" instead of "3". For Mandrake 7 and
maybe 6.2, this seems to be no longer supported.
Other uses of inittab:
I haven't changed inittab often, but one
use is adding remote serial terminals. If you look through inttab
you'll see that it executes a number of mingettys on devices tty1
to tty6. These are actually the handler programs for the virtual
consoles (CTRL-ALT-F1 to CTRL-ALT-F6). The respawn means that
when you quit/logout/exit, the console will restart ready for another user
or another login.
You can copy this behavour using getty (check the man page for the slightly different syntax) on devices such as ttyS0 which will give you remote serial terminals.
3.3 Change the default
number of colours used by X
First of all, you need to discover what
type of X server you are running. To do that, type;
ls -l /etc/X11/X
which returns the symbolic link information,
something like;
lrwxrwxrwx 1 root root
31 Jun 8 01:48 /etc/X11/X -> ../../usr/X11R6/bin/XF86_Mach64
Basically you are looking for the last word on that line. In my case it is Mach64 (since my video card uses an ATI Rage IIc chip, aka Mach64), which is an accelerated chipset. You must classify your server into VGA (if you see XF86_VGA or similar such as XF86_VGA16) or SVGA (if you see XF86_SVGA) or accelerated (almost any other). This tells you which part of the X setup file to alter.
Next edit the file /etc/X11/XF86Config which is often quite long. Scroll down until you get to the Screen sections near the end. There are probably a few of these defined for different drivers such as VGA2, VGA16, SVGA, accel etc.. You should know which screen section defines your display because it's the one which matches the symbolic link that we found above. Mine was for Mach64, which is not VGA2, VGA16, SVGA etc.. so I need to edit the section which deals with the accel driver.
My section is reproduced below;
Section "Screen"
Driver "accel"
Device "My Video Card"
Monitor "My Monitor"
Subsection "Display"
Depth 32
Modes "1024x768" "800x600"
ViewPort 0 0
EndSubsection
EndSection
The important thing is the number that
follows the Depth keyword. This is the number of bits that are stored
for each pixel on the display (bits per pixel) and define the number of
colours available. For example, 8 would give 256 colours, 24 gives
17 million colours etc...
Basically you just need to change this number to whatever you require from the choices: 2, 8, 15, 16, 24, 32.
A word of warning: if you choose more bits per pixel there are some consequences - you need more video memory to display your screen, your computer will probably operate slower, and you may exceed certain maximum bit rates allowable for your video card (especially at high resolutions, high refresh rates with lots of colours). You will not, however exceed any monitor limits (this is because the monitor inputs analogue voltages - you are allowing the graphics card to output more voltage steps but are not changing the overall voltage range).
If you don't know how close to the limit you are - experiment and see. Personally I find 1024x768 resolution with 16 bits per pixel is adequate for my needs. You can drive this with almost any SVGA video cards available with 2MBytes RAM and above.
Note: before testing your new configuration, it may be useful to prevent X from being loaded by default on start up. That's because, if you have a problem when you restart X it will be difficult for you to correct it if the automatic restart causes a crash each time!
Restart X and check that everything is
fine. If you have problems, then reuse your existing configuration.
Remember, you can always terminate an X session by pressing CTRL-ALT-F12.
4.1 Getting a soundcard working
How to get this going depends on your hardware, and on the version of linux you are using. I'm assuming Mandrake or RedHat from version 5.2 onwards which came with a kernel that had modular sound support compiled in. If you have or are about to make your own kernel, it's best to keep sound support modular. That means you can easily experiment by plugging and unplugging modules until you find the right combination.
The standard tools for sound card configuration
are:
drakxconf (Mandrake 7 and above)
- if you have this X-windows based application, then try it first.
soundconf - a console based config
tool which is next best. Claims to autodetec PCI and PnP cards but
never actually did that for me, still the setup worked fine.
sndconfig - the old RedHat console
based config tool, leaves a lot to be desired.
If those tools don't work then do not give up. You will have to experiment. See section 4.2 or 4.3 to find out how to deal with Plug and play ISA and PCI devices. The assumption here is that you've followed and PnP wakeup required (for ISA cards see 4.2, PCI gets done automatically) and that your card is alive but just not working. The information below will help you to look what you need and conduct your experiments.
4.1.1 Does your soundcard work?
As root, get a terminal up and type;
cat /dev/sndstat
This will tell you the status of your sound system. If you get an error such as "No such device" then your sound modules are not installed. A working sound system will gve you something similar to;
OSS/Free:3.8s2++-971130Note that you can get something like this but have a non-working sound system if some of the options such as DMA channel, IO port or IRQ are incorrect.
Load type: Driver loaded as a module
Kernel: Linux guinness 2.2.14-15mdk #1 Tue Jan 4 22:24:20 CET 2000 i586
Config options: 0Installed drivers:
Card config:
Audio devices:
0: MS Sound System (CS4231) (DUPLEX)Synth devices:
Midi devices:
0: MPU-401 0.0 Midi interface #1Timers:
0: System clock
1: MS Sound System (CS4231)Mixers:
0: OPL3-SAx and AD1848 (through MSS)
1: MS Sound System (CS4231)
Looking at the output above, the important thing is that I have something listed under "Audio devices" since without this all the mixers, timers and midi devices are useless. Now we investigate how to get the above.
If you want to hear something (albeit noise),
just pipe a file to the sound port;
cat /etc/issue > /dev/audio
4.1.2 Find the correct module(s) to load
First thing is that you must load the correct modules into the kernel to drive your particular soundcard. There are a number of different modules, and each one has a number of different options which you must get right, but right now we need to find which module to use.
For a standard installation, the repository for sound drivers is the directory /usr/src/linux/drivers/sound, so go there and look for a likely driver. Read the README files. Also read through the files in /usr/src/linux/Documentation/sound/ for more information.
If you have an unusual card (e.g. a blasta2)
then search in each of the above directories in turn for information by
moving into the directories and typing;
grep blasta2 *
if the blasta2 is mentioned, it will tell you in which file the text was found. It would then be a good idea to read any files that mention the blasta2...
Hopefully it will now be fairly obvious
which module to use as a driver. The documentation should also tell
you what arguments to pass to that module. An example is;
opl3sa2 mss_io=0x530 irq=5 dma=0 dma2=1 mpu_io=0x388 io=0x370
Note that the syntax is not the same for each module. For example, "dma2" may be "dma16" or you may need something like dma=0,1 instead.
4.1.3 Finding the correct arguments for your module(s)
If you have dual boot with windows, and the soundcard works in windows, then use the Start->Settings->Control panel->System sequence to display a list of system devices. Click on your soundcard and click on the resources tab to see what IRQs DMAs and IO ports it uses. Write these down, and preserve the order (i.e. in windows the top IO will be called IO1 in linux for PnP purposes).
If you don't have windows check the PnP
information with;
pnpdump | more
Or just guess. If you guess, try
to avoid assigning used IO and IRQ resources to the soundcard. Used
resources can be found from;
cat /proc/ioports
and
cat /proc/interrupts
If you have to guess, try each possible choice learnt from pnpdump in turn.
4.1.4 Loading and unloading modules
Assuming you now know (or think you know)
what arguments to give your modules, you can use the following commands
to manipulate them:
lsmod - lists the currently loaded
modules
rmmod - removes a module
modprobe - loads a module and its
dependent modules (if any)
insmod - loads a single module
For example, do lsmod to see if sound is
loaded. If not,
modprobe opl3sa2 mss_io=0x530 irq=5 dma=0 dma2=1 mpu_io=0x388 io=0x370
will load the opl3sa2 module (and a few
others). If that complains or doesn't work then unload it with;
rmmod opl3sa2
and try again, maybe with;
modprobe opl3sa2 mss_io=0xe80 irq=7 dma=0 dma2=3 mpu_io=0x300 io=0x330
to load the opl3sa2 module with alternative arguments.
You can use the isapnp tools to manipulate PnP devices. Some considerations are;
You can use pnpdump to examine any
PnP cards you have in ISA slots with;
pnpdump | more
If you are using isapnp then there will
be a file called /etc/isapnp.conf that
tells isapnp what cards to wake up and configure every time you boot the
computer into linux. If you don't have that file you can create it
either automatically or semi-automatically. Lets do the latter;
pnpdump > /etc/isapnp.conf
and then edit the resulting file.
If you know what resources your PnP card uses then uncomment those in the
file by removing the # character at the start of the corresponding line.
If you aren't sure, you can get pnpdump to guess the correct settings (but
beware that this may cause problems when you activate, such as crash your
machine if the settings are wrong). pnpdump can guess with;
pnpdump -c > /etc/isapnp.conf
Then look at the resulting file and check it is OK.
Finally, you can then activate or "wake up" and PnP devices by typing;
isapnp /etc/isapnp.conf
If there is a problem, this will issue an error message.
Look at /proc/pci to examine the PCI devices
that were autodetected (this should be all of them);
cat /proc/pci
I believe that this also lists AGP (advanced graphics port) devices.
4.4 Using a USB digital camera
Most modern cameras on most systems with a recent (1 or 2 year old version) of Mandrake linux or similar (RedHat, SUSE, Debian etc...) should automatically recognise a connected USB device.
Unfortunately until recently all camera manufacturers had their own interfacing protocols. More recently, a standard called PTP has emerged (Picture Transfer Protocol) that quite a few manufacturers are adopting.
In my view the best way to talk to your camera is using gphoto2. For my Canon Ixus 4 I have the option to set the camera to its proprietary transfer mode, or to PTP. In the first instance I would use the following command:
gphoto2 --get-all-files --port usb:
gphoto2 --get-file X-Y --port usb:
Of course I would probably do this as root. I could also address exactly my camera using:
gphoto2 -f "/DCIM/105CANON" -p "MVI_0515.AVI" --quiet --port usb:
to retreive the file MVI_0515.AVI into the current directory. Generally gphoto2 recognises my camera, but if I need to tell it that I am in PTP mode I would add the following to the end of the command line:
--camera "USB PTP Class Camera"
gphoto2 has loads of great options - just type gphoto2 on the command line to see them!
5.1 Decoding a winmail.dat file
So someone sent you an attachment that appears as a "winmail.doc"
file in your mailbox...first save the file to a temporary location.
The trick is to then use hexedit.
Scroll down a fair way until the filename of the attachment appears.
It may be around line 2340 or so.
Now identify where the attachment actually starts - it should be
a line or two BELOW this. For a word document, the first 3 hex
characters are "D0C".
Position the cursor on the first character of the attachment (it
should be the D). Press Ctrl-SPACE to mark the character.
Next move to the end of the file (press the > key). Position the
cursor on the last character of the file and press:
ESC-M to copy the region
The new file (with a .doc extension) is the word file.
ESC-Y to save the selected region to a new file.
6.1 Netscape and/or other X apps display fonts that are too small
It seems that a few things can cause this to happen, including some Netscape features. However, if you are running your display in 1024x768 or above (and maybe 800x600 too - let me know...) than you can change the fonts available to X windows. By default it seems that X is given 75dpi (dots per inch) fonts to display in preference to another set of 100dpi fonts. A check on mandrakeuser.org indicates that this is only a problem for Mandrake distributions prior to 7.0.
First check to see if you have the 100dpi
fonts installed. Get to a command prompt as root and type:
rpm -qa | grep 100
This queries all entries in the rpm database
and looks for a match with the text "100". If you have installed
your 100dpi fonts then this will return something like:
XFree86-100dpi-fonts-3.3.5-3mdk
If 100dpi fonts are not installed, then you should do this first (follow the standard instructions for installing an rpm from your distribution CD).
Now 100dpi fonts are installed you need to ask X to use them. To do this you must edit the file /etc/X11/fs/config in your favourite editor.
Inside that file is a catalogue where X goes to look for fonts. The problem is that X will use the top entries first. If the 75dpi fonts are listed ahead of the 100dpi fonts then the 75dpi fonts will get used. Make sure that the 100dpi fonts are located first by swapping lines if necessary. My /etc/X11/fs/config file now looks like:
#Next time you restart X windows, you should see more readable fonts.
# Default font server configuration file for Red Hat Linux 6.0
## allow a max of 4 clients to connect to this font server
client-limit = 4# when a font server reaches its limit, start up a new one
clone-self = off# alternate font servers for clients to use
#alternate-servers = foo:7101,bar:7102# where to look for fonts
# Some of these are commented out, i.e. the TrueType and Type1
# directories in /usr/share, because they aren't forced to be
# installed alongside X.
#
catalogue = /usr/X11R6/lib/X11/fonts/misc:unscaled,
/usr/X11R6/lib/X11/fonts/100dpi:unscaled,
/usr/X11R6/lib/X11/fonts/75dpi:unscaled,
/usr/X11R6/lib/X11/fonts/misc,
/usr/X11R6/lib/X11/fonts/Type1,
/usr/X11R6/lib/X11/fonts/Speedo,
/usr/share/fonts/default/Type1,
/usr/X11R6/lib/X11/fonts/75dpi,
/usr/share/fonts/ttf/western# in 12 points, decipoints
default-point-size = 120# 100 x 100 and 75 x 75
default-resolutions = 75,75,100,100# how to log errors
use-syslog = on