Posts Tagged Linux

Automounting NTFS drives in Ubuntu 8.04

This is another stepping stone in my journey of getting to know Linux.

When I installed Ubuntu on my PC, it used to detect my other drives without any problems. What I mean by other drives, is my Windows partitions (C: drive, anyone?). Well, I have 4 of them, and I’ve nicknamed them as well. C: is called Cayman S, D: is called Carrera S, E: is called Carrera GT and F: is called Turbo.

You see, I’m a Porsche fanboy.

Anyway, to mount these drives, I would have to manually go to Places -> Removable Media, and select my drive. This was OK with me…till now. The thing is that, my music is all stored on D:, and having to manually mount it is, well, a little problem. In fact, I have a little applet on the panel, which allows me to mount a drive with 2 clicks, but, being the perfectionist that I am, I wanted it to be done automatically.

It didn’t take too much of digging around to find a forum thread which told me how to do this. It involved editing a file called fstab. This file can be found in the /etc folder. This is the file that Linux looks at when mounting drives while booting. It was a simple matter of adding entries for my other drives, so that they would be automounted as well.

First, you need to know what is the exact name for the drive your mounting. The thing is that in Linux, all driver are names as sda or hda, with individual partitions names as sda1 or hda6, or something like that. So, open up a terminal window, and type in

sudo fdisk -l

You’ll have to enter your password after entering the above command. This program should list all the partitions on your hard drive. Now, comes the hard part. You need to find which hda# or sda# corresponds to which partition. # represents number, by the way. Now, it’s going to be a game of hit and trial. See, generally, hda1 will represent C: rather than D:. Get it, but, if Linux resized partitions for you, this numbering might’ve got messed up.

See, the easiest way to find which sda is which partition is to mount them. But, there’s a hitch. In order to use the mount command, the partition must be in the fstab file I mentioned earlier, otherwise it won’t mount. In fact, we need to make these entries, because only then will the partitions be automounted. So, since I can’t do it that way, I mounted them using the Removable Media menu. Your hard drive partition label is automatically applied to the mounted partition, so it should help you identify the partition you mounted. Then try using the command umount. Umount is used to unmount the drives. See, if I mount C:, and then upon trying sudo umount /dev/sda1, and it gets unmounted, it means that sda1 represents C:, get it? Two things you should know, while doing all this…

  1. You’ll have to give the full path for the device i.e. /dev/sda# or /dev/hda#. In fact, if you have more than one hard drive, as in physical hard drive, you’ll have /dev/sdb# or /dev/hdb#, get it? a, b, c? Good boy. You’ll get to know what all to try an unmount, by going through the output of your earlier sudo fdsik -l command. I strongly recommend opening a new terminal window for your attempts at unmounting non-existent drives, because you will need to refer to the output of the fdisk command.
  2. Open up /etc/fstab, by typing in gedit /etc/fstab at a terminal. Keep in mind that if you don’t mention sudo before the command, you’ll only be able to view the file. That’s OK, cause I just want to know something, not edit anything. You see, the first 2 entries in the file, are your Linux partition and your swap file. Don’t try to unmount them, because it might lead to your PC crashing or something. Linux is supposed to deny any attempts to unmount them, but in any case, don’t try to. By the way, the lines in the fstab file which have a ‘#‘ before them, are comments, they’re not comments.

Now, you should’ve found out which sda# or hda# refers to which drive. Now, you need to create mountpoints for these drives. Mountpoints are nothing but the folder which points to the contents of the partition. When you try to access the folder, you’ll be able to see the contents of the partition. In Ubuntu, mountpoints are best created inside the /media folder. Other Linux distributions like to make in under /mnt, but it really doesn’t make a difference. So, now we need to make the mountpoints. Do so, by giving the command:

sudo mkdir /media/<mountpoint_name>

Here, mkdir is the command used for making directories, or as they’re better known, folders! So, make as many mountpoints as there are partitions you need to automount. Keep in mind that although while mounting through the Removable Media menu, the mountpoints can have a space in the names, it’s not advisable to put spaces when you’re manually making mountpoints. It’s not that you can’t have a space in the folder name, it’s more because I haven’t been able to figure out a way to automount a partition to a mountpoint with a space. See, to create a fodler with a space, like Cayman S, I’ll have to write:

sudo mkdir /media/Cayman S

The forward slash (I hope it’s a forward slash…I always mess up the slashes!), signifies that the upcoming character is not a part of the command being input, but is to be interpreted as is. As a character. Because while giving commands, a space can mean different things. Like, there’s a space between sudo and mkdir. But to literally mean a space, like in the folder name, you need to put a forward space.

Anyway, you can’t add an automount entry with the mountpoint having a space. At least, that’s what my experience tells me. To add the automount entry, type in:

sudo gedit /etc/fstab

gedit is the text editing program in Ubuntu. Actually, for GNOME, the desktop environment for Ubuntu. GNOME stands for GNU Object Management Environment. sudo is because we need the priveleges to edit the system file as well.

At the end of the file, after all the other system generated entries, we need to add our own. I suggest you make a copy of the file, by typing in:

sudo cp /etc/fstab /etc/fstab_bk

This copies the original fstab and names the copy as fstab_bk. In case you need to replace the edited version with the original, type in

sudo rm /etc/fstab

This removes the edited fstab. Then:

sudo mv /etc/fstab_bk

This renames the previously created fstab_bk as fstab. So back to the entries you need to add at the end of the file…

<dev_name> <mountpoint> ntfs-3g defaults 0 0

  • <dev_name> – hda# or sd#
  • <mountpoint> – The mountpoint i.e. /mount/<foldername>
  • ntfs-3g – is the filesystem. In this case, it’s NTFS, but you’ll need to write ntfs-3g
  • defaultsis for the options.
  • 0 – I don’t know what this number is for
  • 0 – nor this

Assuming that you didn’t try to put in some mountpoints with spaces like I did, it should work. If you’re adamant on having a space in the mountpoint, either find a website that helps you with that, or just replace the space with an underscore or ‘_’. Restart your PC, and all should be fine.

Tags: , ,

sudo

I think I’ve already used this once, but haven’t explained it properly.

sudo is a tool in Linux, which allows you to perform certain tasks, which require root user privileges. sudo can be translates as super user do. Well, root is the super user. With this account, you have unlimited access to the system.

In short, you’re king…on that PC, at least!

Well, it isn’t a good idea logging in as the root user, because then we wouldn’t even need users would we. So, some ingeniuos fellow came up with sudo, which allows you to impersonate the root user while performing certain tasks.

When you issue a command with sudo prefixed, you’ll need to give your password. Not the root’s password, your own password. Just to authenticate you. You see, someone else can crash your PC, simply by logging in as root, and mucking around with your files. The password is a nice barrier. Also, you’ll need to give your password only once each terminal session. This means that if you open a terminal window, and issue a sudo command, later sudo commands won’t need the password. So, make sure you close that terminal window.

Also, sudo is actually a program itself, and this program accepts other commands as arguments while running. By the way, an argument is a piece of information that you pass onto a program, based on which it works. If you didn’t know this, you should’ve boiled your head by now. sudo is listed as a package in Synaptic. To know more about Synaptic and packages, click here.

There really isn’t much else to say about sudo, so I’ll leave it at that…

Tags: , ,

Restricted Stuff

I recently installed Ubuntu 8.04 on my PC. Had got the CD shipped from Netherlands. Got here quicker than I expected! Anyway, I’m like CompizFusion on my PC, it was one of the chief things that attracted me to Linux.

So, the first thing I tried to do when I got Ubuntu up and running (really, you don’t need to do much, actually!), was enable Desktop Effects. CompizFusion has been further expanded and integrated into Ubuntu, as compared to earlier versions. But when I tried to enable the effects, it gave a very simple message.

Desktop Effects couldn’t be enabled.

OK

Not like Windows, which would give something like..

Error 0×428563 :: Dektop Effects initialisation failed. Module GFX-core terminated in an unexpected manner. Last output – Unable to interface with nv169.21-6600gt. Writing 64KB crash dump to C:WINDOWSsystem32logscrashlogsdsktpxf.txt. Contact your system administrator for further help.

Send Error Report                                         Details                                                       Cancel

Anyway, I had experienced a similar prooblem on my old PC, when I couldn’t enable Compiz. In that case, it was because there were no proper 3D drivers for the integrated graphics chip. So, I proceeded to enable the nVidia drivers.

I open Synaptic (to know more about Synaptic, click here), and search for nvidia. It turns up a lost of results, and I find that 3 of them are main drivers: nvidia-glx-legacy, nvidia-glx and nvidia-glx-new, with the first one being for older cards, second one for not so old cards, and the last one for the new cards. So, I tried installing nvidia-glx, and everything went smooth, except that it didn’t get enabled. Installed but not enabled. Now, not knowing how to edit xorg.conf myself, I tried going to System -> Administration -> Hardware Drivers, which is where you can enable Restricted Drivers. Restricted Drivers are those which aren’t open source, and thus, may or may not be compatible with all PCs and configurations. But I’d found nVidia restricted drivers pretty OK, and so I enabled that, thinking it would solve my problems.

Upon enabling it, Synaptic began downloading nvidia-glx-new. No probs, installed, restarted, and found that the resolution at 1024×768, whereas my monitor supported resolutions upto 1280×1024.  I should note that while Ubuntu is loading the resolution is 1280×1024, but it later goes to 1024×768. So, I opened System -> Preferences -> Screen Resolution and found that the list of resolutions didn’t have anything after 1024×768. Infact, the original generic driver which was working earlier, was giving me the resolutions I wanted! But not the one specifically designed for my 6600GT. But the generic driver didn’t support hardware acceleration, which is why I wanted to install the restricted drivers in the first place!

So, after a lot of uninstallation and installation, I was stumpted. But the tech nut in me, doesn’t like stumpted. He’s likely to blow up his PC, if that’s what it takes to fix it! Nothing that drastic required this time. I opened Synaptic again. Searched for nvidia and found a package called nvidia-settings. My instincts told me this was what I was looking for. It was, After installing, I could access this control panel for my 6600GT, which was not unlike the control panel for nVidia graphics cards in older driver versions. So, there I could set the resolution to 1280×1024.

But after resarting, the resolution was still 1024×768. I opened the Control Panel again, and there was a button, Save to X Configuration File. Well, I clicked, and it said that it couldn’t save the file. Then I realised that, like with many changes made to system files, this one also required administrative priveleges, so in the Terminal, I typed:

sudo nvidia-settings

and all was well… Clicked on the Save to X Configuration File after changing the resolution and it was OK. Just one thing. When Ubuntu boots up, for about half-a-second, the nVidia logo appears full-screen.

It’s kinda nice, cause it reminds me I have a 6600GT under the hood, although it’s not great anymore.

Tags: , , ,

apt and Synaptic

It’s not cryptic, just technical. In Windows, if you have to install an application, you download the setup file from the Internet, and run it, right? And to uninstall it, you go to Add/Remove Programs, in the Control Panel? Well, it’s a bit different in Linux. Actually quite different. And simpler! For this post, I’m going to take up the case of Ubuntu, which is the Linux distribution I use.

Software, in Linux, consists of packages. And packages are managed by package managers. There are several package managers, like dpkg, rpm etc.. Anyway, I’ll concentrate on dpkg, which is the one used by Ubuntu. dpkg uses the .deb file format for its packages. But, the command you’ll generall by using is apt.

The problem is that apt has to be used from the Terminal, which is the equivalent of MS-DOS in Linux. Actually, it’s much more powerful… The format for the command will be something like:

sudo apt-get install <packagename>

sudo is for giving administrative privileges to the command. apt-get is the command. install is an argument well, install <packagename>.

Anyway, typing out all the commands yourself can be kinda cumbersome. So, an application was designed to be the front-end for apt, where you could click-select-aah-it works, and so on. This application is called Synaptic Package Manager. Find it under System -> Administration. You’ll need to give your password to open this application.

Synaptic

The system is pretty simple, you open Synaptic. Now, a list of ready-made packages is downloaded from the Ubuntu servers. This list is not just Ubuntu software, and pretty much anything and everything Linux can be found here, short of other Linux distributions. You ideally will not need to hunt around the Internet for packages to install. It should all be accessible from Synaptic. So, all you need to do is find the package you want to install, and double click it, to mark it for installation. A package already installed will have a darkened box next to it. To remove a package, right-click the item, and select Mark for Removal. Mark for Complete Removal also removes the setup files, so if you decide to reinstall the package, you’ll need to download the package file again. Mark for Upgrade, well, upgrades the package if a new version is available. Simple?

Synaptic Toolbar

Let me explain the Toolbar. Reload refreshes your list of packages by downloading a fresh list from the Ubuntu servers, Mark All Upgrades, is self-explanatory. Apply begins the process of downloading the packages and installing them. Properties gives more detail info about the package, than that available in the pane at the bottom. Search let’s you search for packages by name and/or package description.

Synaptic Topic List

The list on the left gives a list of categories into which the packages are sorted. Makes it easier for you to find what you’re looking for.

Oh, and one last thing. You can add more places to get packages from. These web addresses are known as repositories. Click on Settings -> Repositories, or alternatively, from the main System menu in Ubuntu, select Administration – > Software Sources. Here, under the Third Party Software tab, you can add more web addresses. If you like to experiment with Beta software, go to the Updates tab, and select the third and/or fourth check box, depending on your level of adventurism!

There’s another thing. See, in Linux, software is made up of several packages. So, if you’re installing Firefox (which, by the way, is pre-installed on Linux), you’ll need to install other packages Firefox depends on. If you try to manually download each of these packages, you’re likely to lose your marbles, because those packages Firefox depends on will themselves depend on others! So, you’re likely to be banging your head on a wall sooner or later. Synaptic makes it easy, by automatically installing the dependencies.

Once you’re done marking all of the packages you want, click Apply, and Synaptic will download all of the packages for you, and also install them. You’ll need to do nothing. And by the way, unless your changing an important system file, you won’t need to restart your PC, like Windows loves to.

If you bother to search on websites for ways to install your software, the websites may also give the Terminal commands. Running those commands is not unlike selecting the packages from Synaptic. It’s the same thing.

Also, whenever you get update notifications, it’s actually apt and Synaptic working in the background. And they say Linux is complicates. Personally in this front, Windows is much more complicated, because software often make Registry entries, that may/may not be erased during uninstall, cluttering up the Registry.

Ubuntu doesn’t pay me to post about them, and they give me their CDs for free, and the CDs don’t blow up Windows. Coexistence is the key. Try it out. Go to shipit.ubuntu.com/login and order a copy for yourself.

Tags: , ,

Snowball

It’s a common thing. Especially when your dealing with computers. One thing happens, which causes another, which in turn, throws other stuff out of sync.

The effect is multiplied if you’re dual-booting Windows XP and Linux.

For the uninitiated, dual-booting is when you have multiple operating systems installed on your PC. You know you’re dual-booting if you have to select an OS when booting your PC. Anyway, back to my predicament. I assume you’ve read my previous post before reading this. If not, click here.

Well, I got Windows working fine on my PC. As I had predicted, I could not boot into Ubuntu. However, this was not a problem. Ubuntu comes with a Live CD. A Live CD is nothing but the operating system pre-installed on a CD, which you just need to pop-into your drive and boot your PC.

Note: Do refer to this post, if you can’t get your PC to boot from a CD.

Anyway, I used the Ubuntu Live CD to boot Ubuntu. I had read instructions to reinstall GRUB to the Master Boot Record. Anyway, I wanted to check the exact commands, so I tried connecting the Internet. Unfortunately, I had turned off DHCP on my ADSL modem. DHCP refers to Dynamic Host Control Protocol. It’s a feature on many modems and network routers, which automatically assigns IP addresses to PCs. IP refers to Internet Protocol. IP addresses are a series of digits in the form of xxx.xxx.xxx.xxx, which uniquely identifies a component in a network. Also, ADSL stands for Asymmetric Digital Subscriber Line, which is a way to connect to the Internet using an existing phone line.

Ubuntu, by default, uses DHCP to connect to the Internet, and for some reason, my manual configuration wasn’t working. I fed in the IP address, gateway and DNS, manually, but it just wouldn’t connect. By the way, gateway and DNS are terms related to networks. A gateway is that IP address to which to send to data if it’s intended to go out of the internal network. For example, if I have a network consisting of me and my modem, then, my modem would be the gateway, because my PC will send information to the modem to send to the Internet. DNS stands for Doman Name Server. It’s actually something without which using the internet would be next to impossible. When you type ‘google.com’ into your browser address bar, the address is sent to the DNS, which looks up the IP address for that domain in its database.

Finally I did get connected. When I did, I found the page I was looking for – https://help.ubuntu.com/community/RecoveringUbuntuAfterInstallingWindows. This website describes how to get GRUB up and working again, so that I could boot into Ubuntu. It required me to:

  • Open the terminal. The terminal is similar to MS-DOS in Windows, although much more powerful. To be precise, similar to what MS-DOS was during the Windows 95-98 era.
  • Run sudo grub. Here sudo has no relation to Sudoku, because that’s what popped up in my mind, when I first read about. Sudo causes the command to be run with the credentials of the root user. The root user is similar to the Administrator in Windows, and has the highest privileges in all Linux distributions.
  • This command will open up the GRUB console. Type in find /boot/grub/stage1. The find command is used to locate which partition of a hard drive a particular file is located. By running this command, you get to know which partition GRUB files are located in. The output will typically by hda*.*, where * is replaced by a number, depending on what partition you install Linux.
  • Then, set the root partition for GRUB by typing root (hd*.*). Use the same value obtained in the last step.
  • Then type setup (hd0). This sets up GRUb in the Master Boot Record of the first hard disk of your PC.
  • Type quit to save changes and quit.
  • Now restart your PC. Windows and Linux should have ideally been automatically detected.

Not in my case.

Unfortunately, I could only boot into Windows. In the case of Linux, it gave me Error 17: Cannot mount partition or something like that. So, I booted using the Live CD again, and tried several permutations and combinations, till it finally worked. Apparently, while specifying the root partition, something had gone wrong. Installing Windows after formatting C: drive, seemed to have upset the partition numbering or something.

Not the end of my problems.

Something’s gone horribly wrong with Ubuntu. It boots up, but doesn’t show me the login screen. It boots into text-mode, showing me the terminal. And then the screen blink on and off 3 times, and then goes into safe graphics mode. It tells me that my graphics card and monitor can’t be detected and I have to set them myself, manually, which I do. Still, no change. I set the graphics driver to nVidia, and then reboot and the problem persists. Anyway, I managed to copy the Documents and Settings folder back to my C: drive.

Will post again about how I restored settings and how I fixed Ubuntu (if I do, that is…).

Tags: , , , ,

The Tech Nut is using WP-Gravatar