Archive for the ‘ubuntu’ Category

Linux: how do I find the devce name of my USB drive?

Monday, December 28th, 2009

Around the time I reviewed Chromium OS, I managed to totally b0rk one of my thumb drives. I somehow botched the dd command, and the device became unusable. When I plugged it in, nothing would happen. Or rather nothing on the UI side. My KDE would simply ignore the drive and pretend it was not there. I didn’t want to just throw out the USB stick, so I decided to figure out what device name gets assigned to it, and then repartition it again.

How do you do that? The simplest method is to watch the log files. When you plug in a USB the device, your system should make a note of it in /var/log/messages. So you should do the following:

tail -f /var/log/messages

In case you didn’t know, the tail command prints out the last few lines of a text file, and the -f argument basically means “follow”. So tail will basically pring any new lines that are appended into the console in real time. Once you issue this command, just plug in your device. Your output should look something like this:

Dec  1 12:56:44 malekith kernel: [13631.153753] usb 2-1: new high speed USB device using ehci_hcd and address 4
Dec  1 12:56:44 malekith kernel: [13631.288125] usb 2-1: configuration #1 chosen from 1 choice
Dec  1 12:56:44 malekith kernel: [13631.288669] scsi5 : SCSI emulation for USB Mass Storage devices
Dec  1 12:56:49 malekith kernel: [13636.295004] scsi 5:0:0:0: Direct-Access     Kingston DT 101 II        1.00 PQ: 0 ANSI: 2
Dec  1 12:56:49 malekith kernel: [13636.295900] sd 5:0:0:0: Attached scsi generic sg3 type 0
Dec  1 12:56:49 malekith kernel: [13636.306962] sd 5:0:0:0: [sdc] 7831552 512-byte logical blocks: (4.00 GB/3.73 GiB)
Dec  1 12:56:49 malekith kernel: [13636.308590] sd 5:0:0:0: [sdc] Write Protect is off
Dec  1 12:56:51 malekith kernel: [13636.315523]  sdc: sdc1
Dec  1 12:56:51 malekith kernel: [13637.905840] sd 5:0:0:0: [sdc] Attached SCSI removable disk

Check out the second to last line – it says sdc1. What does that mean? That means that my b0rken thumb drive is assigned to the /dev/sdc1 device. Now that I know that I can easily run fdsk on the device to format it and rebuild the partition table that was messed up by a botched dd command.

It’s that easy. I’m putting it here for future reference more than anything else.

Kubuntu 9.10 Upgrade: Karmic nVidia Failure

Monday, November 16th, 2009

Did they name Ubunu 9.10 Karmic on purpose, and then had it ruin the lives of the wicked people? My upgrade was an absolute train wreck. I spent my whole afternoon, and evening fixing it, and managed to accidentally delete few moths of email. Yay me!

The upgrade went smoothly up until I rebooted the machine and noticed that I’m running 800×600 and my dual head setup was broken. This was very noticeable on a 23 inch monitor, and running the new KDE version which super-large windows decorations. So I decided to fix it.

Quick note on KDE 4.3:

WHAT THE FUCK?

It seems that the design goal of this release was to “make it as shitty as Vista”. Can we please stop doing that? Seriously, I don’t even recognize this environment anymore. It was working fine before – there was no need to change the Kmenu, the panel or the fucking desktop.

Granted, the desktop effects are actually very nice, and the plasma widgets are cool. Still, I wasn’t very happy viewing it in 800×600 resolution on a 23″ monitor. Try that yourself and you will see why I was angry. Without the bells and whistles the desktop was just ugly and barely functional. I’m slowly getting used to it now and I think I will be fine but the first impression was horrible.

So I did the exact same thing that worked for me last time. I pulled up the KDE Hardware app and told it to activate proprietary nVidia driver. It didn’t work. I tried couple more times, and then restarted the machine thinking that maybe the damn thing is just not registering the change. That’s how I hosed my X. Kubuntu came back in text only mode and I had to hack the xorg.conf and switch it back to the generic driver.

After this I tried following some online troubleshooting steps trying to install, re-install the drivers, hack the xorg.conf and each thing I did made my system more broken than it was. Eventually I managed to delete my .kde folder with several moths of emails (ie. my last backup was few months ago, and I have no one to blame for this but my own stupidity).

PROTIP:

Do not do mv -i as root. Ever!

In fact, every time you do any moving or deleting from the command line you should back up the folders in question just in case. The beauty of working from the shell is that it does not try to hold your hand or second guess your choices. Linux will do precisely what you ask it to do – whether it is good or bad for the system. This gives you great deal of power and flexibility but comes at a price – a typo, or badly formatted command may actually damage the system or wipe your files.

This is what happened to my email folder. At one point during the troubleshooting I got it in my head that something went wrong in my KDE setup. At that point I got my machine to display the log in screen, but X would crash when trying to actually load the environment. So I decided rename my .kde directory and let the system generate a clean one to see if this helps. It did not, so I renamed it back. About 2 hours later I realized that I must have made a typo of some sort. When I finally got KDE to load it completely forgot all my settings. I went searching for the .kde-bak directory I created earlier, but it was nowhere to be found. It just went *poof*.

It wouldn’t be that bad if it wasn’t for the fact that Kontact keeps it’s email diles in there. Oops… I had backups, of course, but unfortunately I have been rather lax about them in the last few… um… months. So yeah – you get the idea. I was not a happy camper and there was no one I could blame for this but myself. First for being reckless with my commands. Second for not making a copy prior to fucking with such a crucial directory. Third for getting complacent and not running the backup script in god knows how long.

To make a long story short, half the solutions posted in the Ubuntu forums are total crap. It became painfully obvious that my problem ran much deeper. Reinstalling the drivers and re-creating the x config just wouldn’t cut it.

For reference my machine is a Latitude D820 with nVidia Quadro NVS 140m board. I was starting to think that there is just no working driver for this card that is compatible with the 2.6.31-14-generic kernel. Finally, after several hours I found the solution.

Alexander V. Røyne-Helgesen deserves one free internet for figuring this out. His fix is the only thing that worked for me. In case you are to lazy to click on the link, here is the solution:

First, open up your /etc/modprobe.d/lrm-video file and comment out every single entry that references nvidia. Your file should look something like this:

 # Make nvidia/nvidia_legacy and fglrx use /sbin/lrm-video to load  
install fglrx /sbin/lrm-video fglrx $CMDLINE_OPTS  
#install nvidia /sbin/lrm-video nvidia $CMDLINE_OPTS  
#install nvidia_legacy /sbin/lrm-video nvidia_legacy $CMDLINE_OPTS  
#install nvidia_new /sbin/lrm-video nvidia_new $CMDLINE_OPTS'

Once this is done, go to your /etc/modules file and add this at the end:

nvidia

Finally, go to your xorg.conf, find the entry that describes your video card and change the driver to nvidia. It should look something like this:

Section "Device"
   Identifier      "NVIDIA Corporation NV40m [Quadro NVS 140m]"
   Driver          "nvidia"
   # more lines here...

Now restart thy X server and… Boom! Back in business.

I should probably mention that I uninstalled and reinstalled the nVidia drivers about 10 times during the whole ordeal. I used various sources. The last thing I tried was the EnvyNG script (the package name is envyng – it’s in the repos). So I can confirm that this method above works with Quadro NVS 140m with a driver installed by EnvyNG. May not work after a straight upgrade.

Did I mention that the upgrade also broke my VirtualBox installation? Yeah, it did, but that’s a topic for a whole other post. Needless to say, I am never doing this sort of thing again on a weekday.

You don’t need to convert them…

Thursday, November 5th, 2009

Recently a friend of mine approached me with a weird question: how to install Windows on a machine without a CD or Floppy drive. I was intrigued. The obvious question here was “why?” It turned out that he just ordered himself one of those Dell Mini notebooks. Naturally, like every living being on planet Earth my friend hates Windows Vista with a passion and as a result he didn’t really feel like paying a Vista tax. So he opted for the Ubuntu version with the intention of installing his copy of Windows XP on the machine. But while he was in the cost saving mode, he also decided not to purchase the optional external CD drive.

Oops… That CD drive was sort of there for a reason. He realized that after it was too late to do anything. So now he basically wanted to know if it’s possible to install XP from a USB thumb drive. Can it be done? Apparently, yes it can. All you need to do, is google for it.

But at the time we were having this conversation I gave him a benefit of the doubt and assumed he already did search it online, and came up empty. And since I didn’t know the solution of the top of my head, I got a crazy idea.

“Why don’t you just keep Ubuntu?” I asked him.

I mean, it’s a Dell Mini with a 16GB solid state drive and a tiny ass screen – he is definitely not going to use that machine for gaming, photoshop or other Windows centric stuff like that. The machine will likely be used as a hardware extension of a web browser. The OS is mostly an overhead on a machine like that.

Now, I’m not a linux evangelist. I don’t go around telling people to switch to Linux. I honestly can’t do that anymore because I know that my experience with the OS is irrelevant. I am a computer geek a software developer and linux enthusiast. This makes so far removed from the general population, that I can hardly relate to your average Windows user.

Nevertheless I did my best to give him a quick pitch on how the OS will be mostly irrelevant on that machine. And it will run most of his favorite apps – like firefox for example.

“Will it run Chrome?” he demanded.

Of course it will run chrome. Then again last time I used Linux version of Chrome Flash didn’t work yet, but they fucking update it daily. I quickly launched my copy of the browser to check, and lo – it was running flash quite flawlessly now.

My friend was not fully convinced yet. He started asking me about opening Word documents so I pulled up Open Office and illustrated how it works. Then I quickly downloaded and burned him a copy of the Gnome based Jaunty to show him what the OS that ships with his Mini will look like (I’m running Kubuntu on my laptop, and it looks quite different).

I booted it on his laptop, and he was blown away when he realized you can actually run a fully functional OS from the CD like that.

“But how can it do that?”

Well, because it’s really not that impressive. I mean, it doesn’t really matter whether your OS binaries are on the HD or on some other media. You have to load them into memory before they get executed anyway – so where they are originally is irrelevant. There is really no reason why Windows couldn’t have a Live CD version. In fact, you can easily make one with BartPE.

He was also enamored with virtual desktops. “It’s like tabs for your desktop” he said. I never thought about them like that, but yes – that’s a valid analogy. That’s technically how these things work.

He was also amazed on how many “features” were included in the OS itself. I had to explain that most of the applications he saw there were really stand alone open source projects – but by virtue of being free software they could be included in the free OS.

To make this long story short, my friend decided to keep Ubuntu on that machine – at least for now. In fact, he said he might replace it with the Notebook Remix version he found online so he can be running Jaunty (the Dell ships with Intrepid if I’m not mistaken). I told him that if he tries Ubuntu can’t deal with it, I’ll be happy to help him with the XP installation hack. He nodded, but I’ve seen that gleam in his eye that told me it won’t be needed. I think our little community might have a brand new member.

Now, I’m fairly sure my friend will continue using Windows. I didn’t “convert” him and made him into an exclusive Linux user. But he will give Ubuntu a try, and hopefully will like it becoming an OS agnostic nut bag like me. And that’s more than I could ever ask for.

We really don’t need to convert people, or try to ween them off of Windows. All we need to do is to show them the alternatives and find places in which they work well – like mini notebooks for example. This will have far reaching effects. For one, they will no longer automatically assume that OS == Windows. They will see that there are different operating systems that can be used for different purposes. Secondly, they will be now able to call MS on their bullshit as they will see that things can be done differently in the open source world. Thirdly… Well, they will be using linux. The more of us are there, the better. I don’t care if he still uses Windows on the other machine – he still counts as one of us.