Linux Tutorial – Part 3

By: Solutions Are Obvious

I failed to mention in the previous installment that, depending on BIOS, a wireless keyboard may not be able to register a keystroke to get into a BIOS setup or to select a boot time option. That’s because on some hardware, the wireless keyboard is only recognized after the O/S activates it. Same goes for a wireless mouse. The install may not see the mouse depending on hardware. If in doubt, use wired devices temporarily.

Possible install options

It is possible to be presented with a text based installation screen although that’s not the norm. It’s BIOS dependent and it will contain a count down timer that will bring up the test drive unless you specifically request otherwise within the allotted time for you to react. If you miss the opportunity to make your selection, just quit the test drive and start over.

The initial screen allows you to select your language and either start Ubuntu from the stick for a test drive or actually install it.

The test drive may or may not be a good idea as a test to see if you like the O/S or not. As mentioned previously, whatever comes up may be old and may have issues. What shows up is the default GUI that I always replace with Gnome. Maybe it’s worth a shot to just kick the tires a bit but I don’t think that’s really worth much.

What the test drive option is good for is as a prep tool to manipulate and test hard drives before you expend any energy on the actual install. Ubuntu in particular has a primitive drive / partition manipulation capability within the actual install. Therefore, I use the test drive to interrogate the drives and fix anything I don’t like so that by time the real install hits the drives they’re clean.

The test drive is also the only way I’ve figured out how to get an install to configure the drives and partitions exactly the way I want it done, including setting up LVM the way I want LVM set up.

If you want to clean up your drives and / or test them, start the Ubuntu test drive option but realize that what follows will destroy any and all data on the drives chosen to be manipulated. Do not do this on a drive containing an operating system or data that you need. Read that last sentence again. Also, you should do this when you can guarantee that the box will not lose power. An unexpected power down at certain critical points can destroy a hard drive. You can skip to Start the real install if you like.

Nuke the drives.

I’m not going to explain what everything means. Just follow along.

Start the test drive.

Once it’s up, you can start a terminal session via one of the famous ‘three finger salutes’, the simultaneous CTRL – ALT – T keystrokes. You will be the default ubuntu user as shown by the prompt at the bottom of the terminal screen, with little to no rights to do anything.

For those not familiar with a terminal session, the term ‘execute’ as I use it means to key in whatever is listed after the colon and hit the Enter key. Leading spaces are ignored so don’t bother keying them in as they’re used here for readability only. The letter case of commands and related fields is important. Spaces between fields are important.

To gain ‘root’ privilege, execute: sudo -i

The command prompt has changed to show that you are now functioning as the root user with absolute authority over everything.

Because you booted off the stick, none of the hard drives / SSD’s are ‘mounted’. That means the test drive O/S won’t exert any form of control over them and we’re free to do as we like with them. If you mistakenly touch and manipulate the Windows drive, Windows is toast, so be careful.

To discover the names of the drives as the operating system sees them,

execute: fdisk –l | grep ‘/dev/sd’

What shows up are the names of the drives and the names of the partitions on those drives. Drive names are 3 characters long and partition names are 4 characters long that include the drive name. On really antique boxes (non SATA drives), the naming convention is different and varied offering too many possibilities that I won’t address. The command is filtering only for SATA drives and things that mimic SATA drives.

As an aside, that command sequence is ‘piping’ the output of the fdisk command via the pipe symbol (|) to the input of the grep filtering command to only show lines of output that match the filter specification. If you have older hardware and KNOW that your drives won’t show up via this filter, execute the fdisk alone and manually discover your drive and partition names. Alter the instructions below to use your discovered naming convention.

Note that your stick and probably optical drives show up in the list and we don’t want to touch them in any way. External hard drives and SSD’s will / may also show up and we only want to touch them if they’re going to be involved in the eventual Linux install. To tell the stick and optical drives from the hard drives, check the size statistics. Hard drives are much larger in capacity. Because the stick is mounted, the O/S won’t allow it to be altered.

There will be a /dev/sd? listing for every drive in the box. Below each such listing are the names of the discrete ‘partitions’ on that drive numbered starting from 1 such as /dev/sdg1 . Maybe there’s only one partition on a drive. Maybe there’s more than one. We want to nuke every partition on the drive, so for every partition on a particular drive execute : parted /dev/sd? rm #

replacing the ? with the drive letter and the # with the partition number. i.e. parted /dev/sdg rm 1 for example.

Do this for every hard drive letter discovered and for every partition number per drive that you want nuked. When completed, all the drives are empty of normally recognized data. Just make sure you don’t nuke anything of importance, like your Windows area.

Optionally, if you want to thoroughly test and isolate every bad spot on your hard drives, do the following, but don’t do this for an SSD as it’s unnecessary.

Execute: dd if=/dev/zero of=/dev/sd? bs=1M

replacing ? with a drive letter.

What this is doing is writing 0’s to every writable location on the drive potentially triggering the hardware’s automatic masking off of bad spots. Hillary could have used this instead of Bleach Bit.

Be forewarned. This will take a long time, and is drive size and drive speed dependent. A 1T drive can take hours to complete. A 4T drive is an overnight operation. Once started, all data on the drive is compromised and once completed is irretrievably lost. Do not disturb the process once it’s initiated. Wait for the root command prompt to reappear to signal that the command is done and then go on to the next drive. The report produced always shows an error as the operation ran out of drive space which was the whole point. That’s normal.

When your drives have been totally written to, any bad spots on a drive are accounted for and won’t cause a problem once the drive is put to use.

To exit out of the terminal session as the root user, execute: exit

To exit out of the terminal session as the ubuntu user, execute: exit

As the last user in the chain, that will terminate the terminal session.

You can continue with a real install by starting it from the provided icon on the desktop.

Start the real install.

Trivial stuff

The install will ask for the language you want to use. It will also request the keyboard type to expect and that usually goes with the language choice. Pick appropriately and continue.

If your box has wireless capability, it will ask for which WiFi to connect to or to ignore the WiFi. Note that if you have a hidden WiFi setup there’s no option to find it and therefore you have no choice but to ignore WiFi for now. If you want WiFi, you can implement it later. Decide and continue.

A digression on connectivity

You’re going to have to know something about your Internet connection. Do you have an ISP that offers a static IP address? Do you want a static IP address? Probably not, but I don’t know. You have to figure it out. Most installs assume that the Ethernet port, wired or wireless, will receive an IP address dynamically from a DHCP (Dynamic Host Configuration Protocol) source, typically your Internet gadget. If you have no DHCP source available, your Ethernet won’t initialize and you won’t get a connection.

Some distro installs allow you to state a preference at install time, so you can select a static IP connection by filling in the necessary IP address, subnet mask, default route, DNS servers, etc. Some installs won’t give you that choice and the install will complete but the initial boot won’t have a functioning Ethernet port without a DHCP source. You’ll have to configure it yourself.

Again, relax – the DHCP default is usually what a home user wants and is what an ISP provides unless you typically pay extra for a static address if it’s even available. A business might want one or more static addresses to advertise services they offer such as a web server, smtp server (email), etc. You can’t reasonably advertise services on a private network. I said reasonably.

When one wants to configure a box to be a firewall, that usually entails at least two Ethernet adapters that each require set up.

More trivial stuff

You have a choice between a minimal install and the preferred normal install. Minimal is for people that know exactly what that entails and are capable of installing whatever is missing, in their opinion. I suggest accepting the Normal install. It’s a bit bloated, but provides the bulk of what I usually want. I add lots of additional software later.

You also have the option, if you have a wireless connection defined, to download the latest patches as part of the install. I would suggest NOT doing this. I’ll eventually show a script that I use to patch a box that works in all cases. I use that script whenever I decide I want to patch the O/S.

Finally, this screen offers to install 3rd party tools, but provides no specifics. I normally do NOT accept this offer as my use of the O/S hasn’t required anything special, so from experience I know I don’t need this. You may want this if you’re into video editing, audio manipulations, etc, for the codecs. If you install an app that needs some resources, it will usually state that it needs something and will either ask you to install it or offer to install it automatically. Therefore I see very little need for this option.

Drive Manipulations

This is where things can get a bit hairy. The next screen involves how the install is to use your disk drives / SSD drives. The options you’re presented with are dynamic and depend on what operating systems are detected on the drives already, possibly none at all.

To fully understand what’s going on here, would require knowledge of partitions, why partitions are created, how they can be used, and why certain partition arrangements aid in system performance, reliability, disaster recovery and security. There’s no way to quickly gain that knowledge, so I’m going to assume some trivial / common cases only. If someone were building a huge server with a dozen or more data drives and maybe a few SSD’s thrown in just to make it interesting, that’s when proper partitioning can make a huge difference.

Simplest case

On a box with one drive (new or used) and you want to use that drive exclusively for Linux, select the erase and install option. You’ll get a default partition scheme that’s adequate for most home users.

If this is your situation, then don’t read what follows as it will just confuse you to no benefit. Skip ahead to A digression on the Linux File System.

Note that this option sometimes will not reuse all the space on an already used drive. There have been times when I had to nuke existing disk partitions manually to recapture all the available disk space. That’s when I backed out of the install and used the test drive installation option to bring up a functioning O/S and used the tools available to clean up the drive manually and then restarted the install knowing what shape the drive was in.

Complicated cases

For all other cases, the best I can do is explain what situation you’re potentially in and how to think about proceeding.

If the install detects another operating system already installed, it will offer to install along side of it. The issue, however, is that the already installed O/S has probably allocated all the available disk space for itself and therefore there’s nothing left for the Linux install. The install may attempt to shrink a partition to free up space if it can recognize how to go about doing that.

For an existing Windows install, for example, it might be possible to shrink its partition. At best, the total Linux partition arrangement could max out at the existing Windows free space quantity. However, to allow Windows to continue functioning it needs free space so you’ll have to decide on some split of how much of that current Windows free space to allocate to the Linux install and how much should remain as part of the Windows environment.

If the Windows partition contains any errors, the reorganization of that partition could be a disaster. Although the probability is low, it’s not zero.

If you were to add a drive (new or used) then Linux could leave the Windows set up alone and install on the added volume. Drives are cheap as dirt. You’ll have to specify which drive(s) the install is allowed to use and then you’re basically back at the Simplest case section above.

Other options

I never encrypting drives, but that’s your call. It slows down access due to needing to encrypt and decrypt on the fly. For security, I rely on multiple firewalls but that’s because I’ve got lots of boxes.

LVM (Linux Volume Management) is a somewhat complicated topic because it can involve so many situation. LVM should probably be used if your box contains multiple hard drives that you want to allocate to Linux and logically view as one large entity. Read the previous line one more time. An LVM can not include any foreign partitions, only partitions that it can control exclusively.

Although the Linux file system allows for inserting drives / partitions into an existing file system via ‘mount points’, LVM does something similar but at a much lower level and far more sophisticated. On an LVM volume, even if it spans multiple drives, the file system sees it as a single entity, without extraneous mount points.

As an example, if you want an ocean of data disk space, create an LVM using X number of drives. Drive size and geometry (head & cylinder count) is of no consequence and neither is the speed of the drives involved. You may want an SSD to hold the Linux operating system for fast booting and software access but want the LVM to hold all the data, for example. The combinations and permutations are endless.

In the trivial case of a 1 drive system, LVM really doesn’t offer anything. It’s only when multiple drives are involve or when you start with a single drive but can envision needing to add additional drives later that LVM should be / might be your choice. LVM’s main benefit is that you can expand disk space dynamically by adding physical drives and adding them into the logical volume, but you better know what your doing if you attempt it. There’s another way of expanding available space without LVM.

Sadly, Ubuntu’s installation procedure doesn’t offer the ability to properly configure an LVM and is why I use the test drive to do it and then have the install just use what I’ve previously prepared. A bit too much to go into here as it’s difficult to describe.

Lastly, you are provided with the option to partition the available disk space yourself. If you’re going to install an SSD for the operating system software and a regular drive for data, then you’re going to need to manually partition to specify what goes where because you can’t trust some default set up to provide the best organization.

For example, the SSD’s space should be allocated to the ‘/boot’ partition and the root of the file system – ‘/’. ‘/home’ should be allocated to the hard drive. The ‘swap’ partition most likely should be allocated to the hard drive but depends on a particular situation.

The Ubuntu install procedure isn’t flexible enough to handle all possible cases. Sometimes the install is done just to get things going and then the resulting operating environment is modified after the fact to configure to taste.

When you hit the Install Now button, you’ll have one last opportunity to review what will happen next. Ubuntu will install and another sequence of questions will be presented.

A digression on the Linux File System.

Linux doesn’t use drive letters like C: . The entirety of a Linux file system is a tree structure that starts at ‘/’ known as the root of the file system, not to be confused with the root user. Below ‘/’ are numerous directories aka folders. Most of these are part of the Linux O/S and have specific uses and meaning. Others are rarely added directly below ‘/’ for miscellaneous purposes by various software installs or by the root user for specific purposes. Monkeying around just below ‘/’ is frowned upon and verboten for regular users.

The root user has access to the entire file system. Regular users only have access to what they’ve been assigned to have. The directories ‘/root’ and ‘/home’ are typically available but they aren’t mandatory. ‘/root’ is the root users home directory – personal space and ‘/home’ is the top of a sub tree of directories and files for all the regular users. ‘/home/bill’ would typically be the bill users home directory and bill would have absolute rights to it and everything below it. ‘/home/mary’ would similarly be the mary users home directory.

If a box has multiple hard drives / SSD’s, then the single file system has to some how span these devices. Windows would assign C: to one and D: to the other and so on. Without considering LVM, RAID and a few odd instances, the way Linux does this is through ‘mount points’. Every stick, optical drive, whatever that represents a data storage location finds its way into the file system as a mount point.

Assume there’s a functioning Linux file system, and it’s running out of space. A possible fix is to add a drive and assign its capacity to a newly created mount point. If the shortage is due to users home directories being full of files, then allocating the new space to /home makes sense. /home is typically not a mount point, but it can be converted into one and all existing data currently below /home can be relocated to the new drive. The disk space those files were occupying is released on the original drive. The end result is an identical directory structure, but now more space is available where it’s needed and the freed up space on the original drive gives it some expansion potential.

Running out of disk space is a frequent occurrence no matter which operating system is involved. Linux offers LVM or mount points to handle added capacity without resorting to new drive letters.

When a stick is inserted and recognized, the way a user gains access to it is to go to its mount point. The ‘/media’ directory is usually where dynamic mount points are created for the logged in user. When a stick is removed, that mount point is destroyed and the data that was accessible no longer is. For convenience, a ‘link’ is created in the users home directory for quick access, but any manipulations are reflected in the actual mounted location.

LVM aggregates drives into a single logical volume. That volume looks like one large drive as far as the O/S is concerned. Adding a physical drive to a virtual volume adds capacity and the new capacity just expands the available disk space without a mount point. If one wants to add a mount point within a virtual volume, that mount point would function exactly equivalent to it being in a non virtual environment.

Install is in process

It will ask for a time zone to be used. Pick appropriately.

You will be asked for the default user’s information. That user will become part of the Admin group (adm) with rights above the other average users. The root user is always created quietly without a knowable password. What you’re being requested to supply is for the first or primary actual user of the box.

For the box’s name, the install will manufacture something that’s almost never reasonable, so fill that in with something of your making. All lower case letter and possibly numbers for anything but the first character.

Install is finished

You’re done. Bounce the box – that’s reboot the computer for non techies.

What you now have is an environment that uses a desktop GUI that I’m not that fond of. You also have a box that needs to be patched with the latest software.

By default, Ubuntu will start a service that checks for updates and will inform you of them. It will be your option when and how to perform the updates. In some environments, that update process will fail and fail repeatedly with 403 errors. I scripted a way that does updates and will keep trying till its successful.

If you’re a WiFi user and didn’t specify a proper wireless environment at install time, that also needs fixing. If you’re a wired Ethernet user that environment needs to be set up. Numerous other things need tweaking, fixing, installing, etc to make for a really usable box.

Till next time.

Click to visit the TBP Store for Great TBP Merchandise

Author: Glock-N-Load

Simply a concerned, freedom loving American.

22
Leave a Reply

avatar
  Subscribe  
Notify of
mark
mark

Donkey,

Off topic – but when you get time I thought you would be interested in your silver going to $200.

JOHN RUBINO: THIS NIGHTMARE ENDS WITH $200 SILVER – System Broken, READY TO SNAP!

M G
M G

Nick would finall quite saying “I told you we did NOT need to buy that last shipment at $32.”

I could FINALLY be able to say…I told you so.

Now that we are on our land and Nick has worked his ass off to get the place ready for whatever happens, the important thing to ME is the “i told you so” part.

mark
mark

Next to “I win,” “I told you so” are the sweetest words.
Gore Vidal

Mark in Mayenne

I had the wireless/ wired keyboard problem when I upgraded the memory of my Dell.

M G
M G

Thanks for these by the way…

Got busy in the woods,but will read all three.

Jamesjamescarter556@hushmail.com

Sorry I missed this article(s),am a user of linux and am a fan of it,limited net connection recently has found me without,well,a connection.I whole heartedly recommend folks try Linux and get rid of the rotten apples and microsucks OS’s completely,

Discover more from The Burning Platform

Subscribe now to keep reading and get access to the full archive.

Continue reading