Friday, April 10, 2015

Making my Ubuntu box resolvable by hostname on my network

I had an old PC laying around with some old flavor of Ubuntu.  I decided to resurrect it to use as a backup server, ssh server, or whatever the heck else I wanted (it is Linux, after all ;)

Anyway... I connected it to my router and fired it up.  I saw "voyager" pop up on the Network display of my router, so I was pretty happy.  I ssh'ed in and started updating to the latest release - 14.04.

All went well, until the next time I tried to ssh or vnc to my box...  "Could not resolve hostname."  What?!?!  This worked a little while ago...  What changed?  My router still called it voyager...  Oh well, I just started using the IP instead.

Finally, I determined to figure this out.  After some googling, I found that I need to add this line to /etc/dhcp/dhclient.conf:
send host-name "voyager";
It was originally:
send host-name = gethostname();
 But that didn't work anymore for some reason.  Restart network:
sudo service network-manager restart
And we were in business!

Wednesday, April 8, 2015

PS3 HDD Failure? ddrescue to the Rescue!

It finally happened...  I knew it was going to, but I was too lazy to do anything about it.  Several months ago, I turned on my PS3 and was presented with a screen saying something to the effect of, "Your filesystem is corrupt.  Select 'Yes' to repair the filesystem".  Then it started happening more frequently.  My kids got mad when they tried to watch Netflix or play Minecraft but had to wait for the filesystem scan to complete.  I knew this was bad, and all I had to do was walk 20 feet to my office, grab my USB hdd, and do a backup of my PS3...  but I didn't....

Finally, the Friday before Easter, the PS3 booted up to the filesystem scan screen, took longer than usual, rebooted... and came back to the scan.  It was in an infinite loop.  I read through the tips of booting in safe mode, but the system ended up hanging when trying to restore the defaults.  I thought all was lost.  I was bummed that hours of Uncharted 1, 2, and 3, The Last of Us, and Red Dead Redemption would be lost...  I shuddered to think of my childrens' sad faces as I told them the thousands of hours that they put into building levels on Minecraft were gone...

Just to be sure it was my PS3's hdd and not an issue with the system, I took the hdd out and slapped it in my laptop, booted to my Lubuntu USB stick, and ran:
sudo badblocks -v /dev/sda > /tmp/bad-blocks.txt
Sure enough, there were eight bad sectors.  I thought all hope was lost.  But not so fast!  After a couple hours of searching, I came to Deon's World.  Hmmm...  ddrescue?  Yes!  That just might work!  I plugged my USB hdd into my laptop and executed:
sudo ddrescue -vr 1 /dev/sda /media/usb/ps3.img /media/usb/ps3.log
After an hour or so, the clone completed, spitting out a few errors about the bad sectors.  I shut the laptop down and put a spare 9.5 mm SATA hdd in, and copied the image to it:
sudo ddrescue -v /media/usb/ps3.img /dev/sda
No for the moment of truth!  I put it back in the PS3 and booted it up.  I saw the "SONY" screen that popped up the very first time I booted my PS3.  I panicked a little at first, then remembered that this was probably the effect of my trying to revert back to default settings from safe mode.

Finally, sure enough, everything was back!  Now, I'm guessing that some save file somewhere is corrupt due to the bad sectors...  but at this point, I'm just glad I don't have to tell the kids how close there Minecraft worlds were to complete destruction!

Now I just gotta remind myself to back up my PS3 on a semi-regular basis...

Hope this can help someone else!

UPDATE:

I think I mentioned above my original PS3 HDD was 120 GB and the new one was 250 GB.  I knew ddrescue would make an exact image of the 120 GB hdd, which I assumed meant that the PS3 would only see the first 120 GB of the new drive.  After I got over the joy of knowing that all my stuff was back, I thought about this and checked the System Information.  Funny thing was that the PS3 recognized it as a 250 GB drive, but said only 24 GB were free.  Hmmmmm...  So, I took a backup (it took like 2.5 hours to backup 40+ GB of data???).  Then, I formatted the hdd from the safe mode menu (I can't recall which option I chose now).  Then I restored the latest firmware via my USB hdd.  Finally, I started it back up, went through the initial setup process, and restored from backup.  Now everything is back, and I'm showing a lot more free space :)  

Thursday, April 2, 2015

Bar jokes

  • A dog limps into a bar looking for the man who shot his Pa.
  • A horse walks into a bar and the bartender says, “Hey! Why such a long face?”
  • A mushroom walks into a bar and the bartender says, “Sorry, we don’t serve mushrooms in here.” The mushroom replies, “Why not? I’m a fungi!”
  • A sandwich walks into a bar and the bartender says, “Sorry, we don’t serve food here!”
  • A rope walks into a bar. The bartender says, “We don’t serve ropes in here.” The rope walks outside, ties a knot in the middle of his body, brushes out the strands at the bottom and heads back into the bar. The bartender says, “Aren’t you the rope I just threw out of here?” The rope replies, “No, I’m a frayed knot.”
  • A pair of jumper cables walks into a bar. The bartender says to them, “I’ll serve you two, but don’t start anything.”
  • Two peanuts walk into a bar that’s patronized by a rough crowd. One was assaulted.
  • A pony walks into a bar and whispers to the bartender, “Can I have a beer?” The bartender replies, “Sure, but why are you whispering?” The pony answers, “I’m sorry. I’m just a little hoarse.”
  • Two cannibals were sitting in a bar having drinks and munching on a clown. One cannibal says to the other, “Does this taste funny to you?”
  • A skeleton walks into a bar and says, “Give me a beer and a mop.”
  • A grasshopper walks into a bar and orders a drink. The bartender says, “Hey! We’ve got a drink named after you!” Surprised, the grasshopper replies, “You’ve got a drink named Steve?”
  • A blind man walks into a bar with a seeing-eye dog. He grabs the leash and starts swinging the dog round and round over his head. The bartender rushes over and asks the blind man, “What are you doing?” The blind man very calmly replies, “Just looking around.”
  • A termite walks into a bar and asks, “Is the bar…tender here?”
  • A giraffe walks into a bar and the bartender says, “Let me guess, a longneck.
  • A snake slithers into a bar and the bartender says, “I’m sorry, but I can’t serve you.” The snake replies, “Why not?” The bartender answers, “’Cause you can’t hold your liquor.”
  • A baby seal walks into a bar. The bartender asks, “What’ll you have?” The baby seals replies, “Anything but a Canadian Club.”
  • A penguin walks into a bar and asks the bartender, “Have you seen my brother?” The bartender replies, “I’m not sure. What does he look like?”
  • A bear walks into a bar, sits down and asks, “Can I have a margarita and ……….. a sandwich?” The bartender answers, “Sure, but why the big pause?”
  • A giraffe walks into a bar and asks for a beer. The bartender serves him and says, “That’ll be $7.50. Hey! We don’t get many of your kind in here.” The giraffe replies, “At $7.50 a beer, I can see why not.”

ROWID in Toad

Just a quick reminder to myself...  Was trying to understand a query to delete duplicates out of an Oracle table a bit better, but I could not understand why Toad did not display the ROWID.  For example:

select a.rowid, a.* from table_xyz a where a.rowid > (select min(b.rowid) from table_xyz b where b.some_column = a.some_column);

I eventually found that by aliasing ROWID, it will display in Toad.  For example:
select a.rowid as show_me ...
There's also a way to perform various clicks in the correct spot of the Data Grid to enable the display of ROWID...  But the alias is easier to explain here...