How to test if Bacula-fd is running

I just installed a new Bacula client but for some reason the server could not connect to it. I found this out by trying to get the status of the client on the server with the following command:

sudo bconsole
status client=my.client-rd

Here is the things that I checked on the server.

Step 1 – Check that the service bacula-fd is started:

sudo service bacula-fd status

Step 2 – Check the bacula-fd process is bound to the port 9102

sudo netstat -an|grep 9102

Step 3 – Check that you can telnet into the client port from the server.

telnet ip.ad.dr.ess 9102

I found the the client configuration did have the correct client ipaddress but each of these checks enabled me to narrow down the problem.

The Teamviewer daemon is not running – please start the daemon ubuntu

I have just started using Teamviewer on Ubuntu 13.10 to help a few people setup some software on their computers. When I try and launch it pops up a dialogue saying:

The TeamViewer daemon is not running!

Please start the daemon (needs root permissions) before running TeamViewer

teamviewer –daemon start
….

Trying “sudo teamviewer –daemon start” doesn’t actually do anything – so the solution is to:

sudo teamviewer --daemon enable

php ini_set(“memory_limit”) isn’t working at all

If you are trying to set your php memory limit at the top of a php script using the php int_set() and it doesn’t appear to have any affect then there is a chance that you have the PHP Suhosin security extension installed. Suhosin stops a script from being able to increase the memory limit.

If you have the Suhosin extension installed then simply edit /etc/php5/conf.d/suhosin.ini and change:

;suhosin.memory_limit = 0

To:

suhosin.memory_limit = 1G

Or however much memory you would like to allow for the script. Then restart nginx / or apache.

sudo service apache2 restart

Note – if you use int_set() and attempt to set a higher memory limit than allowed in the suhosin settings then it will no have any affect at all.

How to make Teamviewer work on Ubuntu 13.10 – install lib32asound2?

I had a problem installing Teamviewer on Ubuntu 13.10. This is an awesome tool for helping to remote desktop into other Linux or Windows machines. I downloaded the .deb file but when installing it complained:

unresolvable dependency: lib32asound2

I did some research and some various solutions including installing the package which has been removed from Ubuntu:

The lib32asound2 package is deleted from saucy: https://launchpad.net/ubuntu/saucy/amd64/lib32asound2
You can download lib32asound2 from: https://launchpad.net/ubuntu/saucy/amd64/lib32asound2/1.0.25-4ubuntu4
Direct link for a .deb download for lib32asound2: http://launchpadlibrarian.net/139194357/lib32asound2_1.0.25-4ubuntu4_amd64.deb

So, I downloaded the .deb for this package but got even more dependency errors including:

dpkg: error processing lib32asound2_1.0.25-4ubuntu4_amd64.deb (–install):
cannot access archive: No such file or directory
Errors were encountered while processing:
lib32asound2_1.0.25-4ubuntu4_amd64.deb

The Solution:
The solution for me was to install a different Teamviewer installer:

http://download.teamviewer.com/download/teamviewer_linux.deb

God knows why this teamviewer.deb worked for me but it did.

How to reset your Apple password

I forgot the password to my Macbook Pro and it turns out that there aren’t very many short guides on this. However, it turns out that it is very easy to reset the password on a Macbook.

Step 1 – Boot to the Recovery HD:
Restart the computer and after the chime press and hold down the COMMAND and R keys until the menu screen appears Alternatively, restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD and click on the downward pointing arrow button.

Step 2 – When the menu bar appears select Terminal from the Utilities menu. Enter reset password at the prompt and press RETURN. Follow instructions in the dialog window that will appear.

How to repair / restore Grub on Ubuntu using Live CD

I just upgraded Ubuntu and selected the wrong location to install Grub onto. Basically, I installed Grub on /dev/sda1 and not /dev/sda and so I need to repair and installing grub.

I got out an Ubuntu installer cd which is essential a live cd and booted in it up. Then mounted the sda1 partition:

sudo mount /dev/sda1 /mnt

Grub then needs to have access to /dev so:

sudo mount --bind /dev /mnt/dev

To install Grub on sda then:

grub-install /dev/sda --root-directory=/mnt/ /dev/sda

Note: we are using the –root-directory option rather than changing the root directory using the chroot command which sometimes doesn’t work on a live CD.

For a tutorial with more words these two pages might helped you learn more:

Visualising your source code with gource…

This is the settings that worked for me when running gource

xvfb-run -a -s “-screen 0 1280x720x24” gource -s 0.4 -p 0.01 -1280×720  –auto-skip-seconds .4 –multi-sampling –stop-at-end –highlight-users –hide mouse,progress,filenames,dirnames –file-idle-time 0 –background-colour 111111 –font-size 20 –title “Omlet Lib 4_1” –output-ppm-stream – –output-framerate 60 | avconv -y -r 60 -f image2pipe -vcodec ppm -i – -b 8192K movie.mp4

How to remove exif metadata from jpegs using php or command line

There is a method of hacking php using a security flaw in php in how it handles exif meta data embedded in jpeg, png or gif images. You describe this as an EXIF injection attack. As a precaution it is a good idea to strip all EXIF information from any images that are uploaded to your website.

I have found these two tools really useful to do this and this is a quick outline of how we used them:

Removing EXIF meta data from .jpg on Ubuntu / PHP
There is a really good tool called exiftool. There is a version in the Ubuntu repositories – so it is super easy to install.

apt-get install libimage-exiftool-perl

You can then strip exif meta from a jpeg using the command:

exiftool -all=  filename.jpg

So in php this would look like this:

$output = exec(sprintf("exiftool -all= %s", escapeshellarg($_image_path)));

Removing EXIF meta data from .png images on Ubuntu / PHP
The best tool for removing exif information from .pngs is Optipng. You can install optipng on Ubuntu from source using this recipe.

apt-get install optipng

and so again in php it would look something like this:

$output = exec(sprintf('optipng -strip all %s', escapeshellarg($_image_path)));

I hope this helps someone.