Tag Archives: ubuntu

Zero (One) writing a disk in Ubuntu

Or in any other Linux, from what I know.

Do a search and most of what you’ll find is this:

dd if=/dev/random of=/dev/sdX bs=1M

The intent is for that to fill a drive with random garbage.  You are also supposed to be able to use /dev/null or /dev/zero as the input to zero-write the drive.

Quite simply, that did not work for me.  I’ve had this problem before and again I spent too long getting around to the approach that actually worked.  As for the part that didn’t work, for all I can tell this command wasn’t actually doing anything even if I let it run for hours or pointed it to a specific partition (e.g., sdh1).

The command that worked!

tr ’00’ ‘\377’ < /dev/urandom | pipebench | sudo dd of=/dev/sdX

This required installing “pipebench” (sudo apt-get pipebench …).

Essentially, this fills a drive with ones instead of zeroes.  I think the idea of that — mostly “just because”.  Piping the translation of the zeroes to ones through “pipebench” gives a benchmark of the data rate.  That allows you to estimate how long until you are done.  Finally, the output is sent to the outfile (of) which is the mount for the drive (sdX).  In about 2.5 hours that wrote a 60GB drive with all 1’s.

This command ends with a “device out of space” error, which is fine.

So, my steps were:

  1. delete all partitions
  2. create one partition for the whole drive (to change the file table)
  3. write 1’s to the entire drive

In theory, said drive is now not possible to recover short of using a professional data forensics lab.  But who’s really that interested in me anyway?

Acer AspireONE D255 Wireless Network and Kubuntu

One of the things I really love about the Ubuntu community is how helpful it is.  By following these easy directions,  I was able to get the wired network up and running on my netbook.  Yes, that’s right.  I have a situation where the wireless works and the wired doesn’t!  Even stranger, the fix is in an wireless network adapter package!

Because I’ve been burned by stale links, I’m going to repeat some information here.

Netbook:  Acer AspireONE D255

Wireless (lspci):
01:00.0 Ethernet controller: Atheros Communications AR8152 v1.1 Fast Ethernet (rev c1)
02:00.0 Network controller: Intel Corporation WiFi Link 1000 Series

The steps:

  1. Go here (http://linuxwireless.org/download/compat-wireless-2.6) and download “compat-wireless-2.6.tar.bz2”
  2. Run the following commands:
sudo apt-get update
sudo apt-get install build-essential
cd ~/Desktop
tar -xjvf compat-wireless-2.6.tar.bz2
cd compat-wireless*
scripts/driver-select atl1c
sudo make install

At this point a reboot should load the network driver.  For me, the “sudo make install” took a very long time.  Well, 10 minutes.  But it felt like an eternity.

If a reboot doesn’t load the module, try “modprobe atl1c” (that’s ay-tee-el-one-cee).

And that was it.  Lovely!  Again, I can’t promote the friendliness and helpfulness of the Ubuntu community enough.  They have been great.

Update 2011-03-30: I had to repeat these steps after upgrading to kernel 2.6.32-28 or -29.  But it worked.

File Recovery with Ubuntu

Today I found the most impressive piece of open source file/data recovery software:  foremost (also found here as sources).  I think this also convinced me that I need to include in my toolkit an Ubuntu Rescue Remix (URR) thumbdrive.  The most amazing this about this tool is its origins and the fact that it ended up in the FOSS community.

I called this utility into service out of a last-ditch attempt to recover files that were deleted from a Windows machine a month or so ago.  Yes, from a Windows machine.  And it worked very well.

I ran it from an Ubuntu Live USB and it installed with a hiccup that I was able to work out.  The easier way would have been to run URR, but I didn’t have the time to make a Live USB of that.

From that Live USB, I was also to install that utility, switch to the Window’s disk to recover, and run the recovery with the file destination as that drive.  I think something like 12,000+ files were recovered, and it included a vast majority of the files we were looking for.

I did not find the audit feature of this utility very useful, but I think if I was going into a drive cold and wanted to know what was available for recover, it could be useful.  Also the audit stack dumped and was unable to finish — strangely, the actual file recovery ran successfully.

This has, without a doubt, convinced me that I need to make a URR Live USB as soon as possible.  The great amount of documentation on the web about data recovery, and the availability of fantastic free tools makes this a must have for anyone who does this sort of thing.

New Install of Ubuntu Server — Part IV (bugzilla)

Again, installing bugzilla was easy.  I took it straight from the repositories — and therefore I installed 2.22 (note that version if you are following this for a higher version…).  Migrating this was easier than mediawiki, but included a few more steps than subversion.  This page says the basics, but there are some key steps missing.

  • dump the database
  • make a backup of either your “data” or entire “bugzilla” directory.  Now… where’s that?  Under Ubuntu Server it is under /var/lib/bugzilla.
  • make a copy of your localconfig (from /etc/bugzilla)

On the new machine, you must first:

  • install bugzilla
  • create the bugzilla database
  • create your bugzilla user (e.g., bugs)
  • grant bugs the appropriate permissions which can be found here
  • backup /etc/bugzilla/localconfig and copy the one from the old machine — update the $db_pass in that file if necessary
  • restore the data or bugzilla directory in /var/lib/bugzilla (or where appropriate)
  • now you can import the dump per the appropriate database

And that is it.  It worked when I restarted apache!

New Install of Ubuntu Server — Part III (mediawiki)

Installing mediawiki is easy.  Setting up a new wiki is easy.  Migrating to a new server AND upgrading the version of mediawiki is triki…

My first issue was setting up the user.  I know SQL, but the exact specifics of some databases can elude me.  Enter my first “bit in the butt” moment with MySQL.  Apparently the best way to GRANT permissions to the mediawiki user is to use a statement similar to the following:

GRANT SELECT,INSERT,UPDATE,DELETE ON db_name.* TO db_user@’%’ IDENTIFIED BY ‘some password’;

It was that little percent sign (%) that bit me.

My second issue was upgrading mediawiki.  This, of course, is not a smart move to do as part of moving to a new server.  But, hey, I did it.  The final key was to run the update script (maintenance/update.php) that is included in the mediawiki install dir (/usr/share/mediawiki on Ubuntu).

Otherwise, the steps at this site, and the ones it links to, are great.

New Install of Ubuntu Server – Part II (subversion)

After installing the baseline of the server I needed to install subversion.  Installing subversion is something I have had trouble with in the past, and have been surrounded by talented people to fix my mistakes.

Yes, humility there.  I suck at installing subversion, but ask for help.  This time, I finally found the right resources to make things work as expected.  The interesting park is that I was moving content between servers, so I had to install, dump, load, and configure.  A couple more steps, but appears to have been successful.

1) This page provided simple instructions on installing and configuring subversion.  I did not import a project because I loaded from a dump.

2) This page provided fantastic instructions for dumping and loading subversion.  The notable changes I made where the user and groups I chown’d to because this subversion instance is controlled through apache modules.  So after the chown/chmod commands, I stopped.

3) Finally I needed a hint about why my apache server wasn’t letting me into the repository.  Here is the hint I needed.  Specifically the section about editing the httpd.conf file.

New Install of Ubuntu Server – Part I

I have installed Ubuntu Server before, but this time is different.  An instance completely pooched in a way that was not reliably recoverable.  For unknown reasons the virtual disks were unstable.  So, critical data was backed up and moved to a new image.  Not terribly difficult, but something fun to note.  Some really great sites helped with some of the more mundane details.

I will break this into four parts:  Server, Subversion, Mediawiki, and Bugzilla.

The server installation was direct and obvious:

  • install from the ISO
  • update
  • run a neat script (below) for a basic gnome desktop
  • install subversion, mediawiki, and bugzilla (exactly as named) from the repositories
  • update the host name (sudo hostname new-host-name; sudo vi /etc/hostname)
  • update the IP address to be static (sudo vi /etc/network/interfaces) — details below.

The neat script:

# Ubuntu-Desktop-Minimal: Post-install script to install only the bare
# essentials of an Ubuntu Desktop.
echo "[*] Installing Gnome Essentials"
sudo apt-get -y install gnome-core gdm network-manager-gnome fast-user-switch-applet \
human-theme x11-xserver-utils tangerine-icon-theme gnome-themes ubuntu-artwork \
jockey-gtk gnome-screensaver gnome-utils xorg
echo "[*] Installing Application Essentials"
sudo apt-get install -y gcalctool tsclient system-config-samba gnome-nettool ntfsprogs update-manager \
gdebi system-config-printer-gnome brasero gparted epiphany

The new eth0 entry in the interfaces file (with real IPs obfuscated):

auto eth0
iface eth0 inet static
address a.b.c.d
network a.b.c.0
broadcast a.b.c.255
gateway a.b.c.1

It was really that simple.

This page is also worth nothing where I found a superb set of steps to migrate users from the old server to the new server.