Sub process dpkg set selections returned an error code 2

How fix E: Sub-process /usr/bin/dpkg returned an error code (2)? When I’m trying to use apt-get install or upgrade I get that message! I tried this command sudo dpkg -C and got this results: This is the results of this command: dmesg And for smartctl -A : 2 Answers 2 You’ve experienced (at least) […]

Содержание

  1. How fix E: Sub-process /usr/bin/dpkg returned an error code (2)?
  2. 2 Answers 2
  3. Check smartctl
  4. If you do not have smartctl
  5. Critical next step
  6. Use a live system to run smartctl, xfs_repair
  7. After filesystem repair
  8. How to prevent this in the future
  9. E: Sub-process /usr/bin/dpkg returned an error code (2) #28
  10. Comments
  11. Fixing «Unable to acquire dpkg frontend lock. Are You Root?» Error on Ubuntu and Other Linux Distributions
  12. Become root to avoid this error
  13. Seeing a ‘User is not in sudoer file’ error?
  14. Where is the incident reported?
  15. What can you do if a user is not in sudoer list?
  16. Did this help?
  17. How to Solve “Sub-process /usr/bin/dpkg returned an error code (1)” In Ubuntu
  18. Solution 1: Reconfiguring the dpkg Package
  19. Solution 2: Force Install the Troublesome Package
  20. Solution 3: Purge the Bad or Corrupted Software Package
  21. Solution 4: Remove all the Files Associated with the Package
  22. If You Appreciate What We Do Here On TecMint, You Should Consider:
  23. Как решить ошибку “sub process usr bin dpkg returned an error code 1″ в Ubuntu
  24. Решение проблемы Sub-process /usr/bin/dpkg returned an error code (1)
  25. Способ 1: переконфигурировать базу данных пакетов
  26. Способ 2: Использовать принудительную установку
  27. Способ 3. Попробуйте удалить проблемный пакет.
  28. Способ 4. Удалите информационные файлы с информацией о проблемном пакете

How fix E: Sub-process /usr/bin/dpkg returned an error code (2)?

When I’m trying to use apt-get install or upgrade I get that message! I tried this command sudo dpkg -C and got this results:

This is the results of this command: dmesg

And for smartctl -A :

2 Answers 2

You’ve experienced (at least) a bad block on your disk. Unfortunately, it hit an XFS data structure, so you’ve lost some filesystem metadata. I hope you have backups.

Check smartctl

Hopefully you have smartctl installed (it needs to run as root, e.g., via sudo ). If installed, it should give output like this:

The exact attributes shown vary from disk to disk, but most all of them have a 197 and/or 198 telling you how many un-repaired bad sectors the disk knows about. In the above output, you can see #5 is FAILING_NOW , and it’s type is Pre-fail . That means the disk firmware expects the disk to fail within 24 hours. If you have any failed attributes, especially pre-fail ones, I’d replace the disk (and if its still under warranty, you should be able to RMA it).

If you do not have smartctl

If you don’t have smartctl, now is not the time to install it.

Critical next step

If you have any important files on the machine disk—especially ones that haven’t already been backed up—attempt to copy them to a different disk, USB flash drive, network share, etc. Your filesystem has been damaged, and it’s possible this is your last chance to do so easily.

Use a live system to run smartctl, xfs_repair

If you don’t have smartctl installed, you can reboot (after copying off important data!) into a live system (from CD, USB stick, etc.) and run smartctl from there. You can also use xfs_repair from the live system to attempt filesystem repair. (Please read the manpage for xfs_repair first; I confess to not having much experience with XFS).

Note that disks made in the last decade or two have spare sectors and will use on of them to replace the bad sector the next time it’s written to. smartctl -A will normally have attributes showing how many times this has been done.

After filesystem repair

If there were important files you couldn’t grab before, you can now try again.

Depending on bad the damage was (how many files you lost, and which ones), you’ll need to either re-install a few packages (using dpkg -i or apt-get install —reinstall ) or, if it was bad, re-install the OS.

Of course, if you have a recent full-system backup, probably easiest to restore from backup.

How to prevent this in the future

Using two disks (in a mdraid RAID1 mirror) allows the kernel to deal with bad blocks by reading the sector from the other disk. It then writes the correct data back, allowing the disk to use a spare sector. You can also run RAID1 between two partitions on the same disk, which will half your available space but protect against bad sectors (but not against the disk failing entirely).

Источник

E: Sub-process /usr/bin/dpkg returned an error code (2) #28

Hi,
Can you help me to fix this error while installing packages.

root@admin:/gofaxip# apt install dh-golang dh-systemd git-buildpackage
Reading package lists. Done
Building dependency tree
Reading state information. Done
dh-golang is already the newest version.
git-buildpackage is already the newest version.
dh-systemd is already the newest version.
The following extra packages will be installed:
libmodem-vgetty-perl
The following packages will be upgraded:
libmodem-vgetty-perl
1 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
1 not fully installed or removed.
Need to get 24.9 kB of archives.
After this operation, 45.1 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ftp.nz.debian.org/debian/ jessie/main libmodem-vgetty-perl all 0.03-2 [24.9 kB]
Fetched 24.9 kB in 0s (29.6 kB/s)
Reading changelogs. Done
(Reading database . 160016 files and directories currently installed.)
Preparing to unpack . /libmodem-vgetty-perl_0.03-2_all.deb .
E: Sub-process /usr/bin/dpkg returned an error code (2)

The text was updated successfully, but these errors were encountered:

please try and post the output of:

and maybe
dpkg —configure -a

By the way. the problem has nothing to do with gofax.
Because the desired packages are already installed 😉

Источник

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

I am presuming you are quite new to Linux.

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.

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?

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.

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.

Источник

How to Solve “Sub-process /usr/bin/dpkg returned an error code (1)” In Ubuntu

It’s not uncommon to run into an issue of broken packages in Ubuntu and other Debian-based distributions. Sometimes, when you upgrade the system or install a software package, you may encounter the ‘Sub-process /usr/bin/dpkg returned an error code’ error.

For example, a while back, I tried to upgrade Ubuntu 18.04 and I bumped into the dpkg error as shown below.

This indicates that the google-chrome-stable package is either broken or corrupt. There are a few workarounds to this problem, so don’t throw in the towel yet or discard your system.

Solution 1: Reconfiguring the dpkg Package

One of the triggers of this error is a corrupted dpkg database. This can be caused by the sudden interruption of the installation of a software package. Reconfiguring the database is one way to resolve this issue.

To do this, simply execute the command:

This reconfigures the unpacked packages that were not installed during the installation process.

Solution 2: Force Install the Troublesome Package

Sometimes, errors can occur during the installation of software packages. When such happens, you can force install the package using the -f option as shown.

The -f option & —fix-broken can be interchangeably used to fix broken dependencies resulting from an interrupted package or cached package download.

Solution 3: Purge the Bad or Corrupted Software Package

If the first two solutions did not fix the problem, you can remove or purge the problematic software package as shown.

For example, in my case, purging the Google chrome package fixed the issue.

Then invoke the commands below to remove all the old, unused, and unnecessary packages which also frees up space on your hard drive.

Solution 4: Remove all the Files Associated with the Package

Lastly, you can manually remove all the associated with the troublesome package. First, you need to find these files which are located in the /var/lib/dpkg/info directory as shown.

After listing the files, you can move them to the /tmp directory as shown

Alternatively, you can use the rm command to manually remove the files.

Finally, update the package lists as shown:

You can thereafter give it another shot in reinstalling the software package.

Conclusion

This type of dpkg error points to an issue with the package installer usually caused by the interruption of an installation process or a corrupt dpkg database.

Any of the above-mentioned solutions should fix this error. If you have come this far, then it’s our hope that the issue has been successfully resolved and that you were able to reinstall your software package.

Tutorial Feedback.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

We are thankful for your never ending support.

Источник

Как решить ошибку “sub process usr bin dpkg returned an error code 1″ в Ubuntu

Если вы столкнулись с ошибкой с «sub process usr bin dpkg returned an error code 1» при установке программного обеспечения на Ubuntu Linux, вот как вы можете это исправить.

Одной из распространенных проблем в Ubuntu и других дистрибутивах на основе Debian являются ломанные пакеты.

Вы пытаетесь обновить систему или установить новый пакет, и столкиваеиесь с такой ошибкой, как «Sub-process /usr/bin/dpkg returned an error code 1.

Вот что случилось на днях.

Я пытался установить радио приложение на Ubuntu, и система вернула мне эту ошибку:

Здесь важны последние три строки:

Это говорит мне, что пакет полярная polar-bookshelf является причиной . Это может иметь решающее значение для устранения этой ошибки.

Решение проблемы Sub-process /usr/bin/dpkg returned an error code (1)

Попробуем исправить этот сломанный пакет.

Я покажу вам несколько методов, которые вы можете попробовать по одному.

Они простые в использовании и просто без проблем осуществимы.

Вы должны попытаться запустить sudo apt update, а затем попытаться установить новый пакет или обновиться после каждого из описанных здесь методов.

Способ 1: переконфигурировать базу данных пакетов

Первый метод, который вы можете попробовать, – перенастроить базу данных пакетов.

Вероятно, база данных повреждена при установке пакета.

Реконфигурация часто устраняет проблему.

Способ 2: Использовать принудительную установку

Если установка ранее прервалась, вы можете попробовать установить пакет принудительно:

Способ 3. Попробуйте удалить проблемный пакет.

Способ 4. Удалите информационные файлы с информацией о проблемном пакете

Это должно быть вашим последним прибежищем.

Вы можете попробовать удалить файлы, связанные с пакетом, из /var/lib/dpkg/info.

Вам нужно немного узнать о базовых командах Linux, чтобы выяснить, что происходит, и как использовать их с вашей проблемой.

В моем случае у меня была проблема с polar-bookhelof.

Источник

Suddenly,Ubuntu had been getting an error:

E: Sub-process dpkg --set-selections returned an error code (2)
E: couldn't clean the currently selected dpkg state

I can’t fix this issue with sudo apt --fix-broken install cause the system get the same issue.Someone can help me please? I need to upgrade and install some softwares!

Here is the complete output:

> ****@****:~$ sudo apt --fix-broken install
Lendo listas de pacotes... Pronto
Construindo árvore de dependências       
Lendo informação de estado... Pronto
Corrigindo dependências... Pronto
Os seguintes pacotes foram instalados automaticamente e já não são necessários:
  libnvidia-cfg1-390 libnvidia-common-390 libnvidia-compute-390:i386
  libnvidia-decode-390 libnvidia-decode-390:i386 libnvidia-encode-390
  libnvidia-encode-390:i386 libnvidia-fbc1-390 libnvidia-fbc1-390:i386
  libnvidia-gl-390 libnvidia-gl-390:i386 libnvidia-ifr1-390
  libnvidia-ifr1-390:i386 linux-image-4.15.0-39-generic
  linux-modules-4.15.0-39-generic xserver-xorg-video-nvidia-390
Utilize 'sudo apt autoremove' para os remover.
The following additional packages will be installed:
  libnvidia-cfg1-390 libnvidia-compute-390 libnvidia-compute-390:i386
  libnvidia-decode-390 libnvidia-decode-390:i386 libnvidia-encode-390
  libnvidia-encode-390:i386 libnvidia-fbc1-390 libnvidia-fbc1-390:i386
  libnvidia-gl-390 libnvidia-gl-390:i386 libnvidia-ifr1-390
  libnvidia-ifr1-390:i386 xserver-xorg-video-nvidia-390
Os pacotes a seguir serão REMOVIDOS:
  nvidia-390 nvidia-driver-390
Os pacotes a seguir serão atualizados:
  libnvidia-cfg1-390 libnvidia-compute-390 libnvidia-compute-390:i386
  libnvidia-decode-390 libnvidia-decode-390:i386 libnvidia-encode-390
  libnvidia-encode-390:i386 libnvidia-fbc1-390 libnvidia-fbc1-390:i386
  libnvidia-gl-390 libnvidia-gl-390:i386 libnvidia-ifr1-390
  libnvidia-ifr1-390:i386 xserver-xorg-video-nvidia-390
14 pacotes atualizados, 0 pacotes novos instalados, 2 a serem removidos e 329 não atualizados.
É preciso baixar 0 B/75,1 MB de arquivos.
Depois desta operação, 1.102 kB de espaço em disco serão liberados.
Você quer continuar? [S/n] S
dpkg: erro: a interpretar o ficheiro '/var/lib/dpkg/status' perto da linha 49469 pacote 'bc':
 valor duplicado para o campo 'Status'
E: Sub-processo dpkg --set-selections retornou um código de erro (2)
E: Couldn't clean the currently selected dpkg states

I am presuming you are quite new to Linux.

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.

sudo your_command
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:

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’.

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.

I am running 64bit Ubuntu 13.04

I tried to install cairo-dock

executed these command :

  • sudo add-apt-repository ppa:cairo-dock-team/ppa — went well, no error.
  • sudo apt-get update — went well, no error.
  • sudo apt-get install cairo-dock cairo-dock-plug-ins — error.

This is the process in the terminal :

sudo apt-get install cairo-dock cairo-dock-plug-ins

Reading package lists... Done Building dependency tree
Reading state information... Done 
The following extra packages will be installed: cairo-dock-core cairo-dock-data cairo-dock-plug-ins-data cairo-dock-plug-ins-dbus-interface-python cairo-dock-plug-ins-integration compiz-plugins curl libetpan15 libgldi3 Suggested packages: cairo-dock-plug-ins-dbus-interface-mono cairo-dock-plug-ins-dbus-interface-ruby cairo-dock-plug-ins-dbus-interface-vala gnote 
The following NEW packages will be installed: cairo-dock cairo-dock-core cairo-dock-data cairo-dock-plug-ins cairo-dock-plug-ins-data cairo-dock-plug-ins-dbus-interface-python cairo-dock-plug-ins-integration compiz-plugins curl libetpan15 libgldi3 
0 upgraded, 11 newly installed, 0 to remove and 0 not upgraded. 
Need to get 10.3 MB of archives. After this operation, 26.7 MB of additional disk space will be used. 
Do you want to continue [Y/n]? y 
Get:1 **link** raring/universe cairo-dock-data all 3.2.1-0ubuntu1 [468 kB] 
Get:2 **link** raring/universe libgldi3 amd64 3.2.1-0ubuntu1 [352 kB] 
Get:3 **link** raring/universe cairo-dock-core amd64 3.2.1-0ubuntu1 [1,125 kB] 
Get:4 **link** raring/universe cairo-dock-plug-ins-data all 3.2.1-0ubuntu1 [4,190 kB] 
Get:5 **link** raring-updates/main curl amd64 7.29.0-1ubuntu3.1 [149 kB] 
Get:6 **link** raring/universe libetpan15 amd64 1.0-5 [286 kB] 
Get:7 **link** raring/universe cairo-dock-plug-ins amd64 3.2.1-0ubuntu1 [871 kB] 
Get:8 **link** raring/universe cairo-dock-plug-ins-integration amd64 3.2.1-0ubuntu1 [59.9 kB] 
Get:9 **link** raring/universe cairo-dock-plug-ins-dbus-interface-python all 3.2.1-0ubuntu1 [16.0 kB] 
Get:10 **link** raring/universe cairo-dock all 3.2.1-0ubuntu1 [8,738 B] 
Get:11 **link** raring-updates/universe compiz-plugins amd64 1:0.9.9~daily13.06.19~13.04-0ubuntu1 [2,764 kB] Fetched 10.3 MB in 2min 1s (84.8 kB/s)
Selecting previously unselected package cairo-dock-data. dpkg: unrecoverable fatal error, aborting: reading files list for package 'linux-headers-3.8.0-19': Input/output error E: Sub-process /usr/bin/dpkg returned an error code (2)

The install hasn’t completed. It’s stuck on dpkg. This error occurs everytime I try to install a program using apt-get install.

The link: http://ph.archive.ubuntu.com/ubuntu/

gronostaj's user avatar

gronostaj

54.8k17 gold badges118 silver badges174 bronze badges

asked Aug 31, 2013 at 2:08

dreamsR4real's user avatar

The error.

unrecoverable fatal error, aborting:
-> reading files list for package ‘linux-headers-3.8.0-19’: Input/output error
—> E: Sub-process /usr/bin/dpkg returned an error code (2)

The verdict.

Input / Output error means that the media is bad. Use another CD, download the package, or replace your hard drive (it could be just a filesystem error).

If the problem is indeed with your hard drive, further indications thereof will be in the kernel log. Run dmesg to look at it. Look for suspicious, technical-looking lines starting with «ata» or «sdX».

answered Aug 31, 2013 at 5:22

Ярослав Рахматуллин's user avatar

3

Понравилась статья? Поделить с друзьями:
  • Sub or function not defined vba excel ошибка
  • Sv0368 serial data error
  • Su42118 6 ошибка
  • Sv0364 soft phase alarm ошибка fanuc
  • Suzuki ошибка p0707