Feeds:
Posts
Comments

Posts Tagged ‘Command-Line/Terminal’

When you uninstall a program in Ubuntu, sometimes bits and pieces like configuration files are left behind. Occasionally this is a good thing, like when you remove a program due to some issues you’re having with it and then reinstall it again, since your old settings are usually restored.

But more often than not, when a program is uninstalled it is because the user doesn’t want it, so any remaining configuration files are just wasting space. And often in the case of trying to reinstall a program to get it to work properly, a configuration setting is what is causing the issue, so a complete removal is needed.

There are 2 ways to go about this: via the user-friendly GUI of Synaptic (or your preferred package manager), or the much faster way of command-line in a terminal.

Either way, you’ll of course need to know the name of the program, and if possible the actual package name. While often the package name is the same as the program’s displayed name, but in lowercase, this isn’t always the case, so if unsure check out these ways of finding out.

If you want to use Synaptic, open it and enter the name of the program or package in the Quick search bar. When it and related packages appear, right-click the main package and choose “Mark for Complete Removal“.

It is usually fairly easy to tell which is the main base package; if the name isn’t a give-away, the information after it should clear things up. For example, AbiWord is actually abiword, so is instantly recognisable from the other packages that install with it.

When you “Mark for Complete Removal“, you will be informed if other packages also need to be removed, meaning you don’t have to do this manually.

When you accept the proposed changes, you will see that the program and additional packages will be removed. If there are other related packages that haven’t been automatically selected, you can do so manually before proceeding.

When ready, simply click the Apply button in the Synaptic toolbar. You will receive a final request for confirmation, after which the program will be removed, along with the extra packages and any configuration files.

As in the case of the AbiWord example, not everything is always automatically selected for removal, so it pays to look through the search results and see if anything needs to be removed manually (abiword-common is actually larger than the other packages combined at nearly 9Mb). Doing this before proceeding with the last step will save you coming back later.

If you prefer the quicker command-line method, open a terminal and enter:

sudo apt-get purge packagename (replacing “packagename” with the actual name of the package in question).

If you’re familiar with apt-get remove and wondering what is the difference, especially since additional packages are also marked for removal, the answer is that configuration files are often left behind if you simply “remove” the app. To get that command to work, the --purge option needs to be added (eg: sudo apt-get remove --purge packagename). You will still see much mention online that this is the way to do it, but since then the purge command has been added to apt-get, so this is no longer needed (though for backwards compatibility, remove --purge will continue to work).

Either way you choose to do it, you should be able to get rid of all the junk that programs can leave behind when simply removed. Just keep in mind that if you ever saved any settings or user profiles etc, occasionally these can still be left behind, but they will be in config folders within your home folder (you might need to enable displaying of hidden files and folders). If you ever get a message that a certain folder could not be removed, or a certain file, just go in there later and remove it.

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

Leave some unwanted packages behind? It’s actually pretty easy to get rid of the vast majority of packages that weren’t automatically selected for removal. When you install via the terminal, you will notice that a list of orphaned packages is presented along with the simple command to remove them all in one go.

As you can see in the example, after uninstalling AbiWord the abiword-common package was left behind (not to mention a few libraries), but you can easily remove it and others taking up space with the following command:

sudo apt-get autoremove

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

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!

Advertisements

Read Full Post »

When initramfs (the initial ramdisk filesystem used to boot into Ubuntu) is updated, whether it be during an official upgrade or through some manual tinkering, the last thing you want to happen is get an error message. More often than not, when you reboot, you won’t be able to get to your desktop, so it’s best to tackle any issues before you do so.

If you were lucky enough to see the initramfs update fail in the terminal, you can usually have success by running it again. If you updated or upgraded your system and didn’t even know anything went wrong until you failed to log in again, there are still ways to get around this.

You’ll find a few different approaches to various error messages, so hopefully something here will be of use to you. When it comes to specific firmware issues, you may need to start a thread at the Ubuntu forums (quite often, someone will point you towards a patch). Best of luck!

Last Resort for Boot Failure Due to initramfs Error

I’ve listed this first, as in most cases it will work, but it should be your last resort. When booting, choose an earlier kernel from the GRUB list, and you should be able to get to your desktop to fix things. Technically, you really should avoid this, especially if you’ve just upgraded Ubuntu and the kernel along with it, since running certain commands may complicate things, or just waste your time. For example, it’s no use recompiling initrd.img when you’ll be doing so to the one for the previous kernel.

But you can use this method to get to your desktop, search the forums and web for answers, and edit configuration files. And, as an absolute last resort, you can even open Synaptic and remove the latest kernel, then reinstall it (take note of all package names when uninstalling, to make sure you reinstall everything correctly).

Failure Generating /boot/initrd.img

This error is unfortunately common, and the message you’ll see is like:

update-initramfs: failed for /boot/initrd.img-2.6.32-22-generic

Quite often, running the following command will let the update start again:

sudo update-initramfs -u

Continued “dpkg was interrupted” Error

This error occurs when the initramfs update has halted, sometimes because something has interfered, but generally when it gives up trying to get the files from the server:

dpkg was interrupted, you must manually run ‘sudo dpkg --configure -a’ to correct the problem

While it gives you the answer, you might find yourself in an endless loop of running sudo dpkg --configure -a over and over again. If it just won’t stop, the last thing you want to do is reboot without having tackled this, so here is a work-around that may help. You’ll be editing a text configuration file as superuser, so paste the following into a terminal:

sudo gedit /etc/initramfs-tools/update-initramfs.conf

Locate the line “update_initramfs=yes” and change it to “update_initramfs=no“. Save and exit the file, then run:

sudo dpkg --configure -a

Hopefully, everything should be fine when you reboot, and later you can try changing the “no” back to “yes” in update-initramfs.conf.

initramfs Update Aborted & Recovery Fails

This problem is fairly common, and can generally be remedied easily, even though it produces a long and rather sinister error message that looks like:

Processing triggers for initramfs-tools … update-initramfs: Generating /boot/initrd.img-2.6.32-22-generic dpkg: subprocess post-installation script killed by signal (Interrupt) Could not install the upgrades The upgrade aborts now. Your system could be in an unusable state. A recovery will run now (dpkg --configure -a). Please report this bug against the ‘update-manager’ package and include the files in /var/log/dist-upgrade/ in the bugreport. E:Sub-process /usr/bin/dpkg returned an error code (2) Setting up initramfs-tools (0.85eubuntu36) … update-initramfs: deferring update (trigger activated) Processing triggers for initramfs-tools … update-initramfs: Generating /boot/initrd.img-2.6.32-22-generic Could not install the upgrades The upgrade aborts now. Your system could be in an unusable state. A recovery will run now (dpkg --configure -a). Please report this bug against the ‘update-manager’ package and include the files in /var/log/dist-upgrade/ in the bugreport. installArchives() failed

You might find that running sudo dpkg --configure -a as suggested doesn’t help, but the following command should do the trick:

sudo update-initramfs -u

Delete Corrupted initrd.img Then Run Update Again

Here’s another way you may be able to get around the familiar update-initramfs: failed for /boot/initrd.img… error message. Some have success with the following commands, so you can try them first:

sudo dpkg --configure -a

sudo apt-get update

But don’t be surprised to find yourself back where you started, but here is a trick that seems rather unlikely, but has worked before: move or delete initrd.img. If that file is corrupted, you would think it would just get overwritten in the update, yet deleting (or moving, if you want to play it safe) initrd.img has made all the difference in some instances.

It’s probably safer just to move the file, since if a replacement is successfully generated, you can delete it later. To move it to your home folder, enter the following command, remembering to replace the kernel number with the one you’re moving:

sudo mv /boot/initrd.img-2.6.32-22-generic ~/

Or you can open the /boot folder as root, and just drag the file to wherever you want:

gksu nautilus /boot

Now try those first two commands, and hopefully all goes well.

°ºÒθÓº°

Hopefully a trick or two here saved your day; if not, godspeed in sorting it out!

°ºÒθÓº°

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

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 »

For an introduction to drives, partitions and folders in Ubuntu, check out Differences Between Hard Drives & Media Storage Devices in Ubuntu & Windows.

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

The most visual and informative way to get info about your drives and media storage devices, like the path names and filesystems, is to install GParted. That is the same partition editor on the Ubuntu Live CD, and you can install it with sudo apt-get install gparted in the terminal. It will end up in System > Administration, and will either be called Partition Editor, GParted or Gnome Partition Editor.

To change devices, choose another from the dropdown menu in the top right. You can then right-click the partitions and choose Information to get more info.

Another way is to enter sudo fdisk -l in a terminal. It will give you info like so:

Disk /dev/sda: 750.2 GB, 750156374016 bytes
255 heads, 63 sectors/track, 91201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x2101e331
Device        Boot   Start      End       Blocks                Id      System
/dev/sda1    *             1     45762   367583233+     7     HPFS/NTFS
/dev/sda2            45763   90564   359872065        83    Linux
/dev/sda3            90565   91201    5116702+          5     Extended
/dev/sda5            90565   91201    5116671            82    Linux swap / Solaris

You can also have a look at everything that’s mounted via gedit /etc/mtab (or cat /etc/mtab if you want the output displayed in the terminal). It will give you something similar to:

/dev/sda2 / ext3 rw,relatime,errors=remount-ro 0 0
proc /proc proc rw 0 0
none /sys sysfs rw,noexec,nosuid,nodev 0 0
none /sys/fs/fuse/connections fusectl rw 0 0
none /sys/kernel/debug debugfs rw 0 0
none /sys/kernel/security securityfs rw 0 0
udev /dev tmpfs rw,mode=0755 0 0
none /dev/pts devpts rw,noexec,nosuid,gid=5,mode=0620 0 0
none /dev/shm tmpfs rw,nosuid,nodev 0 0
none /var/run tmpfs rw,nosuid,mode=0755 0 0
none /var/lock tmpfs rw,noexec,nosuid,nodev 0 0
none /lib/init/rw tmpfs rw,nosuid,mode=0755 0 0
/dev/sda1 /media/Windows-XP-x64 fuseblk rw,nosuid,nodev,allow_other,blksize=4096 0 0
binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc rw,noexec,nosuid,nodev 0 0

Or you can use sudo blkid (or sudo blkid -c /dev/null) if you just want your drives and partitions listed:

/dev/sda1: UUID=”1D3688CD689CA81D” LABEL=”Windows Drive” TYPE=”ntfs”
/dev/sda2: UUID=”daf56d80-15b5-4314-9672-fd91d12a3bd6″ SEC_TYPE=”ext2″ TYPE=”ext3″
/dev/sda5: UUID=”241939b6-9c32-4cb8-b644-0455c4a5460f” TYPE=”swap”

If you’re just after the unique UUID of a partition, you can also use ls -l /dev/disk/by-uuid:

total 0
lrwxrwxrwx 1 root root 10 2009-12-18 11:10 1D3688CD689CA81D -> ../../sda1
lrwxrwxrwx 1 root root 10 2009-12-18 11:10 241939b6-9c32-4cb8-b644-0455c4a5460f -> ../../sda5
lrwxrwxrwx 1 root root 10 2009-12-18 11:10 daf56d80-15b5-4314-9672-fd91d12a3bd6 -> ../../sda2

You can also find out mount points and drive/partition usage info with df -h:

Filesystem Size Used Avail Use% Mounted on
/dev/sda2 338G 309G 12G 97% /
udev 2.0G 400K 2.0G 1% /dev
none 2.0G 1.7M 2.0G 1% /dev/shm
none 2.0G 216K 2.0G 1% /var/run
none 2.0G 0 2.0G 0% /var/lock
none 2.0G 0 2.0G 0% /lib/init/rw
/dev/sda1 351G 343G 8.4G 98% /media/Windows-XP-x64

Or if you want device paths, mount points and options, especially if you just want to find the device name and mount point of your CD/DVD drive, you can use mount|grep ^'/dev':

/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)

As you can see, there are many ways to get technical info about your devices and partitions in Ubuntu. If you’d like to see what files and folders are taking up the most space, check out Filelight for disk usage analysis.

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

How to Find the Block Device File Name of a Disc Drive

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

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 »

It doesn’t matter whether you’re using Windows, Mac OS, or a Linux distro like Ubuntu, the names programs display in the titlebar and the names of the actual files that run them can be quite different. A familiar example for many would be Microsoft Office Word (or Word for Windows in the old days) – or winword.exe, to be precise.

In Ubuntu, you can guess the package names of many programs simply by making all characters lower-case, and perhaps removing a space between words, or even abbreviating it. For example, KAlarm is actually kalarm, tovid GUI is tovidgui, and Downloader for X is d4x.

But you can’t guess them all, so you’ll need to look at the properties of launchers to the programs you want to know more about. Since you can’t really right-click launchers in the Applications menu for this purpose, by far the easiest method is to temporarily add them to your panel (or desktop), then just delete them when no longer needed. You can actually get the properties of launchers while editing the Applications menu, but this method is simpler and quicker.

For any program you need to know the package name of, right-click it in the Applications menu and choose either Add this launcher to panel or Add this launcher to desktop. When you right-click the new launcher on your panel or desktop, choose Properties, and the Command field will reveal the program’s actual name.

Just remember to ignore any options on the end of a command, since a program name must be one word without spaces (this can of course include many words strung together with hyphens or underscores). So while Amarok‘s launcher says amarok %U, the %U is an option, and amarok is the command. Even if you can see nothing familiar, you can bet whatever the command starts with, and is before the first space, is the command. For example, Downloader for X is actually no longer d4x, and since the command string is now nt -a %U, one has to assume nt is now the name of the command that runs this program.

The exceptions to this rule are when the path or address of the command is specified, or when another command precedes it. A good example is gksu /usr/sbin/firestarter for Firestarter, as not only is the path specified before the command, firestarter, but in order to run it with superuser privileges, the whole lot starts with gksu (basically, sudo for GUI programs). In a situation like this, one would look to the end, not the beginning.

If you need to find out the version numbers of installed packages, read this.

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

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 »

For those who don’t know this, you can use you UP arrow on your keyboard to cycle through previous commands you’ve entered in the terminal. Your “bash history” records them, and you’ll be presented with them in the order of last used first. If you go too far, use your DOWN arrow to find the command you passed. Similarly, if you decide to type in a new command, just use the DOWN arrow to get past the previous entries and back to an empty prompt.

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

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 VirtualBox opens fine, but when you try to start a virtual machine (VM) you get the following error:

Failed to start the virtual machine Windows XP.
VirtualBox can’t operate in VMX root mode. Please disable the KVM kernel extension, recompile your kernel and reboot (VERR_VMX_IN_VMX_ROOT_MODE).

… it means another virtualisation package – kvm – is interfering with VirtualBox. kvm isn’t installed on Ubuntu by default, so you probably installed qemu, the popular open-source emulator.

A quick fix is to stop kvm via the terminal:

sudo /etc/init.d/kvm stop

To stop this happening completely, mark the following packages for complete removal in Synaptic if they’re installed: kvm, qemu, qemu-kvm & qemu-launcher. Or you can do it via the terminal, and ignore errors regarding packages that weren’t installed (so can’t be uninstalled):

sudo apt-get remove kvm qemu qemu-kvm qemu-launcher

You should now be able to start your VM, without having to close and restart VirtualBox.

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

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 »

Older Posts »