Main menu

Tag Archives: linux

Post navigation

If you are using gnome 2.x and you have problems with your indicator applets not displaying properly after login. I often do. I don’t know the reason. It occurs sporadically and more often than not.

A simple fix is to restart gnome-panel. You don’t need to use sudo. Open a terminal and run the following command.

$ pkill gnome-panel

That was easy–and is usually all you need to do.

However, if that didn’t solve your problem. You can try reseting your panels and get pristine panels again. WARNING: If you have customized your panels by adding application launchers and etc, you will lose those setttings and have to customize them again.

Now that you have been warned, here are the steps to reset your panels.

If you are new to VirtualBox, you might not be aware that you can run your guest VMs without having a console window to them on your desktop. IOW, run your guest VMs in the background and unseen. This is called headless mode. I’ll show you how to do that and a little more.

In headless mode, your guest VMs run in the background and you have the option to connect to them using the RDP protocol should you need a console to them. This is great for uncluttering your desktop particularly if you run many guest VMs and you don’t care to see their console. I have one server where I normally run at least five guest VMs at all times. Headless mode is great when you need to log into your host server remotely using ssh and start a guest VM. This can be handy if you are on the road, away from your server.

Here is an example to demonstrate some common tasks.

Log into your host server using ssh. Get a list of all VMs.

$ VBoxManage list vms

Start a guest VM named mywiki with RDP enabled and listening on port 3390. If you plan to run multiple guest VMs in headless mode with RDP enabled, you will need to choose a unique port for each to listen on. If you don’t specify a port, the default port is 3389.

$ nohup VBoxHeadless -s mywiki -v on -p 3390 &

Now if you want to check that your guest VM is among your running VMs

$ VBoxManage list runningvms

If you should need to connect to the console on that running VM named mywiki. Lets assume it’s IP address is 192.168.139.10. We are going to use rdesktop, which is a good RDP client found in most linux distros.

$ rdesktop -g 1024x768 -a 16 -5 192.168.139.10:3390 &

That should open up an nice 1024×768 window to your guest VM. If the resolution 1024×768 is too big for you, then adjust the size to fit your needs. The rdesktop settings “-a 16 -5” use a 16bit color depth and RDPv5. Those settings work well for me and look good.

To view the properties of your VM use the showvminfo option. This is handy if you want to connect your RDP client to a running VM and you don’t remember which port your VM is listening on.

$ VBoxManage showvminfo mywiki

Ok, now lets assume you have a rogue guest VM that want to shut-down and it is not responding to your request for a normal orderly shut-down. You can power it off using VBoxManage.

$ VBoxManage contolvm mywiki poweroff

One of the things I love about VirtualBox is the amount of control you have from the cmdline. Pretty much anything you can do from the management console can be done from the cmdline. That is great especially if you enjoy writing scripts and want to automate some of these VirtualBox tasks.

Lets say you want to convert a VMware vmdk disk image to a VirtualBox vdi disk image. It’s super easy. First let me mention that VirtualBox already supports vmdk files and can use them as is. However lets continue with the original idea of converting. I assume you already have VirtualBox installed.

If your vmdk image file is already connected to a guest VM.

shutdown the VM

remove the vmdk file from the guest VM (you can’t convert it while it is attached to a VM)

From the cmdline, use VBoxManage. It’s a swiss army knife type of program. You will see it used for a variety of things.

If you merely want to make a copy of a vdi disk image file, you can leave out the “–format VDI” option. The vdi disk image files contain a UUID. The clone process will make sure that the new output file has a different and unique UUID from the original. If you use “cp” to make a copy of the vdi image file, you will find that the output file is unusable because it contains the same UUID as the original file. A duplicate UUID is not acceptable to VirtualBox.

This is a simple bash shell script to convert a folder of .ogg (vorbis) files to mp3 files. I won’t get into the advantages of one format versus another. You may have a device that supports only mp3 files. Therefore, you have a reason to convert .ogg files to .mp3. There are many scripts out there that will convert ogg to mp3 but with most of them you lose all of your tags in the process. That can be a real pain. My script will preserve the tags of my choice and write them to the mp3 file.

The tags that I am concerned about are:

Artist

Album

Title

Genre

Date (year)

Track #

If there are other tags that you care about, then adjust the script as needed.

I named the script ogg2mp3.sh. I chose to leave the *.ogg files rather than delete them after converting them to *.mp3 files. To use the script, I cd to a folder that contains *.ogg files, then I run the script.

$ cd ~/Music
$ ./ogg2mp3.sh

You can make the script as elaborate as you want. Hopefully it was simple enough to give you a feel of how to use the other utilities together: ogginfo, oggdec, id3v2, and lame.

So you want run Android applications on your linux box. Basically you’ll need three things. The Android SDK, Java JRE, and 32bit libraries. If your server is already a 32bit server then you already have 32bit libraries installed. If you server is a 64bit server then you will need to install the 32bit execution libraries, for Ubuntu that is the ia32-libs package.

Select a name for your Android device. I chose fakeDroid. Select an API level, SD card size, and a Skin (screen size). The Hardware section, lets you outfit your Android with various features. I’m going to select the following:

SD Card support

GPS support

Accelerometer

DPad support

Touchscreen support

Audo playback support

Then click “Create AVD”.

This will create a virtual android device for you. You can select your virtual device and click the Start button.

Your virtual Android will then power-on and begin botting. When it finishes booting you should see something like the following.

Now lets install an Android application. Click on the button that looks like a globe to start the android web browser. You should see a web browser like the following.

To zoom in you can double click on the Android touchscreen. You can pan the display by using your mouse pointer to “drag” the touchscreen. I’m going to install the application PicSay 1.3.0.7, but you can choose whatever application you want. You install android applications by downloading the android package files with .apk extension. You should see a link for downloading the file.

After the download begins, click and drag downward on the top menu bar. This is where android keeps its notifications. Soon, you should see that the download has completed.

Click on the downloaded file and it will open the installer program for that application. Click the Install button.

When the application finishes installing, you can click the home button to go back to your Android home page. Then click the touch screen button which looks like a grid. That is the launcher button. It takes you to the screen where you can launch applications. You should see the icon for your newly installed application (PicSay).

This is part 3 of a series of posts regarding setting up a linux RAID 5 disk array. Let’s say you started your disk array with three drives and now you have more funds and you purchased an additional drive to increase the size of your disk array. Adding a fourth drive to a three drive RAID 5 array will increase your storage space by 50%. So you get a lot of bang for your buck.

Let’s continue with my example. I started with three 1 TB SATA drives and now I’m adding a fourth 1 TB drive. Before I had approximately 2 TB of storage, and after adding this fourth drive, I will end up with approximately 3TB of storage space.

Here are the basic steps that I will cover:

Partition the bare drive

Add the drive to your array as a spare

Grow your array to include this spare

Extend your file-system to recognize this additional space

Save your new configuration

First lets create an “auto-detect” partition on the bare drive. You have seen this step before, I’ll include it again to refresh your memory. This step is essential.

Now we will add this disk, to the our array as a spare drive. If you merely want to add a hot spare drive to your array, you can stop after this next step. A hot spare is a drive that is automatically used, whenever you have a failure of one of your active drives.

$ sudo mdadm --add /dev/md0 /dev/sde1

Now in this next step we will initiate the process of growing the existing array to include this new drive. I say initiate, because this is a very lengthy process. The data on your existing array is rewritten so that it is spread across four drives instead of three. This will take several hours. The good news is that your array remains online during this process. You don’t have to endure any downtime.

$ sudo mdadm --grow /dev/md0 --raid-devices=4

You can monitor the progress with the file /proc/mdstat. Periodically “cat” the contents of /proc/mdstat and you can see the percentage of progess. When it has finished, you will have a four disk array, but your mounted file-system will still show its old size. It will not automatically recognize the additional space. You to resize your file-system so that it recognizes the additional free space. Fortunately this step is very fast and takes only a few minutes.

$ sudo resize2fs /dev/md0

When this is done, you can do df -h and see that your file-system now has the additional free space. What’s cool is you added lots of free space without downing your box all afternoon.

Please don’t forget to update your array configuration file. Since you now have a four disk array instead of three, you need to let the system know to expect to see four drives instead of three.