Linux.com

Community Blogs



Multi-booting My Way (Not Necessarily the Easy Way)

The following is a brief step-by-step on how I've been multi-booting different operatings systems on my machines for the past few years.

It's not necessarily the easy way to do things. It is the way I first learned and the way that I'm most comfortable with using. I'm posting it here, as I believe it may be helpful to some Linux Explorers out there. This tutorial is based on GRUB Legacy. I do not use the new GRUB2 on my machines.

Here we go...

I have multiple drives on my system, so multi-booting becomes a bit more interesting. Currently, I have three hard drives installed. They are /dev/sda, /dev/sdb, and /dev/sdc. We won't concern ourselves at all with /dev/sdc because it is primarily used as a common storage/backup drive. My operating systems are installed on /dev/sda and /dev/sdb.

I use /dev/sda (1st boot device in my BIOS) as the drive that has my primary operating system and my secondary operating system on it. I break my drives down into numerous partitions because I always install GNU/Linux operating systems on at least two partitions; /(root) and /home. I also have a common /swap partition on each drive that I plan on installing GNU/Linux distributions on.

My /dev/sda partitions look like this:

/dev/sda1   *       16065    51215219    25599577+  83  Linux <-- Slackware /(root)
/dev/sda2        51247350   153645659    51199155   83  Linux <-- Slackware /home
/dev/sda3       153661725   488392064   167365170    5  Extended
/dev/sda5       153661788   204860879    25599546   83  Linux <-- Arch /(root)
/dev/sda6       204877008   307275254    51199123+  83  Linux <-- Arch /home
/dev/sda7       307307448   311403959     2048256   82  Linux swap / Solaris
/dev/sda8       311420088   488392064    88485988+  83  Linux <-- Archives

My /dev/sdb partitions look like this:

/dev/sdb1   *       16384    51216383    25600000    7  HPFS/NTFS/exFAT <-- MS Windows XP
/dev/sdb2        51232768   102432767    25600000    7  HPFS/NTFS/exFAT <-- MS Windows Programs
/dev/sdb3       102453181   488270159   192908489+   5  Extended
/dev/sdb5       102453183   106550639     2048728+  82  Linux swap / Solaris
/dev/sdb6       106565823   137289599    15361888+  83  Linux <-- CentOS tester 1 /(root)
/dev/sdb7       137304783   188501039    25598128+  83  Linux <-- CentOS tester 1 /home
/dev/sdb8       188516223   219239999    15361888+  83  Linux <-- Foresight tester 2 /(root)
/dev/sdb9       219255183   270451439    25598128+  83  Linux <-- Foresight tester 2 /home
/dev/sdb10      270466623   301190399    15361888+  83  Linux <-- Debian tester 3 /(root)
/dev/sdb11      301205583   352401839    25598128+  83  Linux <-- Debian tester 3 /home
/dev/sdb12      352417023   383140799    15361888+  83  Linux <-- vacant tester 4 /(root)
/dev/sdb13      383155983   434352239    25598128+  83  Linux <-- vacant tester 5 /home
/dev/sdb14      434367423   488270159    26951368+  83  Linux <-- common storage

You get the above information on your drives using the fdisk -l command as root from the command line.

Alright then, let's say that I now want to install Fedora Core Linux on my tester 4 partitions of /dev/sdb. Here's how I would do that step-by-step:

1) Begin the Fedora installation setting /dev/sdb5 as swap, /dev/sb12 as /(root), and /dev/sdb13 as the /home partition from Fedora's installer.

2) When the Anaconda installer reaches the point where it asks where I want to install the GRUB bootloader, I choose to SKIP installation of GRUB.

3) Once the install is finished, I reboot my main operating system (Slackware) and from the command line I mount the newly installed Fedora /(root) partition:

root_Slackware/home/vtel57:# mount /dev/sdb12 /mnt/tmp

*Note: I have a /mnt/tmp directory in my Slackware. If you don't have a /mnt/tmp, just mount in /mnt. You'll be fine.

4) I list the contents of the Fedora /boot directory:

root_Slackware/home/vtel57:# ls /mnt/tmp/boot

5) I copy down the vmlinuz and initrd information. You'll be looking for the vmlinuz-<kernel version> and the initrd-<kernel version>.img files specifically. You'll need that information for the next step.

6) I edit my /boot/grub/menu.lst file to add the new Fedora Core entry. Note: my MBR-controlling GRUB is in my secondary OS, Arch Linux. I can still mount and modify it from within Slackware, though.

root_Slackware/home/vtel57:# mount /dev/sda5 /mnt/tmp

root_Slackware/home/vtel57:# vim /mnt/tmp/boot/grub/menu.lst

I'll add this entry to the file:

# Fedora Core

title          fedora (t4)

root         (hd1,11)

kernel     /boot/vmlinuz-<kernel version> root=/dev/sdb12 ro

initrd       /boot/vmlinuz-<kernel version>.img

7) I reboot and choose "fedora (t4)" from the GRUB menu to boot my new Fedora installation.

That's it, folks. Straightforward, but not necessary the easiest way to do this. That's the beauty of GNU/Linux. You can do it your way.

Have fun!

~Eric

P.S. I'm still working on the next shell scripting lesson. It's going to be about variables and parameters, a necessary lesson for further BASH learning. Unfortunately, it's also kinda' complicated, so it's taking me a bit to figure out how to formulate a lesson and still stay loyal to my primary goal here... keeping it as simple as possible. Stay tuned...

*Originally published on my Nocturnal Slacker v1.0 blog at Wordpress.com
  

 

 

Accessing Amazon EC2 Instance information from the command line using curl

If you use Amazon Web Services EC2 for virtualising your infrastructure, you may find that once you have a few instances started, that it may be hard (especially if you aren't using a configuration management tool) to trace back 'which machine belongs to what security group?' or 'which AMI did I use to bring up this instance?.'

 

Well theres a few quick tricks you can use to get some info out of your running instances. To do this you need to access the instances meta-data, and this is available simply by using 'Curl' from your running Linux instance, as follows:

 

'curl http://169.254.169.254/latest/meta-data/<metadata-object>'

 

here are some of the metadata objects:

ami-launch-index

ami-manifest-path

block-device-mapping/

hostname

instance-action

instance-id

instance-type

kernel-id

local-hostname

local-ipv4

placement/

profile

public-hostname

public-ipv4

public-keys/

reservation-id

security-groups

 

ami-manifest-path will tell you from where on AWS the AMI (the Amazon Machine Image for the linux virtual machine) was launched. If you rolled/composed your own AMI this helps you match up which Bucket on S3 relates to your AMI.

 

for example:curl http://169.254.169.254/latest/meta-data/ami-manifest-path

 

 

public-ipv4 is the world-facing IP address of the running virtual machine.

 

If your not sure from looking at the AWS Dashboard (or dont have access to it) you can run:

 

curl http://169.254.169.254/latest/meta-data/instance-id

 

this will help you make sure if you want to terminate an instance that you kill off the correct one.

 

Its easy to experiment with, and the fact that you use curl to access the metadata information, it means that its also something thats pretty easy to compose a shell script for commonly needed tasks.

Hope someone finds this helpful.

 

Linux Foundation Guru's get mentioned in FOSS article in UK Linux Format Magazine!

I posted this on my own external blog, but thought I would share the pics of the article in Linux Format that mentions the Linux Foundation!

This years Top Ten Linux Guru’s as judged by the Linux Foundation where picked earlier last month. Imagine my surprise to find my name (Matt Palmer) amongst them when I opened this months (UK June Edition) of Linux Format!!

I thought I would put up a couple of pictures of the article for prosperity. Well done to all the other guru’s as well, who have done a brilliant job of helping new users to Linux, as well as assisting others with questions,whitepapers and best practices, and inspiring innovation and development within the organisation.

Here were the Top Ten contributors to the Foundation:

1)Matthew Fillpot

2)Aaron Aceves

3)Andrea Benini

4)Shane

5)Istimsak Abdulbasir

6)Marco Fioretti

7)Matt Palmer (Me!)

8)Per Lindholm

9)GoinEasy9

10)Adam

Take a look at the Linux Foundations Website linux.com for some great articles and topics for debate, and the latest news on the greatest operating system on the planet!

 

 

Move over Apple, here comes Compufon!

Blimey!

I thought this was amazing. This nifty phone runs on Android, and has the ability to integrate into a Tablet or as a slimline PC with a real keyboard.

Its amazing take a look. It includes bluetooth headset that you can use if you have the phone integrated into the tablet when someone calls you.

http://www.compufon.com/features

This could prove to be an interesting competitor to other Smartphone vendors when this reaches production stage, as it is basically the iPhone/iPad and Laptop all in one. Because its Android, it also opens the door to allow enthusiasts to develop a wider range of applications,etc. 

 

Using a Distributed Shell (dsh) to Administer Multiple Workstations

Introduction

This is something I used to need a lot, that I dug out of my documentation to share.  These are steps to using dsh on ubuntu to administer multiple workstations.  This does not include instructions for setting up public/private key authentication in ssh, but these instructions work the best when this has been setup.  If you don't setup ssh keys, you'll end up having to type the root password for each machine you ssh into.

Setup

Installation

On Ubuntu, run this to install:

sudo aptitude install dsh

 

Configuration

Start by creating a new group of workstations.  I have several CentOS workstations, so I create a new file that contains all of these:

/etc/dsh/group/centos-workstations

# These are standard workstations conforming to the typical centos configuration
root@host1
root@host2
root@host3

Running Commands

You can run pretty much anything, but here's an example:

dsh -g centos-workstations yum clean all
dsh -g centos-workstations yum -y upgrade

Some Shortcuts

I simplify matters even more by creating an alias

alias cent='dsh -g centos-workstations'

I add this to my .zshrc file.  This buys the the ability to run things like:

cent yum -y upgrade

Conclusion

I realize these instructions are a bit basic, but I hope it points out new possibilities to those who have never used dsh before.  I have found myself using this pretty extensively with about 50 workstations and publickey authentication and it works wonderfully.  I found it especially useful a year or more ago when I was trying to modify 50+ workstations to conform to a more standard configuration.  I tried several other solutions over a year ago (parallel ssh or something like that) and I didn't find anything quite as nice as dsh.

 

 

Going to Vatican as a FOSS blogger: which questions and proposals should I bring with me?

I'm one of the 150 people invited to the first "Bloggers in Vatican" meeting next month. I've put all details about the goals of the meeting and why I was invited here, and now I have a question:

Which questions and proposals do you think I may suggest for a meeting like that if I had the possibility, both in general and as a FOSS/Open Standards advocate?

Thanks! Any feedback is welcome.

 

How to automatically replace files when updating WordPress

WordPress is quick and easy to install and update, but the quicker you can make these operations the better, right? If you have shell access to the server where your WordPress copy is installed, it is possible to make some operations much quicker and safer with this shell script.

 

The importance of education to Linux

Just by looking at the amount of voluntary work users engage in to help each other with their computer problems I wonder if we could not use this massive source of human intelligence for educational purposes.

The idea is that we first aim high and help each other on entry level university mathematics. Young adults would then see a another real benefit to join the Linux community.

In my previous blog entry I wrote about the potential benefit from bundling student books with some popular distributions. I believe this where you need to start. Having a couple of good open textbooks for users to engage in. Perhaps its enough to have them in the repository. The import thing is to get enough users reading the same books.

I wrote the below blog entry explaining how the cooperation could work.

http://blogg.idg.se/perrabyte/2011/04/08/idea-how-to-make-swedish-students-much-better-in-mathematics/

Here I focus on explaining the textbook theory in multi fashionable way. What I forgot to write is that the explanations need to be approved before publishing and you can link the specific theoretical part to whatever is relevant be it videos, exercises or forum discussions for questions not answered.

We need advanced innovative software in all fields. By helping with the educational bit I think we get a lot in return.

 

 

Dbmail? A great Open Source email system, especially for LAMP/MySql administrators

A couple of weeks ago, I was thinking about how I may build an advanced search utility for my own email archive. One way to make complex queries on the archive seemed to be to put it all into a relational database. Since the Dbmail system stores email in that way, I asked to its developers and to Harald Reindl (an email administrator at The Lounge who already uses Dbmail: I found him in the PostFix Mailing list archives) if Dbmail could be used in that way. The feedback I got made me change my mind about how to rebuild my own email search system, for the reasons explained below. At the same time, how and why Harald and his company use Dbmail seemed really interesting. Here’s the full story.

 

Claimer.org tries to make it easier to claim damages by climate change


Claimer.org is LAMP software that allows any individual to record claims of damages caused by climate change, so that in the future these damage claims may be litigated. The developers hope to spread this idea and encourage other organizations to use the same model to collect other types of environmental damage claims, so soon the software source code will be available for everybody. Read the interview to a Claimer.org developer here.

 

A Few More Shell Basics

In our last lesson here, I scratched the surface of the basics needed to start scripting in BASH. Today, we'll learn a few more things.

Here are some fundamentals that we need to cover real quick. It's nothing too complicated.

chmod - You've seen this command in action before, I'm sure. It's important when it comes to writing shell scripts because it allows the script to become executable. This is, of course, a necessity if we want the script to actually run and do something.

#! - These two symbols used in this particular order at the beginning of a script specifies which shell we want to use to run this script. We will primarily be talking about BASH here in these lessons, but let's say we wanted to write a script that used the tcsh shell instead. The first line of the script would be:

#!/bin/tcsh

The operating system would check that first line initially to determine what shell we intended when we wrote the script. It would then call up that shell and run the script. You'll see that a lot when programming in BASH. Now you know what it does.

# - This symbol signifies a comment. You've probably seen this many times already in configuration files like GRUB's menu.lst or your distribution's repository configuration file, maybe. It's not at all uncommon to find this symbol used in many different programming languages to alert the OS (and the user) that the data on the same line following the # is an informational comment of some sort. Comments are GOOD things when programming. Make lots of comments. They will help you and maybe others who use your program or script down the road. Here's an example of a commented snippet of script:

#!/bin/bash
# ZIP-100 mknod script - 07222006 - Bruno
mknod /dev/hdb4 b 3 64
#End script

You can see the initial #! telling the OS what shell to use. In the next line, you can see the # symbol followed by some informational data. This was an actual script that I used to need to run at boot to get my ZIP-100 drive to be recognized by the OS. Newer kernels later on solved the issue by using udev, but that's a whole 'nother subject. I just wanted you to see what a comment looks like in a BASH script.

; and <newline> - These two devices, when used in the shell, denote a transition from one command to another. For example, if I had three commands called c1, c2, and c3, I could run them on the same line using the ; (semi-colon) to separate them. Or I could just put each of them on a new line. Here's what I mean...

$ c1;c2;c3 <ENTER to execute>

$ c1 <ENTER>
$ c2 <ENTER>
$ c3 <ENTER>

Pretty simple so far, huh? OK. Let's continue...

- The backward slash is used to continue a command from one line to the next. Like this:

$ echo "She sells seashells

> by the seashore." <ENTER>

She sells seashells by the seashore.

Without the , the line would have been broken when displayed by the echo command's output. Like this:

$ echo "She sells seashells

> by the seashore." <ENTER>

Sea sells seashells

by the seashore.

See the difference? Cool! OK, then... just a few more for today. We don't want to get a headache by stuffing too much in there at one time.

| and & - These two are very cool, and you'll see them a lot. The first one is called a "pipe", and that's just what it does. It pipes output of one command into the input of another. The ampersand (&) symbol tells the shell to run a command in the background. I should briefly diverge here for a moment and mention foreground and background operations so you'll understand what they are.

A quick sidebar lesson...

You can run a command in the foreground (actively running before your eyes) or in the background (hidden from view but still going). The way to do this is to use the bg and fg command modifiers in the command line. Let's look a a couple simple examples. Let's say Mary wants to run some big admin job in the background while she does other stuff in the foreground. It's pretty easy to do. First she starts big_job01 from the command line.

mary@workplace:~$ big_job01

bla-bla-bla-big_job_running_now-bla-bla-bla

With big_job01 running actively in the foreground, Mary doesn't have a cursor blinking at the command line. She cant do any other work because she has to watch big_job01 outputting. To change this, Mary will "background" big_job01 to bring back her command line cursor so she can do other things.

CTRL+Z

What this combination of keystrokes will do for Mary is it will stop the process big_job01, giving this notification:

1]+  Stopped                 big_job01

Now Mary will get her cursor back and she can send the big_job01 to the background and get it running again.

mary@workplace:~$ bg 1

She can check to see that it's in the background and running by listing the jobs.

mary@workplace:~$ jobs -l

1]+  4107 Running                 big_job01 &

Note the following & in the above line. That's telling Mary that big_job01 is running in the background. Cool, huh? Now Mary can go on about her other chores in the foreground as she normally would. When big_job01 finishes, the command line will give Mary a notification like this:

1]+ Done                                         big_job01

OK, there you have it... a bit about backgrounding and foregrounding operations within the shell. Now let's go back to what we were talking about before.

( and ) - The parenthesis are used in shell scripting to group commands. The shell will actually create a copy of itself, called a sub-shell, for each group. Groups are seen by the shell as jobs and process IDs are created for each group. Sub-shells have their own environment; meaning they can have their own variables with values different from other sub-shells or the main shell. A bit confusing, huh? Well, let's see a quick example and then wrap up this lesson so we can all go watch C.S.I. on TV.

$ (c1 ; c2) & c3 &

In the above example, grouped command c1 and c2 would execute sequentially in the background while executing command c3 in the background. Remember that we can background commands by using the ampersand (&) symbol and separate commands by using the semi-colon (;). The prompt would return immediately after hitting ENTER on the line above because both jobs would be running in background. The shell would run the grouped commands  c1 and  c2 as one job and c3 as another job. Clear as chocolate pudding, huh? Don't worry. It'll all come together... I hope.

Until next time....

~Eric

*This article originally appeared on my Nocturnal Slacker v1.0 site at WordPress.com.

 

 

 

 

 
Page 6 of 116

Upcoming Training Courses

  1. LF331 Developing Linux Device Drivers
    03 Jun » 07 Jun - Virtual
    Details
  2. LF411 Embedded Linux Development
    24 Jun » 28 Jun - Silicon Valley
    Details
  3. LF422 High Availability Linux Architecture
    15 Jul » 18 Jul - New York
    Details

View All Upcoming Courses


Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board