1

I tried to install sudo with apt install sudo but it won't work. I got these errors:

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

I am always required to give root access whenever i want to open some files in the terminal but i can't do that without sudo

Kulfy
  • 17,416
  • 26
  • 64
  • 103
Haq
  • 11
  • 1
  • 2
  • 2
    Which Ubuntu release are you using? sudo most of the times is pre-installed. Did you purge/uninstall that? What is the output of `type -a sudo`? – Kulfy Jun 23 '20 at 17:14
  • @Kulfy, isn't `sudo` installled *all* the time? How would you get root access and privileges without it? – Ollie Jun 23 '20 at 17:17
  • You need to install sudo in debian. In ubuntu, it's already packaged. Here, you get the normal output of `apt install` run without sudo. Insteed, try `sudo apt install cowsay`. Sudo gives the root rights temporarely so you can install cowsay. Without sudo, you can't install any package – B. du Garay Jun 23 '20 at 17:20
  • `sudo` is always packaged with Ubuntu, and according to my experience, also in current versions of Debian, but there are Linux distros, where it is not packaged with the default installations. - But you might remove it by mistake, and that would cause problems in Ubuntu. I guess you can boot in recovery mode (and run as root), and then install `sudo'. – sudodus Jun 23 '20 at 17:23
  • @Kulfy I am using Ubuntu 18.04.3 LTS. I was able to use sudo when i started using Ubuntu, but unluckily for me it stopped working – Haq Jun 23 '20 at 17:25
  • @Ollie If you use Ubuntu in a Docker container, the `root` account is the default one. And yes `sudo` isn't installed there. – Kulfy Jun 24 '20 at 05:04

1 Answers1

1

Reboot, go to grub menu and select recovery boot.

Then select root console. Run there

mount -o remount,rw /
apt install sudo
Pilot6
  • 88,764
  • 91
  • 205
  • 313