Friday, 12 December 2014

FIX: master and slave have equal MySQL server UUIDs

Newer versions of mysql use a unique UUID to do what the server variable server-id used to do.

That means if you need to do master/slave db replication each server will need its own UUID.

If the two servers have the same UUID, you will receive an error when attempting to sync the slave to the master:

master and slave have equal MySQL server UUIDs

If you are creating servers those servers from a virtual machine template then you will need to clear the UUID on each copy you make.

To do this, stop the mysql server and simply remove the file that contains the UUID

rm /var/lib/mysql/auto.cnf  

When you start the server again it will generate a new one automatically.

Tuesday, 7 October 2014

nvidia optimus

Trying to setup Mint Debian on a laptop with nvidia "optimus" is a bit different than the normal routine.

If you just install the nvidia-driver package and do nvidia-xconfig then when you try and reboot X will fail to start with;

"(EE) No Screens Found(EE)"

The reason for this is that the dual video card arrangement that Optimus provides is not supported "out of the box". You need to do a bit of extra work to get it working.

I am assuming that you have already installed the nvidia-drivers and linux kernel headers at this stage.

Next thing to do is make sure you remove /etc/X11/xorg.conf if you already have created that by using nvidia-xconfig. In fact at this point I recommend you remove nvidia-xconfig from your system entirely.

Next install some packages;

apt-get install bumblebee bumblebee-nvidia primus

Now, it would be nice to think that would be it but we do need to edit a file to get things working;

vi /etc/bumblebee/bumblebee.conf

Towards the bottom of the file in the [driver-nvidia] section change this line to look like this;


Reboot and you should be good to go.

You can test this by running this command;

optirun glxgears

Thursday, 2 October 2014

Windows 7 refuses to reconnect to Samba after reboot

Faaaaaark! I have been fighting this off and on now for weeks.

The scenario is this:

The network is a Windows domain. Let's call the domain "WINDOZESUX"

I have a Linux host running Samba that is not a domain member. Let's call it "sambaserver"

sambaserver is configured with:

workgroup = WINDOZESUX

Result: Windows 7 client can successfully mount \\sambaserver\share

That's cool.

Move forward until one of the Windows 7 clients reboots.

Result: Windows 7 client cannot reconnect to the samba share "The user name is not found"

Solution: Delete the saved credentials on the Windows client

Result: Windows 7 client can successfully mount \\sambaserver\share

Rinse, lather repeat.

Much troubleshooting follows. Eventually I had a dim recollection that I had "fixed" this once before by using an IP address instead of DNS

Solution: Use an IP address in the UNC path

Result: Windows 7 client can successfully mount \\\share

Reboot and the share connects automatically without trouble. yay

Now, I was going to leave it at that (and I have for a while) but I really don't want to hard configure IP addresses all over the place because it can become a management disaster for the future.

Now, I have spent hours googling, found thousands of posts for basic errors such as noobs who just didn't have their DNS configured properly at, also a bunch of other posts suggesting that the share was trying to reconnect before the network adapter had come up which plainly was not the case because it worked fine with an IP address. No it was something do with DNS or WINS resolution. Or so I thought.

Suffice to say I spent a lot of time mucking about with WINS, DNS and SAMBA configurations and nothing made a lick of difference.

Eventually while clutching at straws I changed the sambaserver configuration to:

workgroup = LINUXROX

Went through the rinse, lather and repeat process and still it behaved in the same infuriating fashion.

Then while I was poking around in the Windows credential manager, about to delete the credential for the hundredth time, I clicked on "Edit credential"

Lo and behold, the username in the credential manager was shown as WINDOZESUX\username where I am sure the last time I had connected to the share it was using LINUXROX\username

Hmmm. So I changed the entry in the credential manager to the correct LINUXROX\username and rebooted again.

Result: Windows 7 client successfully remounts \\sambaserver\share

FFS. So it appears Windows has a bug (which knowing Microsoft may in fact be a feature) where when you connect to a non domain share from a domain member it does it correctly but when it saves the credentials it goes and changes the goddamned domain from the one you had specified to the domain that the client is on. But it only does that when you use a DNS name. When you use an IP address it works fine. Who knows why? Will Microsoft fix it? Why would they. They might however put up a technet article one day suggesting the solution is to buy a windows server you smelly Linux user.

God I hate Microsoft crap.

In other news, Bordlerlands 2 was just released on SteamOS/Linux!

Thursday, 28 August 2014

Recovering a deleted file that is still held open

I accidentally deleted the disk image file for a running virtual machine. oopsy!

Luckily, there is an easy way to undo that using the lsof command!

lsof | grep /home/qemu/images/my-disk-image.qcow2

This produces output like this;

qemu-kvm  24816      root    9u      REG              253,2 214781394944   21102665 /home/qemu/images/my-disk-image.qcow2 (deleted)

Take note of the first two numbers, which in my case are 24816 and 9 (Note: you must strip the trailing char from the second number)

Pause the VM  (don't stop it!) so that the disk is not being written to while we do the next step.

Now you just need to copy the deleted file back to somewhere safe;

[root@devkvm03 images]# cp /proc/24816/fd/9 my-disk-image.qcow2

Tuesday, 22 July 2014

Using docker on Linux Mint Debian Edition

Installing Docker on LMDE takes a few steps and will require that we add a third-party repository.

Note: We will be logged in as root to issue these commands. Also, I am by no means an expert on this, I am learning this as I go on.

So, with that out of the way let's add the key for the repository;

# apt-key adv --keyserver hkp:// --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9

Next add the repository to your apt sources;

# echo "deb docker main" > /etc/apt/sources.list.d/docker.list

Update apt;

# apt-get update

Install docker;

# apt-get install lxc-docker

Verify that it has worked by downloading and running the ubuntu container;

# docker run -i -t ubuntu /bin/bash
Unable to find image 'ubuntu' locally
Pulling repository ubuntu
e54ca5efa2e9: Download complete
511136ea3c5a: Download complete
d7ac5e4f1812: Download complete
2f4b4d6a4a06: Download complete
83ff768040a0: Download complete
6c37f792ddac: Download complete

Congratulations you are sitting in bash inside your ubuntu container. Type 'exit' or use ctrl-d to exit.

Note: It is important to understand that once you exit a container it ceases to run unless you specifically tell it not to (see below). It is not like a normal virtual machine that keeps on running in the background until you shut it down. To exit a container and have it remain running, use ctrl-p followed by crtl-q.

You probably dont want to be the root user every time you use docker. In that case simply add your user to the docker group;

# usermod -a -G docker myusername

You can list all the running containers with the 'docker ps' command. Add '-a to see the stopped ones as well.

Note: The containers that you create are kept in '/var/lib/docker/containers'

That's the basics of docker. The next thing to learn more about is using docker files to build containers.

Wednesday, 2 July 2014

Libvirt/qemu/kvm as non-root user


A server with KVM

I'm going to use the qemu user that is created when you install KVM but you could use any user you like.

First, your user should belong to the kvm group:

grep kvm /etc/group kvm:x:36:qemu

Create a libvirtd group and add your user to it

groupadd libvirt
usermod -a -G libvirt qemu

Create a new policykit config to allow access to libvirtd using your user account via ssh

vi /etc/polkit-1/localauthority/50-local.d/50-libvirt-remote-access.pkla

Add the following content:

[Remote libvirt SSH access]

Restart libvirt

service libvirtd restart

Tuesday, 1 July 2014

Configuring a Printer With CUPS Web Admin

I couldn't get the printer admin applet in Mint to add a new printer. It just kept saying "Failed to add printer" every time.

Then I discovered that CUPS has a web admin page:


When it ask for a username & password just enter any user with sudo privileges and you are in.

Sunday, 29 June 2014

FIX: Black screen at login for LMDE/Cinnamon

So, I installed a fresh copy of LMDE on a machine. Obviously, that will include doing an apt-get dist-upgrade to ensure every thing is all up to date.

After doing that, I restarted the box and got the Mint login screen, entered my password and got . . . . . a black screen with a mouse pointer and nothing else.

I couldn't find an answer on the Internet so eventually I took a punt and entered:

apt-get install cinnamon

and what would you know, Cinnamon wasn't installed at all. For some, the distribution upgrade had decided to remove Cinnamon altogether. After the install finished I rebooted and all was good again.

Wednesday, 25 June 2014

"Permission denied" using libvirt and kvm on CentOS

If you are trying to create a VM using virt-manager on a KVM/QEMU host and you are getting "permission denied" then you need to either disable selinux or configure it to allow access.

To disable it edit /etc/selinux/config and change it from "enforcing" to "disabled" and then use  this command to make it take effect without rebooting.

setenforce 0

Monday, 23 June 2014

Install KVM on CentOS

Installing KVM on CentOS is pretty simple.

yum install kvm libvirt python-virtinst qemu-kvm

You probably want it to start automatically too:

chkconfig libvirtd on
service libvirtd start

You probably also should configure bridged networking.

And finally, if you would like to use virt-manager to administer your VM's from your Linux desktop you will probably want to setup passwordless key access.

Wednesday, 23 April 2014

I Sure Do Hate Closed Source Software

So, I am required to do some stupid online training module for work and it requires that I connect to their "online lab" using some sort of Citrix client. So I check the Citrix website and was pleased to find packages available there in a variety of formats including as a deb package. Cool! Unfortunately, given that we are talking Shitrix here, I should have been a bit more circumspect in my enthusiasm, because you see, it appears that the numbskulls at Shitrix HQ have seen fit to build their packages (as recently as Nov '13) using long obsoleted ia32 compatibility architecture, even though the package is supposedly built for the AMD64 platform. Yes, you read that right, you download the 64 bit version of the Citrix Receiver 13.0 built in Nov 2013 and it has ia32 dependencies that were removed from most Linux distribution 2 years ago. Retards. Google is awash with people who are unable to install this crapware on everything from slackware to debian because of the idiocy of whoever is in charge of the Linux ports of their craptastic products. Avoid at all costs if possible. As for me I'm going to be forced to use a Windows VM to do this stupid training junk. Thanks Shitrix!

Saturday, 22 February 2014

squid-deb-proxy crashing

I had a problem with squid-deb-proxy crashing. I could see this in the system log:

avahi-daemon[830]: Service group file /services/squid-deb-proxy.service vanished, removing services This happened after I had a "disk full" incident on the server it was running on. I couldn't find that error anywhere on Google so I figured that maybe the cache had been corrupted. So with squid-deb-proxy stopped I deleted everything from inside /var/cache/squid-deb-proxy and started the service again. It hasn't crashed since.

Monday, 10 February 2014

Using apt-get through a proxy.

The network nazi's have blocked your access to the Internet and are forcing everything through a proxy. What to do?  
Well, you can do this. 
Edit or create /etc/apt/apt.conf. Add the following lines; 
Acquire::http::proxy "http://username:password@proxyserver:port/";
Acquire::https::proxy "https://username:password@proxyserver:port/";
Acquire::socks::proxy "socks://username:password@proxyserver:port/";

Saturday, 18 January 2014

FIX: Errors were encountered while processing: mint-debian-mirrors

Trying to upgrade LMDE I received this error;

Errors were encountered while processing:

To fix, install python

apt-get install python