The Daily WTF: Curious Perversions in Information Technology
Welcome to TDWTF Forums Sign in | Join | Help
in Search

Net BSD shell access

Last post 06-01-2007 2:42 AM by gunny. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 05-11-2007 4:02 PM

    • kvigor
    • Not Ranked
    • Joined on 05-11-2007
    • Posts 6

    Net BSD shell access

    Does anybody out there have a netbsd system I (and others) could get ssh access to for testing purposes? I know, testing is for nancies. Just call me wuss-boy.
  • 05-11-2007 4:31 PM In reply to

    Re: Net BSD shell access

    Man, testing is an anti-WTF behavior!
  • 05-12-2007 1:13 AM In reply to

    • phaedrus
    • Top 500 Contributor
    • Joined on 03-20-2007
    • Seattle Ex-Pat living in the Bay Area
    • Posts 111

    Re: Net BSD shell access

    kvigor:
    Does anybody out there have a netbsd system I (and others) could get ssh access to for testing purposes? I know, testing is for nancies. Just call me wuss-boy.

    I tried not testing.  I really did.  I couldn't help myself.  I had to know it would compile and run cleanly on the judging system.  I couldn't let it go off half-cocked, either.  Of course, I also have 25 check-ins to a subversion repository and a branching strategy.

    First, to answer your stated question.  No.  I do not have a NetBSD install you can ssh to.  If you did, I wouldn't let you compile code for this contest on it (jeez, what do you think I am, crazy?  I'm entering too, I know what's getting compiled out there...). 

    Now, to answer your real question, "How do I test this abomination before I submit?" 

    Since you're going the Unix route, I'm going to assume you are running Ubuntu Purple Poodle.  Hold on to your butts people, and get ready for more WTFery.

    First, you'll need QEMU

    Ok, now that you've installed that on Purple Poodle, you'll need NetBSD.  I installed it on QEMU from the proper install CD.  You can find it here.  The torrent was wicked fast.  Your other option is to get a pre-installed QEMU image, there's one to be found here (it's near the bottom in the disk images section).  It's a minimal install, so I don't know if it has Xwindows installed.  I didn't use it.  If you want to be lazy, you'll have to put some work in.

    Next, you'll need to install NetBSD onto a QEMU image.  It's simple.  First create a QEMU disk image, this command: 'qemu-img create netbsd.img 500M' will create a 500 MiB empty harddrive image.

    Next, fire up QEMU and install NetBSD: 'qemu -cdrom /path/to/netbsd-install.iso -boot d /path/to/netbsd.img'

    Install NetBSD.  You managed to get Purple Poodle shoe-horned onto what ever ol' thing you call a workstation.  NetBSD is actually pretty simple.  It doesn't have a GUI installer though, so be sure to get your blanket of protection +2 if that bothers you.

    Done installing NetBSD?  Great.  Now, you won't even need to get Xwindows setup on the QEMU image.  We'll just take advantage of some of Xwindows' more esoteric features to avoid that little snafu.

    First, make sure you have the tun/tap driver installed on your machine.  It's a kernel module.  Or it probably is.  If it isn't, you probably know what your doing anyway, why are you reading this?  So, to check if you have it, run 'locate tun.ko', if you see a line that looks like: /lib/modules/2.something.orother/stuff/foo/bar/tun.ko then you have it.  Run 'modprobe tun' to install it. 

    You don't have it?  Uh, go turn it on in your config.  It's in the network drivers, like where your ethernet card is.  Somewhere.  Turn it on (module!) and re-run 'make modules modules_install'.  Then you'll be set.  If that was greek to you, maybe you shouldn't be attempting this.

    Finally, boot NetBSD using: 'qemu -net nic -net tap,ifname=tap0,script=no /path/to/netbsd.img'  You'll need to do this as root, so QEMU can setup the tap0 networking interface.  On your linux side, also as root, run something like 'ifconfig tap0 10.1.1.1 netmask 255.255.255.0 up' and on NetBSD (as root) do 'ifconfig ne2 10.1.1.2 netmask 255.255.255.0 up'.

    Use scp or something to get your tarball (as you will submit it) onto your NetBSD virtual machine (your machine's address is 10.1.1.1 if you followed me blindly, sucker).   Untar it and build.  Whatever your instructions are.  You'll probably get to enjoy figuring out how to get stuff to compile on BSD.  It's different, not much, but enough.  Beyond the scope of this lesson.[1]

    So, it built, right?  Then, on Linux, 'xhost +10.1.1.2'.   On NetBSD: 'DISPLAY=10.1.1.1:0.0 ./mywtfery' in whatever directory your binary ended up in.

    Bam.  Your calculator should pop up on your desktop, but it's really running on your NetBSD virtual machine.  And for the record, Xwindows has always been able to do that.

    There's your lesson for the day.  Now, everyone, see how much easier it is to do things on Linux?  Why are you still wasting your valuable time with that MacOSX and MS Windows junk? 

    Notes: [1] If you need help with getting your entry to compile on NetBSD, I'll be available to answer questions on the 15th.  There's a schmaltzy JPEG on the line here folks. 

    All men are frauds. The only difference between them is that some admit it. I myself deny it.
    -- H. L. Mencken
  • 05-12-2007 11:46 AM In reply to

    • phaedrus
    • Top 500 Contributor
    • Joined on 03-20-2007
    • Seattle Ex-Pat living in the Bay Area
    • Posts 111

    Re: Net BSD shell access

    And yes, for the record, I actually did the above to test my program.
    All men are frauds. The only difference between them is that some admit it. I myself deny it.
    -- H. L. Mencken
  • 05-13-2007 3:58 PM In reply to

    • kvigor
    • Not Ranked
    • Joined on 05-11-2007
    • Posts 6

    Re: Net BSD shell access

    Bless ya, phaedrus: you provided many valuable clues and I managed to get get this all up and working on Purple Poodle with only minimal heartache (actually Gentoo for uber-geek-cred). I did have to jump through some NetBSD hoops to get gtk2 and pkg-config installed on the system,  but once I did the both official gtk framework and my hapless entry compiled and worked fine, much to my surprise. Thank you!
  • 05-13-2007 4:46 PM In reply to

    • phaedrus
    • Top 500 Contributor
    • Joined on 03-20-2007
    • Seattle Ex-Pat living in the Bay Area
    • Posts 111

    Re: Net BSD shell access

    Why, you're welcome, kvigor.  I'm glad my deliberatly WTFey documentation was a help. 

    (I developed the technique on the Slackware flavor of Purple Poodle, for the old-sk00l geek cred.) 

    All men are frauds. The only difference between them is that some admit it. I myself deny it.
    -- H. L. Mencken
  • 05-28-2007 8:57 AM In reply to

    • gunny
    • Not Ranked
    • Joined on 05-20-2007
    • Posts 7

    Re: Net BSD shell access

    I get this error message when I try and launch qemu:

    no: could not launch network script
    Could not initialize device 'tap'

    Can anyone help me?

  • 05-28-2007 10:50 AM In reply to

    Re: Net BSD shell access

    gunny:

    I get this error message when I try and launch qemu:

    no: could not launch network script
    Could not initialize device 'tap'

    Can anyone help me?

    Is your sink installed correctly? 

    Download my OMGWTF entry, Romanorum Computus
  • 05-29-2007 12:59 PM In reply to

    • phaedrus
    • Top 500 Contributor
    • Joined on 03-19-2007
    • Seattle Ex-Pat living in the Bay Area
    • Posts 111

    Re: Net BSD shell access

    gunny:

    I get this error message when I try and launch qemu:

    no: could not launch network script
    Could not initialize device 'tap'

    Can anyone help me?

    Ok, it's complaining about setting up the tap ethernet device.  You need a new sink.

    Just kidding.  it's the '-net nic -net tap,ifname=tap0,script=no' portion of the command.  It's trying to setup the tap0 device by running a script called 'no' (that's what the script= stuff means, check the man page).  In qemu 0.9.0, 'script=no' has a special meaning.  In qemu 0.8.2, it doesn't seem to like this. 

    A work around is to make a file called 'dummy' and make it executable:

     

    $ cat dummy
    #!/bin/sh

    echo "do nothing" >/dev/null

    Then use '-net nic -net tap,ifname=tap0,script=dummy'.  You'll have to setup the tap0 device manually.  If you know what you want it to be always, you could actually make dummy into a real script that does an 'ifconfig tap0 ... up'

     

    All men are frauds. The only difference between them is that some admit it. I myself deny it.
    -- H. L. Mencken
  • 06-01-2007 2:42 AM In reply to

    • gunny
    • Not Ranked
    • Joined on 05-20-2007
    • Posts 7

    Re: Net BSD shell access

    phaedrus:
    gunny:

    I get this error message when I try and launch qemu:

    no: could not launch network script
    Could not initialize device 'tap'

    Can anyone help me?

    Ok, it's complaining about setting up the tap ethernet device.  You need a new sink.

    Just kidding.  it's the '-net nic -net tap,ifname=tap0,script=no' portion of the command.  It's trying to setup the tap0 device by running a script called 'no' (that's what the script= stuff means, check the man page).  In qemu 0.9.0, 'script=no' has a special meaning.  In qemu 0.8.2, it doesn't seem to like this. 

    A work around is to make a file called 'dummy' and make it executable:

     

    $ cat dummy
    #!/bin/sh

    echo "do nothing" >/dev/null

    Then use '-net nic -net tap,ifname=tap0,script=dummy'.  You'll have to setup the tap0 device manually.  If you know what you want it to be always, you could actually make dummy into a real script that does an 'ifconfig tap0 ... up'

     

     

    Funny thing is, I do actually need a new sink: the in-sink-erator has died and whenever I put water down it, it regurgitates something which suspiciously resembles the Windows ME source code.

Page 1 of 1 (10 items)
Powered by Community Server (Non-Commercial Edition), by Telligent Systems