From 93e59c2349c988f515b4fe8fb556e84747cb695f Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Tue, 4 Sep 2007 02:17:45 +0200 Subject: Running GNU/Hurd systems; QEMU. --- Distrib.mdwn | 2 +- Distrib/HurdOnQEMU.mdwn | 142 ------------------------------------- Distrib/QEMU.mdwn | 2 - Hurd/FrequentlyAskedQuestions.mdwn | 2 +- Hurd/running.mdwn | 22 ------ hurd/running.mdwn | 24 +++++++ hurd/running/qemu.mdwn | 142 +++++++++++++++++++++++++++++++++++++ index.mdwn | 2 +- sidebar.mdwn | 2 +- 9 files changed, 170 insertions(+), 170 deletions(-) delete mode 100644 Distrib/HurdOnQEMU.mdwn delete mode 100644 Hurd/running.mdwn create mode 100644 hurd/running.mdwn create mode 100644 hurd/running/qemu.mdwn diff --git a/Distrib.mdwn b/Distrib.mdwn index da1f5b7d..dbdb97a7 100644 --- a/Distrib.mdwn +++ b/Distrib.mdwn @@ -61,7 +61,7 @@ Distribution is in discussion & pre-planning phase Another installation method is using an emulated environment. The [[BochsEmulator]] was originally the recommended virtual machine solution, however most have switched over to QEMU, as it runs faster. -* [[HurdOnQEMU]] - A guide on how to use QEMU to run the hurd. +* [[hurd/running/QEMU]] - A guide on how to use QEMU to run the hurd. * [[BochsFAQ]] - Common questions you should read. * [[VmWare]] - Why using it is discouraged. diff --git a/Distrib/HurdOnQEMU.mdwn b/Distrib/HurdOnQEMU.mdwn deleted file mode 100644 index 7f251b3f..00000000 --- a/Distrib/HurdOnQEMU.mdwn +++ /dev/null @@ -1,142 +0,0 @@ -# Readily Available Images - -(!) Note that these are unofficial images: they have been prepared by -volunteers and may not have been tested extensively. - -* [Disk image](http://www.numenor.art.pl/balrog/hurd/) with an installation of - Debian GNU/Hurd. -* [Announcement](http://lists.debian.org/debian-hurd/2007/09/msg00000.html) of - another image. - - -# What is Needed - -1. First thing is to install [[QEMU]]. -2. A [grub](http://www.gnu.org/software/grub/) boot disk for the floppy disk image needed for booting. The [0\.97 version](ftp://alpha.gnu.org/gnu/grub/grub-0.97-i386-pc.ext2fs) works fine. I downloaded it an renamed to `floppy.img`. -3. You will need a [Debian/Hurd installation CD](http://www.debian.org/ports/hurd/hurd-cd). K14 works fine. - - -# Installing Debian/Hurd with QEMU - -First off you will need to create a disk image using `qemu-img`. I have set mine to 2 gigabytes, although you should be able to get away with less. - - $ qemu-img create hd0.img 2G - -Next you will want to start up QEMU and begin the installation process. The first time you run it you will want to use the `-boot d` option to boot off the cdrom. - - $ qemu -hda hd0.img -cdrom debian-K14-hurd-i386-CD1.iso -fda floppy.img -boot d - -Now at his point do the regular install using `hd0` as your harddrive. Partition it and install the base system. Once you have finished installing the base system select the reboot option as this will ensure the disk is properly un-mounted. When the Debian CD menu comes up again simply close QEMU. - -Now run your image with floppy booting (`-boot a`) and finish the install (`./native-install` .. etc). - -**Important:** Older versions on gnumach needed that the `-M isapc` was passed to qemu. This is not needed anymore. - - -# Mounting Disk Image on Host - -You may wish to mount your disk image on your host system to transfer files. To do this you will first need to find the offset of the partition you wish to mount. - - # fdisk -ul hd0.img - ... - 128 heads, 63 sectors/track, 0 cylinders, total 0 sectors - Units = sectors of 1 * 512 = 512 bytes - - Device Boot Start End Blocks Id System - hd0.img1 * 63 3515903 1757920+ 83 Linux - hd0.img2 3515904 4193279 338688 82 Linux swap / Solaris - -Now take the number of sectors for the beginning of the partition and multiply it by the sector size. My partition starts at sector 63 and I have a sector size of 512 therefor my offset is 32256. - - # mount -o loop,offset=32256 hd0.img /mnt/diskimage - - -# Networking in QEMU - -If you just want to access the internet from within QEMU, you can setup pfinet for QEMU's user-networking: - - # settrans -afgp /servers/socket/2 /hurd/pfinet -i eth0 -a 10.0.2.15 -g 10.0.2.2 -m 255.255.255.0 - -(See also .) - -Outgoing internet connections should just work then, although you might have to setup nameservers in `/etc/resolv.conf` as well. - -If you want to connect from the host system to the Hurd system running in QEMU, you need to setup something more advanced, like bridged networking. - - -## Bridged Networking - -### What is Needed - -1. Your Linux kernel will need 802.1d Ethernet Bridging support and TUN/TAP device driver support. -2. You will need to install [bridge-utils](http://bridge.sourceforge.net). - - -### Setting Up the Host Bridge - -You need to setup a bridge on the host first. This assumes `eth0` is down. I have modified my hosts network startup scripts to automatically setup a bridge, you may want to do this also. - - # brctl addbr br0 - # ifconfig eth0 0.0.0.0 promisc up - # brctl addif br0 eth0 - -At this point you will need to setup `br0` as you would normally `eth0` (`dhcpcd br0` for example). - -### The qemu-ifup Script - -This script gets called when QEMU starts and will attach the tun device to the bridge. QEMU will look for this file at `/etc/qemu-ifup` and that is where I keep mine. - - #!/bin/sh - sudo ifconfig $1 0.0.0.0 promisc up - sudo brctl addif br0 $1 - - -## Setting up the Network in the Hurd - -Now it is time to start-up your QEMU Hurd system and get networking going in there. - -**Important:** Remember you may need to use the `-M isapc` or `-isa` flag if using an older version of the gnumach package. - - $ qemu -hda hd0.img -cdrom debian-K9-hurd-i386-CD1.iso -fda floppy.img -boot a -net nic -net tap - -Once you have logged in as `root` run the `pfinet` translator with values that apply to your network. Think of your QEMU client as another computer in your network. - - # settrans -fgap /servers/socket/2 /hurd/pfinet -i eth0 -a xxx.xxx.xxx.xxx -g xxx.xxx.xxx.xxx -m xxx.xxx.xxx.xxx - -That should do it! Do not forget to edit/update `/etc/resolv.conf` to get DNS working. - - -# Related Links - -These are links that users of [[HurdOnQEMU]] may find helpful. - -[[DebianAfterInstall]] - good source of information pertaining to your system after installation. - -[[Hurd/QemuImageForL4]] - a QEMU image for the Hurd/L4 project. - - -# TODO - -[[IRC]], #hurd, 2007-07-04. - - so, is there a way to use a Debian GNU/Hurd partition (/dev/hda6) with qemu directly? - Don't dare to do that, please. - It will lead to inconsistencies. - Because the Linux kernel thinks that it has complete control over the disk, or something. - In theory you could run something like ``-hda /dev/hda'', having GRUB installed on there to offer you to boot your Hurd system from hda6 and that will even work, but then don't get the idea to stop qemu, mount that partition on your Linux system and restart qemu. That's where I got lots of inconsistencies then, afterwards. - it's probably the same problem as having that partition mounted, suspending to disk, booting into it in the Hurd, and resume Linux - right - That's a different problem. - Then the partitoon is still mounted. - no, I think it is basically the same problem - The file system stuff is cached in the kernel. - you have data that has not been written to disk yet - Right. - and neither is prepared for the resource to be shared - In the azeem-uni scenarion the data is on the file system layer and in my scenarion it's some disk block caching inside the Linux kernel, I guess. - anyway, do you guys think if I use -hda /dev/hda and tell Grub to boot off /dev/hda6, that the rest of hda should be fine, right? - maybe adding -snapshot makes it totally safe - azeem: Should be fine. - Yes. - -The problem is actually that the linux block cache doesn't make any consistency between /dev/hda and /dev/hda6, so if you give /dev/hda to qemu, qemu writings won't be consistent with mounting /dev/hda6 in linux. You can give /dev/hda6 directly to qemu and it will be fine. diff --git a/Distrib/QEMU.mdwn b/Distrib/QEMU.mdwn index 526eb9c7..27086257 100644 --- a/Distrib/QEMU.mdwn +++ b/Distrib/QEMU.mdwn @@ -8,8 +8,6 @@ QEMU has two operating modes: The majority of the program is under the [[LGPL]], with the system mode emulation under the [[GPL]]. -See also: [[HurdOnQEMU]] - ## External links * diff --git a/Hurd/FrequentlyAskedQuestions.mdwn b/Hurd/FrequentlyAskedQuestions.mdwn index 55822a82..0bcb4e79 100644 --- a/Hurd/FrequentlyAskedQuestions.mdwn +++ b/Hurd/FrequentlyAskedQuestions.mdwn @@ -39,7 +39,7 @@ If you still have problems, do not hesitate to make use of the [[MailingLists]] * **_Will GNU work in Vmware?_** * It's highly recommended and easier to get a full image for Bochs. See [[Distrib]] * It didn't use to, [Hurd bootstrap fails](http://lists.debian.org/debian-hurd/2002/debian-hurd-200207/msg00069.html). Vmware is not [free software](http://www.gnu.org/philosophy/free-sw.html) and it is [[Distrib/VmWare]]. We recommend to use [free](http://www.gnu.org/philosophy/free-sw.html) alternatives, like [[Distrib/BochsEmulator]]. - * A faster, more widespread and [free](http://www.gnu.org/philosophy/free-sw.html) recent alternative is [QEMU](http://hurd.gnufans.org/bin/view/Distrib/QEMU). You can find more informations on [[Distrib/HurdOnQEMU]]. + * A faster, more widespread and [free](http://www.gnu.org/philosophy/free-sw.html) recent alternative is [QEMU](http://hurd.gnufans.org/bin/view/Distrib/QEMU). You can find more informations on [[running/QEMU]]. * If someone prefers using VMWare: * It works with VMWare Workstation 4.0.5 build-6030. * Running Debian GNU/HURD in VMWare works for me -- [[Main/MichaelAblassmeier]] - 03 Mar 2004 diff --git a/Hurd/running.mdwn b/Hurd/running.mdwn deleted file mode 100644 index 36f765bf..00000000 --- a/Hurd/running.mdwn +++ /dev/null @@ -1,22 +0,0 @@ -[[license text=""" -Copyright © 2007 Free Software Foundation, Inc. - -Permission is granted to copy, distribute and/or modify this document under the -terms of the GNU Free Documentation License, Version 1.2 or any later version -published by the Free Software Foundation; with no Invariant Sections, no -Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included -in the section entitled [[GNU_Free_Documentation_License|/fdl.txt]]. - -By contributing to this page, you agree to assign copyright for your -contribution to the Free Software Foundation. The Free Software Foundation -promises to always use either a verbatim copying license or a free -documentation license when publishing your contribution. We grant you back all -your rights under copyright, including the rights to copy, modify, and -redistribute your contributions. -"""]] - -* [[Distrib]] - Distributions based on the Hurd -* [[microkernel/mach/gnumach/Xen]] - In Xen -* [[LiveCD]] - Live CDs -* [[Distrib/QEMU]] - In an Emulator -* [[FlashHurd]] - From a flash stick \ No newline at end of file diff --git a/hurd/running.mdwn b/hurd/running.mdwn new file mode 100644 index 00000000..f8a516bd --- /dev/null +++ b/hurd/running.mdwn @@ -0,0 +1,24 @@ +[[license text=""" +Copyright © 2007 Free Software Foundation, Inc. + +Permission is granted to copy, distribute and/or modify this document under the +terms of the GNU Free Documentation License, Version 1.2 or any later version +published by the Free Software Foundation; with no Invariant Sections, no +Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included +in the section entitled [[GNU_Free_Documentation_License|/fdl.txt]]. + +By contributing to this page, you agree to assign copyright for your +contribution to the Free Software Foundation. The Free Software Foundation +promises to always use either a verbatim copying license or a free +documentation license when publishing your contribution. We grant you back all +your rights under copyright, including the rights to copy, modify, and +redistribute your contributions. +"""]] + +* [[Distrib]] - Distributions based on the Hurd +* [[microkernel/mach/gnumach/Xen]] - In Xen +* [[LiveCD]] - Live CDs +* [[QEMU]] - In QEMU +* [[FlashHurd]] - From a flash stick + +* [[Public_hurd_boxen]] diff --git a/hurd/running/qemu.mdwn b/hurd/running/qemu.mdwn new file mode 100644 index 00000000..b7b45126 --- /dev/null +++ b/hurd/running/qemu.mdwn @@ -0,0 +1,142 @@ +# Readily Available Images + +(!) Note that these are unofficial images: they have been prepared by +volunteers and may not have been tested extensively. + +* [Disk image](http://www.numenor.art.pl/balrog/hurd/) with an installation of + Debian GNU/Hurd. +* [Announcement](http://lists.debian.org/debian-hurd/2007/09/msg00000.html) of + another image. + + +# What is Needed + +1. First thing is to install [[QEMU]]. +2. A [grub](http://www.gnu.org/software/grub/) boot disk for the floppy disk image needed for booting. The [0\.97 version](ftp://alpha.gnu.org/gnu/grub/grub-0.97-i386-pc.ext2fs) works fine. I downloaded it an renamed to `floppy.img`. +3. You will need a [Debian/Hurd installation CD](http://www.debian.org/ports/hurd/hurd-cd). K14 works fine. + + +# Installing Debian/Hurd with QEMU + +First off you will need to create a disk image using `qemu-img`. I have set mine to 2 gigabytes, although you should be able to get away with less. + + $ qemu-img create hd0.img 2G + +Next you will want to start up QEMU and begin the installation process. The first time you run it you will want to use the `-boot d` option to boot off the cdrom. + + $ qemu -hda hd0.img -cdrom debian-K14-hurd-i386-CD1.iso -fda floppy.img -boot d + +Now at his point do the regular install using `hd0` as your harddrive. Partition it and install the base system. Once you have finished installing the base system select the reboot option as this will ensure the disk is properly un-mounted. When the Debian CD menu comes up again simply close QEMU. + +Now run your image with floppy booting (`-boot a`) and finish the install (`./native-install` .. etc). + +**Important:** Older versions on gnumach needed that the `-M isapc` was passed to qemu. This is not needed anymore. + + +# Mounting Disk Image on Host + +You may wish to mount your disk image on your host system to transfer files. To do this you will first need to find the offset of the partition you wish to mount. + + # fdisk -ul hd0.img + ... + 128 heads, 63 sectors/track, 0 cylinders, total 0 sectors + Units = sectors of 1 * 512 = 512 bytes + + Device Boot Start End Blocks Id System + hd0.img1 * 63 3515903 1757920+ 83 Linux + hd0.img2 3515904 4193279 338688 82 Linux swap / Solaris + +Now take the number of sectors for the beginning of the partition and multiply it by the sector size. My partition starts at sector 63 and I have a sector size of 512 therefor my offset is 32256. + + # mount -o loop,offset=32256 hd0.img /mnt/diskimage + + +# Networking in QEMU + +If you just want to access the internet from within QEMU, you can setup pfinet for QEMU's user-networking: + + # settrans -afgp /servers/socket/2 /hurd/pfinet -i eth0 -a 10.0.2.15 -g 10.0.2.2 -m 255.255.255.0 + +(See also .) + +Outgoing internet connections should just work then, although you might have to setup nameservers in `/etc/resolv.conf` as well. + +If you want to connect from the host system to the Hurd system running in QEMU, you need to setup something more advanced, like bridged networking. + + +## Bridged Networking + +### What is Needed + +1. Your Linux kernel will need 802.1d Ethernet Bridging support and TUN/TAP device driver support. +2. You will need to install [bridge-utils](http://bridge.sourceforge.net). + + +### Setting Up the Host Bridge + +You need to setup a bridge on the host first. This assumes `eth0` is down. I have modified my hosts network startup scripts to automatically setup a bridge, you may want to do this also. + + # brctl addbr br0 + # ifconfig eth0 0.0.0.0 promisc up + # brctl addif br0 eth0 + +At this point you will need to setup `br0` as you would normally `eth0` (`dhcpcd br0` for example). + +### The qemu-ifup Script + +This script gets called when QEMU starts and will attach the tun device to the bridge. QEMU will look for this file at `/etc/qemu-ifup` and that is where I keep mine. + + #!/bin/sh + sudo ifconfig $1 0.0.0.0 promisc up + sudo brctl addif br0 $1 + + +## Setting up the Network in the Hurd + +Now it is time to start-up your QEMU Hurd system and get networking going in there. + +**Important:** Remember you may need to use the `-M isapc` or `-isa` flag if using an older version of the gnumach package. + + $ qemu -hda hd0.img -cdrom debian-K9-hurd-i386-CD1.iso -fda floppy.img -boot a -net nic -net tap + +Once you have logged in as `root` run the `pfinet` translator with values that apply to your network. Think of your QEMU client as another computer in your network. + + # settrans -fgap /servers/socket/2 /hurd/pfinet -i eth0 -a xxx.xxx.xxx.xxx -g xxx.xxx.xxx.xxx -m xxx.xxx.xxx.xxx + +That should do it! Do not forget to edit/update `/etc/resolv.conf` to get DNS working. + + +# Related Links + +These are links that users may find helpful. + +[[DebianAfterInstall]] - good source of information pertaining to your system after installation. + +[[Hurd/QemuImageForL4]] - a QEMU image for the Hurd/L4 project. + + +# TODO + +[[IRC]], #hurd, 2007-07-04. + + so, is there a way to use a Debian GNU/Hurd partition (/dev/hda6) with qemu directly? + Don't dare to do that, please. + It will lead to inconsistencies. + Because the Linux kernel thinks that it has complete control over the disk, or something. + In theory you could run something like ``-hda /dev/hda'', having GRUB installed on there to offer you to boot your Hurd system from hda6 and that will even work, but then don't get the idea to stop qemu, mount that partition on your Linux system and restart qemu. That's where I got lots of inconsistencies then, afterwards. + it's probably the same problem as having that partition mounted, suspending to disk, booting into it in the Hurd, and resume Linux + right + That's a different problem. + Then the partitoon is still mounted. + no, I think it is basically the same problem + The file system stuff is cached in the kernel. + you have data that has not been written to disk yet + Right. + and neither is prepared for the resource to be shared + In the azeem-uni scenarion the data is on the file system layer and in my scenarion it's some disk block caching inside the Linux kernel, I guess. + anyway, do you guys think if I use -hda /dev/hda and tell Grub to boot off /dev/hda6, that the rest of hda should be fine, right? + maybe adding -snapshot makes it totally safe + azeem: Should be fine. + Yes. + +The problem is actually that the linux block cache doesn't make any consistency between /dev/hda and /dev/hda6, so if you give /dev/hda to qemu, qemu writings won't be consistent with mounting /dev/hda6 in linux. You can give /dev/hda6 directly to qemu and it will be fine. diff --git a/index.mdwn b/index.mdwn index 9665eda4..0d633a26 100644 --- a/index.mdwn +++ b/index.mdwn @@ -46,7 +46,7 @@ The most functional distribution of the Hurd is the one provided by Debian. Find more information about it at the [Debian GNU/Hurd website](http://www.debian.org/ports/hurd/hurd-install). -You can also run the [[Distrib/HurdOnQEMU]]. +There are [[various_possibilities|hurd/running]] of running a GNU/Hurd system. ## What is the Hurd? diff --git a/sidebar.mdwn b/sidebar.mdwn index 4454ce28..17480454 100644 --- a/sidebar.mdwn +++ b/sidebar.mdwn @@ -35,7 +35,7 @@ redistribute your contributions. * *[[About|Hurd/TheGnuHurd]]* * *[[Status|Hurd/GNUHurdStatus]]* * *[[Hurd/Documentation]]* - * *[[Hurd/Running]]*"]] + * *[[hurd/Running]]*"]] * **[[microkernel/Mach]]**[[if test="destpage(microkernel/mach*)" then=" * *[[GNU_Mach|microkernel/mach/gnumach]]* * *[[microkernel/mach/Documentation]]*"]] -- cgit v1.2.3