Peter's Linux Q&A

  1. What is bzImage and how is it different from zImage?
  2. Why doesn't the 3 fingered salute (Ctl-Alt-Delete) work on my Linux?
  3. How do I really accurately set my clock?
  4. How do I disable the caps lock key?
  5. How big should my swap space be?
  6. I just catted a binary file, and now my screen shows wierd characters! What do I do?
  7. How do I resize an ext2 partition on my hard drive?
  8. How do I span a file across several floppies?
  9. How do I automatically set the keyboard's number lock on upon booting the system?
  10. What causes errors like:
    alias ppp-compress-21 bsd_comp
    alias ppp-compress-24 ppp_deflate
    alias ppp-compress-26 ppp_deflate
  11. How do I get my computer to stop beeping?

  1. In terms of kernel compiling, what is bzImage and how is it different from m zImage?
    Actually, it's a common misconception that bzImage is compressed better then zimage (it is NOT bzipped).

    Because of the brain dead design of the intel x86 processor, a zImage suffers from the 640k (16 bit memory access) limitation, just like MS-DOG. The bzImage avoids this by expanding and loading in stages. It loads a pre image in real mode and then loads the rest of the kernel image in protected mode, which has access to all of the memory.

    There have been some problems with bzImages on certain machines, mostly laptops. Some computers *might* see a little more time to load the kernel, but we're talking fractions of a second here.



  2. I have been trying to edit /etc/inittab so that the 'three finger salute' (Ctl-Alt-Del) performs a complete reboot, that is all the way to halt and back up again, like Windows. I saw the line ca::crtlaltdel:/sbin/shutdown -t3 -r now in my inittab and thought that it should work as it is, but it does not. In fact, there is no reaction whatsoever to Crtl-Alt-Del. Why not?
    Ctrl-Alt-Del doesn't work under X AFAIK. X puts the keyboard in raw mode and handles key mapping itself, so the kernel never gets to see the Ctrl-Alt-Del. If you switch to another VT first (Ctrl-Alt-F1 say) then the Ctrl-Alt-Del combination should cause a reboot.

    You might be interested to know that kdm has a nice shutdown button. :)



  3. How do I really accurately set my clock?
    There are a number of ways of doing this. The first way is to use netdate. To set your system clock:
    # netdate cuckoo.nevada.edu
    cuckoo.nevada.edu -82.705
    It sets your clock (must be superuser to set the date) and returns the number of seconds your clock was off by. Another way to set your clock is to use ntpdate; it's supposed to be better:
    # ntpdate ntp.ucdavis.edu
    23 Jun 03:55:20 ntpdate[788]: adjust time server 169.237.105.50 offset 0.006278 sec
    Another way is to use rdate with the -s switch (which stands for `set time'). Note that rdate will give you precision to within one second. If you want more precision, use ntp or xntp (extended network time protocol).
    # rdate -s ntp.ucdavis.edu Wed Jun 23 03:58:14 PDT 1999
    Yet another way is to run xntpd. Lastly, there's the timed daemon. How's that for a choice? For general purpose, these programs are all equivalent. What makes one `better' than another is the precision of time and features. But if you're not going to cry over a milisecond here or there, and if you don't plan on doing really complicated time synchronizations, then you can use any one of these.



  4. How do I disable the caps lock key?
    xmodmap -e "remove Lock = Caps_Lock"



  5. How big should my swap space be?
    Using Linux 2.2 on a 32 bit machine, the maximum swap space that can be used is 2GB. Linux 2.0 on a 32 bit machine used a maximum swap space of 128MB. Dec and Alpha both use 512MB.

    The old rule of thumb is that your swap space should be double your RAM, up to the 128MB limit. These days, computers have tremendous amounts of RAM, so swap space is not nearly as crucial as it used to be. I've seen home systems run just fine with NO swap space! OTOH, hard drive space is really cheap these days. I'd say a good rule of thumb is that you should make your swap space 128MB. Unless you plan on really stressing out your computer, you'll never use it, but it's there if you ever need it.

    Did you know that you can adjust the swap partitions while your computer is running? As root, run mkswap to prepare a partion for swapping, swapoff to stop using a swap partition, and swapon to start using one. (Be careful to give mkswap the right partition as its argument, since it does erase whatever is on the partition). When you are happy with your partition setup, edit /etc/fstab accordingly.



  6. I just catted a binary file, and now my screen shows wierd characters! What do I do?
    There are three things; one of them should work.
    1. Type stty sane
    2. Type reset
    3. Type <Ctrl-V><Ctrl-O>
    According to termcap, printing Ctrl-O character string cooresponds to the `End alternative character set' (abbrev. "ae") command string. So when you write the ctrl-O character to the terminal, it ends the alternative character set session.

    The character string that begins the alternative character set is Ctrl-N, `Start alternative character set for block graffic characters' (abbrev. "as").

    To test this, try typing these:

    $ echo ''
    (see odd characters come up)
    $ echo ''
    (see odd characters go away)
    Of course, you won't actually see yourself type "echo ''"... you'll see the odd characters appear when you press keys.

    For more information on other command strings you can use, look at the terminal capabilities file in /etc/termcap, and read "man termcap" to see what each capability corresponds to.

    For example, here's how I found out what Ctrl-O does. I looked up xterm's termcap entry in /etc/termcap, which looks like:

    xterm|vs100|xterm terminal emulator (X11R6 Window System):\
    ...
    :LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:ae=^O:al=\E[L:as=^N:\
    ...
    :us=\E[4m:
    I noticed "^O", which corresponds to the "ae" capability. Then I looked up what "ae" is in "man termcap", which says:
    ae End alternative character set
    So I realized that's the string to disable alternative character set. I wanted to see if it really works, so I also looked up what corresponds to "begin alternative character set"; I searched for other occurrences of the word "character set" in man. I found:
    as Start alternative character set for block grafic characters
    Then I looked up "as" in /etc/termcap, in xterm session. It corresponded to ^N (see above). So I tried typing "echo ''", which put me in alternative character set mode. Then I typed "echo ''" which put me back in alternative character mode. I also tested it under console to make sure it works on console.

    I didn't realized Ctrl-O corresponded to putting the terminal back to the text mode (thanks, Zach!). Normally I just "Do Soft Reset" by Ctrl-MiddleMouseButton on XTerm. I rarely ever use the console, though...it'll come in handy if the console ever goes into graphics mode. (thanks Mark Kim).



  7. How do I resize an ext2 partition on my hard drive?
    Check out ext2resize on freshmeat .



  8. How do I span a file across several floppies?
    $ tar cvf /dev/fd0 -M *
    SC-97-16.ps
    cg.ps
    Prepare volume #2 for /dev/fd0 and hit return:
    When you're ready to unarchive the spanned disks:
    $ tar xvf /dev/fd0 -M
    SC-97-16.ps
    cg.ps
    Prepare volume #2 for /dev/fd0 and hit return:



  9. How do I automatically set the keyboard's number lock on upon booting the system?
    You'll want to add the following to your /etc/rc.d/rc.local (or whatever your local boot script it)
    TTY=/dev/tty[1-8]
    for tty in $TTY; do setleds -D +num < $tty done



  10. What causes errors like:
    alias ppp-compress-21 bsd_comp
    alias ppp-compress-24 ppp_deflate
    alias ppp-compress-26 ppp_deflate

    On Debian, if in /etc/modutils/aliases you have:
    alias ppp-compress-21 bsd_comp
    alias ppp-compress-24 ppp_deflate
    alias ppp-compress-26 ppp_deflate
    but you don't have the bsd_comp or ppp-deflate modules in /lib/modules//net/, then you may get such an error. On the other hand, if you do have these modules, but don't have the alias lines above, simply add them to the file and run update-modules (the errors should go away).



  11. How do I get my computer to stop beeping?
    1. Add bell-style none to /etc/inputrc
    2. If you want to turn beeping off from within X, do: xset -b.
    3. If you only want to make vi stop beeping put the following in your .vimrc:
      set vb (Use visual bell)
      set t_vb= (Set visual bell code to nothing)


Please report bugs or broken links to me.