Category Archives: linux

Increasing Size of your VirtualBox virtual disk

Today my PHP application on my linux virtual server was giving me a ton of error on simply allocating space for sessions. I couldn’t have actually ran out of space but it was worth the check.

df -h

100% of my virtual image was used and since I did not want to go to the hassle of re-doing everything again, after a bit of research, this is what I have found that helped me a ton:

VBoxManage modifyhd /path/to/the/virtual/disk/image.vdi –resize 20480

This would work perfectly, but my image wasn’t a VDI it was a VMDK which will throw you an error when you do the same process.

There is a way around it:

1st – VBoxManage clonehd /path/to/the/virtual/disk/image.vmdk /path/to/save/the/new/virtual/disk/image.vdi –format vdi
2nd – VBoxManage modifyhd /path/to/new/virtual/disk/image.vdi –resize 20480

For a 8GB Virtual Image it can take up to 20 minutes for the whole process.

Note: This was done in command line for OSX.

Samba and Vista

I was having this little bit of trouble with Windows Vista accessing my files on the SAMBA server.

After a little research I have found a great post wich gives a great trick to work out the imcopatibility issues between Vista and Samba.

Follow the link: Get Vista and Samba to work

Back to old reliable Xubuntu 9.04

Yesterday, after spending some hours to get all development eviroment set, I have managed to finish the installation of the good and old Xubuntu 9.04.

It’s a bit faster than the 9.10 and so far, no errors what so ever. Next step, wait for the next stable release for Xubuntu and check out some forums before the upgrade.

Downgrading your Xubuntu Core

I’m having problems with my new updated Xubuntu core as I have mentioned at my previous post.

After some good search and reading I have found a possible solution. There is a good way to downgrade your core without major incidents.

Here are the steps (got from Ubuntu Forums)

1. Reboot your machine and when Xubuntu is about to start hit ESC (or the key set to show the menu options at boot). You should see about 3 to 5 entries where one of them should be a older version of your core. Choose the right version and you are done.

Now if you don’t see the right core, then this is what you need to do:

1. Using Synaptic install a linux-image (use linux-image to search in synaptic) that reflect the right core that you want to downgrade. Take note on the information about the core. Ex.: 2.6.31-14-generic

2. Open your menu list at your Grub boot menu and see what options do you have to start your Xubuntu (use terminal).

mousepad /boot/grub/menu.lst

Now add the new menu core installed following the same format as the other ones.

title        Ubuntu 9.10, kernel 2.6.31-14-generic
root         ()/ubuntu/disks
kernel       /boot/vmlinuz-2.6.31-14-generic root=UUID=xxxxxxxxxxxxxx loop=/ubuntu/disks/root.disk ro ROOTFLAGS=syncio quiet splash
initrd       /boot/initrd.img-2.6.31-14-generic

title        Ubuntu 9.10, kernel 2.6.31-14-generic (recovery mode)
root         ()/ubuntu/disks
kernel       /boot/vmlinuz-2.6.31-14-generic root=UUID=xxxxxxxxxxxxxxx loop=/ubuntu/disks/root.disk ro ROOTFLAGS=syncio  single
initrd       /boot/initrd.img-2.6.31-14-generic

Remember to always have your files backup. No matter if you are on Windows, Linux or Mac, a full recovery can always brings unexpected results (even knowing that on Linux is mostly likely to have a smooth transition).

Installing SAMBA on Xubuntu

samba is by far the best file / printer sharing service available for Linux. It will surely provides a way to share folders, files and printers with Linux systems and Windows systems, therefore installing it on Xubuntu have some tricks.

First, using Synaptic (or apt-get) install samba (lower case). It will also ask to install other libraries and install them as well.

The next step is to install swat (lower case) a web management tool for SAMBA. Just like SAMBA you can either use the Synaptic or the apt-get to install it.

Now come the tricks.

First make sure that the that the #<off># is removed in the /etc/inetd.conf file.

Now, with apt-get, install the xinetd server. This is the second most important step to allow SAMBA and SWAT to work together.

To finalize, open the xinetd.conf file (/etc/xinetd.conf) and add before the xinetd.d include:

# description: SAMBA SWAT
service swat
disable = no
socket_type = stream
protocol = tcp
user = root
wait = no
server = /usr/sbin/swat
port = 901

With this it will be possible to access SWAT by at your browser.

By default it will only enable the printer sharing to any users. To allow folder sharing, you must go to:

[Menu] Applications -> System -> Shared folders.

Now all is left is to configure SAMBA, a task that using SWAT, becomes very easy.

Have fun.

Context menu disable with JQuery

I have found a ton of tutorials teaching how to disable the context menu on browsers and in all of them I have found one flaw:

Does not work with Opera

It’s an anoying situation that got me thinking and searching for a solution through most part of the day and with no luck.

The function is simple:

$(document).bind(“contextmenu”, function(e)
return false;

and it works with (tested):

and it does not work with (tested)

After a lot of research I have found why it does not work with Opera:

Opera (9.5) has an option to allow scripts to detect right-clicks, but it is disabled by default. Furthermore, Opera still doesn’t allow JavaScript to disable the browser’s default context menu which causes a usability conflict.

You can try to disable by disabling the mousedown event filtering only for Opera, but I do suggest a lot testing on this.

To complete just an extra note: this function does not bind the documents inside an iframe, so in this case you should complete the function by disabling the context menu in the iframe document as well.

Troubleshooting PHP5 Memcache Connetion Error

I have just installed PHP5 Memcache on my Xubuntu dev machine and every page loaded was returning me an annoying error of Memcache connection error.

Warning: Memcache::connect() [memcache.connect]: Can't connect to localhost:11211, Connection refused (111)

When after you tried everything it still doesn’t work, you got to research for something that will actually correct your issue. With that in mind I found this great post that shows a very easy trouble shooting for fixing the connection error with Memcache.

The post is related to installing, but the last 3 commands will help you do a full troubleshoot with your current Memcache configuration.

Follow the link:

Creating a bash script on Xubuntu

Some times doing the same action again and again is quite anoying, so creating a bash script might be the easier way out.

A bash script is simply a file that executes a series of commands. Something very similar to bat files on Windows.

As many other Xubuntu and Linux users, I had no idea of how to create a bash script and how to execute. Well is pretty simple. While surfing the net I found a pretty good tutorial that will give you the basics of how to create a very simple bash script:

Now some notes:

  1. The extension of the bash script does not matter, but the usual is .sh
  2. If you are saving something that will be used globally, the best place to save is /usr/local/bin
  3. If you are saving something that will be used only by your user then save it at ~bin
  4. Linux will look for any command that is inside the bin dir, but you can access it on it’s current directory by typing ./command
  5. the script will be written using c++ mostly (that is Linux main language)

Have fun.

Readyboost for Xubuntu

I have been playing with Readyboost for Microsoft Windows Vista and it’s one of the best features (or the only good feature) that Vista has.

Usually I do my programming with a Xubuntu box, so I thought why not try the same with Xubuntu.

It’s not hard.

  1. Plug, if not plugged, the usb device
  2. Usually Xubuntu will mount the device (or at least show it for you on the desktop). Right click on the icon (Removable Volume) and check if it is mounted (if you can see the files inside the disk, it is mounted). If so, open a terminal screen and type mount. It will show a list of the mounted devices on y our PC. Try to identify the device name for your usb device. Usually is /dev/sda1, but, like in my case, it can change.
    1. Mount the device (if not mounted) and in a terminal screen, use the mount command to show a list with all devices mounted. If you are having trouble finding the device, copy the list to mousepad and umount the device (right click on the icon on desktop) and then, list the devices again. Most likely the device that is missing is your device.
    2. You can use the df -h to list the mounted devices and find out which one is the usb device
  3. Now, before creating the readyboost, you will need to umount the device, so go to the desktop and right click on the icon and umount it.
  4. Now let’s set up the swap file (readyboost).
    1. sudo mkswap /dev/sdf1
      1. Setting up swapspace version 1, size = 3917820 KiB no label […]
    2. sudo swapon -p 32767 /dev/sdf1
      1. This will set up the swap priority for last (to avoid priority mix with the original swap file)
  5. Last step, let’s check the swap files:
    1. cat /proc/swaps

It’s not as easy as Windows Vista, but you can always create a script to run this every time.

Have fun.

Fix for the Xubuntu VPNC killing internet connection

I have been strugling with this issue for the past 2 days. After updating Xubuntu 8 to the 9th core, the VPNC started to act different from what it was before and every time I have connected to the VPNC it was killing the connection for the Internet.

I was discussing this with a friend of mine, much more experienced with Linux, and he told me what was going wrong.

The VPNC removes the default route that connects you to the INTERNET, connecting you only to the private network. If you want to have both of worlds at the same time, you will need to add a new route to the VPN.

Doing this by the GUI is extremely annoying so he did sent me a good article teaching how to do this using the command prompt.

Go to: and go more specifically to the #7 item.

Follow what is being told and you are good to go.

Just a note, you need to be a route for that, so use the sudo command to help you out.

%d bloggers like this: