Wednesday, May 10, 2017

LFS once more

I've got nothing terribly exciting going on with virtual machines right now. No itches to scratch.

What I do have is my old computer and it's gathering dust; along with some external USB hard drives.

 I tried Linux From Scratch before. I compiled everything, booted but there were configuration weirdnesses.

I'm going to do something different this time.

This time I'm going to boot and work from the Mint 18 usb disk, use the external HD as a download and work area ($LFS) and have sda set as my target.

If this works, this should make things a LOT easier than trying to split up one hard drive between Mint and LFS.

I'll post my results if I get any!

Wednesday, March 8, 2017

Back to Virtual NetBSD


I was mistaken in my last post about Openindiana. It appears to compile, but never reaches the point where the final packages are made. It's probably a problem with my sunstudio setup -I don't feel like chasing it down when there's alternatives to play with.

I'm very fond of NetBSD -have been for fifteen or so years now.

Sadly, for nine and a half years I haven't been able to get it to work with real hardware. At first it didn't like my sata drives (in a computer now long-since gone), these days it doesn't like my wifi or my wireless mouse.

...thank God for virtualization, huh?

make release started at:  Wed Mar  8 00:49:50 AKST 2017
make release finished at: Wed Mar  8 02:16:35 AKST 2017
===> Successful make release
===> build.sh ended:      Wed Mar  8 02:16:35 AKST 2017
===> Summary of results:
         build.sh command:    ./build.sh -x -j 6 -r release
         build.sh started:    Wed Mar  8 00:49:44 AKST 2017
         NetBSD version:      7.1_RC2
         MACHINE:             amd64
         MACHINE_ARCH:        x86_64
         Build platform:      NetBSD 7.1_RC2 amd64
         HOST_SH:             /bin/sh
         No $TOOLDIR/bin/nbmake, needs building.
         Bootstrapping nbmake
         MAKECONF file:       /etc/mk.conf
         TOOLDIR path:        /usr/src/obj/tooldir.NetBSD-7.1_RC2-amd64
         DESTDIR path:        /usr/src/obj/destdir.amd64
         RELEASEDIR path:     /usr/src/obj/releasedir
         Removing /usr/src/obj/tooldir.NetBSD-7.1_RC2-amd64
         Removing /usr/src/obj/destdir.amd64
         Created /usr/src/obj/tooldir.NetBSD-7.1_RC2-amd64/bin/nbmake
         Updated makewrapper: /usr/src/obj/tooldir.NetBSD-7.1_RC2-amd64/bin/nbmake-amd64
         Successful make release
         build.sh ended:      Wed Mar  8 02:16:35 AKST 2017
===> .
 tldr; it only takes an hour and a half to rebuild NetBSD on my i5. Not too shabby.

The next task is to build firefox, fluxbox and some other packages that make life under NetBSD easier.

I love the fact I can set this up to build on another computer and do things on my desktop while it runs. It's a lot better than doing everything all on one -it's almost decadent!

Friday, March 3, 2017

Home VM projects

A few months ago (Oct 2016) I got a second desktop as insurance in case my older one dies (it's well past warranty).

The first thing I did was to hook them up ethernet-to-ethernet with a crossover cable. The new computer is weaker than the old one, so I am slowly setting up the old one as a combination router and build machine.

I've done a couple of things with Virtualbox. The first was to create a Windows VM to use for Poser 11; it seems to work OK but I haven't played with it a lot. The second thing was to install the extention pack and play with hooking up an old usb HD to it, and share it between computers -running FreeBSD/UEFI on it. That didn't work terribly well. Both computers could see the drive, but the FreeBSD install got confused and after a couple of sessions wouldn't boot.

I am using VB on both computers. On the weaker computer, I have a Linux VM that has a self-compiled SIMH on it. Following this tutorial ( http://gunkies.org/wiki/Installing_4.3_BSD_on_SIMH ) I was able to get 4.3 up quickly, and was delighted to find out that I could set up tap networking and ftp back and forth to the machine -though I can't get telnet to work at all. I managed to get a few old GNU things to work. I've been trying to figure out how to 'upgrade' the vax780, but no luck yet. I think I simply am missing too much training and background info that people knew back then.

 I am playing with setting up tap instances on both; on the router I have tap interfaces set up (manually) and am connecting to qemu instances running there.

Today I set up an OI kvm machine to use as a build VM. Here's my latest OI build and not much has changed, honestly...a build still takes a little over two hours.

qemu commandline;

cat bin/hipster
qemu-system-x86_64 -vga std -global VGA.vgamem_mb=256 -smp 4 -m 5G -cpu host -enable-kvm -drive file=$HOME/qemu/x86/hipster17/36G.qcow2,media=disk,if=virtio,index=0,format=qcow2 -boot c -net nic,model=e1000 -net tap,ifname=tap0,script=no,downscript=no -vnc 10.42.0.1:3399&


Output in virtual machine;

random@vipster2017:~$ cd /code/illumos-gate/
random@vipster2017:/code/illumos-gate$ time ./nightly.sh illumos.sh

real    47m39.132s
user    129m2.518s
sys     27m36.835s
random@vipster2017:/code/illumos-gate$



I ran that as a regular user in the Hipster vm, not root.

Setting up /etc/rc.local to set up tap turned out to not be the greatest idea, so I'm using that script in $HOME/bin and calling it with sudo when I need a tap interface.

So, I'm making progress in setting up a home network of computers but I have a lot of organizing left to do.

Friday, September 2, 2016

Catching up

Hi, folks!

The last few months have been mostly a matter of making some small, steady progress. This blog is intended as my reference notes, so here's the notes:

1)
The tap stuff I wrote about seems to mostly be irrelevent. After adding a script[1] to /etc, when using qemu I'm able to just do:

-net nic -net tap

And the tap interface "just works".

Simh/vax seems to work too -somewhat. Still ironing that out.

2)
Qemu has the -saveconfig and -readconfig options. They save a hell of a lot of typing!

3)
I saved the following off of the debian/sparc page for the sake of reference:

As mentioned earlier, the Debian SPARC64 port only supports 64 bit SPARC processors which correspond to the following sun4 architectures / processors.

    sun4u
        SPARC64 VI
        SPARC64 VII
        SPARC64 VII+
        UltraSPARC I
        UltraSPARC II
        UltraSPARC III
        UltraSPARC IV
    sun4u1
        UltraSPARC II
    sun4us
        SPARC64V
        SPARC64V+
    sun4v
        SPARC T3
        SPARC T4
        SPARC T5
        SPARC T7
        SPARC64 X
        SPARC64 X+
        UltraSPARC T1
        UltraSPARC T2
        UltraSPARC T2+

The Debian SPARC64 port is stable on most machines using these architectures / processors, but not all of them. Kernel support for the hardware found in these machines is the biggest factor in whether a particular machine is supported or not.
That's really about it. PCem has made great progress, but because reasons I haven't played with it much.  Neozeed has compiled a version with networking for the latest version ...it doens't compile on Linux, and using it on wine is flaky.

I guess it's simh/qemu/virtualbox for now!

[1](/etc/qemu-ifup):
 #!/bin/sh
#
# Copyright IBM, Corp. 2010 
#
# Authors:
#  Anthony Liguori
#
# This work is licensed under the terms of the GNU GPL, version 2.  See
# the COPYING file in the top-level directory.

# Set to the name of your bridge
BRIDGE=br0

# Network information
NETWORK=192.168.53.0
NETMASK=255.255.255.0
GATEWAY=192.168.53.1
DHCPRANGE=192.168.53.2,192.168.53.254

# Optionally parameters to enable PXE support
TFTPROOT=
BOOTP=

do_brctl() {
    brctl "$@"
}

do_ifconfig() {
    ifconfig "$@"
}

do_dd() {
    dd "$@"
}

do_iptables_restore() {
    iptables-restore "$@"
}

do_dnsmasq() {
    dnsmasq "$@"
}

check_bridge() {
    if do_brctl show | grep "^$1" > /dev/null 2> /dev/null; then
    return 1
    else
    return 0
    fi
}

create_bridge() {
    do_brctl addbr "$1"
    do_brctl stp "$1" off
    do_brctl setfd "$1" 0
    do_ifconfig "$1" "$GATEWAY" netmask "$NETMASK" up
}

enable_ip_forward() {
    echo 1 | do_dd of=/proc/sys/net/ipv4/ip_forward > /dev/null
}

add_filter_rules() {
do_iptables_restore <# Generated by iptables-save v1.3.6 on Fri Aug 24 15:20:25 2007
*nat
:PREROUTING ACCEPT [61:9671]
:POSTROUTING ACCEPT [121:7499]
:OUTPUT ACCEPT [132:8691]
-A POSTROUTING -s $NETWORK/$NETMASK -j MASQUERADE
COMMIT
# Completed on Fri Aug 24 15:20:25 2007
# Generated by iptables-save v1.3.6 on Fri Aug 24 15:20:25 2007
*filter
:INPUT ACCEPT [1453:976046]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [1605:194911]
-A INPUT -i $BRIDGE -p tcp -m tcp --dport 67 -j ACCEPT
-A INPUT -i $BRIDGE -p udp -m udp --dport 67 -j ACCEPT
-A INPUT -i $BRIDGE -p tcp -m tcp --dport 53 -j ACCEPT
-A INPUT -i $BRIDGE -p udp -m udp --dport 53 -j ACCEPT
-A FORWARD -i $1 -o $1 -j ACCEPT
-A FORWARD -s $NETWORK/$NETMASK -i $BRIDGE -j ACCEPT
-A FORWARD -d $NETWORK/$NETMASK -o $BRIDGE -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -o $BRIDGE -j REJECT --reject-with icmp-port-unreachable
-A FORWARD -i $BRIDGE -j REJECT --reject-with icmp-port-unreachable
COMMIT
# Completed on Fri Aug 24 15:20:25 2007
EOF
}

start_dnsmasq() {
    do_dnsmasq \
    --strict-order \
    --except-interface=lo \
    --interface=$BRIDGE \
    --listen-address=$GATEWAY \
    --bind-interfaces \
    --dhcp-range=$DHCPRANGE \
    --conf-file="" \
    --pid-file=/var/run/qemu-dnsmasq-$BRIDGE.pid \
    --dhcp-leasefile=/var/run/qemu-dnsmasq-$BRIDGE.leases \
    --dhcp-no-override \
    ${TFTPROOT:+"--enable-tftp"} \
    ${TFTPROOT:+"--tftp-root=$TFTPROOT"} \
    ${BOOTP:+"--dhcp-boot=$BOOTP"}
}

setup_bridge_nat() {
    if check_bridge "$1" ; then
    create_bridge "$1"
    enable_ip_forward
    add_filter_rules "$1"
    start_dnsmasq "$1"
    fi
}

setup_bridge_vlan() {
    if check_bridge "$1" ; then
    create_bridge "$1"
    start_dnsmasq "$1"
    fi
}

setup_bridge_nat "$BRIDGE"

if test "$1" ; then
    do_ifconfig "$1" 0.0.0.0 up
    do_brctl addif "$BRIDGE" "$1"
fi

Tuesday, January 19, 2016

updating netbsd-7 with kvm

KVM commandline (on host):
 screen -S qemu06 /usr/local/bin/qemu-system-x86_64 -enable-kvm -cpu host -smp 4,cores=4,maxcpus=8 -m 2048 -net nic,model=e1000 -net tap,ifname=tap5,script=no -hda /home/random/qemu/x86/n7cde/cde.vdi -nographic
====
build command (inside VM):
time ./build.sh -x -r -j4 release iso-image

=====
make iso-image started at:  Tue Jan 19 18:56:17 AKST 2016
make iso-image finished at: Tue Jan 19 18:57:22 AKST 2016
===> Successful make iso-image
===> build.sh ended:      Tue Jan 19 18:57:22 AKST 2016
===> Summary of results:
         build.sh command:    ./build.sh -x -r -j4 release iso-image
         build.sh started:    Tue Jan 19 17:11:58 AKST 2016
         NetBSD version:      7.0.0_PATCH
         MACHINE:             amd64
         MACHINE_ARCH:        x86_64
         Build platform:      NetBSD 7.0 amd64
         HOST_SH:             /bin/sh
         No $TOOLDIR/bin/nbmake, needs building.
         Bootstrapping nbmake
         MAKECONF file:       /etc/mk.conf
         TOOLDIR path:        /usr/src/obj/tooldir.NetBSD-7.0-amd64
         DESTDIR path:        /usr/src/obj/destdir.amd64
         RELEASEDIR path:     /usr/src/obj/releasedir
         Removing /usr/src/obj/tooldir.NetBSD-7.0-amd64
         Removing /usr/src/obj/destdir.amd64
         Created /usr/src/obj/tooldir.NetBSD-7.0-amd64/bin/nbmake
         Updated makewrapper: /usr/src/obj/tooldir.NetBSD-7.0-amd64/bin/nbmake-amd64  
         Successful make release
         Successful make iso-image
         build.sh ended:      Tue Jan 19 18:57:22 AKST 2016
===> .
     6324.10 real     12894.15 user      4787.03 sys

Sunday, January 17, 2016

Qemu bridging sorted

My original idea was to put a script in $HOME/bin which would start tap interfaces on demand.

That ran into snags when the echo 1 >/proc commands would give me permission errors.

Then I had the idea -make everything permanent and throw it all into /etc/rc.local.

Not the most elegant solution -but at least now I have six guarenteed tap interfaces to work with!

here's the code to put in /etc/rc.local (warning, make sure your distro supports /etc/rc.local..many newer ones may not);

 echo 1 > /proc/sys/net/ipv4/ip_forward
 echo 1 > /proc/sys/net/ipv4/conf/wlan0/proxy_arp

for x in {0..5}
 do
  tunctl -u random 
  sudo ip link set tap$x up
  echo 1 > /proc/sys/net/ipv4/conf/tap$x/proxy_arp
  route add -host 192.168.200.2$x dev tap$x
done

exit 0
===
Rebooted, works for me! So far, at least.

My next problem to work out involves figuring out how to kill headless qemu sessions (x86 doesn't give any output when done with -nographic).

Saturday, January 16, 2016

struggling with qemu bridging

I think I almost have this figured out.

I read these two blogs:
https://shanetomlinson.com/2009/bridging-a-wireless-card-in-kvmqemu/
and
http://blog.bodhizazen.net/linux/bridge-wireless-cards/

Basically I'm creating a new route on a new interface (tap*) and connecting through that.


router=192.168.200.1
Host=192.168.200.100

So, I install everything I need and might need

sudo apt-get install uml-utils bridge-utils

from bodhi's blog;
C : Tap. We do not assign a ip address to the tap, rather we assign a route on the host. This route will become the ip address of the guest.
route = 192.168.0.20
This is important to note.
So far it seems that what that means is that for each virtual machine you want to make, you'll need to make a new tun device and add it's IP to the host machine's routing table.

On the host after each reboot the tun device(s) ..one for each vm.. need to be remade.

So, the important numbers for my configuration;
router: 192.168.200.1
host:192.168.200.100
tap0:192.168.200.20
tap1:192.168.200.21
and so on (tap2 .22;tap3 .23 etc)

So we take the following steps to make a tap device
sudo -s
tunctl -u $USERNAME (note; use your actual username, not "$USERNAME")
echo 1 > /proc/sys/net/ipv4/ip_forward
echo 1 > /proc/sys/net/ipv4/conf/wlan0/proxy_arp
echo 1 > /proc/sys/net/ipv4/conf/tap0/proxy_arp
ip link set tap0 up
route add -host 192.168.200.20 dev tap0

Then in the virtual machine you can use 192.168.200.20 as the IP, 192.168.200.100 as the gateway and 192.168.200.1 as the nameserver.

For example, I have an openbsd/sparc64 VM I've configured thusly;
/etc/hostname.ne0 contains:
inet 192.168.200.20 255.255.255.0
/etc/mygate contains:
192.168.200.100
/etc/resolv.conf contains:
lookup file bind
nameserver 192.168.200.1 (note, on netbsd I had to change this to 8.8.8.8 in order to work)


to make additional tap interfaces you simply re-run the tunctl command, echo 1 to a new /proc.../tapX/proxy_arp, ip link set tapX up and then add the IP you want the new interface to have to the routing table.

For instance, assuming you've already set up tap0, to set up tap1 to have the IP of 192.168.200.30 you'd run the following commands;

sudo -s
tunctl -u $USERNAME
echo 1 > /proc/sys/net/ipv4/conf/tap0/proxy_arp
ip link set tap1 up
route add -host 192.168.200.30 dev tap1

...and bob's your uncle; your tap1 is ready to use.

After you've set up your interface you can invoke it in qemu by adding the following to your qemu invocation;

-net nic -net  tap,ifname=tap0,script=no


automating zfs mounts -a quick and very dirty script

 #!/bin/sh for x in obj xsrc src pkgsrc pkgsrc/distfiles pkgsrc/packages pkg         do zfs create ext/$x zfs set mountpoint=/usr/$x ext/$x ...