Emulating the XO/Help and tips/Obsolete

From OLPC
Jump to: navigation, search

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

Obsolete: Configuring X

This sounds like it hasn't been true in at least half a year. MitchellNCharity 18:58, 8 November 2007 (EST)

  • In some builds X is configured to load the Geode driver by default. You need to modify it to load the frame buffer driver instead. In /etc/X11/xorg.conf, go to the "Device" section and change the Driver setting from "amd" to "fbdev"

Obsolete: Change Keyboard Layout

There is now better discussion of this elsewhere. MitchellNCharity 18:29, 8 November 2007 (EST)

  • You can change XKbLayOut in the file /etc/X11/xorg.conf to your keyboard code with for example nano text editor by
  nano /etc/X11/xorg.conf

Build recommendations from around late 500's

Removed from Emulating the XO#Build recommendations on 2007-09-29.

505 is the most recent build known to work in qemu. But 557 may also.

For a time, builds after 541 ran, but collaboration was broken (you couldn't see other laptops).
Many builds between 541 and 505, including 531, 529, and 525, didn't boot. However, some of the later 50x may work.

Actually build 542, the Trial 2 build, introduced a "feature": the configuration is no longer hardcoded to use the server olpc.collabora.co.uk, and has no server prepopulated. You can set the server yourself by editing ~olpc/.sugar/default/config and setting server = olpc.collabora.co.uk and restarting. This should mean that 542 is the preferred image for developing with, since 505 and other 50x are quite old. --morgs 03:54, 21 August 2007 (EDT)
I've added seting the server to the instructions below. Thanks!  :) But for now, we're still stuck at 505, because the workaround for #1977 stopped working. MitchellNCharity 23:25, 22 August 2007 (EDT)
#1977 is now marked fixed. Hopefully once #2981 is fixed, emulation of current builds will again work. MitchellNCharity 10:33, 24 August 2007 (EDT)
#2981 is now marked fixed. If qemu is run with -net nic,model=rtl8139, then NetworkManager no longer needs to be disabled (build 564). Presence services still doesn't seem to work (neither jabber.laptop.org, nor olpc.collabora.co.uk (registered False or True)). Cause unknown. MitchellNCharity 00:39, 2 September 2007 (EDT)
Observations: 557 and 564 seem to behave similarly. wget http://SOME-IP-ADDRESS/ fails (Connecting to SOME-IP-ADDRESS... failed: Network is unreachable.). ifup eth0 fails (Determining IP information for eth0... failed.). nm-tool reports Gateway: 0.0.0.0 Primary DNS: 0.0.0.0 Secondary DNS: 0.0.0.0. Hmm, how does one /sbin/route add -net 0.0.0.0 gw 10.0.2.2 eth0[1] on an xo? MitchellNCharity 01:45, 2 September 2007 (EDT)
I probably simply misconfigured my qemu. -net user -net nic,model=rtl8139 is needed. MitchellNCharity 13:41, 29 September 2007 (EDT)

Build 557 is reported to work on VirtualBox and VMWare, but not qemu. MitchellNCharity 22:52, 19 September 2007 (EDT)

But a qemu workaround is suggested above. MitchellNCharity 00:51, 29 September 2007 (EDT)

Builds 578, 579, 581 are known to not boot #3470 (578, 579 in VMWare, 581 in QEMU). MitchellNCharity 13:55, 15 September 2007 (EDT)

Reported fixed. Buld 593 is reported[2] to run on VMWare. MitchellNCharity 00:51, 29 September 2007 (EDT)


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.