Ubuntu Install Grub Problems

While trying to install Ubuntu 10.04.1 & 10.04.2 with Software RAID using drives over 1TB, that have already had an install on them once, i keep running into problems.

First the partitioner kept putting 1M of free space at the beginning and end of the drives, no matter what I tried, manual or automatic partitioning. Finally I booted up in the Live CD and ran gparted to create the partitions starting at the very beginning of the drives. A little leftover free space at the end is fine. But as far as i know the boot partition needs to be at the very beginning of the drive or it won’t boot. Even in spite of partitioning them like that, the install still fails with a fatal error when it tries to install the grub boot loader.

Tomorrow I’m going to just try installing grub onto this system from the Live CD and see if it can boot without another whole reinstall. It seems like Ubuntu’s partitioning program is very finicky and prone to mishap if, like me, you aren’t 100% sure of what you’re doing! It just doesn’t seem to be able to do a fresh install on a used disk, the disk needs to first be re-partitioned elsewhere.

From searching around, it seems like this problem has happened for a LOT of people. And what’s the solution? Try 4 times and it works!?

Posted in Uncategorized | 1 Comment

IDE Cable gone bad?

Had some timeout errors on a webfarm server that had been running steady with an uptime of several months. All of a sudden it couldn’t write to some directories, couldn’t reboot, I figured the HD failed. But the HD tested OK in another system, and a drive I knew was good wasn’t detected by this server. I was starting to think it’s the motherboard. But when I tried a different IDE cable, everything worked perfectly. Put back in the original IDE cable and it won’t boot. hmm I think that’s a first for me.

well now i’ve got the “new” cable in there and it’s working great, yum update and back in service.

Posted in Uncategorized | Leave a comment

CentOS Software RAID Grub bug

Was working with an old CentOS 5.2 software raid and trying to replace the 70GB drives with 500GB drives. Had quite a bit of difficulty with grub not working when trying to boot on one drive or the other after repartitioning the drives.

This comment seems to have come to the rescue:
1) Connect both drives and verify that all drives are sync’d (i.e. “cat
/proc/mdstat”)
2) If not, add the missing drive (i.e. If /dev/sdb1 is missing, “mdadm /dev/md0
–add /dev/sdb1”)
3) Wait for drives to sync up.
4) grub
5) grub> device (hd0) /dev/sda
6) grub> root (hd0,0)
7) grub> setup (hd0)
8 ) grub> device (hd0) /dev/sdb
9) grub> root (hd0,0)
10) grub> setup (hd0)
11) grub> quit

After that, I tested booting from one drive and then the other, both were able to boot on their own – OK! On to growing the raid, after some fun with Knoppix Qparted to get the drives partitioned to use as much space as possible and keep swap at the end.

Somewhere along the way I had to set the partition type with the instructions found on this page
fdisk /dev/sdb
> t
> 1
> L
> fd
(sets partition 1’s type to Linux raid autodetect.)
Repeat for partition 2 (ie replace ‘1’ above with ‘2’)

Once I was (finally) able to boot from the repartitioned drives, ran this to increase the raid size:
mdadm -G /dev/md0 –size max
watch -d cat /proc/mdstat

then after things finished syncing up, ran this to actually get that space available:
resize2fs /dev/md0

Repeated steps 4 – 11 before rebooting to test that the raid can boot off either drive.

Posted in Uncategorized | 1 Comment

Recover Soft Raid on Ubuntu

Experienced a power failure and the Raid1 ubuntu system I’d set up with soft raid didn’t come back up; the boot screen had a message that

/dev/md0: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
mountall: fsck / [466] terminated with status 4
mountall: Filesystem has errors: /

So I booted into rescue mode with the install CD and tried to run

e2fsck /dev/md0

got a scary message that there WILL be SEVERE damage from running e2fsck on a mounted partition.
found a post that said to mount as read only, as follows:
mount -o remount,ro /dev/md0

ran e2fsck and got the same warning but proceeded with apparent good success!

Posted in Uncategorized | Leave a comment

vmware on linux

I installed vmware on an ubuntu server and had some trouble connecting to the virtual machine through firefox.

Cannot access virtual machine console

I read that the latest firefox does not work with VMware, so I downgraded from firefox 3.6.X to 3.5.X and now everything works, installing the first virtual machine right now!

Posted in Uncategorized | Leave a comment

sudo without password on Ubuntu

OK so I am working with Ubuntu servers (no, I haven’t abandoned CentOS, just broadening the horizons).
Anyway, Ubuntu is different in that, rather than creating a root password during the install, it has you create a user account with sudo permissions.
However, whenever you type sudo ‘this’ or sudo ‘that’, Ubuntu asks for your password. Every time. Gets kind of annoying after a while.
So… search for Sudo without password on Ubuntu and problem solved!

sudo visudo

Add this line at the end (change “jerome” to your username):

jerome ALL=(ALL) NOPASSWD: ALL

Ctrl-X to leave, save your changes, and you’re done!

Posted in Uncategorized | Leave a comment

Stuff I’ve been doing

installing ffmpeg-php on 64 bit
learning perl
writing a wordpress plugin
worked with drupal views and CCK
rebuilding encoding systems
fun stuff!!!

Posted in Video | Leave a comment

A test video

This is a video i like
http://www.youtube.com/watch?v=yy0I9WKWp44

Posted in Video | Leave a comment

myCookieMonster

Had this old perl program to set and log cookies and id’s but now we needed it to run from wordpress.
Figuring out how to set custom cookies (before the html begins) from inside thesis / wordpress was harder than it should have been!

So finally figured out that inside custom_functions.php you can add, for example,

add_action('init', 'myCookieMonster');

and this shows up before any headers / output are sent.

So now it’s a plugin, here is the code:

/*
Plugin Name: myCookieMonster
Plugin URI: n/a
Description: Sets and updates custom cookie "s"
Version: 1.0
Author: Joe
Author URI:
License:
*/

## Note: To move this Cookie functionality, change below in 2 NOTED places!
#-----Create the log file - for myCookieMonster ---------#
function writelog($tracking_id = '',$session_id = '') {
# Log visit
$timestamp=time();
$human_readable_timestamp=date("D M d h:m:s Y", $timestamp);
$log_file_line =
$session_id ."\n".
getenv("HTTP_REFERER") ."\n".
getenv("SCRIPT_URI") ."\n".
getenv("REDIRECT_SCRIPT_URI") ."\n".
getenv("REDIRECT_QUERY_STRING") ."\n".
$timestamp ."\n".
$human_readable_timestamp ."\n";

$log_file_line = str_replace("\n","\t",$log_file_line) . "\n";

// need to use absolute path on server, data dir needs 777 permission
## NOTE: CHANGE FOLLOWING LINE, & CHECK 'data' DIR PERMISSIONS = 777
$filename = '/home/##NOTE SET THIS PATH##/data/'.$tracking_id;
$handle = fopen($filename, 'a');
fwrite($handle, $log_file_line);
fclose($handle);
}

#-----Create the random numbers - for myCookieMonster ---------#
function CreateTrackingId() {
// create a 15 digit number

$myfile=0;
while ($myfile<1){ $newfile = rand(10000,99999).rand(10000,99999).rand(10000,99999); $testthis = '/home/##NOTE SET THIS PATH##/data/'.$newfile; if(!file_exists($testthis)){ $myfile=1; } } return $newfile; } function myCookieMonster () { # Cookie params ## NOTE: CHANGE FOLLOWING LINE $cookie_domain='##NOTE SET THIS DOMAIN##'; $cookie_path='/'; $cookie_expiration=''; $cookie_name='s'; $tracking_id=""; $tracking_time = ""; $session_id=""; $cookie_life=60*60*24*365; # 1 year $session_life = 1800; # 1/2 hour # cookies are seperated by a semicolon and a space, this will split # them and return a hash of cookies $rawCookies = split ("; ",getenv("HTTP_COOKIE")); foreach($rawCookies as $thisCookie){ $mysplit = split ("=",$thisCookie); $key = $mysplit[0]; $val = $mysplit[1]; $current_cookies[$key] = $val; //echo $key." : ".$val."
\n";
}

# Already has cookie set
if (isset($current_cookies["s"])) {
$message= "yes s"; // for debugging
// Lesson learned, from certain browsers, the cookie stores the '|' as '%7C'

$cooksplit = split("%7C", $current_cookies["s"]);
if (count($cooksplit)<3){ $cooksplit = split("|", $current_cookies["s"]); } $tracking_id = $cooksplit[0]; $session_id = $cooksplit[1]; $tracking_time = $cooksplit[2]; #Check previous tracking time??? if ((time() - $tracking_time) > $session_life) {
$session_id=CreateTrackingId();
}

#Reset tracking time
$tracking_time=time();
$current_cookies["s"] = $tracking_id . '|' . $session_id . '|' . $tracking_time;
$cookie_expiration=($tracking_time + $cookie_life);
//echo "
YES s, ".$tracking_id." , ".$session_id;
writelog($tracking_id,$session_id);
}
# No existing cookie
else {
$message= "no s
\n";
# Pick a random tracking id
$tracking_id=CreateTrackingId();
//echo $tracking_id."
\n";
$session_id=CreateTrackingId();
$tracking_time=time();
$current_cookies["s"] = $tracking_id . '|' . $session_id . '|' . $tracking_time;
$cookie_expiration=($tracking_time + $cookie_life);
//echo "
NO s, ".$tracking_id." , ".$session_id;
writelog($tracking_id,$session_id);
}

$cookie_value = $current_cookies["s"];

# Set cookie
//setcookie($cookie_name,$cookie_value,$cookie_expiration,$cookie_path);
setcookie($cookie_name,$cookie_value,$cookie_expiration,$cookie_path,$cookie_domain);

//print "cookie details: ".$cookie_name." , ".$cookie_value." , ".date("m-d-Y h:m:s",$cookie_expiration)." , ".$cookie_path ." , ".$cookie_domain;
//print $message; // for debugging, tells if the cookie was found or not

// End of Cookiemonster function
}

add_action('init', 'myCookieMonster');

Posted in Uncategorized | Leave a comment

Install PHP with Apache2 on 64 bit AMD

when installing php-5.3.5 on AMD64, make install on php gives this:

cannot access `/usr/local/apache2/modules/libphp5.so': No such file or directory

Apparently a lot of things can cause this problem.
Finally I tried an earlier version of PHP (5.3.3) from another AMD64 machine, and what do you know, libphp5.so was created in the .libs folder this time!
So now I can upgrade php to 5.3.5 and the file is there in the apache modules. But if you are trying to install PHP 5.3.5 for the first time, it seems like libphp5.so never gets created.

Posted in Uncategorized | Leave a comment