Feeds:
Posts
Comments

Posts Tagged ‘drive’

If you’ve upgraded your Ubuntu system only to find you don’t have permission to do pretty much anything, as I did after upgrading to 13.10, it can be pretty annoying even for an advanced user, and downright scary for a novice. The symptoms are pretty obvious, as when you go to install updates, all you get is an error message saying “This operation cannot continue since proper authorization was not provided“. And using the Shutdown button seems to do nothing, and even using a terminal command to power off might see the shutdown process halt half-way through, forcing you to use the PC’s power button.

On top of that, even mounting removable drives (or other partitions on your internal drive) ends in being told you can’t, and even trying to play a DVD ends with “Unable to access “DVDVIDEO”. Not authorized to perform operation.

While there are ways around all of these situations for more advanced users, those less experienced with Ubuntu/Linux would find it all quite daunting, and pretty much look at their system as unusable. And one shouldn’t have to go through the bother of manually mounting drives through the terminal, or invoking the Software Updater as superuser, or any other thing we usually take for granted.

Luckily, the fix – which involves PAM (Pluggable Authentication Modules) – is actually quite simple, and should have everything back to normal in no time.

In a terminal, enter the following command to edit the PAM authentication file for the LightDM display manager:

gksu gedit /etc/pam.d/lightdm

Under the first line “#%PAM-1.0” paste the following 2 lines:

session required pam_loginuid.so
session required pam_systemd.so

Save and exit the file, then log out and back in again, and all should now be fine (you shouldn’t need to reboot).

☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻

Another method, which fixed the problem for some (but not in my case, and many others) is to run:

sudo pam-auth-update --force

This opens PAM‘s config within the terminal, at which you either check or uncheck items, or just hit Tab to go to OK, and hit Enter.

☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻

If need be, like you have GDM installed and it is interfering with LightDM, run dpkg-reconfigure gdm and select lightdm (you may need to reboot).

☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻

Did this information make your day? Did it rescue you from hours of headache? Then please consider making a donation via PayPal, to buy me a donut, beer, or some fish’n’chips for my time and effort! Many thanks!

Buy Ubuntu Genius a Beer to say Thanks!

Read Full Post »

A couple of years or so ago, Ubuntu‘s file manager, Nautilus, gave you the ability to “Safely Remove Drive” when right-clicking an attached USB hard drive (or flash drive), rather than just simply “Unmount” it. The difference between the two is that when you simply unmount a drive, it is still listed as attached (but not mounted) in Nautilus‘s left-pane. For many, seeing the drive completely removed was reassuring, since it could then be unplugged safe in the knowledge there would be no data loss, or physical damage to the device.

However, in the Ubuntu 12.10 upgrade, we lost this option, and now only have “Unmount” and “Eject” (which is exactly the same as “Unmount“, except in the case of CD/DVD drives where it will eject the disc tray).

Device Context-Menu

While “Safely Remove Drive” may yet make a return (it has caused a flood of complaints about this backward move), for now you can do it via the command-line if you really prefer this to simply unmounting.

First, if you’re unsure what the drive’s address is, run the following in the terminal:

mount|grep ^'/dev'

If you only have one internal hard drive, and no other storage devices attached, it should be something like /dev/sdb. To safely unmount and totally remove the drive, enter the following command, replacing /dev/sdb with your own drive’s designation if need be:

udisks --unmount /dev/sdb1 && udisks --detach /dev/sdb

You should now see your drive disappear from the file manager’s left-pane.

Note that in the unlikely event you have a partition other than the first partition on the drive mounting, you will need to change the “1” (ie: sdb1) in the command to reflect that.

☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻

Did this information make your day? Did it rescue you from hours of headache? Then please consider making a donation via PayPal, to buy me a donut, beer, or some fish’n’chips for my time and effort! Many thanks!

Buy Ubuntu Genius a Beer to say Thanks!

Read Full Post »

If you’ve attached an external hard drive for backing up your files, or created a new partition for storage, only to find you don’t have the permissions to use it, you’d be understandably frustrated. But it’s actually quite easy to remedy by simply running a command in the terminal in the form of:

sudo chown -R username:username /partition/mount-point

Note that the above isn’t the actual command you’ll be using, as you’ll need to replace each instance of username with your actual username, and also determine your mount-point, which is not the device name (eg: /dev/sdb1).

To find the mount-point, run mount in the terminal, and locate the line that corresponds to the drive or partition in question. If you have never named (or set the label for) it, it will probably look something like:

/dev/sdb1 on /media/bf9a2c45-491a-4778-9d76-47832fe38820

If you have set the label with something descriptive, it should like similar to:

/dev/sdb1 on /media/1Tb Pocket Drive

As you can see, your mount-point will look something like /media/bf9a2c45-491a-4778-9d76-47832fe38820 or /media/1Tb Pocket Drive, so all you need to do now is run a command like one of the following, replacing the relevant info with what is appropriate to you:

sudo chown -R billgates:billgates /media/bf9a2c45-491a-4778-9d76-47832fe38820

sudo chown -R billgates:billgates '/media/1Tb Pocket Drive'

Note that if your custom label contains spaces (e.g. 1Tb Pocket Drive) , you will need to enclose the entire mount-point path in single quotes, but won’t need them if it’s a single word or multiple words joined by hyphens or underscores.

That’s it – you should now be able to do whatever you want with the drive or partition in question, as you’re now the owner.

☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻

Did this information make your day? Did it rescue you from hours of headache? Then please consider making a donation via PayPal, to buy me a donut, beer, or some fish’n’chips for my time and effort! Many thanks!

Buy Ubuntu Genius a Beer to say Thanks!

ption]

Read Full Post »

If you’ve attached an external hard drive to your system, then decided to use your partitioner to format it to EXT4 for greater efficiency (or just to match your Ubuntu system), you may have been shocked to find that your empty drive seemed to be missing a few gigabytes when mounted afterwards. And this has nothing to do with the good old binary (base-8) vs decimal (base-10) situation which would see your “750Gb” drive be more like 700Gb (in Windows and earlier versions of Ubuntu – now Mac OS X and Ubuntu have followed hardware manufacturers and use decimal, so that’s more like 738Gb).

This is because Ubuntu (and other Linux distributions) reserve typically around 5% of the space for the root user and system services, so should you run out of hard drive space, the administrator can still log in, and system services continue to run.

However, this is only really needed for your Ubuntu partition, so if you have an external EXT4 drive, or have an EXT4 partition on your internal drive (other than the one your system is on), you are needlessly wasting space (40Gb of the drive in the example). But you can free up that disk space quite easily, without having to re-partition the drive or anything. All it takes is a couple of commands pasted into the terminal.

In the following example, an external hard-drive will have the reserve set to 0 (zero), since this is what most people will need this for. First, we have to determine the device name, as using its mounted name – /media/700Gb Ext4 – won’t suffice. To do so, enter the following into the terminal:

mount|grep ^'/dev'

Look for the line containing your device:

/dev/sdc1 on /media/700Gb Ext4 type ext4 (rw,nosuid,nodev,uhelper=udisks)

… and you can see what it is named (/dev/sdc1 in this case). To free up reserved space, enter the following (replacing /dev/sdc1 with whatever the appropriate device name is, if need be – just make sure you don’t do it to your main drive!):

sudo tune2fs -m 0 /dev/sdc1

You should then be presented with the following message:

Setting reserved blocks percentage to 0% (0 blocks)

To confirm all has gone well, you can right-click an empty area of the folder window for the device and choose Properties, then compare the free space from before and after, or run the following command (once again replacing the device name with the correct one in your case):

sudo tune2fs -l /dev/sdc1 | grep 'Reserved block count'

You should be greeted with the following:

Reserved block count: 0

That’s it – you now have all of your drive to use.

ΘΘΘΘΘΘΘΘΘΘΘΘΘΘΘΘΘΘΘΘΘΘΘΘΘΘΘΘΘ

Note: if you receive the following error message:

tune2fs: Bad magic number in super-block while trying to open /dev/sdb1
Couldn’t find valid filesystem superblock.

… then the filesystem likely isn’t EXT4 – chances are the drive is actually formatted as NTFS or FAT for use on Windows systems (which would be the case if you’ve bought an external drive, and never did anything other than copy files to it). You would have needed to partition/format the drive to EXT4, so if you didn’t, then you actually don’t need this guide.

☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻

Did this information make your day? Did it rescue you from hours of headache? Then please consider making a donation via PayPal, to buy me a donut, beer, or some fish’n’chips for my time and effort! Many thanks!

Buy Ubuntu Genius a Beer to say Thanks!

Read Full Post »

If you’re scratching your head wondering why your launchers for folders and drives are opening with something other than the default file manager, Nautilus, then hopefully the answer you’re looking for is here.

If you’re experiencing this, you might find your desktop launchers to be fine, but those you’ve custom made for your panel, and even those in the Places menu, will be opening with the wrong program.

In my case, I had right-clicked a DVD’s VIDEO_TS folder and used Open With to open the title with SMPlayer (since the folder was on my hard drive), and all was well – until I clicked a location launcher on my panel. I had done this before without issue, but suddenly all my location launchers started opening SMPlayer, which then tried to find anything to play in the folder Nautilus was supposed to open. It might be a coincidence, but I saw others complaining of this strangeness occurring with another media player – the popular VLC.

If something similar is happening to you, you don’t need me to tell you that something has changed the default app for the task. And while you may have done similar to me in opening a folder with a program like a media player, there is no way you could have accidentally set it to be the default task. But there is a way to fix this, and you don’t even need root privileges for it.

Simply run the following command in a terminal or via Alt+F2:

gedit ~/.local/share/applications/mimeapps.list

When the file opens, look for the line starting with inode/directory= and you should see the offending app listed at the beginning, ahead of Nautilus. All you have to do is either remove it or put it on the end of the line, making sure that nautilus-folder-handler.desktop is directly after inode/directory=.

Once you save and exit the file, your location launchers should be back to normal.

☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻

Did this information make your day? Did it rescue you from hours of headache? Then please consider making a donation via PayPal, to buy me a donut, beer, or some fish’n’chips for my time and effort! Many thanks!

Buy Ubuntu Genius a Beer to say Thanks!

Read Full Post »

“Failed to eject media; one or more volumes on the media are busy.”

That is an error message you may come across from time to time, and of course the obvious thing to do is make sure no programs are still trying to access a CD or DVD in your disc drive. And this includes programs that aren’t actively using the device, but are nonetheless keeping it “busy”, like if you have a media player open with files or titles from the disc still in its playlist. But once you have ruled all that out, you still might be left with the inability to eject the disc and get on with things, so hopefully some information here will be of use to you.

In most cases, the following command run in a terminal or via Alt+F2 will successfully unmount the disc, and then eject the tray:

sudo umount -l /media/cdrom0 && eject

Please note: since Ubuntu now automagically creates mount points for discs based on the label, /media/cdrom0 may not work for you, so you may need to ascertain the correct path for the current disc with this command:

mount|grep ^'/dev'

°ºÒθÓº°¤°ºÒθÓº°¤°ºÒθÓº°

☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻

Did this information make your day? Did it rescue you from hours of headache? Then please consider making a donation via PayPal, to buy me a donut, beer, or some fish’n’chips for my time and effort! Many thanks!

Buy Ubuntu Genius a Beer to say Thanks!

Read Full Post »

If you’ve come across some commands that require the actual device name of your CD/DVD drive (eg: /dev/dvd), rather than the mount point (eg: /media/cdrom0), it pays to know what it is, as commands won’t work if they’re looking in the wrong place. There are a couple of ways of doing this, and you’ll probably find they give conflicting outputs, but where one is not useful to you, the other will be; for example, if your drive is both /dev/scd0 and /dev/sr0, you might find /dev/sr0 works for most commands, and where it fails /dev/scd0 won’t.

Method 1:

To find out the name of the block device file representing your optical disc drive, enter the following into a terminal, without a disc in the drive:

wodim --devices

The information will be displayed as follows:

wodim: Overview of accessible drives (1 found) :
————————————————————————-
0 dev=’/dev/scd0‘ rwrw-- : ‘ASUS’ ‘DRW-24B1ST’
————————————————————————-

If there is a disc in the tray, you will see the following error, so just eject the disc and run the command again:

wodim: No such file or directory.
Cannot open SCSI driver!
For possible targets try ‘wodim --devices’
or ‘wodim -scanbus’.
For possible transport specifiers try ‘wodim
dev=help’.
For IDE/ATAPI devices configuration,
see the file README.ATAPI.setup from
the wodim documentation.

Method 2:

To find out the name of the block device file representing your optical disc drive, as well as its mount point, enter the following into a terminal:

mount|grep ^'/dev'

The output will look as follows:

/dev/sda3 on / type ext4 (rw)
/dev/sda1 on /media/Windows XP type fuseblk (rw,nosuid,nodev,allow_other,blksize=4096)
/dev/sr0 on /media/cdrom0 type iso9660 (ro,noexec,nosuid,nodev,unhide,user=ozzman)


°ºÒθÓº°¤°ºÒθÓº°¤°ºÒθÓº°

☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻

Did this information make your day? Did it rescue you from hours of headache? Then please consider making a donation via PayPal, to buy me a donut, beer, or some fish’n’chips for my time and effort! Many thanks!

Buy Ubuntu Genius a Beer to say Thanks!

Read Full Post »

Every now and then, you’re going to need some technical info about your optical disc (CD or DVD) drive. For example, if you’re using a command like that outlined in Fix “Cannot find input plugin for MRL [dvd:/]” Error in Kaffeine, MPlayer & Other Media Players in Ubuntu, being sudo ln -s /media/cdrom0 /dev/dvd, it will be useless if /media/cdrom0 is not the actual mount point. Often I see in forums people complaining a command couldn’t find the disc drive, but the command would work if the correct mount point was specified (they’re not universal, which I think many people expect them to be).

But finding out the mount point of your CD or DVD drive is actually quite easy: insert a disc, wait for it to be mounted, and when a folder window opens to the drive automatically (if it doesn’t, open it manually), simply note the path/address in the Location bar! Yes, it’s that easy, since the location won’t be the disc’s label, but the mount point on your system.

Another way to do it is simply browse through the subfolders in /media (or could even be /mnt on older systems) until you find the one that shows your disc (you’ll need to have one in the drive, of course).

Or if you want to do it via the terminal, you can use mount|grep ^'/dev' which will display info as follows:

/dev/sda2 on / type ext3 (rw,relatime,errors=remount-ro)
/dev/sda1 on /media/Windows-XP-x64 type fuseblk (rw,nosuid,nodev,allow_other,blksize=4096)
/dev/sr0 on /media/cdrom0 type iso9660 (ro,nosuid,nodev,user=ozzman)

In this case, /dev/sr0 is the device path, and /media/cdrom0 is the mount point, so if you ever come across a command for your disc drive where the mount point is specified as (for example) /media/disk1, you can pretty much expect it not to work, but at least you know that you can replace the incorrect value with /media/cdrom0 (or whatever your mount point actually is).

☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻

Did this information make your day? Did it rescue you from hours of headache? Then please consider making a donation via PayPal, to buy me a donut, beer, or some fish’n’chips for my time and effort! Many thanks!

Buy Ubuntu Genius a Beer to say Thanks!

Read Full Post »

If you’re unfamiliar with MD5 checksums (or MD5sums for short), they are simply a string of numbers (hashes) generated when each file is scanned, to be used to later verify the integrity of the data. You may have noted when downloading Linux .iso images or similar that there either was a text file with it – usually with the same suffix as the main file, but with perhaps an .md5sums extension – or the actual hash below the download link.

Also, you probably know you can check your Ubuntu CD for defects while at the boot menu, but since that just looks to an md5sum.txt file (most common name on Linux live CDs), you can also do so in Ubuntu via the terminal. So, for example, if you’ve burned a copy of the latest Ubuntu (or other Linux distro) live CD for a friend, you can simply open a terminal and check it without having to reboot.

But the most important use of the md5sum command is to create data verification for folders on your drive, as well as data CDs and DVDs, and even video DVDs. If you just wanted to periodically make sure no files are corrupt in a given folder (or whole drive if you want), this is the way to go. If you have a whole bunch of things in a folder you want to burn to a data disc, then the checksum file you create will let you check the disc for defects.

θθθθθθθθθθθθθθθθθθθθθ

So when you want to create the checksums, open a terminal in that folder and enter the following:

find -type f -exec md5sum "{}" \; > md5sum.txt

Note that this will also create a hash for the file itself, ie:  md5sum.txt, which will produce an error when checked, since it was generated while the file was still being created:

md5sum: WARNING: 1 of 103 computed checksums did NOT match

When you scroll up the terminal to see the cause of the error, you’ll find:

./md5sum.txt: FAILED

You will need to manually edit out the line for md5sum.txt, and if the file is really large, just hit Ctrl+F and search for md5, and it will take you to the line you need to delete.

OR:

To avoid md5sum.txt being added to the checksums altogether, run the following instead:

find -type f -exec md5sum "{}" \; | sed '/md5sum.txt/d' > md5sum.txt

Note that not only the md5sum.txt currently being generated will be left out, but any other files of the same name that already exist in other folders being checked. If you want to include all the other md5sum.txt files, run the first command instead, and just edit out the reference to the one that was generated in the root folder.

Once that’s done, you can verify the folder/drive any time you wish. With discs, it isn’t limited to data, or rather since the .vob files etc of a DVD are data, you can generate the md5sum.txt in the parent folder of the title (ie: the one VIDEO_TS resides in) and check movies as well as data backups.

θθθθθθθθθθθθθθθθθθθθθ

To check a folder, open a terminal there and enter:

md5sum -c md5sum.txt

To check a disc that has that file, including the likes of the Ubuntu CD, you’ll need the terminal pointing at the disc. But rather than open a folder window and choose Open in Terminal from the context menu, you can do that via any open terminal and incorporate the checking command above with:

cd /media/cdrom0 && md5sum -c md5sum.txt

Occasionally systems don’t have cdrom0 as the device name for the disc drive, so when you open a terminal there the other way, make note of the device name and alter the last command accordingly.

θθθθθθθθθθθθθθθθθθθθθ

When the check is over, if there are any errors, it will tell you how many failed the test out of how many listed. In the following example, you are actually presented with two errors at the end, the first complaining of a missing file, the other reporting one that seems to be corrupt:

md5sum: WARNING: 1 of 102 listed files could not be read
md5sum: WARNING: 1 of 101 computed checksums did NOT match

You can then scroll up the terminal if need be and find those that didn’t pass:

md5sum: ./Wallpaper01.jpg: No such file or directory
./Wallpaper01.jpg: FAILED open or read

./Wallpaper002.jpg.jpg: FAILED

In this example, Wallpaper01.jpg is seen as “missing”, because it was in fact renamed to Wallpaper001.jpg (to keep in line with the 3-digit numbering of the rest of the files) after the checksum was created (so Wallpaper001.jpg is totally ignored, since there was no hash created for it, and Wallpaper01.jpg is seen as missing, since there is no longer a file of that name). Wallpaper002.jpg is probably corrupt, though not all files that do not pass the test fail to open (but, generally, the case is that the file is corrupt, and the larger the file, the  more chance there is of that).

Otherwise, if all you see is the command prompt with the last file above it with an OK next to it, then all is fine:

./Wallpaper100.jpg: OK

θθθθθθθθθθθθθθθθθθθθθ

To make all this easier, make command aliases, like make5 (to generate an md5sum.txt file), 5 (to check a folder) and cd5 (to check a disc that can be verified). This will save you memorising and typing long commands, or even copying and pasting from a text file of commands you’ve probably got (if you’re clever).

θθθθθθθθθθθθθθθθθθθθθ

To check a disc image or other file you’re downloading that has a checksum listed, you can generate a checksum, and simply compare the output with what is listed on the website:

md5sum name_of_the_image.iso

Obviously, you’ll need to replace the name in the example with the actual name of the file, but to save typing it if it is long, you can just enter md5sum (followed by a space), drag the downloaded file to the terminal and drop it there, then hit Enter (though you can, of course, just copy the file’s name as well). Then, as I said, simply compare the numbers in the terminal and website.

Now, if you’re downloading a bunch of stuff, all with checksums supplied, you can create your own master checksum file, which will check them all in one go when you’re ready. Syntax is very important, so the lines should look like this:

8790491bfa9d00f283ed9dd2d77b3906 *ubuntu-9.10-desktop-i386.iso
3faa345d298deec3854e0e02410973dc *ubuntu-9.10-alternate-i386.iso
dc51c1d7e3e173dcab4e0b9ad2be2bbf *ubuntu-9.10-desktop-amd64.iso

In this example, Ubuntu CDs are used, but they can be anything, as long as you lay it out like that. You can name the file what you want, but if you want to stick with tradition, and to make it easier to check  (via the command above, or its alias 5), name it md5sum.txt. And you can use this before you get all the files, as when you run the check, it will just tell you 2 out 0f 3 couldn’t be found (and you’ll see the one you did download listed, hopefully with an OK next to it).

If you name the checksum file something different, or in the case of the Ubuntu discs downloaded a master checksum file for all images, and it has a name like Ubuntu 9.10.MD5Sum (though that’s the name I actually gave it), it doesn’t matter. You can just enter md5sum -c (followed by a space), then either type the name of the file, or drag the file to the terminal. Note you can also do this with the alias 5 – it will complain it didn’t find md5sum.txt, but then go on to verify the files recorded in Ubuntu 9.10.MD5Sum (or whatever your file is called). Of course, you could just rename the checksum file to md5sum.txt, but as you can see, you don’t really need to.

θθθθθθθθθθθθθθθθθθθθθ

When you’re going to backup a folder to DVD, always run a check on it first. That way, if you’ve done something like renamed a bunch of files after the md5sum.txt file was created, you’ll know before burning a disc that will always come up with those “errors”. You can then either generate new checksums, or open md5sum.txt and replace the old names with the new ones (renaming files does not alter their checksum hashes, so you do not need to generate new ones for them).

θθθθθθθθθθθθθθθθθθθθθ

So, hopefully that’s all you need to get you going in setting up some data verification, which comes in handy when wanting to make sure all the data on a DVD is valid before passing it on, or deleting the copies off your hard drive if archiving. And now that you know what those hashes or .md5 files are on websites, make sure you grab them, so you can verify the integrity of your downloads. And if you set up those aliases, all of this becomes even simpler, as those names are short and easy to remember.

☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻

Did this information make your day? Did it rescue you from hours of headache? Then please consider making a donation via PayPal, to buy me a donut, beer, or some fish’n’chips for my time and effort! Many thanks!

Buy Ubuntu Genius a Beer to say Thanks!

Read Full Post »