Emulating the XO/Help and tips/Obsolete

From OLPC
< Emulating the XO‎ | Help and tips
Revision as of 17:16, 29 September 2007 by MitchellNCharity (talk | contribs) (+'Network setup' sections.)
Jump to navigation Jump to search

Here are sections which no longer apply to recent builds. New sections are at the top.


Builds before around 557 -- Network setup

Probably fixed around 557. Definitely by 602.

Chances are that the network will not be enabled. Following are two possible ways to enable it.

Network setup

(This section is linked to from elsewhere, so don't rename it casually.)

To see the net:

echo ifup eth0 >> /etc/rc.local

To also see other sugar machines:

mv /etc/rc3.d/S98NetworkManager /etc/rc3.d/DISABLED-S98NetworkManager
mv /etc/rc5.d/S98NetworkManager /etc/rc5.d/DISABLED-S98NetworkManager
  • Reboot the image. Simply exiting qemu and starting it again is fine.

Congratulations, your network should now be working.

Per Qemu 0.9.0 FAQ a software network card driver is needed available within the OpenVPN.net download. This finally worked for me. Grantbow 22:56, 28 August 2007 (EDT)

Dealing with NetworkManager

NetworkManager is intended to make wireless networking "just work". As connectivity comes and goes, it notices and sets things up. Unfortunately, it doesn't work in xo disk images on qemu.

Logged into an image as root, you can see

ifconfig

thinks eth0 is up, as the web browers proves, but NetworkManager's

nm-tool

thinks eth0 is Active: no, and thus that you are disconnected from the net.

The problem is nm expects a modern network interface card which supports line/carrier detect. Qemu's default emulated nic, ne2k_pci, doesn't. An alternate model=rtl8139 is reported to, and to work with nm, but the xo images don't have a driver for it.

Fortunately, inside qemu, with our hardwired eth0, we don't care about the functionality nm provides. And also fortunately, sugar has reasonable fallbacks for when it finds nm isn't running.

So if we avoid running nm, everything works.

mv /etc/rc3.d/S98NetworkManager /etc/rc3.d/DISABLED-S98NetworkManager
mv /etc/rc5.d/S98NetworkManager /etc/rc5.d/DISABLED-S98NetworkManager

Enabling the Network Alternative #1

When the emulator is starting GRUB boot loader, press a key.

  1. Choose then the Qemu line with arrow keys.
  2. Press E
  3. Move to the 'Kernel' line and press End
  4. Add Space 1 to end of the line
  5. Press Enter
  6. Press B

You will be automaticaly log in as superuser in terminal (in single user mode).

You can start network and put your local keyboard layout command there like this (using tabulator key to complete the filenames):

  echo ifup eth0 >> /etc/rc.local

or

  #(change ONBOOT from "no" to "yes")
  nano /etc/sysconfig/network-scripts/ifcfg-eth0
  #(disable NetworkManager)
  mv /etc/rc5.d/S98NetworkManager /etc/rc5.d/K98NetworkManager

On build 432, the following is also needed to have the network automatically started on bootup:

  mv /etc/rc5.d/K90network /etc/rc5.d/S10network

It also helps sugar to find other people automatically upon startup.

Put your own keyboard layout for text terminals

  echo loadkeys Your_two_letter_country_code >> /etc/rc.local
  . /etc/rc.local

Type Ctrl-D to continue normal boot.

Keyboard layout and network should work automatically every time you start the QEMU image. --Tonyv 01:52, 13 January 2007 (EST)

Enabling the Network Alternative #2

 Make sure the the window has the focus (label should say QEMU - Press Ctrl-Alt to exit grab).
 If the following keys do not work try pushing also the Shift key down to exit the Sugar environment. 
 If it does not work see the sendkey method of Alternative #3
  1. Press Alt + Ctrl + F1 to enter the terminal mode of the OLPC.
  2. Make sure that you're logged in.
    • If not, just hit enter and it'll ask you to.
    • Login as root (no password is required)
  3. Type dhclient and press return.
  4. Press Alt + Ctrl + F7 to return to the graphical mode of the OLPC.
  5. Your browser / network connection should be working fine.

Enabling the Network Alternative #3

The steps below work on QEmu regardless of which operating system you are running.

If you are having trouble getting an internet connection inside QEmu:

Get the image running in QEmu so that you can see the normal view with the XO icon in the middle. Empty no apps no frame.png

Make sure your mouse is active in QEmu, then press ctrl+alt+2 together.

This will bring up a screen like a command line, called the QEmu monitor.

Type the following:

sendkey ctrl-alt-f1

And press return.

Then with the keyboard hold down the following keys: ctrl+alt+7

Another text based screen will appear, asking you to log-in. Sometimes there can be an extra "1" after the word "Login:", just delete it. Type root and press return

Then type:

dhclient

or

ifup eth0:

You should see the screen fill with text.

QEmu running dhclent.png

Some of the numbers have been removed from the screenshot above - they're not important.

Then hold down the following keys on the keyboard: ctrl+alt+2

and type the following:

sendkey ctrl-alt-f7

Justin: Using the latest disk image (Build 385), I found that it was "ctrl-alt-f3" that returned to the Sugar interface.

Then using the keyboard, hold down the following keys: ctrl+alt+1

Now open the browser and you should have internet access.

Sugar browser with frame google home page.png OLPC 20070104.png


Builds between 445 and 48? -- Workaround for "Cannot find root filesystem!" preventing boot

Fixed by 494.

Build 445 was the last version which booted cleanly under qemu (ticket). More recent builds require workarounds. Build 485 resolved one problem.

  • When booting on qemu, add root=/dev/hda to the grub kernel line. This needs to be done every time.
    1. When you start your xo disk image on qemu, you should see a blue grub screen, doing a "Booting .. in N seconds" countdown. Press space to interrupt it.
    2. Press e (edit). This will show you 3 lines.
    3. Move to the second, which begins "kernel". Press e. This will take you to the end of the kernel line.
    4. Add root=/dev/hda1 Then press enter.
    5. Press b to continue booting.
(This workaround avoids "WARNING: Cannot find root file system!", and being dropped into an emergency shell.)

Should add instructions to modify the image's grub config, so this doesn't need to be done every time you boot. MitchellNCharity 12:04, 3 July 2007 (EDT)

It might be worth gathering the currently scattered notes, into a single list of step by step instructions, for getting from nothing, to a pair of qemu images running with Xephyr's and ssh. MitchellNCharity 12:04, 3 July 2007 (EDT)

And some related content from elsewhere:

0. Press any key to interrupt the countdown to boot. Then,

  1. Press e.
  2. Press down-arrow to get the "kernel" line.
  3. Press e. This takes you to the end of the kernel command line.
  4. Type space and root=/dev/hda1
  5. Press Enter.
  6. Press b.
mv /boot/grub/grub.conf /boot/grub/grub.conf.orig
awk '/kernel/ {print $O,"root=/dev/hda1";next} {print}' < /boot/grub/grub.conf.orig > /boot/grub/grub.conf
grub-install hd0

If grub-install hangs, just kill it. It may even have worked anyway.


Builds between 445 and 485, non-inclusive -- Workaround for netfs preventing boot

Fixed in build 485.

  • The boot currently hangs in rc netfs. So we disable it. This only needs to be done once.
    1. Get a shell. Do this by following the instructions below, but add a "2" to the end of the kernel line. So it is root=/dev/hda1 2
    2. Log in as root, no password.
    3. Then:
mv /etc/rc.d/rc3.d/S25netfs /etc/rc.d/rc3.d/DISABLED-S25netfs
mv /etc/rc.d/rc5.d/S25netfs /etc/rc.d/rc5.d/DISABLED-S25netfs
4. Done. Now restart qemu, following the instructions below.
(This workaround avoids the boot hanging after saying "Mounting other filesystems:".)


New sections get added to the top of the page.