Thursday, December 5, 2019

Linux Kernel 5.4 and VirtualBox Puzzle

I've been puzzling over WHY my VirtualBox doesn't work under Linux kernel 5.4 ever since 5.4-RC1 came out.  Last week, Slackware -current made 5.4 the default kernel so I hoped all was well - NOPE!  So I compiled it myself adding in the modules that have always allowed everything to work up until 5.3.x.  That didn't work either.  Bummer.

So I did a bit of research (5 seconds of googling) and it seems there was a lot going on with VirtualBox and Linux kernel 5.4.  First there was this:

Linux 5.4 kernel will no longer make interfaces available so that arbitrary kernel modules may modify page attributes to turn the executable bit on/off. Virtualbox currently is one of such kernel modules doing that.

 Then, it seems, in 5.4-RC7 they added a special "shared folder" area for Virtualbox which was later removed

So, at this time, it seems VirtualBox and Linux kernel 5.4 are not going to play well together until a special new VirtualBox 6.1 candidate is released (designed specifically to work with VirtualBox).  So far, I cannot find this release candidate (5 seconds of googling).

That's ok, I have my box set to always my special vanilla 5.3.x (5.3.15 at the time of this writing).  I just hope this continues to get updates so I don't have to drop back to the 4.19.x LTS kernel.

If you see a release candidate for VirtualBox 6.1 post a response.  I'll do the same (so we're racing).

Monday, October 14, 2019

Slackware 14.2 Under XenServer 7.1

I've always had a networking problem with Slackware as a guest VM under Citrix XenServer (or Citrix Hypervisor, I guess is what they call it these days).  I still prefer Slackware as a desktop and so I set about solving this again recently - this time I would not be thwarted!

I ran across this article: How do I disable 8139too network driver... because lsmod lead me to search for 8139too networking module.  This was an Ubuntu article, so, I'll transmorgify it a bit for Slackware users.   The first thing it suggested was to blacklist 8139 in the modules.  Like the author of this I did not have any luck with that.  It was suggested you use the 8139cp instead (cool!  I didn't even know of its existence before this article).

# lsmod | grep 8139


This revealed 8139too in use and bound with mii, so...

# rmmod 8139too
# rmmod mii
# modprobe 8139cp
# modprobe mii
# /etc/rc.d/rc.inet1 restart

At this point, I had, for the first time ever as a Slackware XenServer guest, a working eth0!

In order to keep it (and use less resources) I created a smaller kernel /boot/initrd.gz by running mkinitrd.

# /usr/share/mkinitrd/mkinird_command_generator.sh

I appended :8130cp to the suggested mkinitrd script:

# mkinitrd -c -k 4.4.14 -f ext4 -r /dev/sda2 -m jbd2:mbcache:ext4:8139cp -u -o /boot/initrd.gz

This seemed to work nicely so I doctored up the boot area a bit:

# cd /boot
# rm System.map
# ln -s System.map-generic-4.4.14 System.map
# rm config
# ln -s config-generic-4.4.14 config

Then I added a section to the /etc/lilo.conf:

 image = /boot/vmlinuz-generic
   label = Slackware
   initrd = /boot/initrd.gz
   root = /dev/sda2
   read-only

And I always add default = Slackware before running lilo -v.

After that, I rebooted and had a Slackware install with a nice lean kernel with a eth0 running as a guest VM under Citrix XenServer (or Hypervisor - I can't get used to that!).
   

  

 

Monday, December 10, 2018

Ansible is so useful - Even for someone who doesn't know how to use it!

I love Ansible!  It is so useful even though my skills with it are very minimal, it is so powerful and useful.  I have about 80 or 90 playbooks that I use over and over.  They're all pretty simple but they get things done.  I forget when and where I can use ad-hoc ansible commands.  I love it when those work though.  I thought I could use ad-hoc to view /etc/resolv.conf and goofed around with -shell and had no success.  Then I found this I had written 13 months ago:

- hosts: all
  sudo: yes
  tasks:
  - name: Display /etc/resolv.conf
    shell: cat /etc/resolv.conf
    register: resolv

  - name: Debug resolv
    debug: var=resolv

  - name: Debug resolv.stdout as part of a string
    debug: msg=`{{ resolv.stdout }}`




Wednesday, November 28, 2018

Codename: Ubuntu Rusty

Just call me Rusty -  with regards to Ubuntu anyway.  Man!  I can't remember how to set the IP in the old Ubuntu.  Now, 18.04 has changed yet again.  I'm a RHELish* user when I'm not using Slackware for my own personal desktop.  Don't get me wrong - Ubuntu is a fine desktop.  I used it from '04 to '09 parting ways when the Unity desktop came into play.  I did enjoy Xubuntu and then later Lubuntu but found my 5+ years of 'buntu had weakened my RHELish skills much in the way the last (nearly 10) years has mu 'buntu skills SO I switched back.  Actually, I always load Ubuntu for other people (non-Unix folks) who want to salvage an old laptop or old desktop that ran Windows 7 or something.  I've had some success stories there.  But I digress.  

This is just a place to save these commands so I don't have to hunt them up YET AGAIN.  


Changing an Ubuntu 18.04 LTS server's name

This is pretty easy.  

$ sudo hostnamectl set-hostname linuxconfig

This note is not (currently) for me: Check for the existence of /etc/cloud/cloud.cfg and change preserve_hostname: false to preserve_hostname: true

Changing the static IP of an Ubuntu 18.04 LTS server

This is no longer in the /etc/network/interfaces.  Instead look in /etc/netplan (sudo -s first or it will not auto-complete leading me to believe it didn't exist).  The file is 50-cloud-init.yaml.

That is all I have to say since this note is mainly for me.  Hopefully I'll know what else to do when I need this information again. 



---
*RHELish (pronounced "relish") is the term I coined for Red Hat -like based systems such as (of course) Red Hat Enterprise Linux, CentOS, Scientific Linux and Oracle Linux. 

Tuesday, November 28, 2017

Slackware14.2-current, VirtualBox and new kernels

I keep blowing up my Slackbuild VirtualBox setup with every new kernel update.  Usually, I can just re-run the Slackbuilds for virtualbox-kernel and virtualbox (with a re-boot in between) and I'm fine. Not today. Tried all kinds of things. Then got weird. I was running the Slackbuild for VirtualBox 5.0.40. I decided to just skip package management and go straight to the source (hey, I'm a Slacker). So, I went to the Oracle Virtualbox site and found this link and then, from the command line ran the following:


curl -O http://download.virtualbox.org/virtualbox/5.2.2/VirtualBox-5.2.2-119230-Linux_amd64.run
sh VirtualBox-5.2.2-119230-Linux_amd64.run

Lots of things works, lots of things complained about symbolic links already existing (step 1 of this script attempted to remove my Slackbuild VirtualBox with, I'd say, partial success), and then it ended on "unable to start kernel drivers". Not a good sign I thought. Just for luck, another reboot. And then, I re-ran "rc.vboxdrv start" AND IT WORKED! So now I'm running 5.2.2!!

So, I fire up an ALL NEW Oracle VirtualBox with lotsa Oracle branding (hmmm... didn't remember all of that). I attempt to start my Windoze VM - no go. It complains about USB 2.0 support not being there and suggests I try installing extensions.

Implementation of the USB 2.0 controller not found!

Because the USB 2.0 controller state is part of the saved VM state, the VM cannot be started. To fix this problem, either install the 'Oracle VM VirtualBox Extension Pack' or disable USB 2.0 support in the VM settings

I re-run extensions. Still no go. So, I retro my VM's USB support from 2.0 to 1.1 (trying to think how often I use USB with a VM anyways?) AND IT WORKED! 


Ok, not the slickest solution in the world. The installer did something with Python bindings, from what I could tell, installed some things, fixed some things, possibly broke my USB 2.0 support but otherwise bailed me out.

So, if you're desperate - you're welcome.

Tuesday, February 21, 2017

The Rare un-iSCSI Commands

I often add iSCSI volumes to Linux servers but, until now, rarely take them away.  That strikes me as odd too.  But, I guess when I get to the point of not using storage, the server is usually going away too.  -Not in this case. 

So, here's the steps for removing all traces of an iSCSI volume.

Step 1: Find the iSCSI Session

[root@localhost]# iscsiadm -m session
tcp: [1] 192.168.0.100:3260,1 iqn.2001-05.com.emc:0-af1ff6-c57ac0bd5-712a2878fd0
533c6-backuppc (non-flash)

Step 2: Disable (logout) current iSCSI session

[root@localhost]# iscsiadm --m node -T iqn.2001-05.com.emc:0-af1ff6-c57ac0bd5-71
2a2878fd0533c6-backuppc --portal 192.168.0.100:3260 -u
Logging out of session [sid: 1, target: iqn.2001-05.com.emc:0-af1ff6-c57ac0bd5-7
12a2878fd0533c6-backuppc, portal: 192.168.0.100,3260]
Logout of [sid: 1, target: iqn.2001-05.com.emc:0-af1ff6-c57ac0bd5-712a2878fd0533
c6-backuppc, portal: 192.168.0.100,3260] successful.


Step 3: Double check that session is logged out

[root@localhost]# iscsiadm -m session                                   iscsiadm
: No active sessions.

Step 4: Permanently delete iSCSI session

[root@localhost]# iscsiadm -m node -o delete -T iqn.2001-05.com.emc:0-af1ff6-c57
ac0bd5-712a2878fd0533c6-backuppc --portal 192.168.0.100:3260


Step 5: Stop iSCSI from running (since targets are gone)

[root@localhost]# service iscsi stop
Stopping iscsi:                                            [  OK  ]            
[root@localhost]# chkconfig iscsi off

Step 6: Remove references to iSCSI in /etc/fstab

[root@localhost]# vi /etc/fstab ...

Friday, August 5, 2016

Slackware and LXC

I have a fresh Slackware 14.2 I've been enjoying since it came out this month.  I needed a hyper-visor and was getting ready to add Xen (the hyper-visor of choice on Slackware).  I like Xen, but I knew the compile times for the Slackbuilds and it's dependencies would probably take more time than I had at the moment.  Then I remembered LXC.  It comes with.

I didn't know much about LXC so did some quick reading.  They say "it's similar to Docker but easier" - I like the sound of that.  So I check it out.  It's EXACTLY like Solaris containers!  Which I've been using for over 10 years - but, again, easier!  It's pretty slick!  And it installs by default on Slackware 14.2 but there's a few things you need to change.

ON THE HOST

Edit the /etc/rc.d/rc.inet1.conf

Slackware does not have a bridged network device by default BUT it does have it defined and commented out.  I found this works nicely except I was expecting my host interface to use eth0 and lxc guest to use br0.  It was not what I expected but it works fine!

# Example of how to configure a bridge:
# Note the added "BRNICS" variable which contains a space-separated list
# of the physical network interfaces you want to add to the bridge.
IFNAME[0]="eth0"
BRNICS[0]="br0"
#IPADDR[0]=""
#NETMASK[0]=""
USE_DHCP[0]="yes"
#DHCP_HOSTNAME[0]=""

Routing = Yes

You will, of course, need your host to route packets so

# chmod 755 /etc/rc.d/rc.ip_forward

And then start it or restart.  I like to restart to make sure everything is the way it needs to be before relying on it.  You could also just

# echo 0 > /proc/sys/net/ipv4/ip_forward


LXC Config

Really the only other thing you need to do is add a bit to /etc/lxc/default.conf.  This worked for me:

root@slacks:~# cat /etc/lxc/default.conf
lxc.network.type=veth
lxc.network.link=br0
lxc.network.flags=up

ON THE LXC GUEST

Just run netconfig and set a static address or DHCP and then restart rc.inet1.  

WHAT LXC GUEST?!!

Oh, I skipped that bit, eh?  Super simple.  Try this:
  
# lxc-create -n lxcguest -t /usr/share/lxc/templates/lxc-slackware
# lxc-start -n lxcguest -d
# lxc-console -n lxcguest  (it'll tell you how to login)

Now, run netconfig.  

What?!  You're already running Slackware on the host and you'd like to try something different?  Just run list the contents of  /usr/share/lxc/templates and then try one or a dozen of the other 18 pre-installed templates.  Like:

root@slacks:~# ls /usr/share/lxc/templates
lxc-alpine*     lxc-cirros*    lxc-openmandriva*  lxc-sparclinux*
lxc-altlinux*   lxc-debian*    lxc-opensuse*      lxc-sshd*
lxc-archlinux*  lxc-download*  lxc-oracle*        lxc-ubuntu*
lxc-busybox*    lxc-fedora*    lxc-plamo*         lxc-ubuntu-cloud*
lxc-centos*     lxc-gentoo*    lxc-slackware*



If you down like any of those, try something else with this command:

# lxc-create -t /usr/share/lxc/templates/lxc-download -n newguest

You will be given an even bigger choice.  Knowing Slackware and how stable it is, I would stay with the local choices to ensure that legendary stability stays as is (but that's just me). 


THE END

Well, that's all of my notes.  Postive comments and any kind of experiences with LXC are always welcome below.  

Tuesday, December 22, 2015

It's a good time to be a Linux sysadmin!

Linux is everywhere now.  It's on my TV, on my Roku, it's the firmware running my SAN hardware, it's the OS behind all of our virtualization platforms. If you know me, you know my technology passions are for Linux, Perl and pretty much anything running open source.  I started using Linux about 1993/94 when I downloaded SLS from GEnie over my 2400 baud modem.  It was kernel 0.99p11.  It booted Linux and ran off of floppy.  Later, I got a larger copy from GEnie using work's 9600 baud connection.  I had to dialup Indy to get a speed that fast!

Later, when Windows 95 came out, I started running Linux as my desktop and I've stuck with it.  I remember that the guys in my office would always reboot their Windows 95 systems at lunch as a preventative measure to prevent accidental lockups.  One time, just prior to lunch, I distinctly remember Ken yelling "Oh  no!  It locked up and I've been working on that spreadsheet for an hour!" I typed "w" to get my uptime:

[rat@localhost Desktop]$ w
 16:39:19 up 99 days,  8:14,  4 users,  load average: 0.25, 0.25, 0.27


Ha!  They can't keep their desktop up half a day - mine's been up for 99 days and still going.  I think to myself: "Linux - I think I'll keep it."

It's been over 20 years.  I can remember telling someone I worked on Unix and Linux systems.  "Ah, a niche OS, eh?"  "Niche?"  Not really.  Unix/Linux was running the Internet before these guys knew there was an Internet.  It's always been the one to run DNS, web servers, DCHP servers, NTP (time protocol), etc.  It ran all the SMTP (mail) and SNMP (network and hardware monitoring).  Linux WAS the back office of any decent sized IT shop. 

Later, Apple forked BSD Unix into its operating system OSX.  Now Apple was Unix!  I was very much at home on the Apple OSX command line.  Everything was there: Bash shell, Perl, and all the core Unix commands.  Pretty cool. 

Next came Windows PowerShell.  So many of the commands were aliased to bash commands that I was once again at home.  I really like Windows 2012 R2 Core and PowerShell.  Each new version of PowerShell adds more and more bash-like aliases.

And now, Microsoft Azure Cloud Services has dozens of versions of Linux you can deploy in their cloud service.  One estimate was that over 75% of the virtual machines in Microsoft Azure Cloud Service were Linux.  Even better - Microsoft runs AZURE on Linux!!  What's more, the Azure services SDK client also runs on Linux!  It was pretty freaky seeing bash scripts with a Microsoft license boiler plate on them.  And now the Office 360 is coming to Linux!

It's not a niche!  It's not going away.  I'd say that, without fan fare, Linus' OS has finally won.  I saw the future 20 years ago.  It is Linux!!

Merry Christmas everyone!

P.S. Don't forget - Linux is the OS running Android phones and the Raspberry Pi.

References:
http://www.wired.com/2015/09/microsoft-using-linux-run-cloud/

Thursday, December 17, 2015

The Joy of Modern Computing

  1. Solaris Zones & Containers
  2. Oracle VirtualBox
  3. Xen 
  4. VMware
  5. KVM 
  6. Heroku
  7. Hyper-V 
  8. Citrix XenServer 
  9. Oracle VM Manager (OVM) 
  10. Amazon Web Services (AWS) 
  11. Microsoft Azure Cloud Services
These are a few of my favorite virtualization platforms that I've been using since 2006. I love virtualization!  I work mainly out of a virtualized desktop running ssh into virtualized systems.   Lately, I've been working a lot with Microsoft Azure Cloud Services.

It's funny how this is perceived by some people unfamiliar with it.  Today in a meeting, some people thought that moving systems to the "cloud" would cause a loss of IT positions.  I never thought so.  My least favorite part of the job is the part that takes .001% of your time - mounting the physical hardware in a rack and wiring it.  If that goes away, I will not miss it at all.

I love that I can clone, copy and snapshot VMs.  Using physical hardware now seems to me like working without a net. I would not want to go back.  Even better is having the services in the cloud.  No messy wires, no failing hard drives (I have an open ticket for one now).  Even backups are a breeze.

I have a 32 bit Windows 7 desktop VM that I migrated from a PC running CentOS 5 under Xen to a PC running Red Hat Linux 6 running KVM (that was a tough migration - but it worked!) and then I moved it again to a PC running Oracle Linux 7 under KVM (much easier move).  So, my Windows 7 has been with me through 3 PCs.  All of my stuff is there - all my files and software.  Virtualized PC's are really cool!

I also run additional VMs on my PC.  If a new distro comes out and I want to see what it looks like - I just load it from the ISO!  I don't have to have spare hardware.  It's great!  I have been running my desktop like this about 6 years and can't imagine doing it any other way.  (I started virtualizing my servers almost 10 years ago).

Lately, as I have built about a dozen various VMs in Azure.  I've been testing the cloning of VMs & filesystems and securing endpoints. (It took some time to figure out how to reserve static addresses.)

Now, I love Linux and my technology passion is learning pretty much anything OpenSource - BUT, even though I could do quite a bit with the cross platform kit for Azure under Linux - most of the work was easier in Powershell.  No problem - because I really like Powershell - BUT, my 32 bit Windows 7 system didn't seem to want to finish the install and hung twice.  I figured it was because it was 32 bit.  Again, thanks to virtualization - No problem - I just loaded up 64 bit Windows 10.  (I tried to like Windows 8 and 8.1 but eventually gave up. Skipping that one.)  Windows 10 is a nice mix and seems more intuitive then its predecessor and ran the Azure Powershell environment which made cloning much easier.

The cool thing is, I can still run my old Windows 7 for as long as it gets patches (and then I could just remove the network and keep it for nostalgia) BUT I also get to run Windows 10 and use the Azure Powershell features I need.

Anyway, Linux and KVM gives you a lot of possibilities and it's free (your VMs, may not be). 


Tuesday, November 17, 2015

Azure and Oracle Linux 6

Typical of my luck - the VERY FIRST Azure VM I install is the Oracle Linux 6.4.  Of course, the first thing I do after a new install is "yum upgrade".  For the first time ever, I get a weird error and cannot complete this:

...
Running rpm_check_debug
ERROR with rpm_check_debug vs depsolve:
kernel-headers is needed by glibc-headers-2.12-1.166.el6_7.3.x86_64
kernel-headers >= 2.2.1 is needed by glibc-headers-2.12-1.166.el6_7.3.x86_64
kernel-uek is needed by oracle-rdbms-server-11gR2-preinstall-1.0-12.el6.x86_64
kernel-uek is needed by oracle-rdbms-server-12cR1-preinstall-1.0-14.el6.x86_64
** Found 4 pre-existing rpmdb problem(s), 'yum check' output follows:
glibc-headers-2.12-1.107.el6_4.4.x86_64 has missing requires of kernel-headers
glibc-headers-2.12-1.107.el6_4.4.x86_64 has missing requires of kernel-headers >= ('0', '2.2.1', None)
oracle-rdbms-server-11gR2-preinstall-1.0-7.el6.x86_64 has missing requires of kernel-uek
oracle-rdbms-server-12cR1-preinstall-1.0-8.el6.x86_64 has missing requires of kernel-uek
Your transaction was saved, rerun it with: yum load-transaction /tmp/yum_save_tx-2015-11-17-08-39DucKzd.yumtx

...


Very strange.  I have never needed to install kernel headers to complete this task before.  So, I install kernel headers and still it insists on installing the UEK kernel - so I do.  Now it allows me to fully patch the system.

Installing : kernel-uek-firmware2.6.32-400.37.12.el6uek.noarch
Installing : kernel-uek-2.6.32-400.37.12.el6uek.x86_64
Installing : kernel-headers-2.6.32-573.8.1.el6.x86_64


I reboot and now my Azure appears to hang.  There is nothing I can do - with no console to see what's going on or choose a different kernel or single user mode.  I'm stuck.  Of course, there is always the procedure of detaching the drive, adding it to a rescue VM, editing, chroot'ing, re-running grub - yeah, fun.



I suspect it is trying unsuccessfully to boot the Unbreakable Linux Kernel (um, yeah, I've seen that break things before).  So, I scrap this new install and start again.  This time, taking it slow.  I remove the item requiring UEK:

yum remove oracle-rdbms-server-11gR2-preinstall oracle-rdbms-server-12cR1-preinstall

I do not need to run Oracle on this system (luckily - because this is really handy if you do) so now I can just install kernel-headers and re-run yum upgrade.  I do this - then reboot and it works.  (Strangely enough - I try Oracle Linux 7 and do not have this issue.  I need to review and see why [updated post later].)

Meanwhile, I run across this blog post from last month stating "UEK2 is not supported on Hyper-V and Azure as it does not include the required drivers".  yup - found that out the hard way.

I also noticed my favorite volume manager LVM is not installed by default.  I needed to add more disk space and would probably need to grow the data area in the future so I add a VG (volume group) for data and create a PV and LV (Physical and Logical Volume) for the data and logging areas.  Seem to work ok.  But the above blog post (from last month) says: "it is recommended that you use standard partitions rather than LVM". It complains mainly of issues with LVM name conflicts with cloned VMs.  I really think that was more of an issue with RHEL 5 (they named everything the same).  Anyway, my LVM group is, so far, unique, so I'm not worried (but I'll have to remember this).

That's all from me.  The documentation above covers a lot of Oracle Linux 6 issues and work-around.  Be sure to click on it.




Monday, April 13, 2015

Getting old browser history for new PC

I just got a new PC.  I have a pretty complicated setup.  I run Linux and use KVM to run Windows 7 for Outlook and Powershell.  I run a lot of VMs.  And, whenever I get a new PC, I migrate the VMs from the old system to the new.  Before I do, I'm in a transition period where I just use virt-manager to run the old VMs off the old system and display on my new desktop (cuts down on monitors & keyboards.

So, I have my shiny new PC and I want to check on my BackupPC servers (I have 3 of them).  I usually just click on them in my quick-launch but the browser history is missing.  I decided to just look at the old history instead of launching the remote (old) version of FireFox for some reason.  And, besides, I need to move that info anyway.

My boss thinks my setup is nuts but he generously donated an extra 1TB drive for my VMs.  I create a VG for this disk and start carving off space.

# lvcreate -L 165G -n lv_oldol6 vg_tank
# mkfs.ext4 /dev/mapper/vg_tank-lv_oldol6

# mkdir /oldol6
# vi /etc/fstab   (add new file system)
# mount /oldol6

Now I have a place to store my data from my old system. So I mount the old system via SSH.

# yum install sshfs
# mkdir /ssh
# cd /ssh
# sshfs me@old.system.ip:/ /ssh/
# tar -cf - . | (cd /oldol6/ && tar -xf - )
# sync   (old sysadmin good luck command)
# updatdb
# locate places.sqlite   (I look for the one in the old place)
# sqlite3 /oldol6/.mozilla/firefox/umw8efgh.default/places.sqlite
SQLite version 3.7.17 2013-05-20 00:56:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"

sqlite> .mode column
sqlite> .header on
sqlite> .schema
sqlite> select url FROM moz_places where title LIKE '%backuppc%';

Ta-dahhh!  That worked nicely.  I find the URL I'm looking for.


Monday, January 5, 2015

Booting Headless M3000 with XSCF and Wyse 55

The nice thing about Sun/Oracle Solaris Sparc systems is THEY JUST RUN!  It had been a while since I had rebooted the M3000 from a cold powered-off state.  We had some weird power issues over the holidays and lost some equipment and crashed others (despite UPS protection and generator backups).

The system was powered off - nothing but XSCF was on.  I couldn't remember the XSCF password.  I was trying root.  As it turns out, you are forbidden from creating an account called "root" on XSCF (it is one of the many reserved words).  I had to create a new user using the following procedure (thank you, Bikash!):

    login: default
Change the panel mode switch to Locked and press return…
Leave it in that position for at least 5 seconds. Change the panel mode switch to Service, and press return…


I did as directed...

 Create a user andrew

XSCF> adduser andrew
 Change the password for andrew

XSCF> password andrew
New XSCF password:
Retype new XSCF password:
 Grant andrew the following privileges, useradm, platadm, aplatop.

XSCF> setprivileges andrew useradm platadm platop
 After that, I was able to log in as my new user and view the errors.  There were none.

        XSCF> showlogs error 

Other options here: showlogs event, showlogs power, showlogs monitor, showlogs console and fmdump.

What I needed to do was boot.  Again, I struggled to remember the procedure for getting to the boot prompt.  I tried the T2 commands to start a console - no luck.  I tried simply console which got me close.  I needed a domain_id that I did not know.  Then I vaguely remembered something and tried this:

    XSCF>  console -d 0


I answered Y to "Do you really want to start console" and then it did nothing.  You need an extra ENTER here before the boot prompt showed up.  Then I typed "boot" and was finished.

It all seems so straight-forward and mnemonic now.  I don't know what my problem was this morning.  :-)

Thursday, December 18, 2014

EVEN MORE Fun with Server Core 2012 R2

And finally, to finish off my Windows Server Core 2012 R2, I install Cygwin!  Advice from the web says preemptively open port 22 for OpenSSHd.


netsh advfirewall firewall add rule name="SSHd" dir=in action=allow protocol=TCP localport=22

Now, download the Cygwin installer:

$client = new-object System.Net.WebClient
$client.DownloadFile( "http://www.cygwin.com/setup-x86_64.exe","c:\windows\temp\setup-x86_64.exe" )

Now, run the installer:

c:\windows\temp\setup-x86_64.exe


Don't forget to configure OpenSShd (in Cygwin Bash):

$ ssh-host-config -y
$ cygrunsrv -S sshd
$ ssh-keygen -t rsa

Assuming you added lots of nice Cygwin utilities, you now have a very useful server.  ;-)


 

More Fun with Windows Server Core 2012 R2

SCONFIG Follow-Up

In my earlier post on using SCONFIG, I mentioned needing to be able to do a few other things from the command line before I could stay immersed in Windows Server Core 2012 R2.  Namely, adding disks and formatting them.  I recently covered that here and here.  There's a couple of other things: Firewall Rules (viewing and setting), mapping network drives (turns out the old "net use" is by far the easiest way for that) and turning off IPv6.

Firewall rules definitely rates its own post.  Mapping drives is trivial as long as they allow you to use the old "net use"command.  Slightly less trivial with Powershell.  Honestly, I would only use the PS way if i was programming something (or it MS took away "net use"command in a future release).  So that leaves IPv6 for this post.  Here's how to disable that: First you have to find the name (alias) of your Ethernet card.  After that, you can display it's settings.

PS C:\Windows\system32> Get-NetAdapter

Name                      InterfaceDescription                    ifIndex Status       MacAddress             LinkSpeed
----                      --------------------                    ------- ------       ----------             ---------
Ethernet 5                Citrix PV Network Adapter #2                 20 Up           BE-EF-B0-1D-FA-CE         1 Gbps
Ethernet 8                Citrix PV Network Adapter #0                 23 Up           FE-ED-BA-5E-BA-11         1 Gbps


PS C:\Windows\system32> Get-NetAdapterBinding -InterfaceAlias "Ethernet 8" | Select-Object Name,DisplayName,ComponentID

Name                                    DisplayName                             ComponentID
----                                    -----------                             -----------
Ethernet 8                              Link-Layer Topology Discovery Responder ms_rspndr
Ethernet 8                              Link-Layer Topology Discovery Mapper... ms_lltdio
Ethernet 8                              Microsoft Network Adapter Multiplexo... ms_implat
Ethernet 8                              Client for Microsoft Networks           ms_msclient
Ethernet 8                              QoS Packet Scheduler                    ms_pacer
Ethernet 8                              File and Printer Sharing for Microso... ms_server
Ethernet 8                              Internet Protocol Version 6 (TCP/IPv6)  ms_tcpip6
Ethernet 8                              Internet Protocol Version 4 (TCP/IPv4)  ms_tcpip 
Now, just disable IPv6...

PS C:\Windows\system32> Disable-NetAdapterBinding -InterfaceAlias "Ethernet 8" -ComponentID ms_tcpip6
And -  TA-DAHH!  That's it.

iSCSI with Powershell and Hyper-V on Windows Core 2012 R2

I found a great link for working with iSCSI drives from Powershell.  The first thing you have to do is turn on iSCSI:

PS C:\Windows\system32> Set-Service -Name MSiSCSI -StartupType Automatic
PS C:\Windows\system32> Start-Service MsiSCSI

Next, tell Windows Server Core where your SAN resides:

PS C:\Windows\system32> New-IscsiTargetPortal -TargetPortalAddress 192.168.12.34
0
 
 
InitiatorInstanceName  :
InitiatorPortalAddress :
IsDataDigest           : False
IsHeaderDigest         : False
TargetPortalAddress    : 192.168.12.34
TargetPortalPortNumber : 3260
PSComputerName         :

I would have thought at this point it would know the iSCSI share but it did not.  Had to run this command:

PS C:\Windows\system32> $target = Get-IscsiTarget
PS C:\Windows\system32> print $target.NodeAddress
Can't find file iqn.2003-06.com.equallogic:0-bf1bf6-56acce3eb-fd0030124795492f-testvol1

PS C:\Windows\system32> Connect-IscsiTarget -NodeAddress $target.NodeAddress

You just need the above TWO commands in black.  I ran the line in red to see what it was looking at (making certain of the IQN before proceeding).  The Connect-IscsiTarget command responds with this:

AuthenticationType      : NONE
InitiatorInstanceName   : ROOT\ISCSIPRT\0000_0
InitiatorNodeAddress    : iqn.1991-05.com.microsoft:testsrv.example.com
InitiatorPortalAddress  : 0.0.0.0
InitiatorSideIdentifier : 412341375678
IsConnected             : True
IsDataDigest            : False
IsDiscovered            : True
IsHeaderDigest          : False
IsPersistent            : False
NumberOfConnections     : 1
SessionIdentifier       : ffffe000cd87c020-4012313700056702
TargetNodeAddress       : iqn.2003-06.com.equallogic:0-bf1bf6-56acce3eb-fd00301...-testvol1                      TargetSideIdentifier    : 4f00
PSComputerName          :

Testing the iSCSI session...

PS C:\Windows\system32> Get-IscsiConnection


ConnectionIdentifier : feffe060cd87c029-1
InitiatorAddress     : 0.0.0.0
InitiatorPortNumber  : 15552
TargetAddress        : 192.168.12.34
TargetPortNumber     : 3260
PSComputerName       :

Looks good so you permanently register it (you don't want your iSCSI volumes disappearing after a reboot after all this).


PS C:\Windows\system32> Get-IscsiSession | Register-IscsiSession

Now, check to see if you have a iSCSI session:

PS C:\Windows\system32> get-IscsiSession


AuthenticationType      : NONE
InitiatorInstanceName   : ROOT\ISCSIPRT\0000_0
InitiatorNodeAddress    : iqn.1991-05.com.microsoft:testsrv.example.com
InitiatorPortalAddress  : 0.0.0.0
InitiatorSideIdentifier : 400301370020
IsConnected             : True
IsDataDigest            : False
IsDiscovered            : True
IsHeaderDigest          : False
IsPersistent            : True
NumberOfConnections     : 1
SessionIdentifier       : bfbfe030cd87c020-400201370020d002
TargetNodeAddress       : iqn.2001-05.com.equallogic:0-af1bf6-66acce3eb-fd02300
                          24795492f-testvol1
TargetSideIdentifier    : 4f00
PSComputerName          :

Looking good.  Now check your drives again:

PS C:\Windows\system32> get-disk

Number Friendly Name                            Operationa Total Size Partition
                                                lStatus                Style
------ -------------                            ---------- ---------- ---------
0      XENSRC PVDISK SCSI Disk Device           Online          88 GB MBR
1      XENSRC PVDISK SCSI Disk Device           Online          40 GB MBR
2      EQLOGIC 100E-00 SCSI Disk Device         Online       77.01 GB RAW

You can see the Dell Equalogic SAN volume has been added as disk number 2.
Now you just need to format the disk and give it a drive letter:

PS C:\Windows\system32> Get-Disk | Where partitionstyle -eq 'raw' | Initialize-D
isk -PartitionStyle MBR -PassThru | New-Partition -AssignDriveLetter -UseMaximum
Size | Format-Volume -FileSystem NTFS -NewFileSystemLabel "iDisk3" -Confirm:$fal
se

DriveLetter FileSystemL FileSystem  DriveType  HealthStat SizeRemain       Size
            abel                               us                ing
----------- ----------- ----------  ---------  ---------- ----------       ----
F           iDisk3      NTFS        Fixed      Healthy      76.91 GB      77 GB

Remember: Get-Disk | Where partitionstyle -eq 'raw' is CRUCIAL if you do not want to initialize a disk with data on it already.

That's it.  You've added an iSCSI drive from the command line.
 

Wednesday, December 17, 2014

Hard Disks with PowerShell

The other day, I needed to extend a Hyper-V iSCSI disk store (after increasing the size on the SAN).  I didn't know how.  One of our consultants used DISKPART - oh yeah - forgot that from NT 3.51 (or perhaps earlier).  I was using PowerShell's Get-Disk but wasn't able to go much further.  So I mocked up a VM to play with.  I added a drive and formatted it (after looking at the Hey, Scripting Guy! blog).
  PS  C:\Windows\system32> Get-Disk | Where partitionstyle -eq 'raw' | Initialize-Disk -PartitionStyle MBR -PassThru |New-Partition -AssignDriveLetter -UseMaximumSize |Format-Volume -FileSystem NTFS -NewFileSystemLabel "disk2" -Confirm:$false

You can run most of the commandlets between the pipes as individual commands (not sure that makes it any easier).

Anyway, once I had my test drive, it was time to expand it.  I halted the system and then made the changes in Citrix XenCenter.  After restarting, I checked to see that the drive was now 40GB instead of 25GB.  HOWEVER, this is misleading.  Although the DRIVE is now 40GB, the partition being used is still only 25GB.

PS C:\Windows\system32> Get-Partition -DiskNumber 1
Disk Number: 1

PartitionNumber DriveLetter  Offset       Size Type
--------------- -----------  ---------    ---- ----
1               E            1048576     25 GB IFS


To expand the disk, I had hoped there was a simple "MaxSize" but instead I found this:


PS C:\> $size = (Get-PartitionSupportedSize –DiskNumber 1 –PartitionNumber 1)

PS C:\> Resize-Partition -DiskNumber 1 –PartitionNumber 1 -Size $size.SizeMax

Ta-dahh!  Sadly, DISKPART is easier.  But, for the PowerShell purists, running Windows Core 2012 R2, this does the trick.

 
 

Friday, September 12, 2014

When your VM gets stuck in suspended mode in Red Hat KVM...

I needed to re-do my network interfaces in KVM - make more bridged Ethernet connection for the VMs to use.  I totally forgot that I had a guest VM running as I began my reboot.  "Suspending SSB2" it says as I panic suddenly realizing what I had done.  It's ok - I've done this before I quickly remember.  It does a great job of automatically suspending and resuming UNLESS YOU JUST HAPPEN TO CHOSE THAT REBOOT TO SCREW UP THE NETWORK CONFIGURATION.

So, it reboots and networking is goofed.  I quickly see what I did, fix and reboot again.  This time it's ok but the SSB2 VM does not start.  I try to start it manually and get the message:

libvirtError: error creating macvtap type of interface: Device or resource busy

Whatever that means.  (It actually means I tried to un-suspend but couldn't talk to the iSCSI network so we're leaving it in limbo).  I google and google and find a lot of folks in the same boat.  They came up with some very iffy and convoluted solutions involving editing multiple XML files, etc.  I follow the threads to the bottom of each.  None of them seem quite right.

New to KVM, I try clonging the non-startable SSB2 and succeed.  It boots and works (requires a lot of network changes, but oh well).

Still not satisfied I see mention of "/var/lib/libvirt/qemu/save/rhel.save"  (it's ssb2.save in my case).  Again some very complicated procedures involving editing multiple XML files, etc. with no guaranteed results by the author.

Since I have a working clone, I figure "What the heck!  I'll just delete "/var/lib/libvirt/qemu/save/ssb2.save" and try starting.  It worked!  -Except for one snag - I already had an exact doppleganger running.  It locked up my virt-manager and the server hard.  After, rebooting all was well.

This worked for me.  On a TEST system.  Use at your own risk.

Thursday, June 5, 2014

Fun with Windows Server Core 2012 R2

As a Unix/Linux admin, I find administering Windows servers boring and tedious.  Until now.  With Server Core 2012, you get Powershell pre-installed.  Some of the windowish apps, still launch little windows (e.g. Xen Tools) but for the most part, I find I can deploy servers much more quickly simply by using SCONFIG.  To me, this is much quicker than hovering a mouse all over trying to find where they've hidden the thing you need now (seems to change in every version).

This isn't Windows Server Core, but you get the idea.  The menus are pretty self explanatory.  I find configuring a system with this much quicker!  All I needed was a command line disk utility (which has been around a long time I know).  Brushing up on the commands, I was able to quickly deploy a new disk.  I will post the command line version of iSCSI when that comes up (soon, I'm sure).
Again, all pretty straight forward.  This looks a little more complicated than the GUI but I'll bet if I raced someone, they would not be able to find the utility, right click, etc. etc. as quickly.

Although this isn't showing it off much, I am really loving the power of Powershell.  I like how all of my Unix commands like ls and cat are already aliased (I used to have to make a ls.bat and cat.bat, etc.).  With Windows Server Core 2012 R2's command line utilities, and powerful shell, I might actually start to enjoy this OS again.  It's becoming more Unix-like everyday - and that's a good thing (for me anyway).


Friday, May 16, 2014

Netbackup Ports

Note to self: After installing the Netbackup client, don't forget to open ports 1556 and 13724 in the firewall.

Simple Things

Having a Red Hat 6 install with no GUI, and little else, made installing Netbackup clients from CDROM rather problematic.  No definition for the CDROM drive was in /etc/fstab so "mount /dev/cdrom" wasn't going to work.  Running "fdisk -l" did not show a CDROM and scanning and grepping dmesg revealed no clues.  Then I found this command:

# wodim --devices

That worked (after running "yum install wodim").  Handy command!