Updated: 2013-05-08 21:01 EDT

1 Note on the Fragility of Hard Drives in backpacksIndexup to index

Your hard disk is very sensitive to shock. Don’t store it unpadded in the bottom of your backpack where it will hit the floor every time you drop your backpack. Keep it in a thick bubble wrap envelope or wrap it in your clothes. Store it in your locker when you aren’t using it and don’t carry it around all the time.

Your hard disk is sensitive to temperature changes. Keep it at room temperature. Don’t bring it into a warm room and power it on right after it has been stored outside in your freezing car overnight or in a cold backpack in winter. If you have a very cold hard drive, give it a few hours to warm up before turning it on.

Put your legible name on your caddy and power supply (and everything) so we can contact you if you leave it behind in a lab some day.

2 How to correctly shut down a VMware caddy systemIndexup to index

Treat every virtual machine as you would a real physical computer. You must power on and power off your real and virtual systems in the correct order to avoid file system damage and locked VMware images:

  1. Inside VMware, Shut Down or Suspend every running virtual machine and wait until every virtual machine fully shuts down or Suspends. Failure to do this will result in corrupted and locked virtual machines! You can use the VMware Suspend button at the top of each running virtual machine, or you can right-click on the running machine menu and Suspend it.
    If you want to Shut Down a running virtual machine, go into the virtual machine and find the correct Shut Down menu for that operating system. (In Linux Fedora 12, the Shut Down menu is under the System menu.) NEVER USE THE RED “POWER OFF” BUTTON IN VMWARE! NEVER CLOSE VMWARE OR WINDOWS BEFORE ALL VIRTUAL MACHINES ARE SHUT DOWN OR SUSPENDED!
  2. Close the VMware application (after you have Shut Down or Suspended all virtual machines).
  3. Shut down the Windows host O/S and wait until the power goes off.
  4. After the Windows host computer turns off (wait for it!), only then turn off the external caddy.
  5. After powering off the caddy, wait 15 seconds until the disk inside the caddy stops spinning.
  6. Unplug the caddy wires and pack the caddy in thick bubble wrap to take away in your backpack.

Reverse these steps, bottom-to-top, to power on your systems.

3 Must restart networking when resuming machinesIndexup to index

If you resume a virtual machine in a different room than where you Suspended it, the resumed networking will likely be wrong - it will be the networking used in the room where you Suspended the machine. Under the Network menu on the top menu bar, you have to “Disconnect” and then reconnect the wired network to get networking functioning again.

4 No Networking under Fedora 12 inside Windows host O/SIndexup to index

If you start up a Fedora VM inside your Windows host O/S and don’t see any eth0 or eth1 networks available in the drop-down menu under the Network icon on the top menu bar, perhaps you have lost your NAT networking in VMware.

In VMware, under the Edit menu, open up the Virtual Network Editor and make sure that one of the networks (usually vmnet8) is still set as a NAT type. If not, create a new NAT network and reset your Fedora 12 to use it.

5 Do NOT Install (hundreds of) Fedora 12 UpdatesIndexup to index

Your Fedora 12 installation will at some point announce that dozens of security updates are available for your Linux system, as well as hundreds and hundreds of other non-security updates - over 900MB of updates in total. Do not install any updates to Fedora 12.

If you only use Fedora in your virtual machine, inside a NAT network, there is little risk of damage from an unpatched system. When you install a more current version of Fedora, that would be the time to also install the related updates.

To disable annoying update notices, you can right-click on the Update Icon in the top Fedora menu bar (red with exclamation point) and select Preferences and then set all the Update Settings to Never. (Don’t do this on the job! Ignore updates only for school use!)

Do not install any updates to Fedora 12.

6 How to rename a Fedora/CentOS machineIndexup to index

To change the host name of a Fedora/CentOS machine:

  1. Edit the /etc/sysconfig/network file and change the HOSTNAME= variable to the new host name, e.g. HOSTNAME=myhostname
  2. Edit the /etc/hosts file and add that host name to the start of the list of local host names after the 127.0.0.1 address, e.g. 127.0.0.1 myhostname localhost
  3. Reboot the machine.
  4. Confirm that the host name has changed by using hostname

7 How to unlock virtual machinesIndexup to index

Lock files are sometimes left behind when you fail to Shut Down or Suspend your virtual machines before closing VMware or before shutting down your Windows host. Locked virtual machines may be corrupted, since they did not shut down cleanly. To unlock your locked virtual machines:

  1. close the VMware application
  2. in your Windows host file system, navigate to where you keep your virtual machines (likely on your D: drive)
  3. go into the VMware folder
  4. look inside every virtual machine folder and find every file and directory ending in *.lck and remove it
  5. Re-open VMware.

All your machines should be unlocked; some may be corrupted or damaged and may not work properly. Do not remove the lock files of running virtual machines. Follow correct shutdown procedures.

8 Enabling Focus-Follows-MouseIndexup to index

Normally you have to click in a Fedora window to make it accept focus (keyboard input), and that click also raises the window. You can change this behaviour so that simply moving the mouse into a window enables keyboard input without requiring any mouse click and without raising the window. This is called “focus-follows-mouse”; it’s really useful.

To enable this wonderful feature, first take a snapshot of your working system (in case you don’t install everything correctly).

Next, install both the control-center-extra and updated nautilus packages, either through the System|Administration|Add/Remove Software menu or by becoming root and using the command line:

    su
    yum install control-center-extra
    yum install nautilus
    exit

Answer Yes to all questions. You will have to enter your root password and confirm the installation of some other related packages. You must install both packages, otherwise your system will loop.

When installed, this package creates the menu System|Preferences|Windows. Select this Windows menu item to open the Window Preferences dialog box. Check “Select windows when the mouse moves over them”. You can leave “Raise selected windows after an interval” unchecked, unless you like that behaviour.

Now, just moving the mouse pointer into a window will enable keyboard focus. You don’t have to click in the window to type there any more. Wonderful!

If your system reboots and starts looping, creating many window tabs, then you did not read all the words in this section. Restore your system back to a working snapshot and try again.

9 Customizing the Linux Top Menu BarIndexup to index

You can open any Linux Fedora menu and click-and-drag anything you see there up to the top menu bar for easier access. The Terminal application is one such frequently-used item to consider dragging up.

10 Answering the VMware moved it vs. copied it questionIndexup to index

When you first power on a VMware virtual machine on hardware different from that on which it was created, you may be asked if you moved or copied the virtual machine. The answer is simple: If this virtual machine is not a copy of an existing machine, reply moved it (this is the usual case). If you actually did make a file copy of the virtual machine file and power on the new copy, reply copied it.

11 Using VMware linked clones/snapshots on other machinesIndexup to index

A linked clone/snapshot links to the base version using a host-specific absolute pathname that doesn’t work directly on alternate architectures, such as when moving from a Windows host O/S to a Linux host O/S. You can still use the clone/snapshot, but you have to manually browse to the new absolute pathname in the new O/S when booting the system.

12 Don’t change processors with Suspended VMware machinesIndexup to index

Using VMware to Suspend a machine is faster and more convenient than using the menus to shut it down. One time you should not use Suspend is if you are going to restart the machine on a different processor.

VMware gives a warning about problems if the processor vendor changes when you restart a machine. Avoid restarting a Suspended machine on a different processor. If you know you’re moving to a different processor (e.g. moving to home from school or vice-versa), shut down your virtual machines instead of suspending them.

13 Increasing VMware BIOS screen pauseIndexup to index

The VMware BIOS screen flashes past very quickly, which is a problem if you want to change the boot order of your virtual devices. On modern versions of VMware, you can boot directly into this BIOS screen using the “VM -> Power -> Power On to BIOS” menu.

To get a longer pause at the VMware BIOS boot menu, edit (using Notepad) each of your VMware *.vmx configuration files and add this line at the bottom. It adds 60,000 milliseconds to the boot delay:

bios.bootDelay = "60000"

You need to turn on seeing file extensions in Windows, to find the correct *.vmx files to edit. (System admin must never hide file extensions!)

The mouse does not work on any BIOS/POST screens or GRUB (boot menu) screens. First, click in the virtual machine window (to set keyboard focus there), then use the keyboard arrow keys to change selections and ENTER to proceed in these keyboard-only, terminal-only screens.

14 Handling forgotten passwords under LinuxIndexup to index

You can never recover or find out an existing password from Linux. All you can do is set a new password to replace the old one.

14.1 Changing an ordinary non-root account passwordIndexup to index

Since the default VMware mouse escape (Hot Keys) starts with CTRL+ALT, you may need to change this in the VMware Edit|Preferences|HotKeys dialog before the following instructions using CTRL+ALT+F2 can work. I recommend changing the Hot Key Combination to Custom and using CTRL+SHIFT+ALT+WIN in “Down” mode.

If you forget the password of your ordinary (non-root) account, switch to a text console (e.g. use CTRL+ALT+F2), log in as the root user and use the command passwd user where user is the account for which you want to set a new password. (You cannot log in as root via the Fedora GUI; you must switch away from the GUI to use a text console.)

After you have set the new password, log out from root by typing exit, switch back to the Fedora GUI using either CTRL-F1 or CTRL-F7, then log in as user using the new password. Remember it!

14.2 Changing the root account password - Single User ModeIndexup to index

If you forget the password of your root account, you have more work to do. Read this whole section through once before you begin.

To recover the root account, you have to Shut Down and restart Linux in single-user mode. Look for the “I forgot my password” PowerPoint file on Blackboard, which has pictures and is mostly right but not completely correct, or follow these directions here which are definitely right (Fedora 12, September 2011):

  1. Use the Fedora System menu to Shut Down and Restart Linux
  2. Quickly, just as the VMware logo and black BIOS boot screen appears, click the mouse in the VMware window (to set the keyboard focus there) and immediately push the space bar to trigger access to the blue GNU GRUB menu. If Fedora starts to boot, you weren’t quick enough, and you will have to wait until Fedora boots, then repeat the Shut Down and Restart until you get the space bar timing right. The blue GNU GRUB menu contains a line with your Fedora 12 kernel version number and some instructions on how to select entries.
  3. Your mouse does not work in the blue GNU GRUB window. Use only the keyboard and keyboard arrow keys.
  4. As the blue GNU GRUB menu says, press the letter “a” to edit the Fedora kernel arguments. This will switch to editing the kernel boot line.
  5. Add a space at the end of the line and then add the word: single
  6. Push ENTER to boot this modified kernel line in single-user mode.
  7. The system should come up in single-user mode. You will see a black text terminal screen with a root shell prompt and no mouse function. You will see a root shell prompt containing a number sign (“#”).
  8. At the root prompt, use the passwd root command to change root’s password.
  9. After changing the root password, type reboot at the prompt.

You can also change any other user account password as root in single-user mode, using the same passwd user syntax. See the man page for passwd.

Don’t forget your passwords!

15 Using VMware at Home or via LaptopIndexup to index

You can take your caddy home (or connect it to your laptop) and plug it in as a second external hard disk, either ESATA or USB. You can then open your virtual machines and run them using either the free VMware Player (from http://vmware.com/), or the full VMware Workstation application.

The version of VMware Workstation pre-installed in your Windows host O/S this term is already licensed for a year. (You can renew the license via the VMware Web Store, mentioned below.) You only need a license for the second copy of VMware Workstation that you download at home (or on your laptop).

You can get an updated license for VMware Workstation by following the directions you got in a recent email message sending you to the VMware Web Store at onthehub.com. (You can also get to this store via the Drivers and Downloads menu at http://cstech/.) You do not need Workstation to run your existing virtual machines - the free VMware Player application will do that. You need a licensed copy of VMware Workstation only to modify or create new virtual machines.

For home or laptop use, use your caddy as an additional external hard disk and connect it to your existing Linux/Windows/Mac computer or laptop using an ESATA or USB cable. In most cases you won’t even need to reboot your system when you connect the external disk; the disk will be recognized when you plug it in.

Do not try to use your caddy drive as a boot drive (main disk). Use it as a second, external disk only.

16 Configuring the T126 Printer under Linux Fedora 12Indexup to index

Make sure your Networking is working before you configure a network printer. (Check the Network icon in the Linux top menu bar, and make sure you can use Linux Firefox to open a Google window inside Linux.) Installing a network printer requires network access.

Although the printer in T126 is a Lexmark model T644, the Lexmark E220 driver is available and works, so we use that below:

  1. Select System -> Administration -> Printing
  2. Under the New menu select Printer
  3. Under Devices, open Network Printer
  4. Under Network Printer, select LPD/LPR Host or Printer
  5. Put 10.50.16.249 as the Hostname (this IP address is written near the printer)
  6. Leave the Queue empty (blank)
  7. Select Forward
  8. In the Choose Driver dialog box, select Lexmark and then click Forward
  9. Under Models select Optra E220
  10. Under Drivers select the top (recommended) driver
  11. Click Forward
  12. In the Describe Printer dialog box shorten the Printer Name to lp126
    • make sure you change the Printer Name and not the description!
  13. In the Location box enter: Lexmark T644 at 10.50.16.249 in T126
  14. Click Apply
  15. Rather than printing a test page, print something you actually need printed!

Note that the printer will only work if your Fedora Linux system is fully connected to the network, as indicated by the Network icon in the Linux top menu bar. Be careful about queueing multiple print jobs with the network disconnected - all those print jobs will rush to the printer when the network becomes active. Go to System -> Administration -> Printing and right-click on lp126 and select View Print Queue to see and delete queued print jobs you don’t need. Once all the print jobs go to the printer, you have to physically run to the printer and use the front panel buttons to cancel the stored print jobs. Save trees! Don’t print!

17 Troubleshooting a failed caddy driveIndexup to index

See the disk troubleshooting help on the http://cstech/ web site. The cstech web site only works properly inside the College or through the College VPN. You can find a partial off-campus mirror of some of the information at CSTech Web Mirror.

If your caddy doesn’t work on a particular machine in a lab (i.e. your disk drive is not visible during POST, or the blue LED light never blinks during POST to indicate access to the hard disk, or the blue LED is constantly blinking even when the computer is off), follow these steps:

  1. Power down, then unplug your cables and plug them back in again firmly. Also check where the cables connect to the computer and make sure they are pushed into the computer firmly. Power up. Does it work now?
  2. Power down and try a different ESATA or USB cable. (Many of the lab cables are worn and intermittent.)
  3. Power down and try a different caddy power supply.
  4. Power down and move to a different computer. (If this works, label the computer that doesn’t work.)
  5. Try a USB cable instead of ESATA (but USB2 will be much slower to use than ESATA!). If USB works but not ESATA, determine where the problem is or contact CSTECH to help you.
  6. Re-seat your disk installed inside your caddy drive. See below for re-seating instructions.
  7. Contact CSTECH for assistance. See below to contact CSTECH.

17.1 Re-seat your disk inside your caddy driveIndexup to index

If your caddy still doesn’t work, take your caddy apart, unscrew, remove and re-insert the hard drive, making sure to push it firmly against the circuit board for a good connection. There should be no space between the hard disk and the circuit board. Screw it down firmly.

Many student drives shift during term and need to be re-seated inside the caddy enclosure.

17.2 Last Resort - get CSTECH helpIndexup to index

If after all the above attempts you still can’t get the drive to work properly, go to a working machine or an open access centre and bring up the CSTECH problem report form and submit a problem report: http://cstech/

Under “Room Number:” either select the room you are in from the drop-down menu or use “General Inquiry” if you are in a different room. If you are in a different room, remember to include the room number in the description of the problem report so that the technician can come to you.

This CSTECH report will go immediately to the hardware people via pager, and if they are on duty they will come to your room right away to help you diagnose the problem. You can also try visiting the hardware lab in T110, though paging through the reporting form is probably faster.

You cannot return your drive or caddy to the campus store as defective until it has been signed off as defective by our hardware technicians. You must follow the above steps before you can get a replacement hard drive or enclosure.

18 Old Windows may mishandle Modern Hard DisksIndexup to index

Many modern hard disks have 4KB blocks, not the old 512-byte blocks, but Windows versions prior to Vista(?) don’t handle these new large-block disks properly, leading to extremely slow access times. You need to re-align your 4KB-block disk to make it usable under old versions of Windows, especially Windows XP. See this link: http://support.wdc.com/product/downloadsw.asp?sid=128

The hardware kits supplied to students have Seagate disks that claim to have alignment software built into the disk.

19 Windows ESET Anti-Virus ConfigurationIndexup to index

You must have a valid and current anti-virus installed in any Windows systems used on Campus. This software is installed in your Desktop Operating System (Windows) course.

20 Unscrambling your TerminalIndexup to index

Here is how to unscramble a terminal emulator that is stuck in graphics character set mode, where you will see many special and line-drawing characters instead of your typed text.

Most terminals and terminal emulators can be switched into a “graphics” mode by sending them a special sequence of escape characters. Sometimes this happens when you don’t want it, e.g. you display a binary format file on your screen by mistake. This might happen after you accidentally use cat to send a non-text file to your terminal screen, e.g. cat /bin/ls or cat file.gz. (Don’t do that!)

To restore your terminal (you may not be able to read what you are typing!):

The above should switch your terminal emulator back to its normal character set. Practice this now, in case it happens to you!

21 Installing Linux natively in a disk partitionIndexup to index

You can install Linux natively into an empty partition on your hard disk, without using VMware, if you have room.

When you install Linux directly onto your disk, the installation process will detect the hardware that you have at the time of installation and set up Linux to use that exact hardware (video card, monitor, Ethernet card, sound card, etc.). If you move your disk to a machine that has different hardware, the Linux image may not even boot properly due to the change in hardware. Or, the boot process may cause Linux to reconfigure for some of the new hardware, resulting in an image that won’t work when you move the disk drive back to the original hardware.

Some distributions even install processor-specific optimizations at install time, meaning that your disk can’t be moved between Intel and AMD processors!

Unless you specifically use a version of Linux that reconfigures itself for new hardware every time you boot it (e.g. a Live CD), a Linux system installed natively on a partition should always be booted with the same hardware attached. Normal Linux hard-disk installations don’t expect to have big hardware changes between reboots.

If you run Linux in console mode (no X11 GUI), you can usually boot Linux on any hardware; however, you may have work to do getting the rest of the new hardware to function properly (e.g. getting networking to use different network hardware).

Once Linux is installed natively on disk, it doesn’t like to be moved to new hardware. Use virtual machines if you intend to move around.

22 Using “script” to create a session logIndexup to index

You can create a file log of everything you type and see on your terminal screen by using the script command and giving it as an argument the name of a file into which it will record your session:

$ script raw.txt
Script started, file is raw.txt
$ date
Thu Sep 23 02:19:59 EDT 2004
$ echo hi there
hi there
$ who am i
idallen  pts/1        Sep 19 20:07
$ exit
Script done, file is raw.txt
$
$ col -b <raw.txt >saveme.txt

After you exit the shell started by script, the file raw.txt will contain a raw session log containing everything that was sent to your screen, printable or unprintable, including all your backspaces and carriage-returns. Filtering is usually needed.

The command col -b is useful for filtering out backspace and carriage-return characters from a recorded script session:

$ col -b <raw.txt >saveme.txt

Note: The col command only reads standard input; you cannot pass it file names on the command line. RTFM

Warning: If you use a full-screen editor such as VIM inside a screen session (not recommended!), the screen output will be a huge mess when recorded in the session file due to all the unprintable characters that VIM uses to draw characters on your screen. Make sure you edit out this mess before you print the file! Don’t use full-screen editors inside a script session if you can avoid it.

The script command has an option to append to a session file instead of overwriting it. (RTFM)

See also the BUGS section of the script manual page.

23 Locked Out of Unix/Linux HomeIndexup to index

If you find yourself unable to access your home directory, with permission errors such as the following:

$ ls
ls: .: The file access permissions do not allow the specified action.

You have probably removed either read or execute permissions from your own directory. To restore these permissions for your userid, use this:

$ chmod u+rwx "$HOME"

Details on the chmod command are available in the Unix manual pages. The environment variable $HOME expands to be your home directory.

You must be able to read your directory, to see what file names are in it. You must have execute permission on a directory to pass through it to any of its contents. You need both read and execute for ls . to work.

24 Line endings on Unix, Windows, and MacintoshIndexup to index

C programmers will recognize that the line end character for Unix text files is \n - an ASCII newline (LF) character. (See man ascii for details on the ASCII character set.)

Unix commands that count characters in files and lines will also count the newline character at the end of every line:

$ echo hi | wc -c
3
$ echo hi >out ; echo ho >>out ; wc -c out ; ls -l out
6 out
-rw-r--r-- 1 idallen idallen 6 Jan 22 03:44 out

Microsoft operating systems use two characters at the end of every line of text - the LF is preceded by an ASCII carriage return (CR). A text file containing the word hi contains four characters: hi<CR><LF>

A text file written on Unix contains only linefeed (LF, \n) characters at the ends of lines; Windows expects lines in text files to end in both a carriage-return (CR, \r) and a linefeed character. This may result in “stair-casing” text if you send a Unix text file to a Windows printer from inside some Windows programs (e.g. Notepad).

Apple computers (e.g. Macintosh) use the single character CR instead of LF at the end of every text line.

You can tell the VIM editor to read and write text files in different formats using the fileformat VIM variable:

:set fileformat=unix
:set fileformat=dos
:set fileformat=mac

25 Understanding the different types of sort:Indexup to index

The Unix sort command sorts lines by character value, not by numeric value. Explain the difference in output of the two sort commands, below.

$ cat file
1
11
2
22
3
33
4
44
3
33
2
22
1
11

$ sort file
1
1
11
11
2
2
22
22
3
3
33
33
4
44

$ sort -n file
1
1
2
2
3
3
4
11
11
22
22
33
33
44

Why is the sort output different in these two examples? (RTFM)

26 Mapping keys on the KeyboardIndexup to index

Sometimes a keyboard has keys that don’t map correctly under the X Windows GUI. Here is a fix that puts the pipe symbol (vertical bar) back onto the correct key:

xmodmap -e 'keycode 94 = backslash bar'

You can put this in your BASH start-up file.

Author: 
| Ian! D. Allen  -  idallen@idallen.ca  -  Ottawa, Ontario, Canada
| Home Page: http://idallen.com/   Contact Improv: http://contactimprov.ca/
| College professor (Free/Libre GNU+Linux) at: http://teaching.idallen.com/
| Defend digital freedom:  http://eff.org/  and have fun:  http://fools.ca/

Plain Text - plain text version of this page in Pandoc Markdown format

Campaign for non-browser-specific HTML   Valid XHTML 1.0 Transitional   Valid CSS!   Creative Commons by nc sa 3.0   Hacker Ideals Emblem   Author Ian! D. Allen