![]() |
|
ADSP 21xx
Have you found this site useful? Did we save you time? Did we cure your head-ache? Is your hair growing back now? Please make a donation to help with maintenance. |
Mandrake Linux FUBAR HowtoMandrake Linux 10.1, Jan 2005. Herman Oosthuysen ScopeWell, this is the guide we all need sometimes, but won't admit to in public... The acronym FUBAR means fscked up beyond all repair and is an Army situation report abbreviation. It is a good way to describe the condition when an armoured personnel carrier was hit by an RPG. The Linux command fsck means file system check and when that fails, your machine is FUBAR... This guide explains how to handle some of those weird events that can drive you up the wall - for example, what do you do when the screen turns black, or when the keyboard goes dead? I don't profess to have all the answers, some fsckups are just too weird for words, but this collection of things should go some way to get you going. Black Screen of DespairSince I mentioned it above, this is a good one to start with. You installed Mandrake Linux, everything looks fine, reboot and just when you expect to proceed to the login page, the screen turns black or fuzzy or rolls incessantly, or as happened to me recently, the screen worked while the keyboard went dead. The bottom line being that you can't do a durn thing. The problem is that the X-Windowing System is not configured properly and since you can't see anything, or type anything, it is very awkward to fix. The main configuration file of X-Free or X.org is /etc/X11/xorg.conf. Something is wrong in this file, but how to fix it? You could try to switch to a text console with CTRL-ALT-Fn, but that won't necessarily help, since the prompt may be off screen and invisible. Also, if you know how to run xf86config manually, then you don't need to read this guide. The easiest way to fix a bad screen is to run the Mandrake Installation again and this time, select Upgrade. The system will check everything, find nothing to upgrade and you will quickly end up at the end of the install process. Here, select the display setup utility and this time TEST it. Don't leave until you are SURE that it works! Also uncheck the Start X at boot up. This will cause Linux to start up in Runlevel 3. You will then have to log in and run the command startx manually. This will make it easier to figure out what is going wrong. You can later change to Runlevel 5 after boot-up again, for a graphical log in, either by laboriously hunting down the little check box using drakconf or by simply changing file /etc/inittab. Look for this line: id:3:initdefault: and change the 3 to a 5. The screen configuration wizard is XFdrake. You can run this wizard from the command line. Sometimes, depending on your hardware, the Test option will not show in the normal installation, but when you run XFdrake manually, you will get this option. So, you can futz around and test until it works. Note that when all else fails, the Vesa driver always works. This is usually the only option to get a Laptop display to work properly. Another way to regain control is to reboot and select Safe Mode, also known as Single User Mode to get to a text console. How to avoid getting a black screen? Always select a Generic Display when you configure X. This generally works better when you need to switch screens. If you need to move a machine and you have no idea what the new screen is going to be like, reconfigure the display adaptor to VESA at 800x600 pixels before you move the box. Xinerama - Multiple ScreensSometimes Xinerama works out of the box, but I haven't had much luck with Mandrake 10.1. The cure is to edit the /etc/X11/XF86Config file (also called XF86Config-4, or xorg.conf) manually and it helps if you have an example to look at. Experiment while in runlevel 3, so you can run startx from the command line and look at the error messages. This example is a machine with two different display adaptors - Nvidia and ATI. The secret is right down at the bottom, the last few lines:
# File generated by XFdrake.
# **********************************************************************
# Refer to the XF86Config man page for details about the format of
# this file.
# **********************************************************************
Section "Files"
# Multiple FontPath entries are allowed (they are concatenated together)
# By default, Mandrake 6.0 and later now use a font server independent
of
# the X server to render fonts.
FontPath "unix/:-1"
EndSection
Section "ServerFlags"
#DontZap # disable
Wrong Desktop ManagerYou log in, run startx and end up in some funky window manager, such as Enlightenment and you can't figure out how to get out of it. The default desktop is set in the file /home/username/.desktop and looks like this, for the two I tend to use: DESKTOP=KDE #DESKTOP=IceWM Other values are gnome, blackbox, enlightenment and so on, but I don't know whether it should be upper case, lower case or mixed case like IceWM. Manual Mail Server TestsSometimes, it is handy to test a mail server manually with telnet. Here are the common commands:
SMTP, port 25
[localhost:~] matt% telnet mail.domain.com smtp
Trying 64.224.19.12...
Connected to mail.zone.com.
Escape character is '^]'.
220 mail.zone.net ESMTP
ehlo
250-mail.zone.net
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN PLAIN
250-PIPELINING
250-STARTTLS
250 8BITMIME
mail from: <user@domain.com>
250 ok
rcpt to: <user@domain.com>
250 ok
data
354 go ahead
Subject: foo
.
250 ok 1016471746 qp 9246
POP3, port 110
telnet pop.domain.com pop3
+OK Hello there.
user user@domain.net
+OK Password required.
pass secret
+OK
list
1 1586
2 13304
3 795
.
dele 2
+OK
quit
Connection closed by foreign host.
IMAP, port 143
telnet imap.example.com imap
Escape character is '^]'.
* OK Courier-IMAP ready. Copyright 1998-2002 Double Precision, Inc. See
COPYING for distribution information.
. login user@example.com secret
. OK LOGIN Ok.
A0001 CAPABILITY
* CAPABILITY IMAP4rev1 CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT
THREAD=REFERENCES SORT QUOTA
. logout
* BYE Courier-IMAP server shutting down
. OK LOGOUT completed
Here is a session where I verified a user password. I made a mistake in there, so you can see what happened: [herman@mercury herman]$ telnet mail.aeronetworks.ca 110 Trying 66.98.130.68... Connected to mail.aeronetworks.ca (66.98.130.68). Escape character is '^]'. +OK POP3 svr35 [cppop 19.0] at [66.98.130.68] user alice@aeronetworks.ca +OK Need a password w0nd3rland -ERR Command not implemented pass w0nd3rlan +OK You have 0 messages totaling 0 octets from /home/mail/aeronetworks.ca/alice/inbox (full load) quit +OK Bye! Connection closed by foreign host. [herman@mercury herman]$ Mail Server ChecksHow can you quickly check the health of a mail system and get stuck processes going again? Sometimes postfix logging just stops and the /var/log/maillog file doesn't grow. The command service syslog restart, followed by postfix reload will fix that. Say you have SpamAssassin running and millions of messages are logged into a mailbox called spam. Then a user calls wanting to know whether maybe any good mail has been discarded. How can you easily create a list of the sender and subject lines of all messages in the spam box, to send to the user to give him some peace of mind? # cd /var/spool/mail # cat spams | formail -s formail -X Date: -X From: -X Subject: > spams-summary.txt Note that you cannot email that list to the user - the message will get discarded again, due to all the spammy words. You'll have to send him a link to a web page! That will split the mailbox into separate messages, then call formail for each message and extract the headers into a file that you can mail to the user. Procmail also has a little known utility to process the log file and tell you how many messages have been processed. Here is a little script that you can call from cron.daily to keep tabs on your mail system: #! /bin/bash echo >>/var/spool/mail/stat.log date >> /var/spool/mail/stat.log mailstat -km /var/spool/mail/procmail.log >>/var/spool/mail/stat.log chmod 666 /var/spool/mail/procmail.log Username/Password Sniffing for Fun and ProfitI frequently have to fix someone's email setup and the user invariably has no friggen clue what his username and password is. Most people use plain text POP3 or IMAP4, so if it still sort-of works, then you can put a Linux notebook machine on a hub and sniff the information. To do this you need 'ngrep'. Do 'urpmi ngrep' if you don't have it, then try these two commands, while clicking the 'Check Mail' button in the mail client, or just wait a few minutes for the auto check to trigger: # ngrep -q "user" # ngrep -q "pass" La Voila! Most people use the same username and password for everything and if this doesn't convince them that it is a bad idea and that you should never read mail as 'root', nothing will... Broken NetworkSometimes the networking messes up - especially when you are experimenting and plugging things in/out. Assuming the network card driver worked before, only two files need to be configured. The network script is /etc/sysconfig/network: NETWORKING=yes HOSTNAME="fu.bar.org" The other file to configure is /etc/sysconfig/network-scripts/ifcfg-eth# (where # is the numerical name of the device used for networking). This file determines which device will be used for networking, the protocol (static, dhcp, and so on), whether the device will be started at boot, the IP address, the gateway address, the netmask, and, if needed, a number of IPX configurations: DEVICE="eth0" ONBOOT="yes" BOOTPROTO="static" IPADDR="192.168.1.2" NETMASK="255.255.255.0" GATEWAY="192.168.1.1" With the configuration done, restart the server, with the command /etc/rc.d/init.d/network restart Check things with the commands ifconfig and ping. If the network card driver is to blame for your woes, it is configured in /etc/modules.conf which looks like this: probeall usb-interface usb-uhci ehci-hcd above snd-via82xx snd-pcm-oss alias ieee1394-controller ohci1394 alias eth0 via-rhine alias sound-slot-0 snd-via82xx alias eth1 via-rhine Use modprobe to load a new driver and lsmod to see which drivers are currently loaded. The driver files are located in /lib/kernelversion/drivers/net, eg: /modules/2.6.3-16mdk/kernel/drivers/net/via-rhine.ko.gz The via network driver above is in a compressed file. Linux now has the ability to uncompress drivers on the fly as needed, which is important for embedded devices with little storage space. The vast majority of Linux devices are embedded devices, mostly cell phones and routers, about 2 billion of those in 2005. Lost Root PasswordYou forgot the root password of your Mandrake box, or the administrator left, or got run over by a bus and now you can't get into the box to change things. You cannot reverse engineer/recover the root password, since it isn't stored anywhere. What is stored is a MD5 hash of the password and that is a one-way function. You can verify a password against its MD5 sum, but you can't use the MD5 sum to recreate the password. You could potentially reverse engineer a password that will evaluate to the same MD5 sum, but it will take a very, very long time to do that - impossible for all practical purposes. The good news is that if you leave the box alone, it will probably keep running flawlessly for many years, but that may not be very satisfactory for your users. You can fix this in a number of ways, but all require restarting the machine. Reboot and select Safe mode also known as Single User mode from the LILO or Grub menu. Open a console, set user to root and run passwd - la voila! $ su - # passwd This works, because in single user mode, you don't need a password to become root. If you can't get to the boot menu, then use a Mandrake Move CDROM to boot the machine, mount the root partition under /mnt/hda, do chroot /mnt/hda and then run passwd. Isn't this a glaring security hole? No, since when the real sysadmin returns from the dead, he will know you changed the password. Change User Passwords from a ScriptThe normal passwd utility has some protections built in to prevent people from running it from a script, since writing a password into a script is a security hole. This protection sounded like a good idea to the original author of passwd, but if you have to manage a box with hundreds of users, then it may be very useful to be able to use a script to change things, since it is not only faster, but much less error prone. Fortunately, someone else got fed up with this security and created a little known utility called chpasswd, that can be called from a script, with a little bit of effort. The only caveat is to ensure that you only use alphabetic characters in the password, otherwise you may run into problems with the Bash shell interpreting the special characters in unexpected ways. Here is a Perl script that will create a new user account and set his password for use on a mail server (the default group is the same for all users, to keep procmail happy):
#! /usr/bin/perl
# Add a new user account
# Copyright (c) AeroNetworks, GPL, 2004.
# #207, 908 - 17th Ave., SW, Calgary, AB, T2T 0A3, Canada.
use strict;
# Get the parameters
my $username = $ARGV[0];
my $password = $ARGV[1];
print ("Username: $username, pass: $password\n");
# Default mail group, to keep procmail happy
my $group = "users";
my $timeout = 1;
my $err = 0;
## Create the user
system("mkdir /home/$username");
system("/usr/sbin/groupadd $username");
system("/usr/sbin/useradd -g $group -G $username \
-d /home/$username -s /bin/bash $username");
system("chown $username:$username /home/$username");
system("echo $username:$password | /usr/sbin/chpasswd");
exit;
Modify the above as you please. Of course there is no good reason why this is in Perl, since it only calls Bash, but this script is actually part of a much larger mail server management script where the use of Perl makes a little more sense... What is going on???To see what is going on during start-up, look at the console on CTRL-ALT-F1. To get back to the graphical screen, press CTRL-ALT-F7 To see the system log scroll by as things happen: $ su - password # tail -f /var/log/messages No SoundIt is easy to fix most Linux sound problems - turn the volume up - really! The audio is muted by default and it can be controlled in at least three different ways. If any one of those is turned down, then you won't hear anything. The kmix utility should be on the task bar - turn everything up till the sound works. Another way is to run aumix. When all else fails, go to the ALSA Project web page and start reading: http://www.alsa-project.org. Also, do ensure that you have that little cable between the CDROM drive and the mother board plugged in... But it worked Yesterday!Your CDRW worked perfectly yesterday and now tells you that there is no media present or something stupid and K3B just won't work. The only way to fix this is to cycle power to the box. Don't change the configuration, don't go off in a flat spin reading manuals and reloading modules - it won't work. This is a confusion between the hardware and software and the only way to fix it is to power down and back up again. If anyone has a better solution that actually works, please let me know. Set Thunderbird to use Firefox as the Default BrowserOn my system, Thunderbird insists on calling Mozilla when I click on a link in a mail message. Changing the file associations in KDE doesn't help. To fix this, you have to hunt down the Thunderbird prefs.js file and add a line to it. First ensure that Thunderbird is NOT running, then go to the hidden directory .thunderbird. Look for a subdirectory called something like default.xxx and open the file prefs.js in an editor. Add this line - modify to suit your path to Firefox:
user_pref("network.protocol-handler.app.http",
"/home/herman/firefox/firefox");
Now if you start Thunderbird and click a link, Firefox should run. Star Menu BluezIn Mdk 10.2, a.k.a. Limited Edition 2005, the menu editor system is totally FUBAR. Please, do NOT, attempt to modify the Star menu. At best, it will be rendered totally useless... So, you did modify your menu and now it is FUBAR? Well, here's how to fix it, so that it will at least work again. $ cd $ rm -Rf .menu $ rm -Rf .local $ rm -Rf .config Finally, log out and log in again, to force KDE to re-create the Star menu. The above directories are created by menudrake: Right click Star, select Menu Editor. Unfortunately, the new version of menudrake is really, really buggy, to the point of being almost useless and deleting the corrupted schtuff, gets you back to the menu defaults. Moving Menus to Other Users or MachinesThe desktop menus are defined in three hidden directories: .menu .config .local Directory .menu is "source code", .local and .config are "compiled". Copy the definition files in .menu and then compile with: updatemenus -v This way, you can synchronise menus between users and machines - good for deployments in a school or a corporation. MAC SpoofingYour ethernet card used to connect to your DSL service broke, so you install a new one and can't connect. Whatver you do, you can only reach the ISP DNS and nothing else - sounds familiar? DSL providers register the MAC address of the device that was first used to provision the service, so it is a good idea to write that MAC address down, since some cards do not have it printed on a label. The trick to getting connected again, is to spoof the old MAC address for the new ethernet card. Edit /etc/rc.local and add the following lines to the bottom: service network stop ifconfig eth0 hw ether 11:22:33:44:55:66 service network start Substitute your old MAC address in the above. The Immortal MailmanMandrake installs the mailing list manager mailman by default, even though precious few people would ever want to use it. Disabling the service stops the daemon, but if you look in /var/log/messages, you'll notice that every 5 minutes, a python script starts up, so disabling mailman only does a half-assed job. To really kill it for good, you have to delete its cron jobs. Mailman runs as user mail and you can stop the cron jobs, by removing the mail user crontab. To do that, you have to log in as user mail. # su mail $ crontab -r Now mailman should rest in peace... Kill, kill, kill!!!To see what the hey is going on, use the program status command 'ps', or its continuous version 'top'. You can use the Program Identifier (PID) to terminate any running process. There are two ways, using 'kill' or 'killall': To get the PID, type: # ps -e Kill it with kill -9: # kill -9 pidof process eg: # kill -9 1234 or use killall: # killall mozilla-bin In KDE, you can use ctrl-esc to get a GUI version of 'ps' and you can blow things away with ctrl-alt-esc, which will change the cursor into a skull and crossbones - press esc to revert if you change your mind. Kill KwalletKDE has a password safe utility called Kwallet which is supposed to make it easier to handle passwords on web sites with Konqueror, but the silly thing proves to be more trouble than it is worth. Here is how to remove it, so it will never bother you again: # urpme kdeutils-kwalletmanager # rm /usr/share/services/kded/kwalletd.desktop Now restart X (Ctrl-Alt-Backspace) and log in again. Life should be good now. |
|
Copyright © 2005-2008, Aerospace Software Ltd., GPL. |