Tag: delete

  • Proxmox KVM virtual machine: Cannot delete due to missing storage

    Today we encountered a situation where a Proxmox system’s KVM virtual machine refused to delete after the storage volume that it’s virtual HDD resided on was lost; trying to delete the KVM from the web GUI resulted in the following error:

     

    TASK ERROR: storage ‘proxmoxHDD’ does not exists

     

    Attempting to delete it from the command line using:

     

    qm destroy [VM ID]

     

    …resulted in:

     

    storage ‘proxmoxHDD’ does not exists

     

    Fortunately, there’s a way around this. The KVM config files live in:

     

    /etc/pve/qemu-server

     

    Move or erase the [VM ID].conf file and when you refresh your web GUI the VM should be gone.

  • How to delete the rest of a line after the cursor in vim?

     

    Vim has a host of really useful shortcuts; the one we are looking at today allows you to delete the text on the same line after the cursor position. To do this, move the cursor to the desired position and hit:

     

    shift+d

     

    In other words, a capital D. We don’t need a colon in front of it. This will delete the remainder of the line.

  • Ubuntu: How to delete a user

     

    In Ubuntu 12.04 and 12.10, to delete an additional user you have created, use the following:

     

    sudo deluser [username]

     

    By example, if we wanted to delete a user we created called “test”, we would run:

     

    sudo deluser test

     

    Which gives:

     

    Removing user `test’ …

    Warning: group `test’ has no more members.

    Done.

     

    Be careful with this – don’t delete your admin account 🙂

  • How to remove/delete old or unused kernels in Ubuntu

     

    If you have upgraded your kernel you will have found that Ubuntu keeps the older ones around, which can be handy if something breaks in the newer kernel and you have to boot from your old system. Over time, however, these can add up in terms of the amount of space consumed – at around 150MB per kernel you could easily find yourself with over a GB of old kernels if you’ve upgraded enough times. In this example the system we are using is Ubuntu 12.0.4.2. If you’re using Ubuntu Desktop, open up a terminal window – if you’re using Ubuntu Server, log in as usual and run:

     

    uname -r

    to see which kernel you are currently running. Make sure not to delete this one. Now, to see a list of the installed kernels, we run:

     

    dpkg –list | grep linux-image

    This command lists the installed packages and filters the list to include only those which have “linux-image” in them, which should only be your kernels. Your list should look something along the lines of:

     

    ii  linux-image-2.6.32-33-server 2.6.32-33.72     Linux kernel image for version 2.6.32 on x86_64
    ii  linux-image-3.2.0-35-generic 3.2.0-35.55      Linux kernel image for version 3.2.0 on 64 bit x86 SMP
    ii  linux-image-3.2.0-38-generic 3.2.0-38.61      Linux kernel image for version 3.2.0 on 64 bit x86 SMP
    ii  linux-image-server           3.2.0.38.46      Linux kernel image on Server Equipment.

     

    To remove a kernel, run the following:

     

    sudo apt-get purge [kernel]

     

    Using the above list, say we want to get rid of 3.2.0-35. In that case the command would be:

     

    sudo apt-get purge linux-image-3.2.0-35-generic

     

    Once you have removed your unwanted kernels run:

     

    sudo update-grub2

     

    This will update the boot menu accordingly.