Getting Flickr::API to work on Ubuntu Linux SOLVED

In order to use the Flickr::API example by Gabor Szabo, I needed to create a LWP object specifying the path to the system certificates when creating the Flickr::API object.

Works:

my $flickr_api = Flickr::API->new( {
    key       => $key,
    # secret  => $secret,
    unicode   => 1,
    lwpobj    => LWP::UserAgent->new(
        ssl_opts => { 
            SSL_ca_path => '/etc/ssl/certs',
        },
    ),
}); 

Doesn’t work Perl(reports a 500 error with “Can’t connect to api.flickr.com:443 (certificate verify failed)” ) :

my $flickr_api = Flickr::API->new( {
    key       => $key,
    # secret  => $secret,
    unicode   => 1,
    ssl_opts  => { 
        SSL_ca_path       => '/etc/ssl/certs',
    },
});

You could use Mozilla::CA as brian d foy suggests but the bundled file is from 2014. Personally, I’ll use the certificate files from the OpenSSL project. 🙂

Share Button

HOWTO: Enable 3D Acceleration in VMWare Player/Workstation in Ubuntu Linux 15.04 with Intel Graphics SOLVED

When youVMware start a virtual machine using VMWare Workstation or Player and receive a warning saying 3D Acceleration is not available, you can easily enable it. All you need to do is add a single line to the .vmx file (e.g. “Fedora Linux.vmx”):

mks.gl.allowBlacklistedDrivers = "TRUE"
Share Button

FW: Matt Fischer’s LIMITING LXC MEMORY USAGE (aka How to limit the memory usage of Linux LXC containers and validate the memory limit)

I’ve been playing around with LXC over the past few weeks and one of the things I tried out was limiting the memory that the container is allowed to use. I didn’t plan on explaining all the ins-and-outs of LXC here, but a short description is that LXC provides a virtualizedish environment that is more than a chroot gives you, but less than a full-blown virtual machine. If you want more details, please check out stgraber’s blog post about LXC in 12.04.

Kernel Configuration
The first thing you need to do in order to limit memory usage for LXC is make sure your kernel is properly configured, you need the following flag enabled:

CONFIG_CGROUP_MEM_RES_CTLR=y

If you plan on also limiting swap space usage, you’ll also need:

CONFIG_CGROUP_MEM_RES_CTLR_SWAP=y

These flags are enabled for me in my 12.10 kernel (3.5.0-22) and so presumably you’ll have them in 12.04.
Setting the Cap

First, I’m going to create my container. Following the instructions from stgraber’s blog post, and calling the container “memlimit”:

Read the entire post on Matt Fischer’s blog.

Share Button

HowTo: Plex Home Theatre (Plex client) for Ubuntu Linux!

Installing Plex Home Theater in Ubuntu (or related distributions) is quite easy but it isn’t documented all that well.

sudo add-apt-repository ppa:plexapp/plexht
sudo add-apt-repository ppa:jon-severinsson/ffmpeg 
sudo add-apt-repository ppa:pulse-eight/libcec
sudo apt-get update
sudo apt-get install plexhometheater

You will find it in your desktop menu or you can call it directly:

/opt/plexhometheater/bin/plexhometheater

Plex Home Theater

Share Button

HOWTO: Linux Samba protocol negotiation failed: NT_STATUS_INSUFFICIENT_RESOURCES – SOLVED! Windows XP 2k8 Win7 Win8 Win2012

The issue is the LanmanServer service runs out of memory. We need to boost that up:

On your Windows machine, fire up regedit (Start -> regedit) modify the following registry keys:
HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\LargeSystemCache” from 0 to 1
HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters\Size” from 1 to 3

The problem seems to manifest itself more frequently if you use your Windows box as a file server or a media server. If you can, restart the Windows box. If for some reason you can’t (e.g. your significant other is watching a video on the tv streaming from your Windows box), then you can do effectively the same by restarting the following services:

(Start -> cmd.exe) as administrator
>net stop LanmanServer /y
> net start LanmanServer
> net start Browser
> net start HomeGroupListener

Share Button

HOWTO: Installing and running SAP / Sybase SQL Server 11.0.3.3 esd 6 on Ubuntu Linux using KVM

You can run KVM on just about any modern Linux distribution provided that your host is capable of providing virtualization. The folks over at HowtoForge go through the steps for Ubuntu 12.10.

What you will need for the KVM virtual machine:

  • Ubuntu Server 6.06.2 for Intel x86
  • Sybase SQL Server 11.0.3.3 esd 6 for Linux 32bit (if anyone knows of a location to legally download these let me know)

I used virt-viewer to create the virtual machine but you can create the xml file yourself if you want to. Make sure you specify:

  • Disk bus: IDE using native threads and no caching
  • 1GB of RAM or more
  • VNC or Spice display

my Sybase_11033.xml file:

<domain type='kvm'>
  <name>Sybase_11033</name>
  <uuid>85ffed98-fd6e-8475-37b0-219359c89c25</uuid>
  <description>Sybase SQL Server 11.0.3.3 on Ubuntu 6.06.02 (Dapper Drake)</description>
  <memory unit='KiB'>1048576</memory>
  <currentmemory unit='KiB'>1048576</currentmemory>
  <vcpu placement='static'>1</vcpu>
  <os>
    <type arch='x86_64' machine='pc-1.2'>hvm</type>
    <boot dev='hd'></boot>
  </os>
  <features>
    <acpi></acpi>
    <apic></apic>
    <pae></pae>
  </features>
  <clock offset='utc'></clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/bin/kvm-spice</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none' io='threads'></driver>
      <source file='/var/lib/libvirt/images/Sybase_11033.img'/>
      <target dev='hda' bus='ide'></target>
      <address type='drive' controller='0' bus='0' target='0' unit='0'></address>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'></driver>
      <source file='/home/jason/iso/ubuntu-6.06.2-server-i386.iso'/>
      <target dev='hdb' bus='ide'></target>
      <readonly></readonly>
      <address type='drive' controller='0' bus='0' target='0' unit='1'></address>
    </disk>
    <controller type='usb' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'></address>
    </controller>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'></address>
    </controller>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'></address>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:59:e1:78'></mac>
      <source bridge='br0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'></address>
    </interface>
    <serial type='pty'>
      <target port='0'></target>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'></target>
    </console>
    <channel type='spicevmc'>
      <target type='virtio' name='com.redhat.spice.0'></target>
      <address type='virtio-serial' controller='0' bus='0' port='1'></address>
    </channel>
    <input type='mouse' bus='ps2'/>
    <graphics type='spice' autoport='yes'></graphics>
    <video>
      <model type='qxl' vram='65536' heads='1'></model>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'></address>
    </video>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'></address>
    </memballoon>
  </devices>
</domain>

Go through the install of Ubuntu Server 6.06.2. After it is completed, you will need to modify a few files:

Replace /etc/apt/sources.list with:

deb http://old-releases.ubuntu.com/ubuntu/ dapper main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ dapper-updates main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ dapper-security main restricted universe multiverse
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install alien

Modify /boot/grub/menu.lst adding elevator=deadline:

## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
 defoptions=quiet splash elevator=deadline

## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
##      altoptions=(recovery mode) single
# altoptions=(recovery mode) single

## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
##      howmany=7
# howmany=all

## should update-grub create memtest86 boot option
## e.g. memtest86=true
##      memtest86=false
# memtest86=true

## should update-grub adjust the value of the default booted system
## can be true or false
# updatedefaultentry=false

## ## End Default Options ##

title		Ubuntu, kernel 2.6.15-51-server
root		(hd0,0)
kernel		/boot/vmlinuz-2.6.15-51-server root=/dev/hda1 ro quiet splash elevator=deadline
initrd		/boot/initrd.img-2.6.15-51-server
savedefault
boot

Modify /etc/fstab to increase the size of tmpfs and to set noatime,nodiratime:

/dev/hda1       /               ext3    rw,async,noatime,nodiratime,errors=remount-ro 0       1
tmpfs		/dev/shm        tmpfs   size=900M   0 0

Modify /etc/sysctl.conf to set up the shared memory and virtual memory settings:

vm.overcommit_memory=1
vm.swappiness=5
kernel.shmmax=1073741824
kernel.shmall=1073741824

OPTIONAL: Install samba and winbind so you want to connect to your vm by name but don’t want to set up dns:

sudo apt-get install samba winbind

Modify /etc/nsswitch.conf:

# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.

passwd:         compat
group:          compat
shadow:         compat

hosts:          files dns mdns wins
networks:       files

protocols:      db files
services:       db files
ethers:         db files
rpc:            db files

netgroup:       nis

OPTIONAL (needed for samba/winbind) Modify /etc/samba/smb.conf:

# add netbios name
netbios name = sybase-11033
# modify name resolve order
   name resolve order = bcast lmhosts host wins

*RESTART* the VM

Convert the Sybase RPMs to debian packages (dpkg):

sudo alien -d *.rpm

Install Sybase SQL Server:

sudo dpkg -i *.deb

This will install the software into /opt/sybase.

Add a sybase os user and change the owner of /opt/sybase to the sybase user:

sudo adduser --home /opt/sybase --shell /bin/bash --no-create-home sybase
sudo chown -R sybase:sybase /opt/sybase

I created a /opt/sybase/.bash_profile script but you can also put this in /etc/profile if you wish:

export SYBASE=/opt/sybase

export SYBPLATFORM=linux
export LD_LIBRARY_PATH=$SYBASE/lib
export LC_ALL=default
unset LANG

export PATH=$SYBASE/bin:$PATH

Start the Sybase configuration by running as the sybase user:

$SYBASE/install/sybinit

I would recommend a 100MB or larger master device and sybsystemprocs device for 11.0.3.3. It will install just fine but if you try to start Sybase with more the 32MB of memory, it will fail. If you want to increase it you need to do two things:

  1. Increase max shared memory (kernel.shmmax and kernel.shmall) in /etc/sysctl.conf – which we already did
  2. Set the stack size to unlimited

Setting the stack size to unlimited is easy so in your RUN_server file:

#!/bin/sh
#
# Adaptive Server Information:
#  name:                          SYBASE_11033
#  master device:                 /opt/sybase/master.dat
#  master device size:            76800
#  errorlog:                      /opt/sybase/install/errorlog
#  interfaces:                    /opt/sybase
#

ulimit -s unlimited

/opt/sybase/bin/dataserver -d/opt/sybase/master.dat -sSYBASE_11033 \
-e/opt/sybase/install/errorlog -i/opt/sybase -c/opt/sybase/SYBASE_11033.cfg 

Since this is SQL Server 11.0.3.3, we don’t have to mess with LD_POINTER_GUARD.

Screenshot from 2013-03-10 16:05:31

Why you would use such an old DBMS version? You might have software that requires this version and the software vendor went out of business or discontinued the software with no upgrade path. In any case, Sybase’s SQL Server 11.0.3.3 is still useful.

Share Button

You installed Commodore 64 Emulator Vice (x64) and you can’t type in it? Fixing the “Cannot load keymap ‘x11_sym.vkm'” error

Commodore 64 Emulator
Commodore 64 Emulator
See the "About VICE" command for more info.

XRandR: XRandR reports current display: 1600x900@60
Loading system file `/home/jason/.vice/C64/kernal'.
C64MEM: Kernal rev #3.
Loading system file `/home/jason/.vice/C64/basic'.
Loading system file `/home/jason/.vice/C64/chargen'.
Loading system file `/home/jason/.vice/PRINTER/mps803'.
Error - ROM /home/jason/.vice/PRINTER/mps803: short file.
MPS-803: Error - Could not load MPS-803 charset 'mps803'.
MPS-803: Error - Cannot load palette file `mps803.vpl'.
NL10: Error - Could not load NL-10 ROM file 'nl10-cbm'.
Loading system file `/home/jason/.vice/DRIVES/dos1541'.
IECDriveROM: Warning - Unknown 1541 ROM image.  Sum: 1988651.
Loading system file `/home/jason/.vice/DRIVES/d1541II'.
IECDriveROM: Error - 1570 ROM image not found.  Hardware-level 1570 emulation is not available.
Loading system file `/home/jason/.vice/DRIVES/dos1571'.
Loading system file `/home/jason/.vice/DRIVES/dos1581'.
IECDriveROM: Error - 2000 ROM image not found.  Hardware-level 2000 emulation is not available.
IECDriveROM: Error - 4000 ROM image not found.  Hardware-level 4000 emulation is not available.
Loading system file `/home/jason/.vice/DRIVES/dos2031'.
Loading system file `/home/jason/.vice/DRIVES/dos2040'.
Loading system file `/home/jason/.vice/DRIVES/dos3040'.
Loading system file `/home/jason/.vice/DRIVES/dos4040'.
Loading system file `/home/jason/.vice/DRIVES/dos1001'.
Drive: Finished loading ROM images.
Sound: Available sound devices: pulse alsa uss dummy fs dump wav voc iff aiff soundmovie
Keyboard: Error - Cannot load keymap `x11_sym.vkm'.
Joystick: Linux joystick interface initialization...
Joystick: /dev/input/js0 is Logitech Logitech Dual Action
Joystick: Built in driver version: 2.1.0
Joystick: Kernel driver version  : 2.1.0
Joystick: Warning - Cannot open joystick device `/dev/input/js1'.
Joystick: Warning - Cannot open joystick device `/dev/input/js2'.
Joystick: Warning - Cannot open joystick device `/dev/input/js3'.
Joystick: Warning - Cannot open joystick device `/dev/input/js4'.
Joystick: Warning - Cannot open joystick device `/dev/input/js5'.
Main CPU: starting at ($FFFC).
Main CPU: RESET.
Sound: Opened device `pulse', speed 44100Hz, fragment size 11ms, buffer size 104ms
reSID: MOS6581, filter on, sampling rate 44100Hz - fast
Drive 8: RESET.

Vice
From the user’s perspective, this appears to be a variant of Vice bug #223410 where the Vice system files aren’t being located correctly. In that particular bug, the files were not being copied into the $PREFIX/lib/vice directory (typically /usr/lib/vice). So it is only partially related. With the issue of building Vice 64bit, the files ARE being installed and correctly into $PREFIX/lib64/vice but the application is still looking in $PREFIX/lib/vice. This is easily worked around though:

sudo ln -s /usr/lib64/vice /usr/lib/vice
Share Button

HowTo: Getting the Spice client up and working on Ubuntu 12.10 with libvirt / virt-manager

Unfortunately, when you install the Spice client on Ubuntu 12.x, it doesn’t include everything you need to get it to workUbuntu

sudo apt-get update
sudo apt-get install spice-client-gtk qemu-kvm-spice python-spice-client-gtk

If you’re up to date on your 12.10 patches, you shouldn’t need to modify the libvirt-qemu file for Apparmor but if you have troubles, add it in to /etc/apparmor.d/abstractions/libvirt-qemu:

/usr/bin/qemu-system-i386-spice rmix,
/usr/bin/qemu-system-x86_64-spice rmix,
/run/shm/spice.* rwixm,
/run/shm rw,

As I’m running virt-manager on my laptop and connecting to a server, I created an ssh key so I don’t have to add my password over and over again. See ssh-keygen.

Adding a remote server to virt-manager is very easy. File -> Add Connection
Screenshot from 2013-02-10 13:56:27

Share Button

Tomorrow: Howto Windows 7 32bit AND 64bit Sound with KVM / libvirt and the Spice client

Finally got sound working in a Windows 7 64bit KVM virtual machine with Spice. There are a few conditions for it to work:

  1. ICH6 audio
  2. Spice guest drivers installed NOT VNC
  3. QXL video
  4. QXL driver (64bit)

Since I’m using Windows 7 Enterprise 64bit, I had to build and digitally sign the driver. Not difficult at all but PITA. I’ll write a howto blog post tomorrow.

Share Button

HOWTO: Install SAP Sybase ASE 15.x and Linux Containers (LXC) – Ubuntu Server 13.04

Requirements:

Host OS:

  • Ubuntu Server 13.04 x86-64 (64bit)
  • At least 4GB RAM
  • 300GB available disk space

Sybase Patches:

  • If you’re going to run 32bit SQL Anywhere (or an embedded RSSD with Replication Server), you need to apply a SQL Anywhere patch: http://search.sybase.com/kbx/changerequests?bug_id=694479

Install LXC and the bridge-utils to support a network bridge:

aptitude install lxc debootstrap bridge-utils

Create the network bridge br0:

cd /etc/network

Edit interfaces:
replace:

  auto eth0
  iface eth0 inet dhcp

with:

  # LXC bridge
  auto br0
  iface br0 inet dhcp
      bridge_ports eth0
      bridge_stp off
      bridge_fd 0
      bridge_maxwait 0

  auto eth0
  iface eth0 inet manual

Restart networking:

service networking restart

Create lxc-default-sybase Apparmor profile:

cd /etc/apparmor.d/lxc
cp lxc-default lxc-default-sybase

Edit lxc-default-sybase:
replace:

  profile lxc-container-default flags=(attach_disconnected,mediate_deleted) {

with:

  profile lxc-container-default-sybase flags=(attach_disconnected,mediate_deleted) {

replace/add only if using you’re using LXC version LOWER than 0.7.5-3ubuntu60 – see LXC bug 1021411:

   deny @{PROC}/sys/kernel/** wklx,

with:

   deny @{PROC}/sys/kernel/(^shm)** wklx,

Update the kernel with the new lxc-default-sybase profile

apparmor_parser -r /etc/apparmor.d/lxc-containers

Replace /etc/lxc/lxc.conf with:

lxc.network.type=veth
lxc.network.link=br0
lxc.network.flags=up

# cap the memory available to the container
lxc.cgroup.memory.limit_in_bytes = 2G

Assuming that volume group VG02 exists, let’s create the container with the name of “sybase”, and a logical volume of 100G using the xfs file system:

lxc-create -n sybase -t ubuntu -B lvm --lvname sybase --vgname VG02 --fstype xfs --fssize 100G

Before we start the ‘sybase’ container, we need to update the container configuration to use the lxc-container-default-sybase container:

cd /var/lib/lxc/sybase

Edit config:
replace:

  #lxc.aa_profile = unconfined

with:

  lxc.aa_profile = lxc-container-default-sybase

We’re ready to start the container in console mode (to start it as a daemon add -d):

lxc-start -n sybase

The default login credentials are ubuntu / ubuntu

Let’s switch to root so we can install the packages to support Sybase ASE 15.7:

sudo su - root

Enable up to 512MB of shared memory:

echo "kernel.shmmax = 536870912" >> /etc/sysctl.conf
sysctl -p

Install the packages (nmon is a great os monitoring tool but if you don’t want it, don’t include it):

dpkg --add-architecture i386
apt-get update
apt-get install ia32-libs
apt-get install aptitude libaio1 xauth ia32-libs libstdc++5 nmon ncompress

If you want to install PPA repositories:

apt-get install python-software-properties

We need to set up the locale:

locale-gen en_US.UTF-8
echo 'LANG="en_US.UTF-8"' > /etc/default/locale

Copy the sybase software to your new Linux Container and extract it into a temporary directory.

Because Ubuntu seems to think that gzip can uncompress files compressed with the ‘compress’ command (it really can’t btw), you need to alias the uncompress with /usr/bin/uncompress.real:

alias uncompress='/usr/bin/uncompress.real'

From here, you would install and configure Sybase ASE 15.x as you normally would.

Determine ip address for eth0:

ifconfig|grep "inet addr"

In my case, the eth0 ip address is 192.168.0.115. You will either want to reserve this address with your DHCP server or setup a static ip in /etc/interfaces.

Assuming we want to keep the 192.168.0.115 address for this container, we need to modify the /etc/hosts file:
Replace:

  127.0.0.1 localhost sybase

with:

  127.0.0.1 localhost
  192.168.0.115 sybase
Share Button