Are you rooted linux

Are you rooted error

You follow some tutorial on the internet that tells you to install a certain program or run some command. Probably it is something to do with a server.

But when you run the command, you encounter this error:

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?

A similar error is this one:

dpkg: error: required read/write access to the dpkg database directory /var/lib/dpkg
E: Sub-process dpkg –set-selections returned an error code (2)
E: Executing dpkg failed. Are you root?

Both errors ask you the same question: are you root? And that’s the answer to this problem. Become root.

Become root to avoid this error

How do you become root in Ubuntu or Debian? You use the sudo command.

Yes, that’s it. Whatever command you were running, just add sudo before it.

running commands with sudo

Running command with sudo

It will ask you to enter your user account password. Please keep in mind that nothing gets displayed on the screen when you type the password and that’s okay.

There is nothing wrong with your system. In most Linux systems, password typing doesn’t show the usual asterisks or anything of that sort as a ‘security feature’.

Just type your password and press enter after it. If the password was typed correctly, you should be able to run the command now.

You can even use this handy Linux command line trick to run a previous command with sudo:

That was simple and works immediately, unless you do not have sudo access. Then, you’ll see a different error.

Seeing a ‘User is not in sudoer file’ error?

not in sudoer file error

Some users cannot run commands with sudo

When you install Ubuntu, you have to create a user account. This user is automatically granted sudo power to run commands as root when required.

This happens on Ubuntu desktop, not servers. Most server distributions will have a separate root account. If you create a regular account separately, you’ll have to add the user to sudoer so that this normal user can use sudo.

In the screenshot above, I had created this additional user but did not add it to the sudo group. This means that user ‘prakash’ here does not have rights to use the sudo command and hence the system complains that ‘prakash is not in sudoers file’.

Читайте также:  Rtl sdr linux mint

Where is the incident reported?

An incorrect sudo attempt is added to the system logs. It logs the user name, the virtual terminal number, location from where the command was run and which command was run.

sudo incident reported

Incorrect sudo attempts are logged into the system

The location of these logs differ from distribution to distribution.

Normally, you may find it in journalctl logs or /var/log/auth.log file in Ubuntu, /var/log/audit/audit.log file in Fedora.

What can you do if a user is not in sudoer list?

What can you do when you cannot use sudo with the current user account? First, verify if the user has sudo rights or not. If not, here are some options for you:

  • Log in as root or switch to root (if you have root password).
  • Add the user into sudoer list (if you have admin/sudo rights from some other user account).
  • If you are in multi-user Linux system and do not have root or sudo access yourself, ask your sytem administrator to either grant your user sudo access or install the application you wanted to install.

Did this help?

Sudo is a very comprehensive security mechanism, and it is much more than just allowing a normal user to become root. It helps in auditing the system to know which user ran which command with sudo. It can also be configured to allow a certain user to run only certain commands with sudo.

You won’t see such granular sudo configuration on desktop Linux where it is preconfigured to allow any user in the sudo group to run any command as root with sudo. More on sudo in some other article.

I hope while solving this classic beginner problem, you get some initial insights into the sudo command. Let me know if you have further questions on this topic in the comment section.

This error simply means you are not the root user.

me@linuxbox ~#apt-get update
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?
Solution
simply install it using the sudo to install any package as a root user.
This occurs because you are using a normal user account

You forgot the sudo for the second command.
me@linuxbox ~#sudo apt-get update && sudo apt-get upgrade will work.

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.

Already on GitHub?
Sign in
to your account

H4ck3r404 opened this issue

Comments

Running anything using sudo shows:

Читайте также:  What is spamassassin in linux

No superuser binary detected.
Are you rooted?

Except su command is working properly.

Phone is rooted using SuperSU, which doesn’t show up toast message when using sudo. Before update everything worked properly.

Quick update: tsu stopped working either.

Uuhh.. can you show me the output of..

I have no idea where SuperSu puts it su binaries

+ shift + TERMUX_FS=/data/data/com.termux/files + TERMUX_PREFIX=/data/data/com.termux/files/usr + TERMUX_PATH=/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets + ROOT_HOME=/data/data/com.termux/files/home/.suroot + ANDROIDSYSTEM_PATHS=/system/bin:/system/xbin + BB_MAGISK=/sbin/.magisk/busybox + log_DEBUG TSU_AS_SUDO + [[ '' == true ]] + log_DEBUG _TSU_AS_SUDO + [[ -z '' ]] + SWITCH_USER= + declare -A EXP_ENV + log_DEBUG _TSU_AS_SUDO + [[ '' == true ]] + root_shell_helper + log_DEBUG root_shell_helper + log_DEBUG ALT_SHELL + [[ '' == system ]] + [[ -n '' ]] + [[ -x /data/data/com.termux/files/home/.termux/shell ]] + [[ -x /data/data/com.termux/files/usr/bin/bash ]] + ROOT_SHELL=/data/data/com.termux/files/usr/bin/bash + env_path_helper + log_DEBUG env_path_helper + log_DEBUG SWITCH_USER + [[ -z '' ]] + NEW_HOME=/data/data/com.termux/files/home/.suroot + EXP_ENV[PREFIX]=/data/data/com.termux/files/usr + EXP_ENV[TMPDIR]=/data/data/com.termux/files/home/.suroot/.tmp + EXP_ENV[LD_PRELOAD]=/data/data/com.termux/files/usr/lib/libtermux-exec.so + log_DEBUG _TSU_AS_SUDO + [[ '' == true ]] + NEW_PATH=/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets + ASP=/system/bin:/system/xbin + log_DEBUG PREPEND_SYSTEM_PATH + [[ -n '' ]] + log_DEBUG APPEND_SYSTEM_PATH + [[ -n '' ]] + log_DEBUG LD_LIBRARY_PATH + [[ -n '' ]] + EXP_ENV[PATH]=/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets + EXP_ENV[HOME]=/data/data/com.termux/files/home/.suroot + EXP_ENV[TERM]=xterm-256color + [[ -z true ]] + set +x + [[ -d /data/data/com.termux/files/home/.suroot ]] + STARTUP_SCRIPT=/data/data/com.termux/files/usr/bin/bash + SU_BINARY_SEARCH=("/system/xbin/su" "/system/bin/su") + [[ -x /sbin ]] + SKIP_SBIN=1 + unset LD_LIBRARY_PATH + unset LD_PRELOAD + [[ -z 1 ]] + for SU_BINARY in "$" + '[' -e /system/xbin/su ']' + for SU_BINARY in "$" + '[' -e /system/bin/su ']' + set +x No superuser binary detected. Are you rooted? ------------------------------------- tsu ran in debug mode. Full log can be found in tsu_debug.log Report any issues to: https://github.com/cswl/tsu 

pull request #67 will fix this issue.

Источник

Fixing «Unable to acquire dpkg frontend lock. Are You Root?» Error on Ubuntu and Other Linux Distributions

You follow some tutorial on the internet that tells you to install a certain program or run some command. Probably it is something to do with a server.

But when you run the command, you encounter this error:

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?

A similar error is this one:

dpkg: error: required read/write access to the dpkg database directory /var/lib/dpkg
E: Sub-process dpkg –set-selections returned an error code (2)
E: Executing dpkg failed. Are you root?

Both errors ask you the same question: are you root? And that’s the answer to this problem. Become root.

Become root to avoid this error

How do you become root in Ubuntu or Debian? You use the sudo command.

Yes, that’s it. Whatever command you were running, just add sudo before it.

running commands with sudo

It will ask you to enter your user account password. Please keep in mind that nothing gets displayed on the screen when you type the password and that’s okay.

There is nothing wrong with your system. In most Linux systems, password typing doesn’t show the usual asterisks or anything of that sort as a ‘security feature’.

Just type your password and press enter after it. If the password was typed correctly, you should be able to run the command now.

Читайте также:  Распределенная файловая система linux

You can even use this handy Linux command line trick to run a previous command with sudo:

That was simple and works immediately, unless you do not have sudo access. Then, you’ll see a different error.

Seeing a ‘User is not in sudoer file’ error?

not in sudoer file error

When you install Ubuntu, you have to create a user account. This user is automatically granted sudo power to run commands as root when required.

This happens on Ubuntu desktop, not servers. Most server distributions will have a separate root account. If you create a regular account separately, you’ll have to add the user to sudoer so that this normal user can use sudo.

In the screenshot above, I had created this additional user but did not add it to the sudo group. This means that user ‘prakash’ here does not have rights to use the sudo command and hence the system complains that ‘prakash is not in sudoers file’.

Where is the incident reported?

An incorrect sudo attempt is added to the system logs. It logs the user name, the virtual terminal number, location from where the command was run and which command was run.

sudo incident reported

The location of these logs differ from distribution to distribution.

Normally, you may find it in journalctl logs or /var/log/auth.log file in Ubuntu, /var/log/audit/audit.log file in Fedora.

What can you do if a user is not in sudoer list?

What can you do when you cannot use sudo with the current user account? First, verify if the user has sudo rights or not. If not, here are some options for you:

  • Log in as root or switch to root (if you have root password).
  • Add the user into sudoer list (if you have admin/sudo rights from some other user account).
  • If you are in multi-user Linux system and do not have root or sudo access yourself, ask your sytem administrator to either grant your user sudo access or install the application you wanted to install.

Did this help?

Sudo is a very comprehensive security mechanism, and it is much more than just allowing a normal user to become root. It helps in auditing the system to know which user ran which command with sudo. It can also be configured to allow a certain user to run only certain commands with sudo.

You won’t see such granular sudo configuration on desktop Linux where it is preconfigured to allow any user in the sudo group to run any command as root with sudo. More on sudo in some other article.

I hope while solving this classic beginner problem, you get some initial insights into the sudo command. Let me know if you have further questions on this topic in the comment section.

Источник

Оцените статью
Adblock
detector