1

Well, I seem to be a hard drive killer. Several months ago, I had a laptop with harddrive problems, which required me to replace the disk.

Now, I have a separate laptop, which I has a bunch of bad sectors (I don't know how long they've been bad, but I accidentally dropped the computer a few day ago), resulting in a bunch of bad blocks. I've managed to remap these bad blocks using e2fsck -y -c -f /dev/sda5, but for some reason I can't get TTY working again.

Whenever I enter any of the TTY screens, I am greeted with a blinking cursor, which resembles a white underscrore. From there, the computer completely ignores anything I try to type. TTY doesn't even so much as ask me to enter my username/password (If I try to enter my password anyway, I will again be ignored). All I can do is switch back to my desktop using CTRL+ALT+F7.

Since TTY is part of the GNU Core Utilities, I decided to try running repair coreutils ("repair" is a bash alias, which in turn runs sudo apt-get -y --force-yes --reinstall install), but that didn't help at all. I've also tried sudo dpkg-reconfigure coreutils, and again... no dice. The only thing I haven't tried yet is removing coreutils altogether, running 'apt-get autoremove --purge', and reinstalling coreutils from scratch (I'm too scared to even so much as try something like this, unless necessary!).

I'm currently running the Cinnamon desktop (lightdm login), on Ubuntu 13.10 i386 Desktop editon. Also, if I run sudo -i login from gnome-terminal, it pretty much works as expected.

PS: I don't want to buy yet another hard drive, as I'm only working part time, and could use the money for other things.

Update:I think the problem might lie with getty (or agetty), as everytime I run 'getty 0', I get a segmentation fault error. Does anyone know how to reinstall getty? sudo apt-get install getty doesn't seem to work (E: Unable to locate package getty), likewise for agetty.

  • You explain what you've tried in much detail (very good!) but you don't explain exactly what the problem is. You just say the ttys don't work.. "Don't work" is very general. – Seth Feb 1 '14 at 19:17
  • Oops! It seems I haven't actually explained the symptom all that well. I've updated the question. – TSJNachos117 Feb 1 '14 at 19:36
2

One way to check if getty has been corrupted (of which we are already pretty sure) is to check it's md5sum against the md5sum of an uncorrupted getty. For this we need live media.

Boot a liveCD (or DVD, USB, SD, or whatever). Click "Try Ubuntu". Once the desktop loads you will need to mount the hard drive partition that has Ubuntu on it (you should be able to do this from Nautilus, just click on the drive name/size and it'll automount).

Once you have your Ubuntu partition mounted you'll need to find out where it was mounted. Mine was mounted under /media/ubuntu/XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX. Once that's accomplished, open a terminal and navigate to /sbin:

cd /sbin  

This is where the getty executable resides. Now run:

md5sum getty  

You should get a 32 character string of alpha-numeric characters followed by the word "getty". This is the md5sum of the LiveCD's getty. Now move to your ubuntu installation's /sbin folder:

cd /media/ubuntu/XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/sbin  

Replacing /media/ubuntu/XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX with the location that your Ubuntu partition is mounted at (it should be similar). Now run

md5sum getty 

Again. The output this time is for the getty on your system. If the md5sums don't match then one of the gettys is corrupted.

enter image description here

If the md5sums don't match, let's replace the getty on your system with the getty on the liveCD:

cp /sbin/getty /media/ubuntu/XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/sbin

Restart your system and try the ttys again. Of course, there could be more corrupted than just the getty executable so this might not completely solve the problem.

For reference the md5sum of my getty is

ef47463b761005305c9cb42a38183095

And remember, it's always best to sleep the laptop before moving it around.

  • I don't have any live media with me at the moment, but I did compare the md5sums with another laptop (the same one I mentioned in the second sentence), and got a different result. So, I used a LAN filesharing app to transfer both files (that is, getty and agetty), run chmod ugo+rwx, and rebooted. This seems to have solved the problem. Thanks alot! I do find it interesting, though, that I got a different md5sum (on the "good copy) than you: 78ffe6e30c11f6cc070bc4e4619c90db. But, I'm guessing You're using a different version of Ubuntu than me. – TSJNachos117 Feb 1 '14 at 20:55
  • @TSJNachos117 No, I'm using 13.10 too, but I'm using the 64bit version, which could certainly change things. – Seth Feb 1 '14 at 20:59
0

BTW, there's a way to find out which package this file belongs to. If you type dpkg-query -S /sbin/getty, it will tell you that this is part of the util-linux package. So, if one reinstalls that package, all will be good. I haven't tested this, since the problem was more-or-less solved years ago, but it should work with ANY corrupted program (except those that weren't installed in the form of debian packages). I just though I would post that here in case it happens to be useful to someone.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.