Sunday, 31 July 2011

Ignoring MySQL password prompt when installing in Ubuntu

When installing the MySQL server package in Ubuntu you will be prompted for a password, which is a nice feature for users but for geeks doing auto installs etc it's a real pain in the neck. The easiest solution I could find for this:

export DEBIAN_FRONTEND=noninteractive
dpkg -i mysql-server.deb

To download the .deb files and dependencies without installing:

apt-get -d install mysql-server (files are saved in /var/cache/apt/archives)

Installing Debian .deb files to a mounted partition

After getting a custom Ubuntu flash drive installer up and running I encountered the problem of installing additional or custom .deb files to a mounted partition, in this case mounted to /target

The solution is quite simple:

dpkg --force-all -i --root=/target/ my.deb

The --force-all can be left out if dependencies arn't a concern for the package or packages you are trying to install...

Repacking an Ubuntu/Debian Package

Some problems might require you to repack an existing .deb file with some extra goodies in or with some config removed from a control file, MySQL password prompt on install comes to mind... The easiest solution to repack a package (or only extract the files within the package) is:

For this mini howto I'm using MySQL for Ubuntu 10.04 LTS:

Download the file required using apt-get:

apt-get -d install mysql-server
cd /var/cache/apt/archives/

Copy the file that looks similar to the one below to a temp directory eg. /tmp:

mv mysql-server-5.1_5.1.41-3ubuntu12.10_i386.deb /tmp/

Create a folder for the extracted content and extract the binary part of things:

mkdir /tmp/extracted
dpkg -x mysql-server-5.1_5.1.41-3ubuntu12.10_i386.deb /tmp/extracted

Create the DEBIAN folder in extracted, the folder name has to be called DEBIAN for the build to work. Once created dpkg -e will extract the control file etc for the package:

mkdir /tmp/extracted/DEBIAN
dpkg -e mysql-server-5.1_5.1.41-3ubuntu12.10_i386.deb /root/extracted/DEBIAN

Build the new package:
mkdir /tmp/build
dpkg -b /tmp/extracted /tmp/build

Tuesday, 26 July 2011

Virtual Box

VirtualBox is a very easy and nice tool but recently I ran into the problem of getting the virtual vdi onto a flash drive and vice-versa, the following Linux commands might help someone wanting to do the same:

Convert from flash drive to dd:
dd if=/dev/sdb of=flashv2.bin

Convert from dd to vdi:
VBoxManage convertdd flashv2.bin ubuntu.vdi

Convert from vdi to dd:
vditool COPYDD ubuntu.vdi flashv2.bin

Convert from dd to flash:
dd if=flashv2.bin of=/dev/sdb

Friday, 22 July 2011

BurstNet NetBaq Review

I recently decided to try out the NetBaq backup solution they offer on their website. The setup fee was $9.95 and for $4.95 provided 10GB of RAID 5 storage space.

It took a about 24 hours to get the details as per their website and I ordered over a weekend so this part was perfect!

The backup allows you to use rsync over ssh, ftp, or samba. They also provide a PPTP connection for those looking to VPN before copying files over.

Being a geek I wanted to try configure sshfs and mount a local folder to the backup server, it worked like a charm except I was starting to feel a bit unsafe as I was given normal user access without being chrooted to some directory. I was amazed... in front of me was a directory listing of the backup server's / directory!

I immediately started wondering, what if someone manages to gain root access from their user account or manages to exploit a vulnerability in the existing software, scary stuff! I'm pretty sure most people/companies don't spend time encrypting backups, would your backups be safe in the hands of others?

Below are the details for the server obtained from my ssh access, it's given in the hope it might help you setup your own backup server or determine if NetBaq is the right service for you (I decided to move to my own backup service running on a VPS with RAID 6 and encrypt all my archives with AES)...

1. Kernel: 2.6.32-5-686-bigmem on Debian GNU/Linux 6.0
2. CPU: Intel(R) Xeon(R) CPU 5150 @ 2.66GHz
4. Processes of interest running: pure-ftpd, smbd, nfsd, exim4, pptpd, mdadm, 3dm2
5. 8GB memory
6. Partitions:

/dev/md0               92G  5.4G   82G   7% /
/dev/md2               15T  6.8T  7.5T  48% /home

I was also surprised to find a software RAID config instead of a hardware only RAID as normally seen. The software RAID also seems to have a mail alert address set to: root

If your looking for a backup service and don't mind using an application specific tool rather than ftp, nfs, rsync etc take a look at the Amazon S3 cloud, it really works and their data durability is just absolutely amazing!

Wednesday, 20 July 2011

Seagate BlackArmor 400

My uncle purchased a Seagate BlackArmor 400 NAS yesterday afternoon and after struggling with getting it to work he asked me to take a look... Being a Seagate fan I was quick to help out and try to get the device working.

I was unfortunately not very happy with the outcome, so here are some tips for those of you that are considering the purchase of one or own one already...

1. The manual is pretty useless, especially the format it's in, it's best to make a small fire with it and enjoy a pack of marshmallows.
2. The drives supported are only of the Seagate brand, forget all the rest, they also have a list of certified Seagate drives.
3. The LCD screen is pretty useless, it generally outputs some message equivalent to "PC Load Letter" in the movie Office Space.
4. All drives need to be in a "new" state, so no partitions or the device seems to give the message "HasForeignDsk(s)" and pretty much freezes completely, reset also seems to be useless when it reaches this point.
5. If no drives are installed or the device reaches the "HasForeignDsk(s)" point you can ping it on the network (IP here was:, telnet (default username/password doesn't work) and ftp to it but the web server remains down.
6. The software provided won't work when the device has no drives in or reaches the "HasForeignDsk(s)" point.
7. RAID 5 can take 8 to 12 hours to create and RAID 1 takes up to 1 hour to create, this all happens automatically depending on the number of drives inserted while keeping the user in the dark.
8. Use 1 drive in factory state when starting out, this will allow the NAS to move to a ready state quickly (and allow web admin access) as more drives would be required for the NAS to create a RAID automatically.

Personally I would not purchase the BlackArmor made in China device, especially at it's current retail price. If you are considering the purchase of the BlackArmor device rather take a look at another NAS, a proper storage server or use a free solution like SME Server!

Ubuntu 11.04 Custom Ubiquity Installer

This post is a mini how to guide running the Ubuntu 11.04 installer from a flash drive installed with a copy of Ubuntu 11.04, it uses also uses the preseed function to feed the installer settings.

The steps to getting a custom installer from flash (8GB+ drive works well):
  1. Install Ubuntu onto the flash drive, this can be done by booting from the installation disk and selecting the flash drive as the / partition and disk to install Ubuntu on, double check that the boot installer will be installed on the flash drive (seems to be default).
  2. Once installed, boot from the flash drive, this should give you a read/write copy of Ubuntu you can do quite a bit with and use for installing systems. 
  3. Install using apt-get: ubiquity, ubiquity-frontend-gtk, ubiquity-slideshow-ubuntu
  4. You can load your custom images in /usr/share/ubiquity/pixmaps/ubuntu
  5. Copy the content from your Ubuntu disk to /cdrom on the flash drive, you can also mount the iso and copy the files and directories to /cdrom
  6. Save the preseed file can as preseed.cfg in /
  7. Load the preseed file using the command: debconf-set-selections /preseed.conf
  8. Run the installer: ubiquity --automatic --desktop --gtk-ui
  9. Change the preseed.conf and reload it as required, over and over, until all the little bits work in the way required...
  1. Installer log file /var/log/installer/debug
  2. Turn on debugging by running Ubiquity using: ubiquity --automatic -d --desktop --gtk-ui
  3. You can find all installer config options using: debconf-get-selections
  4. The selections database: /var/cache/debconf/config.dat
  5. You run the install and at various point do the get selections command which will contain the value you set in the installer, very handy for debugs
  6. Take regular breaks, the process can be a royal pain!
My preseed.conf file (I'm from South Africa so the locale etc might need adjusting)

# Enable oem mode
d-i oem-config/enable boolean true

# Run a command/script after install
d-i preseed/late_command string ls

# Ensure that the openssh server is included, you can install other packages
# required here too..
d-i pkgsel/include string openssh-server

# Add the username/password specific details
d-i passwd/allow-password-empty boolean true
d-i passwd/user-fullname string My User
d-i passwd/username string myuser
d-i passwd/user-password string myuserpass
d-i passwd/user-password-again string myuserpass

# set hostname
d-i netcfg/get_hostname string ubuntu

# Locale sets language and country.
d-i localechooser/languagelist select en
d-i languagechooser/language-name-fb select English
d-i debian-installer/locale string en_US.UTF-8

# Keyboard selection
keyboard-configuration keyboard-configuration/layout select South Africa
keyboard-configuration keyboard-configuration/unsupported_layout boolean true
keyboard-configuration keyboard-configuration/store_defaults_in_debconf_db boolean true
keyboard-configuration keyboard-configuration/variantcode string

# Detect keyboard layout?
keyboard-configuration console-setup/ask_detect boolean false
keyboard-configuration console-setup/detected note
keyboard-configuration  keyboard-configuration/model select Generic 105-key (Intl) PC

# Controls whether or not the hardware clock is set to UTC.
d-i clock-setup/utc boolean true

# Set timezone
d-i time/zone string Africa/Johannesburg

# Controls whether to use NTP to set the clock during the install
# Say no so we don't wait if there's no network connection
d-i clock-setup/ntp boolean false

# partition the disk
# wipe everything and put everything in /
d-i partman/filter_mounted boolean false
d-i partman/unmount_active boolean false
d-i partman-auto/choose_recipe select atomic
d-i partman-auto/disk string /dev/sda
d-i partman-auto/method string regular
d-i partman-auto/choose_recipe select atomic
d-i partman/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true

# Automatically download and install stable updates?
unattended-upgrades unattended-upgrades/enable_auto_updates boolean false

# run this command after the install
# /target is the newly-installed system
# oem-config-prepare sets the first run wizard for next login
#ubiquity ubiquity/success_command string chroot /target oem-config-prepare

# preseed some ubiquity specifics
ubiquity oem-config/id string MY-BATCH
ubiquity partman/unmount_active boolean false
ubiquity partman-auto/choose_recipe select atomic
ubiquity debian-installer/language string en
ubiquity localechooser/shortlist select US
ubiquity localechooser/preferred-locale select en_US.UTF-8
ubiquity localechooser/supported-locales multiselect en_US.UTF-8

#skip the screens not required
ubiquity localechooser/translation/none-yet note
ubiquity localechooser/translation/no-select note
ubiquity ubiquity/online note
ubiquity ubiquity/summary note
# reboot after installation
# you will still be prompted "Close the tray and press ENTER to continue?"
# unless you add noprompt to the kernel command line
ubiquity ubiquity/reboot boolean false

#end of preseed.conf file

Good Luck!

    Tuesday, 19 July 2011

    Samsung 160GB Drive

    I found this Samsung 160GB drive in a system running Ubuntu 8.04 this morning, after a good cleaning the drive was placed in a backup system and deployed again as the system was urgently required.

    I was pleasantly surprised to see a Samsung drive, so far they seem very reliable from the few we have in the field, will keep you posted!

    Monday, 18 July 2011

    Joe's Datacenter

    I recently got a low cost server from Joe's Datacenter ( in Kansas, I always like paying under the $50/month for a server (I know I'm cheap...) and found their pricing starting at $35/month for a full on box very nice!

    The delivery took about 24 hours and recently I needed support which was also available and Sam did a re-install for me (but installed Centos instead of Ubuntu, was 4am though by them) to get the server back online quickly after I installed a package (cassandra db) which didn't work out very well...

    I know many hosting companies have a policy of installing new hard drives when reusing servers recently decommissioned, this doesn't seem to be the policy at Joe's though and the server arrived with a Western Digital WDC WD2500YD-01NVB1 drive (personally I prefer Seagate) and so far it's been in power on mode for 28 369 hours or 1 182.04167 days or 3.32 years which doesn't inspire much confidence... Currently their packages don't provide RAID so backup... backup... backup...

    The servers connected directly to a Brocade switch and doing a traceroute outbound from Joe's seems to run out via gigabit links to Hurricane Electric, Cogentco and a connection to the Kansas City Internet Exchange. You can grab their test file download from

    Joe's also have a live webcam up and running of the colocation section:

    So far the server and network stability have been flawless, support available, upgrading sales support is just useless... but at the end of the day if your looking for a cheap box Joe's could be the answer for your requirements!

    Sunday, 17 July 2011


    Hi Everyone,

    This is the first blog entry for this blog, basically this blog will be full of many different technology related things. I'm the owner of and a full on geek!

    I do a lot of work on Linux based machines, so many entries may contain some Linux based things I don't want to forget but share with you at the same time. I'm currently busy working toward Cisco CCNP certification and one of the few network engineers that also do some software engineering (PHP, Bash, C++ etc).

    Please feel free to comment and ask anything at anytime, especially Linux based!