Windows Server Trial License Extension

Because I can never seem to remember this and rebuilding server labs with Windows isn’t exactly trivial or time friendly:

Get help:
slmgr ?

Get license information:
slmgr -dli
slmgr -dlv  (more detail)

Extend the trial license time:
slmgr -rearm

Preserving VirtualBox VM’s and Configurations on a Multi-disk Host

Important background information:

My desktop computer has been running Windows 10 since I bought it about five years ago. It was clear to me that I needed to reinstall the OS but that always involves lots of backups and configuration changes. I’d rather not go through this but sometimes you need to.

My system has two drives: a 225G SSD for the OS install and a 2T hard drive for data. When I originally set VirtualBox up, I configured it to store my VM’s and the ISO farm on the 2T HD. This, it turns out, made my OS refresh easy. I currently have 19 VM’s for my various playgrounds, which would have been a real mess to deal with.

How to:

Before reinstalling the OS, you should update VirtualBox (and the Guest Additions if you also install them) to the latest edition. Make sure everything is working OK by spinning up at least one VM. Once you shut all the VM’s down, you need to locate and copy the VirtualBox configuration directory to a safe backup location. This is a hidden folder typically in your user profile named “.VirtualBox”. This folder holds both your VirtualBox configuration settings and the latest VirtualBox Extensions installer file, both of which you will need later.

Once you shut all the VM’s down, you should consider if you want to back everything up. What I did was to shutdown my computer and disconnect my HD.

WARNING: This may cause issues later. In my case after I installed the new OS and reconnected my HD, my HD assumed a different drive letter. You need to reassign drive letters immediately if this happens. I used Windows “Disk Management” tool to do this.

Once you have installed and updated the new OS, and also have your drive letter changes corrected (see warning above), do the following:

1). Install the latest VirtualBox, it should match the version you updated to prior to the OS reinstall.

2) Start VirtualBox. You will not see any VM’s listed because you have not copied the config file yet. But you should do this before copying the old config file over to the new install.

3) Stop VirtualBox.

4) Copy both the “VirtualBox.xml” and VirtualBox Extension Pack file to the new .”VirtualBox” configuration folder under your user profile, replacing the new config file with your old one.

5) Start VirtualBox and reinstall the VirtualBox Guest Additions.

6) Start up some VM’s. Hopefully everything works. If needed, you could make changes to the VirtualBox.xml file, but you shouldn’t have to.

Basic FreeBSD Desktop Setup

I haven’t setup a FreeBSD server in a while so I decided to have a look at FreeBSD 12.1, which I installed as a guest using VirtualBox. I also decided that I wanted a fairly basic desktop on this install. Below are my notes on what I did to setup the desktop after I had already installed the base FreeBSD system.

First – here is a quick list of commands for working with user setup and package management :

  • adduser - Add new user
  • rmuser - Remove a user
  • chpass - Allows for user modification, including shell
  • chsh - Change shell using editor, chsh -s does not use the editor
  • pw - Modify user and groups
    • Type “pw” to get basic help
    • Another example: "pw usermod help"
Working with packages:
  • pkg help
  • pkg info <name>
  • pkg search <name>
  • pkg search -o <name>   - use this one, provides path
  • pkg install <name>
  • pkg delete <name>
  • pkg upgrade
  • pkg autoremove   - remove stale dependencies
  • pkg clean - clean package cache
  • pkg clean -a   - clean all cached packages
  • pkg audit -F   - Check for vulns

Install bash and VIM:

pkg install bash bash-completion vim Edit vimrc: vim /usr/local/etc/vim/vimrc add: "set background=dark" - Easier to see text "set number" - Always display line numbers

Set up UTF-8:

vim /etc/login.conf (edit default class as below)
     :umask=022:\     (add “\” only)
     :charset=UTF-8:\
     :lang=en_US.UTF-8:

execute "cap_mkdb /etc/login.conf"

Edit /etc/profile:
   vim /etc/profile
        LANG=en_US.UTF-8; export LANG
        CHARSET=UTF-8; export CHARSET
        GDM_LANG=en_US.UTF-8; export GDM_LANG

Logout and login again
execute “locale"

Install Xorg, fonts, and XFCE:

pkg install xorg xfce
pkg install virtualbox-ose-additions
pkg install terminus-font liberation-fonts-ttf

execute "fc-cache -vf"

Add the following to /etc/rc.conf:

vim /etc/rc.conf
   dbus_enable="YES"
   vboxguest_enable="YES"
   vboxservice_enable="YES"

If /etc/X11/xorg.conf does not exist:

cd /root/
X -configure

Add these lines to the following:
vim xorg.conf.new

   Section "Files"
        FontPath     "/usr/local/share/fonts/terminus-font/"
        FontPath     "/usr/local/share/fonts/Liberation/"
        FontPath     "/usr/local/share/fonts/dejavu/"

   Section "Module"
        Load  "dri"
        Load  "freetype"
        Load  "bitmap"
        Load  "type1"

   Section "InputDevice"
        Driver      "vboxmouse"

   Section "Device"
        Option     "DRI" "true"
        Driver      "vboxvideo"

cp xorg.conf.new /etc/X11/xorg.conf

Add to ~/.xinitrc (for each user):

exec /usr/local/bin/startxfce4

Add user account:

adduser
passwd username
pw usermod username -G wheel,operator

As user:
vim .xinitrc
    exec /usr/local/bin/startxfce4

Login as user and start xorg:

startx