Jump to content

Tips for Linux Explorers


Bruno

Recommended Posts

MOUNT and UMOUNT

 

In some distro's the additional partitions ( Windows or second Linux distro ) are not automatically mounted and thus not visible.

 

From the story yesterday we know about fstab and mtab:

$ cat /etc/fstab

( shows you the available partitions )

 

$ cat /etc/mtab

( shows you the mounted partitions )

 

If you see partitions in fstab and the same partitions are not in mtab you will have to mount them yourself:

$ su
< password >
# mount /dev/hda1 /mnt/hda1

( as root, if your win. partition is on hda1 )

 

This will mount hda1, usually your Windows partition.

# cd /mnt/hda1

( to get in that directory )

 

# ls

( to see what is in that directory ) ( ls stands for "list" )

 

# umount /mnt/hda1

( will un-mount the partition, NOTE: not unmount but umount )

 

In some cases the mount command will print an error message to the screen. ( Mainly in Slackware and Linux From Scratch ) Have a look then if there are any directories in the /mnt directory to mount on:

$ su
< password >
# cd /mnt
# ls

 

If there is no ( empty ) directory for hda1 ( or other partitions ) you will have to make it first:

# mkdir hda1

 

Only then you can:

# mount /dev/hda1 /mnt/hda1

 

So see first what partitions you would like to mount and make the directories for it in /mnt. Only after that you can do the actual mounting. ( the directories will stay after a reboot, the mounting however has to be done again )Do not mount partitions if you do not need them mounted. ( since every twenty times a partition is mounted there will be a fsck at boot, and that makes the time to boot longer)

 

B) Bruno

Link to comment
Share on other sites

  • Replies 375
  • Created
  • Last Reply

Top Posters In This Topic

  • Bruno

    321

  • greengeek

    5

  • havnblast

    4

  • Peachy

    4

NOTE FROM THE "EDITOR"As you were all celebrating the 4th of July, I had some time to make a brand new INDEX page for the Tips . . . . . . . . . with clickable links directly to each of the 90 tips to date. I know you will appreciate this because finding a special Tip had become a major headache. :):) Bruno

Link to comment
Share on other sites

Guest LilBambi

Beautiful Bruno! Excellent Job as always! :) That will make it so much easier to find specific Tips!

Link to comment
Share on other sites

Thanks Bruno...You don't know how many times your tips have helped me already!Again Thanks

Link to comment
Share on other sites

My dear friends, sure I'd like to present the change of the index page as service to you all ;), but to be completely honest, I could not find my way either in the previous index, so I had no choice, I had to make the titles to links . . . :) :) :DB) Bruno

Link to comment
Share on other sites

LOG FILES CLEANING

 

I always want to keep an eye on the volume of the log files. Very large log files often mean something is wrong with your computer. Then depending on what log file it is you can see, determines in what direction you should be looking.

 

Here is how I do that:

 

$ su
< password >
# du -s /var/log/* | less

 

Will page through less ( scroll with spacebar, close with ¨q¨ ) the logfiles and how many K they are. Also you can see if there are many .gz (zipped) files. We will get rid of those later. First have a look. Do also:

# du -s /var/log/*/* | less

 

And see if there are any strange large ones, and if there are many zipped ones. No zipped log files means a failing ¨logrotate¨ ( see below for info about anacron )

We will clean out the zipped log messages, because we do not need those anymore: ( be carefull typing, you are root !!! )

# rm /var/log/*.gz

It will ask you for confirmation each time, just check if it really is a .gz file and type ¨yes¨ and hit enter.

 

Now we do the same with:

# rm /var/log/*.old

 

Now we do the same with:

# rm /var/log/*/*.gz

 

That should have removed quite a few files from your HD !!

 

If you have no .gz log files and they are many MB´s, that means logrotate does not do its job! Logrotate is a cron-job, a maintenance job that is performed every night between 3:00 and 4:00 AM. If your computer is not on 24/7 you should install anacron to do the maintenance at boot.

 

If you can´t find anacron on your Cds, get anacron: Here and take the top one ( for made in Linux . . anacron-2.3-9mlx.i386.rpm ) download it and just install it by double clicking.

 

!! Anacron makes that your computer shows heavy activity 3 - 5 minutes after you boot up in the morning (afternoon). The activity is for about 5 minutes, so nothing to be worried about - no hacker´s activity - all normal maintenance jobs !!

 

One last tip: anacron needs no configuring, it should be pre-configured and run automatically . .

 

 

B) Bruno

Link to comment
Share on other sites

THE "PATH"

 

As you type a command in a console you do not have to know the full PATH to that command or program, just the name will do. Type ¨kmail¨ and it will bring up the Kmail program, type ¨cp fileX /mnt/win_c¨ and it will call on the ¨cp¨ executable to copy ¨fileX to the Windows C: partition. No need to type the full path to those executables.

 

This is because the Kmail and the cp executables are ¨in your PATH¨ ( the full paths are /usr/bin/kmail and /bin/cp )

Most of these executables for normal users are stored in /bin, /usr/bin and /usr/local/bin, thus these directories are ¨in your PATH¨

 

Sometimes however programs are stored in unusual places, or you make your own scripts and programs and store them in a special directory. Then we can add those directories to ¨your PATH¨, so that a simple short command can call them.

 

First let´s have a look what´s in your path:

$ echo $PATH

 

You will see something like:

/usr/X11R6/bin:/usr/local/bin:/bin:/usr/bin:/usr/games:/usr/lib/jre-1.4.1_01/bin

 

What this means is /usr/X11R6/bin and /usr/local/bin/ and /bin etc. are in your PATH

For root:

$ su
< password >
# echo $PATH

 

Will give this line:

/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin

 

You notice that the PATHs are different for root than for the normal user ! ( ¨sbin¨ is a good give-away that they are for root )

 

Now let´s assume you want to add the /home/bruno/progs/exec directory ( where you store your own executables ) to your PATH:

# export PATH=$PATH:/home/bruno/progs/exec

 

Now you can just type ¨back¨ at the prompt to call on your self-written backup-script or program that you have in /home/bruno/progs/exec.

 

To permanently add something to the PATH you will have to edit a file, could be in a few different ones ( depending on shell and distro): ~/.profile or ~/.bash_profile or /etc/profile or /etc/csh.login. ( More in-depth and accurate info can be found Here )

 

There is a line like:

PATH=$PATH:$HOME/bin

 

Just add a colon and the new directory, like this:

PATH=$PATH:$HOME/bin:/home/bruno/progs/exec

 

And save the file. To load the new settings either reboot or:

# source /etc/skel/.bash_profile

 

Now you know next time you see the error message that something is not ¨in your PATH¨ how to solve this little problem.

 

UPDATE: Another way to add permanently to the PATH is:

$ export PATH=$PATH:/home/bruno/progs/exec

 

B) Bruno

Link to comment
Share on other sites

HDPARM

 

The command ¨hdparm¨ is for showing and tweaking your harddisk performance.

 

To see how your harddisk does compare:

$ su
<password>
# hdparm -tT /dev/hda

( or hdb )

 

Will give you a result like:

/dev/hda:

Timing buffer-cache reads: 128 MB in 0.68 seconds =188.24 MB/sec

Timing buffered disk reads: 64 MB in 1.59 seconds = 40.25 MB/sec

 

Now before you start tweaking, a warning is on its place, some tweaks may even make your HD unstable, so before starting to change settings:

$ su
< password >
# hdparm /dev/hda

 

And note down the numbers so you can set them back to the old values if needed !

 

And read O´Reilly attentively !!

 

To find additional info about your HD:

# hdparm -i /dev/hda

 

This will show you what are the possible settings for your harddisk.

 

An example:

To set 32-bit I/O support flag to 3

multicount to 16

DMA to 1 ( = on )

 

You give the following command: ( as root )

# hdparm -c3 -m16 -d1 /dev/hda

 

Again: enabling DMA can in some cases lead to serious instability, so if needed:

# hdparm -d0 /dev/hda

 

( will disable DMA )

 

After tweaking you run

# hdparm -tT /dev/hda

 

again and see if there is an increase of performance.

 

Have fun tweaking, ( or with the words of O´Reilly: Happy hacking ! ) but please, please be careful !

 

B) Bruno

 

 

PS: Additional info: axljab.homelinux.org

Link to comment
Share on other sites

INDEX.DAT ( the secret windows files )

 

Here is a great little trick for all you dual-booters; You know those ultra secret, sneeky "index.dat" files on your windows drive, the ones you can't read nor delete ??

 

We have just the medicine for that in Linux:

# find /mnt/win_c -type f -name index.dat

 

This will find the files and print the paths to screen.

Suppose "/mnt/win_c/windows/Cookies/index.dat" is one of them, here is how to delete that file:

# rm -f /mnt/win_c/windows/Cookies/index.dat

 

Sure once you boot Windows again they will be re-created, but all the old info will be gone

* not 100% sure this will work on NTFS formatted partitions too.

 

B) Bruno

Link to comment
Share on other sites

CORRUPT RPM DATABASE:

 

Strange things sometimes happen, one of them is a corrupt rpm database. This means that the computer tells you something is installed and it really is not.

Here is how to solve this problem.

 

First backup and then delete by doing the following command:

$ su[/size]
[size=4]< password >[/size]
[size=4]# cp /var/lib/rpm/__db.001 /home/bruno[/size]
[size=4]# rm /var/lib/rpm/__db.001

 

and

# cp /var/lib/rpm/__db.002 /home/bruno

NOTE:( "__" is 2x"_" )

 

# rm /var/lib/rpm/ __db.002

 

then:

# rpm --rebuilddb

 

In case your urpmi database is locked you can do:

# rm -f /var/lib/urpmi/.LOCK [/size]
[size=4]# rm -f /var/lib/urpmi/.RPMLOCK

 

A little reminder: the urpmi database ( install on demand ) needs to be updated at least once a month. See to in that you are connected to the internet for this one and :

# urpmi.update -a

 

B) Bruno

Link to comment
Share on other sites

Bruno, Is there a way to download all of these tips and save them to our hard drives or burn them cd's for future reference? There are times when the internet is unavalible and some people may not want to print in excess of 80 pages of tips. I do know how but some people may not.Thanks,mike180

Link to comment
Share on other sites

PRINTING THE TIPS

 

At the ultra left bottom of the page there is a link that says:

Download / Print this Topic

 

if you click on that one you get 3 choices:

Printer Friendly Version

This will display the topic in a simple, printer friendly format on this page, no download is required.

 

Download HTML Version

This will enable you to download a HTML version of this topic to your hard drive. This will open your browser's download dialogue box

 

Download Microsoft Word Version

This will enable you to download a version of this topic in an editable Word format. This will open your browser's download dialogue box* the MS word version can be displayed in the OpenOfiice program you have on your Linux box ( even Koffice can do the trick )

 

B) Bruno

Link to comment
Share on other sites

MEMORY TEST

 

As we all are growing older ( and our computers too ), we want to test our memory . . . .

To see the amount of memory, open a console and type:

 

$ free

 

output:

. . . . . . . . total . . . . . used . . . . . . free . . . shared . . buffers . . cached

Mem:. . . . 515340 . . . 378232 . . . 137108 . . . . . 0 . . 18312 . . . 209020

-/+ buffers/cache: . . . 150900 . . . 364440

Swap:. . . . 248968 . . . . . . . . 0 . . . 248968

 

Well that did not tell us very much did it ? So lets do some serious testing.

What you need is a program called ¨memtester¨ ( for downloads see links below )

 

(Info @ Homepage)

Description: Memtest is a utility for testing the memory subsystem in a computer to determine if it is faulty. The original source was by Simon Kirby <sim@stormix.com>. I have by this time completely rewritten the original source, and added many additional tests to help catch borderline memory. I also rewrote the original tests (which catch mainly memory bits which are stuck permanently high or low) so that they run approximately an order of magnitude faster.

 

Here is how it works, ( I have 512MB memory )

$ su 
<password>
# memtest 512M 1 -l >

( 512M ¨one¨ ,¨-L¨ ) ( The 1 is for running the test only once, the -l makes a logfile in your /home )

 

Output to screen and logfile in /home:

Run 1:

Test 1: Stuck Address: Testing...Passed.

Test 2: Random value: Setting...Testing...Passed.

Test 3: XOR comparison: Setting...Testing...Passed.

Test 4: SUB comparison: Setting...Testing...Passed.

Test 5: MUL comparison: Setting...Testing...Passed.

Test 6: DIV comparison: Setting...Testing...Passed.

Test 7: OR comparison: Setting...Testing...Passed.

Test 8: AND comparison: Setting...Testing...Passed.

Test 9: Sequential Increment: Setting...Testing...Passed.

Test 10: Solid Bits: Testing...Passed.

Test 11: Block Sequential: Testing...Passed.

Test 12: Checkerboard: Testing...Passed.

Test 13: Bit Spread: Testing...Passed.

Test 14: Bit Flip: Testing...Passed.

Test 15: Walking Ones: Testing...Passed.

Test 16: Walking Zeroes: Testing...Passed.

Run 1 completed in 1418 seconds (0 tests showed errors).

 

Looks like my memory is still okay.

 

The current version of memtest should be available at

http://freshmeat.net/projects/memtester/

 

Read the docs: /urs/share/doc/memtester !!

 

( WARNING: this program will take your CPU to 100% during a long time . . see to it that your cooling is O.K. )

 

B) Bruno

Link to comment
Share on other sites

SEARCHING SOFTWARE IN THE MCC

( Only Mandrake )

 

 

There are a few different ways to search for packages in the Mandrake Control Center. The search field can be used with wildcards ( * ), in names, descriptions and files. Any individual file in a particular package can be found this way. Also any terminology given in the information-panel can be found with the description search.

 

If you have a general idea of what you are looking for, then do a search using ¨find in description¨. If you know the name, you can search by using ¨find in name¨. You can use ¨find in files¨ in case your looking for a specific lib* file ( library ) and do not know what package it comes with.

 

Also you can have a look at 'all the packages', by group, size, selection state, source repository and update availability.

The feature ¨source repository¨ is the most interesting one.

Remember, it will not have many options nor packages under “by source repository” unless you first add a few different sources. Ones to consider are the “Penguin Liberation Front” (PLF ) and ¨Thacs¨. If you are a Mandrake Club member, then go to your Club preferences page and add a source for ¨contributions¨, ¨club-contributions¨ and ¨commercial applications¨.

 

When you have a look at the different packages available, you will find a wide variety of offerings, including games, educational tools, scientific tools, word processing, HTML editors, SWF editors, drawing programs, photo editors, sound/music manipulating software. Anything you can think of, you can find them there. If you have some free time, scroll down through all the programs available. Most of them have unusual names, so be sure to read the descriptions too ( for the descriptions you can choose ¨normal¨ or ¨maximum information¨ ).

 

I sure hope you have a fast connection, because when you are done browsing, you will sure be downloading a lot of them. ( If you have disk 3--the international CD for Mandrake, you will find many of the files here as well as on the other disks. )

 

 

Happy software browsing!

 

 

cool.gif Bruno

Link to comment
Share on other sites

SEARCHING SOFTWARE ( all distro's )

 

 

Last time I wrote about searching software packages for Mandrake, today we do a general round-up.

 

Searching for software is relatively easy in Linux because there are a few places that act like huge warehouses where all the packages can be found.

 

Most important resource is Freshmeat

as they have a search engine on their site that will find you any package you like, be it in tarball, .rpm, or .deb format.

 

Tarball is universal for all Linux distro´s ( but there is a difference between the .tar.gz format and the .tgz one that is special for Slackware and VectorLinux ) Sourceforge foundries is a good place to look.

Also the ftp sites from the specific distros have plenty of extra packages.

 

RPM is ¨RedHat Package Management¨ was originally developed for RedHat but today also used for Mandrake and SuSE ( most of the time there is a difference between RPMs for Mandrake or RedHat so see to it that you get the right one ) A special search engine for RPMs is: RPMfind.net

 

As .deb are Debian specific packages, you get them though apt-get at the Debian mirrors but also on sourceforge and freshmeat.

 

An enormous resource for all thats related to music and sound is the site Linux-sound.org you should really go and have a look there, it´s amazing what you can get from that site. ( no ZZ Top MP3s though, actually no music files at all, but everything to make them. )

 

If you are looking for a package and the Freshmeat search engine can´t find it because you do not know the name of it . . . try google/linux

 

More resources:

LinuxApps

Linux Games

Linux HQ

Kernel Archives

Samba

XFree

Apache

Window Managers

 

If after trying all this, you still do not find the software you´re after . . . . just post a topic on the All Things Linux Forum and we´ll get everybody searching for you !

 

 

cool.gif Bruno

Link to comment
Share on other sites

 

Now we will install those packages, open a console and ¨cd¨ to the directory where you downloaded the files and install them in this order:

$ su 
< root password >
# rpm -Uvh rcd-1.4.4-0.ximian.6.1.i586.rpm 
# rpm -Uvh red-carpet-2.0.1-0.ximian.6.1.1.i586.rpm 
# rpm -Uvh rug-1.4.4-0.ximian.6.1.i586.rpm

 

Now all you have to do is type:

# red-carpet

 

The first time you get two dialogs, choose:

this system ( not remote ! )

start deamon = yes

 

And you get the GUI of the Red Carpet

Next time only typing ¨red-carpet¨ will do the trick.

 

That´s all, have fun !!

 

 

Bruno

 

 

-- Jul 24 2003 ( Project is dead ) --

 
Link to comment
Share on other sites

BACKUP MAIL EVOLUTION

 

 

If you want to backup your mail, addresses and appointments from Evolution, to import them later in an updated version of your distro, or in Evolution of another distro. All you have to backup is the ¨mail¨ directory you will find in /home/bruno/.evolution.

 

Later you can either import the files with the import-function or just replace the ¨mail¨ directory.

With the import function you have to browse to the ¨inbox¨ files you will find in /mail/local/inbox for your mail, any subdirectories you made will also be there.

 

For only importing your addresses, either copy /addressbook or import the addressbook.db that you find in /addressbook/local/addressbook.db. ( I think just copying the ¨addressbook¨ directory is the easy way and in previous versions the import function did not always do what you wanted it to do )

 

For only importing the tasks/calender you do the same as with the addresses.

 

Backup /home/bruno/.evolution/mail/pop, /home/bruno/.evolution/mail/config the /home/bruno/.gconf/apps/evolution and the /home/bruno/.gnome2_private/Evolution for the settings of your ISP/pop-mail addresses.

 

If you make a backup from the ~/.evolution directory to CD on a regular basis, the day that something serious will strike your computer you will just grab the CD and be able to get Evolution back in its old state in a flash.

 

 

 

cool.gif Bruno

 

 

PS: Another handy file to backup: Export your bookmarks to a file in your home directory and put that on the CD as well. ( Edit bookmarks, in the menu-bar --> bookmark --> export and you can choose where to put it, Mozilla exports them in HTML, that makes it easy to import in Galeon, Firebird, Konqueror and of course Mozilla. )

Link to comment
Share on other sites

MULTIBOOT LILO

 

The Mandrake GUI has a nice looking Lilo, that is why I like to use that one to add other distro´s. As an example we will add Slackware ( located on hda5 ) to the Mandrake Lilo. You can add as many distro´s as you like. All commands are given in Mandrake.

 

First we have to make a few directories, one in /mnt to mount the slack partition on ( temporary ) and one in /boot.

 

And open a console:

$ su[/size]
< password >
# mkdir /mnt/slack
# mkdir /boot/slack

 

Then we mount the Slack partition and copy the Slack vmlinuz to the /boot directory of Mandrake ( in this case ¨ vmlinuz-ide-2.4.20¨ while in other cases just vmlinuz, BUT know that the vmlinuz often is just a link to the vmlinuz+number and a copy of the link won't work ). Please have a look before you start what the vmlinuz is called that is in the /boot of the distro that you want to add . ( Also: if there is a initrd.img present, like in other distro's, you need to copy that as well )

# mount /dev/hda5 /mnt/slack
# cp /mnt/slack/boot/vmlinuz-ide-2.4.20 /boot/slack

 

 

Now that is done we can change the /etc/lilo.conf, but first we will make a backup:

# cp /etc/lilo.conf /home/julia

 

 

Then we open the file in vi:

# vi /etc/lilo.conf

( the changes are in red .)

 

(Text @ Screen)

 

boot=/dev/hda

map=/boot/map

default="Mandrake" ( ! I did change Linux to Mandrake ! )

keytable=/boot/us.klt

prompt

nowarn

timeout=100

message=/boot/message

menu-scheme=wb:bw:wb:bw

image=/boot/vmlinuz

label="Mandrake" ( ! I did change linux to Mandrake ! )

root=/dev/hdb5

initrd=/boot/initrd.img

append="devfs=mount hdd=ide-scsi acpi=off quiet"

vga=788 (check this number, this is for my monitor, and copy it to the Slack part)

read-only

image=/boot/slack/vmlinuz-ide-2.4.20

label="Slackware"

root=/dev/hda5

append="hdd=ide-scsi"

vga=788

read-only

image=/boot/vmlinuz

label="linux-nonfb"

root=/dev/hdb5

initrd=/boot/initrd.img

append="devfs=mount hdd=ide-scsi acpi=off"

read-only

image=/boot/vmlinuz

label="failsafe"

root=/dev/hdb5

initrd=/boot/initrd.img

append="devfs=nomount hdd=ide-scsi acpi=off failsafe"

read-only

other=/dev/fd0

label="floppy"

unsafe

 

then save

 

Esc

ZZ

 

Now we want to write the new lilo to the MBR:

# /sbin/lilo

 

 

And you will see:

(Text @ Screen)

Added Mandrake *

Added Slackware

Added linux-nonfb

Added failsafe

Added floppy

 

 

If you get an error message it means that you made a typo somewhere . . .go back in with vi and correct the file . . . .

The * means that Mandrake is the default to boot if no action is taken at the lilo screen.

 

ADDITIONAL NOTE: Now, Slack will NOT be automatically mounted if you boot Mandrake . . we mounted it only once . . . if you want it mounted every time we need to adapt /etc/fstab . . . . . but I would leave it like it is and do ¨mount /dev/hda5 /mnt/slack¨ whenever you need to address Slack from Mandrake ( wich will not be very often )

 

B) Bruno

 

 

PS: I know there are may other ways to do this ( even a GUI tool in Mandrake can do the trick ) but was is my favorite way to adapt Lilo.

 

PS2: For aditional info about adding RedHat 9.0 and if CDRW does not get recognized in Slackware see Here

Link to comment
Share on other sites

AUTO FSCK

 

You probably know already that every 20 to 30 times you reboot your system, or after each un-clean shutdown, you will get a check of the integrity of your file system.

 

NOTE: this text is only relevant for Ext2 filesystems . . . for Ext3 see "IMPORTANT" at the bottom of this tip.

 

Also you might have seen on the screen as the system files are checked that you have to hit the Y button within 5 seconds . . . . now, 5 seconds is very short and the chances are you will be just too late . . . the system will continue booting, but if there are problems with the integrity . . . you have a problem . . so most of the time at a file check I had my finger close to the Y button . . not anymore !

 

I did a few little tweaks:

 

Open the file "/etc/sysconfig/autofsck" in vi

$ su
< password >
# vi /etc/sysconfig/autofsck

 

" i " ( to put vi in insert mode )

 

And you will see two lines:

AUTOFSCK_TIMEOUT=5

( just change the number of seconds here )

and

AUTOFSCK_DEF_CHECK=no
(

change the value to yes and it will hit the Y for you)

 

Save the file

Esc ( put vi in command mode )

ZZ

 

If there is no such file as "/etc/sysconfig/autofsck", just make it (They are the same commands to make or open a file in vi)

 

Mine looks like this:

# -*- Mode: sh -*-

# $Id:$

 

# Specify here how many seconds we wait for timeout

AUTOFSCK_TIMEOUT=3

 

# Specify if we do automatic fsck.

AUTOFSCK_DEF_CHECK=yes

 

#Specify how many seconds we wait for mounting crypto.

AUTOFSCK_CRYPTO_TIMEOUT=25

 

The last line is only for if you have a crypto file system installed ( search google/linux if you want to know more about crypto file systems)

 

IMPORTANT:

The text above is only relevant if you use Ext2 filesystem !

In case of a hard-reset, init messages indicate the computer was not shut down cleanly, and a message appear :"Press Y within 5 seconds to force the file system check "Actually this is very misleading : if you do it with ext3, it does NOT use the journal and then you will experience system losses. Lots of newbies have reported that problem. Now that would be nice to change this message so that people leave the journalisation do the good work. --Eric

 

B)Bruno

Link to comment
Share on other sites

CHANGE THE BIOS SETTINGS

 

For the install of a Linux distro's we will have to change the BIOS settings.

Most important changes are:

1) The value for "PnP aware OS" has to be set to "NO"

2) And the order the BIOS looks for boot options . . ( the MBR is mostly on IDE 0, we want to boot from CD ) We will have to put the CD-ROM on the first place, the floppy and the IDE 0 in second and third place. After the install we can put the BIOS settings back as they were before.

 

Some people have some serious problems getting in the BIOS, some computer brands are making it really difficult, so here is an overview of the different options related to the brand PC:

(took the quotes out of several threads in the Linux and Hardware forum )

 

You may find this helpful. Various way to access BIOS on lots of computers:

AMI/Award: [Delete] during boot

Toshiba: [Esc]during boot

Toshiba, Phoenix, Late model PS/1 Value Point & 330: [F1] during boot

Compaq: [F10] When blinking cursor jumps to top right corner of screen

Compaq: [F10] when logo screen is displayed

NEC: [F2] during boot

IBM PS/2: with reference partition-[insert] during boot

IBM PS/2: Need reference disk and ADF disk for setup

Emachine: [Tab] during boot

some Dells: reset button twice (I suppose this means power reset button)

Misc computers: [Ctrl]+[Alt]

Dell: [Ctrl]+[Alt]+[Enter]

AST Advantage, Award, Tandon: [Ctrl]+[Alt]+[Esc]

Zenith, Phoenix: [Ctrl]+[Alt]+[ins]

Phoenix: [Ctrl]+[Alt]+

Olivetti PC Pro: [Ctrl]+[Alt]+[shift]+ Num Pad [Del]

Misc computers: [Ctrl]+[Esc]

Some PS/2: [Ctrl]+[ins] when pointer at top right of screen

Phoenix: [Ctrl]+

Tandon 386: [Ctrl]+[shift]+[Esc]

 

HP [F2]

 

Gateway systems using Phoenix BIOS [F1]

 

To access the BIOS on a Sony Vaio 320 series, press [F2] during boot.

 

IBM thinkpad [F1]

 

On my Dell Dimension L566cx system, [Esc] will get out of the splash screen and [Del] is the key to get into setup.

 

* If you have a computer that is not listed here and you do know the code, please send me a PM and I will be glad to add it to the list.

 

B) Bruno

Link to comment
Share on other sites

DAMAGED SUPERBLOCK

 

If a filesystem check fails and returns the error message "Damaged Superblock" you're lost . . . . . . . or not ?

 

Well, not really, the damaged "superblock" can be restored from a backup. There are several backups stored on the harddisk. But let me first have a go at explaining what a "superblock"is.

 

A superblock is located at position 0 of every partition, contains vital information about the filesystem and is needed at a fielsystem check.

 

The information stored in the superblock are about what sort of fiesystem is used, the I-Node counts, block counts, free blocks and I-Nodes, the numer of times the filesystem was mounted, date of the last filesystem check and the first I-Node where / is located.

 

Thus, a damaged superblock means that the filesystem check will fail

 

Our luck is that there are backups of the superblock located on several positions and we can restore them with a simple command.

 

The usual ( and only ) positions are: 8193, 32768, 98304, 163840, 229376 and 294912. ( 8193 in many cases only on older systems, 32768 is the most current position for the first backup)

 

You can check this out and have a lot more info about a particular partition you have on your HD by:

$ dumpe2fs /dev/hda5

( go on, try it right now ! )

 

You will see that the primary superblock is located at position 0, and the first backup on position 32768.

 

O.K. let's get serious now, suppose you get a "Damaged Superblock" error message at filesystem check ( after a power failure ) and you get a root-prompt in a recovery console, then you give the command:

# e2fsck -b 32768 /dev/hda5

( don't try this at home . . uh, I mean: don't try this on a mounted filesystem )

 

It will then check the filesystem with the information stored in that backup superblock and if the check was successful it will restore the backup to position 0.

Now imagine the backup at position 32768 was damaged too . . . then you just try again with the backup stored at position 98304, and 163840, and 229376 etc. etc. until you find an undamaged backup :) ( there are five backups so if at least one of those five is okay it's bingo ! )

 

So next time don't panic . . just get the paper where you printed out this Tip and give the magic command

# e2fsck -b 32768 /dev/hda5

 

B) Bruno

Link to comment
Share on other sites

INSTALL CHEATCODEST

 

here are times that an install just will not go the way it's supposed to. Sometimes it hangs half way installing the packages or during the hardware detection. In those cases a "cheatcode" or an alternative kernel version can help.

 

The default is that you press F1 ( or F2 ) at the first screen as you boot from the CD, then you will get a screen with some info about boot options and a prompt where you can type a code.

 

In most cases the CD has a few different kernels you can use, ( Mandrake has: "linux", "alt0" and "alt1" ) we take as example the default one "linux", you start with typing the kernel version and then add the option:

 

linux noapic ( skips part of hardware detection )

linux pci=noapic ( skips parts of the hardware detection on PCI cards )

linux ide=nodma ( disable DMA on all IDE drives )

linux mem=1536M ( if the memory has more then 1G memory )

linux vga=0 ( sets the vga to default )

linux acpi=off ( skips parts of the hardware detection on PCI cards )

 

Here are a few more options you can add after the kernel version:

noagp ( skips hardware detetion on agp slot )

noaudio ( skips parts of the hardware detection )

noddc ( skips parts of the hardware detection )

noapic ( skips parts of the hardware detection )

nopcmcia ( skips parts of the hardware detection )

noscsi ( skips parts of the hardware detection )

nousb ( skips parts of the hardware detection )

nofirewire ( skips parts of the hardware detection )

noapm ( disable Advanced Power Management )

 

The next ones are used without typing the kernel version first and only have effect on the installer itself:

 

vgahi ( high resolution graphical install )

vgalo ( low resolution graphical install )

vga16 ( 640 x 480 in 16 colors install )

text ( text install instead of graphical )

 

I hope that one of these codes will do the trick for you if you have install problems

 

Bruno

 

PS: Slackware has a special power-cheatcode, "the silver bullet" :

bare.i root=/dev/scd0 noapic

 

B)

Link to comment
Share on other sites

THE LINUX COUNTER

 

So, now you've come this far in The Tips it might be time to get yourself and your box registered ( see my sig and those of many others here on the forum )

 

Registered Linux User #299965

 

The procedure is very simple and is free of charge

 

The Linux Counter

 

According to their website there are about 18,000,000 ( eighteen million ! ) Linux users on this planet. Only 134,177 of them are registered. So let's push up those numbers ! ( I'm counting on you )

 

NOTE: You will have to login on their site at least once a year to keep your Registration valid

 

PS: Getting registered does NOT provide any extra benefits, but it's fun !

 

B) Bruno

Link to comment
Share on other sites

THE WHATIS COMMAND

 

Whatis is a funny command that might come in handy as you learn Linux. Let's give an example, we want to know what the command "cp" does:

NOTE: On some systems you have to build the database first by running "/usr/sbin/makewhatis" as root ( Thanks Owyn )

 

$ whatis cp
cp		 (1) - copy files and directories

 

Or the command ifconfig:

$ whatis ifconfig
ifconfig (8) - configure a network interface

 

Now we can do a lot more with whatis, imagine you want to have the information on all the commands stored in, let's say, /usr/bin. We will have to move to that directory first:

$ cd /usr/bin

 

And then we give the next command:

$ ls | xargs whatis | less

( the "|" are pipe signs, the "shfit \" key )

 

This is a part of the list you will get ( scoll page with the spacebar, and close with Q ):

411toppm (1) - convert Sony Mavica .411 image to PPM

a2p (1) - Awk to Perl translatoraclocal: nothing appropriate

aclocal-1.4: nothing appropriate

aconnect (1) - ALSA sequencer connection manager

acroread: nothing appropriate

activation-client: nothing appropriate

adddebug: nothing appropriate

addftinfo (1) - add information to troff font files for use with groff

addr2line (1) - convert addresses into file names and line numbers

addxface: nothing appropriate

alsamixer (1) - soundcard mixer for ALSA soundcard driver, with ncurses interface

amixer (1) - command-line mixer for ALSA soundcard driver

amor: nothing appropriate

animate (1) - animate a sequence of images

anytopnm (1) - convert an arbitrary type of image file to PBM, PGM, or PPM

 

( For the very curious ones: ls = list directory contents, xargs = build and execute command lines from standard input, less = opposite of more )

 

You can do this in any directory you like.

 

HINT: /bin, /usr/bin/, /sbin, /usr/sbin, and /usr/X11R6/bin are the most interesting directories to look for commands and their "whatis" explanation.

 

Have fun exploring !

 

B) Bruno

Link to comment
Share on other sites

TAB COMPLETION

 

This has been in The Tips before, but got lost at the end part of another tip: "searching" . . Just because it's such a handy feature of the commandline and because many members are struggling to get the commands typed correctly . . . here it is again:

 

The Tab key autocompletes on the commandline, you type a few characters and press the Tab key and the command or the name of the file will be completed:

Try this, < cd /u > and press tab now add an "s" and press tab, give an "h" and press tab, now we have got < cd /usr/share/ > OK lets go on, type a "f" "o" "n" tab "t" tab "d" tab. < Enter > Now we are in /usr/share/fonts/ttf/decoratives. < ls > will give you a list of all the fancy ttf fonts on your system.

 

So next time you have to type a long command like this:

# cp synthesis.hdlist.update_source.cz /var/lib/urpmi/synthesis.hdlist.update_source.cz

 

You type:

# cp sy ( tab ) ( space ) /v ( tab ) li ( tab) u ( tab ) sy ( tab )

 

And you will see that the full command is on your screen :( ( This command works only if the file "synthesis.hdlist.update_source.cz" is in your /home direcotry )

 

More on the Tab key and commands:

 

If you don't remember exactly how a command was written, type in the first character or two and hit the tab, you will get a list of all the commands that start with that character(s).

 

If you wish to know what a certain command does ( ex: mkmanifest ), type:

$ whatis mkmanifest

 

This is what you get back to the screen :

mkmanifest (1) - makes list of file names and their DOS 8+3 equivalent

 

All Linux commands and their descriptions can be found at O'Reilly

 

B) Bruno

Link to comment
Share on other sites

SPLITTING LARGE FILES

 

Split is a command we use for splitting large files into smaller ones without corrupting the integrity of the file. We can later merge the files again to the original size.

Why would we want to do that ? Well, an example would be if your laptop only has a floppy drive and you want to copy a large file from your PC to your laptop.

 

This is how it works:

# split -b1m lastweek.mp3 lastweek.mp3.

( The first "lastweek.mp3" is the original file, while the second "lastweek.mp3." is the name of the new files, the last dot has to be there for the double extension, or else it won't work. The -b stands for bytes, the "1m" means in portions of 1 MB . You can use -l instead of -b, then it will be the number of lines, the default is 1,000 lines )

 

If the original file was 5.6 MB you will get 6 files named: , lastweek.mp3.aa, lastweek.mp3.ab, lastweek.mp3.ac, lastweek.mp3.ad, lastweek.mp3.ae and lastweek.mp3.af ( the last one only 0.6MB )

 

Merging them together on the laptop is quite simple too:

$ cat lastweek.mp3.* >lastweek.mp3

( don't forget the * )

 

That's all, so now you've got a spotless lastweek.mp3 of 5.6 MB on the laptop.

 

B) Bruno

 

Yarg mailed us, "I found the windows command that would successfully combine the files":

# copy/b file1+file2+file3 newfile

Link to comment
Share on other sites

  • 2 weeks later...

USB MEMORY STICKS and DIGITAL CAMERAS

 

In most modern distros the USB-stick and digital camera are automounted on /mnt/removable . . . the "removable" directory is auto-created and removed after you plug out the device.

 

If this is not the case: USB sticks, digital cameras, and also memory sticks can be mounted as "mass storage devices" . . . . there is a simple trick if they are not automounted:

$ su
<password>
# modprobe usb-storage[size=4]

[/size]

# fdisk -l

( the -l is the letter L and not the number 1 )

 

This will show all the partitions on harddrisk and removable devices

Take a look on what /dev device the USB-storage is mounted ( we assume for this example /dev/sda1 )

 

Then:

# mkdir /mnt/storage

( make a directory for it )then mount it:

# mount /dev/sda1 -t vfat /mnt/storage

 

If anything is already stored on the memory stick:

# ls /mnt/storage

( will show you the files )

 

Now you can use the cp command to copy files to and from your memory stick

 

B) Bruno

 

PS: More in depth info Here and Here

Link to comment
Share on other sites

MAKING a BOOT FLOPPY

 

If the GUI-tool for making a boot-floppy fails, there is a simple ( command line ) way to make one, the tools are a bit different depending on the distro you use:

( no need to wipe/format the floppy before you start, it will simply be overwritten anyway)

 

Mandrake: ( Pre kernel 2.6 ! . . . post kernel 2.6 see Making boot CD )

$ su
< password >
# uname -r

( will show you the kernel-version: probably 2.4.21-0.13mdk )

 

# mkbootdisk --device /dev/fd0 2.4.21-0.13mdk

 

And put in a floppy and press enter That's all !

 

RedHat:

The same as Mandrake ( only another kernel version ) but you have to add /sbin:

# /sbin/mkbootdisk --device /dev/fd0 <kernel version>

 

Slackware:

$ su
< password >
# makebootdisk

And a dialog will pop up and make the floppy.

 

VectorLinux:

Same as Slackware

 

Debian:

( Also Knoppix HD installed )

# mkboot -r dev/hda? <kernel-version>

( hda? Is the root partition, replace the "?" )

 

NOTE: Always test your boot-floppy after you made it

 

So, next time you feel like doing some serious work on your system, and things go wrong, you will have a good way to boot even if the MBR gets overwritten. Simply boot from the floppy and restore Lilo or Grub to the MBR:

$ su[/size]
< password >
# /sbin/lilo

or

# grub-install /dev/hda

 

Have fun tweaking your Linux box ! ( you can even do a re-install of windows without having to worry about the boot-loader )

 

B) Bruno

Link to comment
Share on other sites

ISO TO ZIP-DRIVE

 

Imagine you can boot from your zip-drive and you want to put a distro on the zip, but distro's come "packed" as ISO, so how do you extract an ISO ?

Simple:

 

Create a directory in /mnt called loop: ( as root )

# mkdir /mnt/loop

 

Then:

# mount -o loop /home/bruno/tmp/damnsmall-0.4.5.iso /mnt/loop

 

This will extract/show all the files of the ISO in /mnt/loop . . all you have to do is copy them to your zip drive and boot from it . . .

 

You can put a small distro like D Small Linux on your USB Memory Stick too, but booting from it is a bit more complicated . . . if you really want to give it a go Here and have a look . . . .

 

B) Bruno

Link to comment
Share on other sites

MOUNTING DOS/WINDOWS PARTITIONS

 

In some distros the Windows partitions are not automatically mounted. In that case we can mount them manually.

 

Most windows partitions have the FAT file system ( support long names for files ) A Linux partition typically has a Ext2 or Ext3 file system.

 

To mount a Fat file system on an Ext partition we have to give an extra argument to the mount command.

 

First we make a new directory in /mnt:

$ su
< password >
# mkdir /mnt/windows

 

Then we can mount the Windows partition ( for this example Windows is on hda1 ) :

# mount -t vfat /dev/hda1 /mnt/windows

( or "mount -t ntfs /dev/hda1 /mnt/windows" for NTFS partitions )

 

( With "fdisk -l /dev/hda" as root you can see on what partition Windows lives )

 

Unmounting:

# umount /mnt/windows

( this is NO typo: umount and not unmount )

 

With most modern distros, however, you do not need all this because the Windows partitions will be auto-mounted every time you access them.

 

B) Bruno

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

×
×
  • Create New...