16

I installed ubuntu inside windows 7 using VMware. I wanted to execute a c program in ubuntu.

when I tried I got like this,

b@ubuntu:~/examples$ vim a.c
The program 'vim' can be found in the following packages:
 * vim
 * vim-gnome
 * vim-tiny
 * vim-gtk
 * vim-nox
Try: sudo apt-get install <selected-package>
b@ubuntu:~/examples$ sudo apt-get install vim
[sudo] password for b:
Reading package lists... Done
Building Dependency tree
Reading state information... Done
Package vim is not available, but is referred to by another Package.
This may mean that the package is missing, has been obseleted, or 
is only available from another source

E: Package 'vim' has no installation candidate
I tried apt-get install vim

E: Could not open lock file /var/lib/dpkg/lock - open (13:Permission denied)
E:unable to lock the administration directory (/var/lib/dpkg/), are you root?

when I tried to do su it asked me for a password . When I typed the root password its not accepting it and says "Authentication Failure"

I could not install the Vim package. Is there any way I can install it? Please suggest me. How do I regain my root paswword.

Angus
  • 261

2 Answers2

17

The same problem occurred with me when I was trying yo install vim on my ubuntu 12.04.
I tried the following and it worked for me: -
sudo apt-get update
and after that
sudo apt-get install vim
After running these commands, it started working correctly.

Pratik Singhal
  • 425
  • 1
  • 4
  • 16
3

When you are prompted for a password after sudo command, you have to enter YOUR password not root password. From the command prompt, the username appears to be b, so b password should be supplied. Of course, this is valid only if b user is allowed to sudo (such as being a member of admin group in ubuntu).

Khaled
  • 1,662
  • I tried as u said but its not taking the password i typed. when i installed ubuntu in vmware all i gave was only one password. and now its not letting me to login as root also. Is there a way to change the root password. –  Feb 05 '12 at 11:52
  • 2
    The root account is disabled by default in Ubuntu. When you installed you should have created a regular user account (e.g. 'jsmith'). That account will have rights to run programs via sudo (with jsmith's password, not root's). –  Feb 05 '12 at 20:11