Wednesday, August 29, 2012

Upcomming Topics

I ran out of room on my laptop for my Sabayon installation, so I figured it was time to do some housecleaning anyways.  I booted up with my System Rescue CD and got to work.  I haven't used Vista in any meaningful way in quite sometime, so I imaged the partition and deleted it.  I also imaged the laptop recovery partition.  I backed up my home partition and my Vista data partition with a simeple cp -ax.  Then I used fsarchiver to backup the lvm volume of my root system.  Once I had all the backups in place, I deleted everything with fdisk. I booted up my Sabayon live CD, and reinstalled.

Once I had Sabayon in place, I booted back up with my Rescue Tools cd, restored my root partition with fsarchiver, mounted the lv_home with a mount /dev/sg_sabayon/lv_home and restored my home with a cp -ax, setup a chroot environment, made sure I had the same kernel using the kernel-switcher.  Then I rebooted with a Sabayon live CD and restored my boot partition, and whew!!!, it worked!!!  w00t!!!

So, anyway, I'm going to try to write a post per week here.  Some upcoming topics will be:

  • Setting up shares with sshfs
  • Using git and git-annex for file backups
  • Backing up lvm snapshots while running live
If there are any topics you would like me to consider, feel free to leave a comment...

Tuesday, August 21, 2012

ssh to vboxguests

Setup a Host Only Network in Oracle Virtual Box:

Assumptions:

  • User knows how to setup network interfaces for DHCP in linux
  • User knows how to add services to a default run level
  • User knows how to set up a ssh server

Add a Host-only Network


File --> Preferences --> Network
Click on add icon
New interface is vboxnet0
Machine --> Settings --> Network --> Adapter 2
  • Attached To: Host Only Network
  • Name: vboxnet0  
Revisit the IP settings in the new Host only adapter...
File --> Preferences --> Network screwdriver icon
Note the ip address and the Lower Bound of the DHCP range.

Setup Networking on Guest and Host OS'es


Start your guest OS Set up eth1 on your guest account to use DHCP. The host only adapter has a built in DHCP server. If you need to force an ip address to get the adapter set up for a single session only try:
ifconfig eth1 <lowerbound ip from above>
On the host system set up vboxnet0 as DHCP or with the static ip address in the IPv4 box in the picture above like you would any network adapter. I have had no luck getting it to run before Oracle virtual machine is started (e.g. at the default run level) After configuring the adapter to run as a service on the host system, the adapter can be started after on guest OS is running by typing as root:
/etc/init.d/net.vboxnet0 start

<optional>

Create a script to start the vboxnet0 adapter on the fly:

# echo "/etc/init.d/net.vboxnet0 start" >> /home/<user>/start-vnet.sh
# chmod 770 /usr/sbin/start-vnet.sh
# chgrp vboxguest /usr/sbin/start-vnet.sh

Edit the start-net.sh script and insert:

#!/bin/bash
At the top of the file.
Once the vboxnet0 adapter is started you should be able to ssh into your guest OS:

sudo ssh <username on guest OS>@<ip address from ifconfig eth1 on guest OS>


Happy Computing!!!