*

Welcome, Guest. Please login or register.

Get your own OLPC - Buy an XO laptop on eBay!
Pages: [1] 2
Print
Author Topic: Explanation of Compressed Files instructions  (Read 17474 times)

Explanation of Compressed Files instructions

moocapiean
Master Contributor
***
Posts: 330


February 03, 2008, 02:41:57 PM

A couple of people have asked that I give a more thorough explanation of what each command does in the Ubuntu installation instructions.  So below is my attempt at doing that.  These instructions come from the compressed files approach.


Before you begin, you'll need at least three things:
1. A USB or SD drive that's at least 600 MB
2. The developer key for your XO
3. A computer running Linux
Your XO can function as #3, as long as you have 194 MB of space free on its drive, otherwise you'll need another drive.

Hopefully this part isn't confusing.  It's actually possible to use a Windows computer for almost the entire installation, but no one's ever asked

Start up your Linux computer.  Since you'll need root privileges for various parts below, let's gain root access right away.  If you're on the XO, just run: su -

The root user is all-powerful, which is a bad thing if you make a mistake as root.  For this reason, sudo was created.  Instead of switching to root user (as su does), sudo gives your root power only for the command you run.  But, the XO doesn't come with sudo, so we'll use su. As long as you follow the instructions, everything should be fine

Now that you're root, we need to start working with the USB/SD drive, so insert that now.  It's important to know what device Linux thinks your drive is, so after it's inserted, wait a few seconds, then try to determine what device node your drive is associated with.  On the XO, you should be able to run df -k and look at the last entry.  Since Sugar will automatically mount your USB/SD drive, it should show up as something like /dev/device.  For me, it was /dev/sda, so I'll use that for the rest of the instructions.

The df command shows information about disk space usage, which we don't really care about here.  The reason we use it is because it tells us every mounted device and its device name.  In Linux, when a storage device (CD, DVD, USB drive, ...) is inserted into a computer, before you can use it, you have to associate the device with a location in the filesystem (called the mountpoint).  Windows does this automatically; the locations are new drives (e.g. E: drive, F: drive, ...).  In Linux, we have more control over where they go, but typically the mountpoints go in /mnt or /media.

For most of the instructions, we're not interested in the mountpoint, but the device itself.  Unlike Windows (as far as I know), Linux allows you to interact with the hardware directly through device nodes.  All device nodes are found in the /dev directory.  If you want to interact with the hardware (and not the filesystem stored on it), you want to deal with the device node.


Make sure the drive isn't mounted, by doing:
mount | grep /dev/sda | awk '{ print $1 }'
For every line that shows up, run:
umount device
where device is one of those lines that appeared.

Welcome to basic BASH scripting!  That first command is actually a list of commands, with the output of one going into the input of another. Here's what each command does:
  • mount - Lists all the mounted devices
  • grep /dev/sda - Search each line of the incoming text for "/dev/sda".  If a line contains that, print it out, otherwise don't print it.
  • awk '{ print $1 }' - For each line of the incoming text, print out the first column of it.

Those '|' between each of the commands sends the output of one command (normally what would be printed to the screen to the input of the next command (normally, the input's the keyboard)

The umount command unmounts a device.  In other words, it removes the connection between the device and its mountpoint.  If you want to interact with the device (and not the filesystem on it), you have to unmount it first.


Ok, once you're done that, it's time to partition and format your drive:
fdisk /dev/sda
p

You might see something like this:
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1           4       32098+  16  Fat16

The fdisk command let's you create partitions on disks. To view all the commands available in fdisk, type m at the fdisk prompt (for the menu).  What I suggested doing in the instructions is to print out the current partition table by using the print command.

The important thing is what's in the Device column.  Notice that my device is /dev/sda1.  The important thing is the number at the end, it represents the partition number.  Since we want to delete all partitions (I don't think we actually have to, but I think the XO wants the boot partition to be the first, so for simplicity...), we're going to have to delete each partition.  For each partition, do:
d
partition_number

When you're going to delete the last partition, you won't need to give it the number.

Once you deleted all the partitions, let's create a new one.
n
p
1
press enter to accept the default starting location
if you want a specific size, specify it here (follow the instructions given by the program, or press enter to use the entire drive


Now that we're finished creating the partition, let's make it bootable:
a
1


While we're here, let's also make sure the partition table knows that this is partition will be an ext3 partition:
t
1    (here you're specifying the partition number so if you only have one, fdisk might not ask you to specify)
83


And now we can write the changes to the drive and close:
w

I think this section was self-explanatory, so there's not much to say (unless someone is confused, in which case, feel free to ask!).  I guess I'll take this opportunity to explain some more about the names in the /dev directory.  My USB drive is considered a SCSI device (I'm not sure why), that's where the "sd" part of the name comes from.  The "a" means the first SCSI device.  If I inserted a second one, it'd be /dev/sdb.  The "1" at the very end of the name represents the partition number on the device; partition number start counting at one. So /dev/sda1 means the first partition on the first SCSI device.

If the drive was mounted again, unmount it (see the instructions above).  Now let's apply the filesystem:
mke2fs -j /dev/sda1

This is an important step.  In fdisk, we told the partition table what kind of filesystem will be on our newly-created partition, but we never actually created that filesystem.  Filesystems are data about what's stored on the drive and where.  With the ext3 filesystem (which is the filesystem you're creating here), the data is stored in inodes.  The mke2fs command creates those inodes.

Now we can mount the partition.  To solve a minor problem in the tar file (see this post), we're going to mount the partition onto /mnt/OLPCRoot.  The directory name here is important!  If it isn't created already, let's create it first:
mkdir /mnt/OLPCRoot
and now mount it:
mount /dev/sda1 /mnt/OLPCRoot

We're associating the device /dev/sda1 with the mountpoint /mnt/OLPCRoot.  This means that everything stored on the card is accessible in /mnt/OLPCRoot.

Now we're ready to download the file.  Let's assume that you downloaded it to /home/olpc:
cd /home/olpc
wget http://myotherdrive.com/file/374.140019.28012008.86470.0067fi/OLPCRoot.tar.bz2

Your best bet for getting the file is to use bittorrent.  See the New home for Ubuntu files? thread for more information.  Eventually there'll be a direct download for the files, but for now, this is the best we can do.

Now go to your USB/SD drive and decompress the file.  I'm assuming that your drive is mounted to /mnt/OLPCRoot, so let's move into the /mnt directory and decompress (again, see this post for why we're not moving into /mnt/OLPCRoot)
cd /mnt
tar -jxf /home/olpc/OLPCFile.tar.bz2


I think most of this is self-explanatory.  The tar command stands for "tape archive". Although tapes aren't used very often anymore, tar is still used a lot.  It lets us combine multiple files into one tar file and then compresses them using various algorithms.  Here, you're uncompressing a file and extracting the contents from the tar file.  The "j" option says to decompress (or compress if we were creating an archive) using the bzip2 compression technique.  The "x" means to extract and the "f" means the next thing in the argument list is the file to extract.

Windows places a lot of trust on the file extensions, but in Linux, they're no more meaningful than the rest of the filename.  So, the .tar.bz2 at the end of the filename is just a way for you, the user, to know that it's a tar file compressed with bzip2.  If it ended with .tar.gz, then it'd be a tar file compressed with gzip (use the "g" option instead of "j").  Files created with tar are sometimes referred to as "tarball files" or "tarballs".


Once that's done, you'll need to set the correct olpc.fth file.  See this post for a multiboot olpc.fth file that should be used.  It appears to work better than the files included in the download: http://olpcnews.com/forum/index.php?topic=1525.0
If you're using an SD card and that doesn't work, try following the instructions here: http://olpcnews.com/forum/index.php?topic=1767.0

Windows assumes that it's the only operating system on the computer, so you rarely/never see a bootloader.  In Linux, you tend to deal with these more.  The olpc.fth file tells the bootloader what operating systems (or more accurately, kernels and operating systems) are available and how to load them.

Now, unmount the drive.  It may take awhile to unmount it since it may still be transferring files over, just be patient:
umount /mnt/OLPCRoot

Once it's unmounted, we need to give the partition the proper name:
tune2fs /dev/sda1 -L OLPCRoot
If you're using an XO, you might need to type /sbin/tune2fs instead of tune2fs

We need to name the partition because the olpc.fth file uses the partition name instead of the device node to refer to the drive.

It's now time to move over to your XO and transfer over the last few files.  Since our drive isn't ready to boot off of just yet, let's boot into Sugar, Xfce, or whatever you have running on there right now.

Once it's loaded, issue the following command:
cp -ra /security /media/OLPCRoot/
Check to see if the directory /media/OLPCRoot/security/.private exists:
ls /media/OLPCRoot/security/.private
If it doesn't, create it with:
mkdir /media/OLPCRoot/security/.private

The XO won't boot unsigned operating systems without the correct files/data in the /security directory.  Since these contents are specific to each XO, you need to copy the content of yours onto your USB/SD card.

And you're done!  If you want to log into your new Xubuntu installation, just reboot, hold down the right game button (it looks like a check mark) until it tells you to release it, then let it boot up.  The username is olpc and the password is olpcolpc.  To start Xfce, after you log in, run startxfce4.

You'll notice that I applied all modifications mentioned on the Xfce? thread (as of January 13, 2008).

Update: I created a battery monitor script for the Xfce panel.  See this post for more details: http://olpcnews.com/forum/index.php?topic=917.msg10648#msg10648

I don't have much to say here.  If you have any questions about my explanations, feel free to ask.


If there's anything you're confused about, anything you want to know more about, or if you have any other questions, feel free to ask.  If you have problems with the instructions (and not my explanations), it'd probably be better to ask in the Installing Ubuntu using compressed files thread.

Unless someone asks, I don't plan to explain the disk image approach instructions.
« Last Edit: February 07, 2008, 11:42:55 AM by moocapiean » Logged

#1 Re: Explanation of Compressed Files instructions

vince
Contributor
*
Posts: 66

G2G1R1H1C1S1H1eeePC


February 03, 2008, 06:54:26 PM

A few comments.  First it works (thanks !!!!!)

My ubuntu image comes up with what seems to be a working battery monitor so I'm not sure we need to do anything any more on that subject or if it even needs mentioning in your instructions.

It might be helpful to point folks at how to su and then run synaptic to download more packages.  I'm doing that now to add goodies that I think are missing from your set of packages (openssh-server to name one) plus looking at the 22,000+ available packages to pick from.  Whee....

Folks will most likely want to set up a swap file on SD to be able to run more apps with acceptable performance.  The way I did it was to make a swapfile on my SD (I used 512MB) and put the following in fstab
      /dev/mmcblk0p1 /mnt/sd  vfat     auto,noatime 0 0
     /mnt/sd/swapfile  none      swap   auto               0 0

Important thing is you want the noatime option for a usb stick since a ext3 filesystem will write the journal once every 5 seconds. You'll burn out your usb stick pretty quickly if you leave it set that way.

I had a lot of problem setting up my wireless to work with wpa2.  Supplying a default set of all the networking config files for a XO would likely help lots of folks, even though it's documented in a number of places on the forums with conflicting instructions.  Even doing Linux professionally for 16 years and unix for 21+, I'm personally confused as anything with how to do stuff under Ubuntu.  I'm very RedHat/Fedora historically, it's pretty big culture shock trying to work in Debian hell for me.

People will likely want to set their clocks with ntpdate (I use time.apple.com for a quick one-time setting, then run hwclock --systohc) and their timezone with tzselect.

Only semi-whine I have is that none of the sysadmin stuff works under the olpc account under xfce4.  It would be helpful to set up the same thing under the root account so all the menus etc. are there in your default configuration so folks can use the native menus for administrative things when needed (ie, log out as olpc, log in as root - do stuff, then log back out).

That said, great stuff.  It's FABULOUS running real linux on this thing and not pulling my hair out battling the excruciatingly slow wierdness that is Sugar.  Thanks MUCH !!!!
Logged

G2G1R1H1C1S1H1eeePc- gave two, got one, RMAd that one, got it back, cancelled one, sold the other....bought a eeePC 4G Surf 'which just plain works' and am totally thrilled with it.

#2 Re: Explanation of Compressed Files instructions

moocapiean
Master Contributor
***
Posts: 330


February 03, 2008, 07:20:52 PM

The instructions were just for getting Ubuntu on their drive, not for customizing it (think Linux From Scratch, not BLFS).  But, I think you have a point.  It'd be nice to have a post explaining how to do various things.  In addition to what you list, it'd probably be good to explain how to rename your user (and related things) and access the internal drive.

On my XO, the battery monitor that comes with Xfce4 doesn't work.  It always reports 50%.

Thanks for the tip about noatime, I completely forgot about it.  I'll add it to the instructions.

As for the administration stuff, it should be possible to access them as olpc.  I have gksudo set up to handle that.  Hmm, I just checked and it appears the Xauthorization file has gone missing again.  Is that the problem you're getting?  I wish I could remember how I fixed this.
Logged

#3 Re: Explanation of Compressed Files instructions

moocapiean
Master Contributor
***
Posts: 330


February 03, 2008, 07:39:44 PM

Found it! It was hiding in my history.  If you're getting the problem with not being able to copy your Xauthority file whenever you try to run a program that needs root privilege (like Synaptic), then run this command in a terminal:
xauth generate $DISPLAY . trusted

It's a good idea to add that command to a startup script, such as the .xfce4_startup file in your home directory.
Logged

#4 Re: Explanation of Compressed Files instructions

billaspell
New

Posts: 2


February 04, 2008, 04:12:17 PM

Thank you moocapiean for the excellent work. After 4 days of tinkering Xubuntu is running cleanly on sd in my XO. I also resolved the overly sensitive trackpad problem by dropping back to firmware version q2d07.rom from q2d10.rom. Thanks vince for the swap file tip.
Logged

#5 Re: Explanation of Compressed Files instructions

jefeliz
Contributor
*
Posts: 47


February 07, 2008, 11:32:27 AM

I seem to be having two issues with my brand new SD card:

By way of explanation, I'm using my XO as the Linux system (in Terminal)

First, when I issue the umount command, I get the response 'umount: /media/SDname: device is busy' printed twice.

Second, is fdisk-ing done on the XO (my Linux system)? If I issue the command as written above, I get 'bash: fdisk: command not found'

Thanks for any help (and sorry if I'm sounding noobish), I'm really looking forward to getting this working!

Jeff. . .
Logged

#6 Re: Explanation of Compressed Files instructions

moocapiean
Master Contributor
***
Posts: 330


February 07, 2008, 11:42:35 AM

The fdisk program is hiding in the /sbin directory.  I'll finally update my instructions to fix the problem.  You should be able to run su - instead of su to get things to work.  Let me know if it doesn't.

As for unmounting, do you have anything open from that drive?  Are you currently in that drive in one of the terminals?  You'd be in one of the drives if you ever did something like cd /media/SDname (or a directory within /media/SDname).  Finally, Sugar may be doing something in /media/SDname (this is probably your problem).  You might want to unmount it in Sugar instead of using the umount command.

Don't worry about sounding inexperienced, that's common on this forum Smiley.
Logged

#7 Re: Explanation of Compressed Files instructions

jefeliz
Contributor
*
Posts: 47


February 07, 2008, 11:55:56 AM

The fdisk program is hiding in the /sbin directory.  I'll finally update my instructions to fix the problem.  You should be able to run su - instead of su to get things to work.  Let me know if it doesn't.

As for unmounting, do you have anything open from that drive?  Are you currently in that drive in one of the terminals?  You'd be in one of the drives if you ever did something like cd /media/SDname (or a directory within /media/SDname).  Finally, Sugar may be doing something in /media/SDname (this is probably your problem).  You might want to unmount it in Sugar instead of using the umount command.

Don't worry about sounding inexperienced, that's common on this forum Smiley.

Wow, thanks first for the great set of instructions (forgot to mention that before!) and the quick response.

I did find fdisk in the /sbin directory, but if I unmount my SD card in Sugar, will I be able to fdisk it (it doesn't then show up if I df -k)?

Thanks again!

Jeff. . .

EDIT: Answered my own question (Yes, I can fdisk it after unmoutning it in Sugar). Man I love this machine, mainly because I know I can blow it up and rebuild it fairly easily - with lots of help from these forums, of course!
« Last Edit: February 07, 2008, 12:49:44 PM by jefeliz » Logged

#8 Re: Explanation of Compressed Files instructions

billaspell
New

Posts: 2


February 07, 2008, 11:56:44 AM

I remember error message (device busy) when trying to umount the sd. I think I did a " cd / " (change directory back to root) then redid the umount command and it worked.  I was logged in as supervisor when I did the above.
Bill
« Last Edit: February 08, 2008, 05:11:17 PM by billaspell » Logged

#9 Re: Explanation of Compressed Files instructions

darrell
Commenter

Posts: 24


February 17, 2008, 07:49:48 AM

Hey, this may be a dumb question...but what is the password for root? Seems I can't access any of the user admin options as olpc after all.

Thanks.
Logged

#10 Re: Explanation of Compressed Files instructions

moocapiean
Master Contributor
***
Posts: 330


February 17, 2008, 12:33:08 PM

That's not a dumb question at all.  The answer, unfortunately, isn't a short one.

Ubuntu doesn't want users to log in as root.  They see it as unsafe since as root, you have the power to do anything, including destroy your system.  By using su, you gain root power until you decide to give it up.  They're worried that you might forget that you're root and accidentally do something bad.  So, they disabled directly logging into the root account.

Instead, they provide the sudo command.  It runs programs as root without having you actually log in as root.  To use it, just put sudo at the very front of your command.  For example, if you wanted to install Firefox using apt-get, you would want to type:
apt-get install firefox
but that would fail since you don't have permission.  To get permission using sudo, you need to type:
sudo apt-get install firefox
It'll then prompt you for your password (not root's) and run the command with root privilege.  Once the command (apt-get in this case) finishes, it'll return, leaving you as olpc, not root.

Now, there is a way to use sudo and su to gain root privilege the way you're used to from Sugar, but I'll leave that as a small exercise for you to figure out Wink.
Logged

#11 Re: Explanation of Compressed Files instructions

darrell
Commenter

Posts: 24


February 17, 2008, 10:46:04 PM

Quote
Now, there is a way to use sudo and su to gain root privilege the way you're used to from Sugar, but I'll leave that as a small exercise for you to figure out .

Wow, never used Ubuntu before. That's lame how they have root all locked down like that, but the workaround was easy enough. Thanks for the pointer. Wink

EDIT:

Okay, it will soon become apparent that I'm not real good at this but...

I succeeded in creating a new user...I logged in...started xfce etc.

I thought I couldn't get nm-applet to work...but it was working...just in the background. When I finally added a systray thingy to the panel I noticed somehow I boneheadly got it running three times...how do I bring that number back down to a useful one?

-PS- Thanks so much for your help up to this point. I'm loving having a usable OS on my XO. Smiley
« Last Edit: February 18, 2008, 02:37:59 PM by darrell » Logged

#12 Re: Explanation of Compressed Files instructions

moocapiean
Master Contributor
***
Posts: 330


February 18, 2008, 07:19:07 PM

I'm not really sure how you ended up running three versions of it, but I hope a reboot will solve the problem.  I'm also wondering why nm-applet didn't show up in the system tray for your new user.  It's been awhile since I created the olpc user, so maybe I had to do something special, but I didn't think I had to, I think it just appeared.  Oh well, report back if you're still having problems after a reboot and I'll try to figure it out.
Logged

#13 Re: Explanation of Compressed Files instructions

darrell
Commenter

Posts: 24


February 19, 2008, 12:03:31 AM

Yeah, color me impressed with my own stupidity as well. After a reboot I still have three lil' NM icons in the systray. (Oh, and for the record, it probably was in the systray before, I just didn't have one, nor did I know how to get it until later...first time with xfce)
Logged

#14 Re: Explanation of Compressed Files instructions

newbie
Senior Contributor
**
Posts: 126

Don't know much about computers but LOVE my Olpc.


February 21, 2008, 05:01:50 AM

Hooray! I tried it and it works! Thank you so much!!!

I admit, I STILL didn't quite understand everything (in spite of your really good explanations) and I'm fairly sure that I didn't follow all the steps correctly but what the hell - it works!

So - I can't add new programs like I do with my "normal" Ubuntu-computer, right? I have to take it the the software it came with?

 Also, is it possibly that my wi-fi works even better with Ubuntu? I have an open network in my neighborhood that never showed up under Sugar.
Logged
Pages: [1] 2
Print
Jump to:  

Members
Total Members: 2406
Latest: sembik
Stats
Total Posts: 31943
Total Topics: 3843
Online Today: 28
Online Ever: 238
(April 18, 2011, 09:48:50 PM)
Users Online
Users: 0
Guests: 14
Total: 14