Updated: 2012-01-29 01:33 EST

1 Note on the Fragility of Hard Drives in backpacks Index up 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 name on your caddy so we can contact you if you leave it behind in a lab some day.

2 How to correctly shut down a VMware caddy system Index up 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 XP host O/S and wait until the power goes off.
  4. After the Windows XP 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 machines Index up 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 Do NOT Install (hundreds of) Fedora 12 Updates Index up 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.

5 How to unlock virtual machines Index up to index

Lock files are left behind when you fail to Shut Down or Suspend your virtual machines before closing VMware or before shutting down your Windows XP 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 XP 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.

6 Enabling Focus-Follows-Mouse Index up 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”.

To enable this wonderful feature, 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:

    yum install control-center-extra
    yum install nautilus

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!

7 Customizing the Linux Top Menu Bar Index up 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.

8 Answering the VMware moved it vs. copied it question Index up 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.

9 Using VMware linked clones/snapshots on other machines Index up 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.

10 Don’t change processors with Suspended VMware machines Index up 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.

11 Handling forgotten passwords under Linux Index up 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.

11.1 Changing an ordinary non-root account password Index up 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!

11.2 Changing the root account password - Single User Mode Index up 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!

12 Using VMware at Home or via Laptop Index up 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 XP 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 use your caddy drive as a boot drive (main disk) other than in the Algonquin caddy labs T108, T110, T111, T113, T114, T115, T126. Booting from the caddy anywhere else will confuse the Windows XP host operating system (because the hardware will be different), and it may lock you out and require you to re-image your O/S partition over again to recover.

13 Configuring the T126 Printer under Linux Fedora 12 Index up 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.

Athough the printer in T126 is a Lexmark model Optera T632, the Lexmark E220 driver is available and works, so we use that below.

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 go to the printer and use the front panel buttons to cancel the print jobs.

14 Troubleshooting a failed caddy drive Index up to index

Your first lab in this course contains printed instructions on troubleshooting a caddy that does not appear to be working properly. See also 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 mirror of some of the information here.)

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. 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 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. If you are imaging your caddy using the lab boot disk, try using a different boot disk.
  6. Try a USB cable instead of ESATA (but USB 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.
  7. Re-seat your disk inside your caddy drive. See below.
  8. Contact CSTECH for assistance. See below.

14.1 Re-seat your disk inside your caddy drive Index up 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.

14.2 Last Resort - get CSTECH help Index up 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.

15 How UMASK works Index up to index

The UMASK value is a mask. It turns off permissions. Do not subtract a umask value from permissions; use it as a mask. For example: default 666 with umask 002 gives 664 but default 666 with umask 001 gives 666 (no change!) and default 666 with umask 007 gives 660.

16 Run Levels Index up to index

In 2011, many distributions of Linux are still in a transition from the old static run-level system sysvinit inherited from System V Unix™ to the new event-driven upstart system (http://en.wikipedia.org/wiki/Upstart) or to the newer dependency-based systemd system (http://0pointer.de/blog/projects/systemd.html and http://0pointer.de/blog/projects/why.html).

The old System V run-level system had a small number of system states, called run levels, each of which had an ordered list of processes running. Switching between states stopped and started processes in a given order. You couldn’t have dependencies such as “start this process whenever that process starts” or “start this process when this hardware changes”. The new upstart and systemd systems can handle these things, while retaining backward-compatibility with the legacy System V scripts.

While Linux is in transition, upstart emulates the old run levels using events and systemd extracts dependency information from the LSB (Linux Standards Base) headers in the old sysvinit files under /etc/init.d. Many programs have not yet been converted to upstart or systemd and still use a legacy run-level start script. Fedora moved to upstart with Fedora 9, then to systemd with Fedora 15.

17 Increasing VMware BIOS screen pause Index up to index

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: bios.bootDelay = "60000"

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.

18 Windows XP mishandles Modern Hard Disks Index up 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 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 Configuration Index up to index

You must have a valid and current anti-virus installed in any Windows systems used on Campus. Your caddy Windows XP comes with ESET. You can update your ESET license via the instructions posted under the Computer Systems Technician course on Blackboard, under “ESET Instructions” in the left side-bar. The update file name is the same for Winter 2012 as for Fall 2011:

20 Unscrambling your Terminal Index up 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”.

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 partition Index up to index

You can install Linux natively into an empty partition on your hard disk, if you have room. (The school disks do not have any spare 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 log Index up 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 Home Index up 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 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 Macintosh Index up to index

C programmers will recognize that the line end character for Unix text files is ‘’ - 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
$ 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

A text file written on Unix contains only linefeed (LF, “”) characters at the ends of lines; Windows expects lines in text files to end in both a carriage-return (CR, “”) and a linefeed character. This may result in “staircasing” 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”: Index up to index

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

(The translate command “tr” is turning blanks into newlines so that the numbers appear on separate lines on input to sort; sort only sorts lines.)

$ list="1 11 2 22 3 33 4 44 3 33 2 22 1 11"

$ echo "$list"
1 11 2 22 3 33 4 44 3 33 2 22 1 11

$ echo "$list" | tr ' ' '\n'

$ echo "$list" | tr ' ' '\n' | sort

$ echo "$list" | tr ' ' '\n' | sort -n

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

26 Notes on GNU and Linux Index up to index

26.1 GNU - Gnu’s Not Unix Index up to index

26.2 Linux “distribution” == Linux Kernel + GNU Utilities Index up to index

| 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