CQuirke’s Long View

Long lead times need long forward planning

My 10 First Linux Toe-Stubbers

Posted by cquirke on 22 September 2007

Technorati tags: ,

The first 10% of what you learn takes 90% of the effort, and as it can never be undone (merely “painted over”) it’s important to start right.

Some of the first 10 things I needed to learn about Linux are basics, others are not; i.e. less-basic things that have to be got right, before anything else can follow.

My perspective is of a Windows user wanting to dual-boot to Linux, with most of the hard drive’s contents being visible to both OSs.  As a builder of such systems, I have strong Windows skills, good general computing sense, and very few Linux smarts!

1  Where’s “Ctl+Alt+Del” ?

Since Windows 95 it’s been instinctive to do the “Vulcan grip” of Ctl+Alt+Del to bring up the task manager, so that errant tasks can be killed.  Almost as soon as I’d booted a Knoppix Live CDR, I needed the equivalent Linux skill, and it’s very frustrating without it.

As far as I know, the answer is various key combinations that will launch command interpreters (which are called “shells’ in Linux), and from there, I’d be expected to enter commands to list tasks to read the corresponding ID, then kill particular tasks via that ID.

2  Where are the “drive letters” ?

Since Windows 95, the DOS file system navigation of drive letters, directories and files has been abstracted to a namespace of folders and objects.

UNIX and Linux have always had that level of abstraction built into the file system, such that what appear to be non-file-system objects in the modern Windows namespace will appear to be syntax-valid entities within the Linux file system. 

We’ve had a whiff of that with DOS devices like LPT1:, CON:, etc. that were carried over from UNIX, but Linux takes that further; such devices can be “pathed” as if they were directories and files within the file system structure.

So not only does one use the “file name” hda1 to refer to the first partition on the first hard drive, it’s also more fully expressed as /dev/hda1 as within the dev “directory”.  Things that are not actually files or directories, have to be “mounted” as items within a directory, so that file system syntax can be applied.

3  How do I know what type a file is?

DOS had strong links between file types and file name extensions, but no system to extend this to automatic association of file types to arbitrary programs, as was added in Windows 95.  Alas, this invaluable safety feature is being eroded within modern Windows.

In contrast, UNIX and Linux don’t rely on visible file name extensions to associate files with programs that “open” them.  It may sometimes user these by convention, e.g. .gz or .tar for archives, but most of the time there is no obvious indication of what a file is, or what it can do.

How do I set default OS in boot loader?

Now we get into specific things that need to be done, whether they are “basic” or not. 

Windows has no generic system-level boot management tools; all of its boot selection mechanisms start within the OS boot and work only for peer and older Microsoft OSs.

Thus when you set up Linux and Windows as a dual-boot, it is Linux that generally brings the system-level boot manager to the party; either lilo or grub.  And in time-honored software vendor tradition, it will default to booting itself unless you choose otherwise.

So one of the first things a Windows user playing with Linux as alternate boot will want to do, is edit the boot loader’s configuration file to set Windows to boot first, as well as clean up what is often rather mucky menu text.

It seems as if no Linux disto anticipates this need; you may have plenty of friendly “getting started” help stuff, but do you think “edit boot manager settings” will appear as an icon or menu drop-down?  I never did find out how to that in Ubuntu 5.x, and just gave up in the end.

5  How do I stop Linux dialing up all the time?

Your mileage may vary on this one, but this was a major PITA in Ubuntu 5.xx – once set to be able to dial up to the Internet, it would do so on every boot. 

In a place where local phone calls to ISPs are billed per second by the local telco monopoly, this is a Bad Thing – especially as any unattended reboot will default to Linux and do this again.  There’s no “can I do this?” dialog to cancel, either; it would just go ahead and help itself to your phone bill, for no apparent reason.

I never did find an answer to this, other than never boot Ubuntu again.  I could have tried harder, but why should I have to?  This should be something intuitive to manage via a control panel of some kind. 

6  Doesn’t Linux know what an extended partition is?

To dual boot Windows and Linux on a single hard drive, with data volumes visible to each, one needs at least three of the four available partition table entries; one for Windows OS, one for Linux OS, and an extended partition containing the data volumes visible to both.

However, some Linux distros expect to hog three out of these four partitions for itself; one for the Linux system, one for swap space, and one for user data.

I know the “extended partition” is part of Microsoft OS space, rather than system space, but as Linux already understands and accesses FATxx and NTFS file systems, it’s surely not asking too much for it to be able to use logical volumes within an extended partition, rather than insisting of hogging 3/4 of the system partition table?

7  How do I mount arbitrary hard drive volumes?

When you first start up Linux via dual-boot, you won’t see your “Windows” partitions, until you mount these.

So finding out how to mount such volumes is one of the first things you need to do – but like (4), even the friendliest distros orientated towards converting Windows users do not seem to anticipate this need.

Good news: Ubuntu 7.04 automatically finds and mounts accessible hard drive volumes, and lists them as desktop icons for easy access!

8  How do I write and run “batch files” ?

I know you can enter shell commands into a text file and use that as a script, but the mechanics to do that are not obvious; where to save such files, what file name extension to use, and how to invoke it again.

This follows on from (7), i.e. once you figure out the command to mount your data volumes, you want to use a command that is easier to remember than what looks like modem line noise!

9  Can hard drive volumes be auto-mounted on boot?

One wants shared access to local data storage to be as transparent as possible, i.e. have such hard drive volumes mounted when Linux starts.

In contrast, Windows is too good at this; it automatically assumes every visible hard drive volume is part of the system, and starts groping content and writing to disk as soon as it starts up – which poses malware and data risks in various maintenance contexts, driving the need for a competent maintenance OS.

As noted in item 7, Ubuntu 7.04 solves this problem out of the box by default.

10  Where’s the “startup axis” ?

Windows has an absurdly large number of ways to integrate arbitrary code so that it runs automatically, and this is a bane of malware management.

But it’s not at all obvious where or what the equivalent(s) in Linux may be, i.e. how arbitrary commands, scripts or programs can be run whenever Linux starts up.

7 Responses to “My 10 First Linux Toe-Stubbers”

  1. Dan Weiser said

    Thanks for your thoughts on Linux so far, Chris. Ctl+Alt+Del has been my favorite function since the days of my first computing in BASIC with my dad’s IBM PCjr. I still have this machine in storage where I grew up in New York City. My folks rent the place out nowadays but we still have a small area for ourselves when we go and visit sometimes. Anyway, what is the best kind of bootlogger to use with Windows and Linux and is it asking for too much trouble to have Linux on a dual-boot PC with 98SE on c:\ in Fat32 and XP Pro. on d:\ in NTFS. I was thinking of trying BING to accomplish this on one of the hard drives — not sure which one — to partition more drives since these 2 hard drives are 2 actually seperate Western Digital hard drives. The 98 Second Edition one is 80 gigabytes and the XP Professional one has 120 gigabytes. There is no rush to answer since my machine is currently being worked on by me and having repairs done on motherboard and upgrading the CPU and checking everything out. My friend Jeff will help me put it all back together because my area of interest is computer software and mainly the security and safety of that computer software as I am sure you already know.

  2. cquirke said

    By “bootlogger” I take it you mean “boot manager”?

    Usually, one uses either grub or lilo that come with Linux. Both live (or at least, start) within system space, i.e. MBR, and may extend into additional system sectors before the first partition, or into additional code stored within some OS partition (typically the Linux one).

    You could use BING (though that costs money), and you could use BING’s extended partition table feature to allow more than 4 partitions per physical hard drive (or RAID’d collection of physical hard drives).

    As to Win9x and NT/2000/XP, you could do that within OS space:
    – primary FATxx C: PBR boots into NT’s \NTLDR, processes \Boot.ini
    – Boot.ini “Win9x” boots PBR image \BOOTSECT.DOS into Win9x on C:
    – Boot.ini “NT” uses native syntax to boot NT on volume other than C:

    This collection of MS OSs can then be “wrapped” by a system-level boot manager that points to this, or to other OSs (e.g. Linuxen) on other partitions.

    By “partition” I mean system-level entities defined in the partition table (or system-level alternative, such as BING’s EMBR). In this context, an extended partition counts as a single partitrion.

    By “volume” I mean (MS)OS-level entities to which drive letters may be assigned. In this context, a Linux ext3 and an extended partition are equally invisible, whereas each logical volume within that extended partition would be a seperate volume.

  3. cquirke said

    Looking more specifically at your scenario…
    – all OSs are MS OSs
    – two physical hard drives
    – no need for > 4 partitions per physical hard drive
    …you don’t need alernate partition tables a la BING’s EMBR, and you don’t need system-level boot managers such as BING, grub or lilo.

    At this point, you’d build the installation as follows:
    – create primary FAT32 partition on 1st hard drive, install Win9x
    – create partition and volume on 2nd hard drive
    – install XP to this volume on 2nd hard drive

    You will now have a standard MBR on 1st hard drive that boots the primary on that hard drive, which boots into \NTLDR there. This NT OS code can then boot into the bulk of XP on the second hard drive, or chain into a BOOTSECT.DOS image of what the PBR would have been had Win9x been the only OS installed, and thence boot the Win9x on C:

    Note that the volume containing the XP installation does not have to be on the 1st hard drive, nor does it have to be a primary partition – it can be a logical volume within an extended partition on the 2nd hard drive.

    Next, to add the Linux. First, backup your partitions, MBR etc. and keep your eyes VERY wide open every step of the way when you do the Linux install! You’d create a partition for Linux, and optionally additional partitions for Linux swap space and data, then install Linux.

    This would also create a grub or lilo system-level boot manager that would list one or more ways to boot Linux, plus a single entry to boot “Microsoft”. If you do the latter, then you’d see additional details of what Microsoft OS to boot, as handled by Boot.ini within the OS space.

    Some linuxen want 3 system-level partitions, i.e. are too dumb to nest swap and user space as logical volumes within a single extended partition – either using the MS extended partition systrem, or something similar of their own. But on two physical hard drives, that’s tolerable; you can have user and swap partitions on the 2nd hard drive, leaving one free partition on each physical hard drive even after you add an extended partition to the first one.

    Where it gets ugly, is when you try all this on a single physical hard drive (or physical drives grouped together via RAID). With 3 (system-level) partitions hogged by Linux, and the last slot taken by a primary MS partition, there’s no slot left for an extended partition and logicals. It’s at this point that BING’s EMBR begins to look tempting.

    When you boot the Microsoft OSs, they will see any volumes containing file systems they can handle; XP will see NTFS and FATxx, and Win9x will see just the FATxx. When you boot the Linux, you won’t see the MS volumes even though Linux can understand the file systems, until you manually mount those partitions and volumes to points within the Linux file system. You will prolly want to automate that if sharing space between all the OSs; if you get that working, do post here as to how you did it!

  4. Tom said

    On Linux toe-stubber 6: Well, yes – Linux does know what an extended partition is. It will recognize both type 0x5h and 0xfh extended partitions, as well as its own which is type 0x85 (Linux extended). Not sure how you came to conclusion that it doesn’t.

    Possibly if you installed a distro and let it automatically create its own partitions, it might only have created primaries? But if you do the partitioning yourself, either beforehand or use the “manual” partitioning option that most installers have, you can certainly use extended/logical partitions.

    In fact, you can install Linux completely to all extended/logical partitions (no primary required). Also, Linux will actually recognize a 2nd extended partition on a drive (and its volumes) – although there’s probably no reason to do that beyond curiosity…

  5. Dan Weiser said

    Thanks Chris. I did test BING previously and plan to buy it in the future. I am thinking of having Windows 98 Second Edition and your suggested version of Linux on one hard drive and use BING there.

    I am working towards developing a tri-source code for the united states military to use for nsa, dod, etc. and to help in Africa and other places with their computer issues and backwards compatibility to allow for us consumers to play our old dos games and finally for all public schools to be able to run older Microsoft software on new computers like Space for Windows 3.1 that will not run on NT, 2000, XP or Vista and only on the 9x consumer operating systems. These things are actually 3 seperate projects in various stages of development. I have petitioned Microsoft to purchase the 9x source code outright and am awaiting there reply as to how much money they want for the 9x source code and kernel. It must be the complete package and all the information to do with it up to Windows 98 Second Edition. I do not care about the developments of Windows ME since it was released as too simplistic for everyone in my opinion and too weak to do much without too much configuring and even then was lacking. My backer can indeed force them to hand over their Intellectual Property if Microsoft decides not to comply since this is an American National Security Issue and also has to do with our global fight against information hackers from places like China first, then U.S.A. crackers, then Russia and others. I have multiple projects that are in different stages of development as time allows. As you can see I also want to help the consumers like me who have collections of dos games and the public schools with running their old educational software in a new computer without compatibility issues in the usa first, then africa then new zealand and australia, then europe, then the rest of the world. As you can see this is a long-term project but I am glad of your caring, respect and support of my projects. Please email me since I cannot go into more details about these projects here.

    In addition on the other hard drive I plan to have Windows XP Professional and set up several testing partitions for Microsoft software. I plan to acquire 2 BING licenses to put it on both hard drives of my custom built machine. It began its life in the year 2000 of the year of our Lord This Falcon Northwest Mach 5 computer sports a cool metal case and I still have the 3.5 inch Teac Floppy drive and the old Optiquest V773 CRT Monitor but that is all that is left of the old machine. I would rather keep the rest of the specs between you and I via email and I would be interested in knowing about your computers that you own and use as well. I will now stay away from VPN with Albuquerque Public Schools as you suggest. I started working at Painted Sky Elementary on 1st September 2006 and you remember all this stuff and I warned them not to get rid of the 98 Second Edition computers but the computer lady Ja would not listen to my advice and they suffered because of it. It is weird but throughout my life everyone seems to not listen to me but that is slowly starting to change, thank goodnesss for that. I am currently busy taking an Intel Essentials Class for teachers one day a week for 4+ hours at a time. I am soon ending my paid leave from APS and plan on returning this coming Wed. to a new elementary school that treats their teachers and educational assistants (me) with more respect. The computer class will help me to meet my goal of 26 graduate credits for a teacher, prepare me for the dossier process, and prepare me for more challenges ahead in my eventual quest to get my Master’s Degree. Currently, I do not plan on going on for a Ph.D but anything can happen in this life. Take Care and Talk to you via email.

  6. Hi Dan! (comment #5)

    If you’re buying OS source code, it’s presumably for long-term objectives – and as such, it’s best to consider Win9x as an OS without native hardware (e.g. as a wrapper to harness apps written for it, running within a hosted VM).

    The newest motherboards break just about every hardware compatibility point possible, with respect to Win9x:
    – PCI Express graphics
    – hard drives always > 137G
    – 512M+ RAM (Win9x OK but needs “settings”)
    – S-ATA that even XP no longer sees natively, e.g. ICH9
    – no PS/S, only USB for keyboards/mouse

    In effect, XP is emerging as the “skinny fast OS” for the future, as 3-year depreciation cycles see “old” XP systems being offloaded. This will be particularly common for SDRAM-based PCs, where RAM is costly to add, and where many XP systems would be stuck with 128M-256M (i.e. too low for Vista)

    Other native OSs that may suit, include Starter variants of current MS OSs, stripped-down embedded versions of the same, and the various Linux distros.

    WinME’s core code would give you generic USB storage support, which is good to have – and if you had the source (and the right to alter it, which is not a given) it would be interesting to see how cleanly the alternate boot to DOS mode could be returned to the OS :-)

    If you do adopt a VM approach to “shelling” Win9x on arbitrary modern hardware, you may not need the source code, depending on what role the host OS can play in protecting the Win9x-and-apps’ “edges”. Some sort of license deal to allow widespread deployment might be enough?

  7. Dan Weiser said

    Hi Chris!

    I want to be able to give our schools a chance to run all of their old dos programs and windows 3.1 programs like Space that will not run on XP or Vista. I want our public schools to not have to throw these old programs away. In addition, I want consumers like me and others who have old dos games to be able to run them on modern operating systems. My final goal is to have a secure tri-source code with Windows 9x technology guarding the interior defense, Windows NT Technology guarding the exterior defense and open source code such as Linux, Mozilla, and Google technologies interwoven throughout this operating system to make a super secure operating system for the U.S. Government. Hopefully, it will be able to help Africa too with Africom if the politicians don’t mess it up. Thanks for your feedback and I appreciate being able to use your blog to share my ideas. Have a nice week. As you can see these are 3 seperate projects with varying levels of completeness and none being able to get too far without the 9x consumer source code.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: