*

Welcome, Guest. Please login or register.

Get your own OLPC - Buy an XO laptop on eBay!
Pages: [1]
Print
Author Topic: Yum on F11 Tips  (Read 5459 times)

Yum on F11 Tips

anna
Master Contributor
***
Posts: 326


September 16, 2010, 06:50:06 PM

Here are some options for yum update and installs under the F11 builds.  It can be fairly irritating getting yum to work, but one or more of the following options should do the trick.  (Options 3 and 4 are mutually exclusive.)


1.  Single User Mode (Memory Issues)


Single user mode stops the Gnome or Sugar window manager, freeing up system resources so you can yum install a few things.  This alone will not allow you to run yum update, as the default cache isn't big enough for that, but you can install the odd package without swap space or extra space for the cache.

From the terminal, create /etc/sysconfig/network-scripts/ifcfg-eth0 for your home wifi.

Code:
sudo nano /etc/sysconfig/network-scripts/ifcfg-eth0

Code:
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=dhcp
TYPE=Wireless
MODE=Managed
ESSID=home

Of course, replace home with the name of your actual home wifi.  If your ESSID has spaces in it - for example "My Home" - surround it with quotation marks like this:

Code:
ESSID="My Home"

If you use WEP or WPA, that's another pickle.  Still doable, of course, so look to the "Linux Answer Machine" (aka Google).

Getting into Single user mode is dead simple.  In the terminal:

Code:
sudo init 1

The screen will go black and you'll be put into a console.  Hit enter for the root login.

Optional:  So you don't have to keep hitting a key to see what's going on, you can disable console blanking.  This isn't necessary, though.  If the screen goes blank, just hit the space bar.

Code:
setterm -powersave off -blank 0

Bring up your wifi

Code:
ifup eth0

Now you should be able to yum install a couple of things without the XO freezing up.  When you're done, just type reboot and the XO will boot back into whatever window manager you were using.

Code:
reboot

Warning for the following options:  If you're working with multiple USB drives plugged into the XO, you might want to verify the device before you start messing with it.  The first drive you plug in *should* be /dev/sda and the second /dev/sdb, but check /dev after inserting each device to be sure.

Code:
ls /dev | grep sd



2.  Creating a USB swap drive (Memory Issues)


If you have an older, small (under 1 GB) USB drive languishing in a drawer, here's an excellent way to get some use out of it.  Yes, this will erase everything you have on the drive, so make sure to get your stuff off of it first.

I've been using an older 1 GB USB drive as swap since I saw this post.  These instructions from fyoder were a lifesaver for me back in the day, as I wasn't aware of this possibility.

http://www.olpcnews.com/forum/index.php?topic=1094.msg17891#msg17891

Code:
sudo mkfs.ext3 /dev/sda1
sudo mkswap -L myswap /dev/sda1
sudo swapon LABEL=myswap

Use the top command to verify your swap is working.  The fourth line starts with "Swap" and you're looking for something other than 0 for the total.

Code:
top

Hit ctrl+c to get back to your prompt.

In the future, on any XO or any other Linux machine, you can insert this drive and turn on your swap space.

Code:
sudo swapon LABEL=myswap

3.  Changing the yum cache directory (Space Issues)

The default /var/cache/yum allotment doesn't have much space and big updates or installs will fail.  For a hacky way to get enough space for downloading and installing from the nand, try this:

Code:
sudo mkdir /root/yum
sudo nano /etc/yum.conf

Change this

Code:
cachedir=/var/cache/yum

To this

Code:
cachedir=/root/yum

Once your update or install is done, you can change the cachedir in /etc/yum.conf back to /var/cache/yum and then

Code:
sudo rm -rf /root/yum

This will only work if you have enough space on the nand to download everything, so it might not be an option if you've already got a bunch of stuff on the XO.


4.  Mounting a USB Drive for the yum cache (Space Issues)  


If you don't have enough space on the nand, another alternative is to mount a usb drive on /var/cache/yum.

Under Gnome, when you insert a regular USB drive, you'll see an icon on the desktop.  Right click on the drive icon and select "Unmount Volume."  I've already got my swap drive going, so my XO sees this drive as /dev/sdb.  I go into the terminal and manually remount it for the yum cache.

Code:
sudo mount /dev/sdb1 /var/cache/yum

If you're doing a lot of reflashing and testing, to save some time, edit /etc/yum.conf for keepcache=1 and the rpms yum downloaded will stay on your USB drive so you can use them again on another install.
« Last Edit: September 16, 2010, 06:59:55 PM by anna » Logged

#1 Re: Yum on F11 Tips

Dinky
Senior Contributor
**
Posts: 238


September 16, 2010, 08:08:34 PM

Can Gerbal's suggestion of changing fstab (at least temporarily) to reallocate memory, provide enough memory for many yum installs ?

It looks like most of the reason the os850 build is so heavy on the XO-1 is some of the decisions made with fstab:

Code:
/dev/root  /         ext3    defaults,noatime 0 0
devpts     /dev/pts  devpts  gid=5,mode=620   0 0
tmpfs      /dev/shm  tmpfs   defaults,size=50m         0 0
proc       /proc     proc    defaults         0 0
sysfs      /sys      sysfs   defaults         0 0
/tmp            /tmp            tmpfs         rw,size=50m 0 0
varcacheyum     /var/cache/yum  tmpfs         rw,mode=755 0 0
vartmp          /var/tmp        tmpfs         rw,size=50m 0 0
varlog          /var/log        tmpfs         rw,size=20m 0 0
none            /ofw            promfs   defaults    0 0

Fstab allocates what looks like 170mb of ram as tmpfs for a whole variety of temp and log files. This makes sense when you have plenty of ram to spare, but is a nogo when you only have 256mb of ram to spare.

The solution to this issue is either to delete the offending tmpfs lines (will fill up the disk with temp, cache, and log files) or to mount /var/cache/yum, /var/tmp, /var/log, and /tmp to an sd card or usb stick (my preferred solution).
Logged

#2 Re: Yum on F11 Tips

mavrothal
Administrator
OLPC News Forum Expert
*****
Posts: 1289


September 17, 2010, 12:49:27 AM

Can Gerbal's suggestion of changing fstab (at least temporarily) to reallocate memory, provide enough memory for many yum installs ?

Actually is quite the opposite. Too little /tmpfs space. Yum will take ~30MB just to download and expand the repos, so if you try to install anything bigger than 10MB will run out of space.
Py builds have
Code:
tmpfs      /dev/shm  tmpfs   defaults,size=150m         0 0
and do much better. With a bit of swap (option 2 in anna's post)  they are totally OK.

BTW if you follow anna's instructions for a swap partition and stick this line in your /etc/fstab
Code:
LABEL=myswap   none   swap    defaults    0 0
swap will be there automatically on  boot (assuming that your stick/card with the partition is attached)
« Last Edit: September 17, 2010, 01:08:34 AM by mavrothal » Logged

XO-1: Is never going to run Flash, but is certainly flashy!
(If you want Flash, get an XO-1.5 running OLPC 11.2.0 or XOpup Grin )

#3 Re: Yum on F11 Tips

Dinky
Senior Contributor
**
Posts: 238


September 17, 2010, 07:33:11 AM

So, I interpret your answer as yes, since "Py builds have"... larger tmpfs... "and do much better".  External swap is the ideal and most practical, but can a major portion of yum downloads that might be needed for enhancing the XO be handle, by optimizing, temporarily, the tmpfs allocation?

Thanks
Logged

#4 Re: Yum on F11 Tips

mavrothal
Administrator
OLPC News Forum Expert
*****
Posts: 1289


September 17, 2010, 07:52:32 AM

Yes.
Ideally with option 1 on anna's post
Logged

XO-1: Is never going to run Flash, but is certainly flashy!
(If you want Flash, get an XO-1.5 running OLPC 11.2.0 or XOpup Grin )

#5 Re: Yum on F11 Tips

anna
Master Contributor
***
Posts: 326


September 17, 2010, 10:54:15 AM

I wanted to see if I could run yum update on os852 without any USB drives.  Yep, options 1 & 3 together let yum update complete.  I ended up with 81M in /root/yum after it was done.  Do make sure to put /etc/yum.conf back to the way it was, then delete /root/yum.

So it does take quite a while, but at least it's possible to get your updates done on os852 if you don't have any spare USB drives.
Logged

#6 Re: Yum on F11 Tips

Dinky
Senior Contributor
**
Posts: 238


September 17, 2010, 01:16:47 PM

So, with a wired XO (USB to Ethernet adapter), all I need is "init 1" and create a cache in nand.  Looks better than messing with fstab.
Logged
Pages: [1]
Print
Jump to:  

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