Меню

Dpkg вернул ошибку 2

Every time I try to install or remove a package, I get this error. I thought maybe it was the hard disk, but a disk check gave me a clean bill of health.

dpkg: unrecoverable fatal error, aborting:
reading files list for package 'linux-headers-3.16.0-31': Input/output error
E: Sub-process /usr/bin/dpkg returned an error code (2)
A package failed to install.  Trying to recover:

I tried the solution of removing the listing for this file from the dpkg status file, but to no avail. I tried purging the package but no use. I’m stuck at this point as nothing I can find on Google helps.

Update:

This is now what the error says:

dpkg: unrecoverable fatal error, aborting:
E: Sub-process /usr/bin/dpkg returned an error code (2)
A package failed to install.  Trying to recover:

After trying: https://askubuntu.com/a/603305/1992

Update2:

Seems the drive has bad sectors, but the reallocated sector count is 0. The drive is relatively old, however, so I expect some issues. I won’t be able to replace it immediately, and until then I would still like to be able to keep the system up to date (especially for security reasons).

I noted that there was an issue with coping some md5 checksums related to the package mentioned in the error, but I don’t know what to do with those, such as if clearing them would allow dpkg to continue.

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:

ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x000f   103   098   006    Pre-fail  Always       -       212688305
  3 Spin_Up_Time            0x0003   094   094   000    Pre-fail  Always       -       0
  4 Start_Stop_Count        0x0032   100   100   020    Old_age   Always       -       76
  5 Reallocated_Sector_Ct   0x0033   002   002   036    Pre-fail  Always   FAILING_NOW 4015
  7 Seek_Error_Rate         0x000f   084   060   030    Pre-fail  Always       -       291678490
  9 Power_On_Hours          0x0032   052   052   000    Old_age   Always       -       42540
 10 Spin_Retry_Count        0x0013   100   100   097    Pre-fail  Always       -       0
 12 Power_Cycle_Count       0x0032   100   100   020    Old_age   Always       -       39
183 Runtime_Bad_Block       0x0032   098   098   000    Old_age   Always       -       2
184 End-to-End_Error        0x0032   100   100   099    Old_age   Always       -       0
187 Reported_Uncorrect      0x0032   018   018   000    Old_age   Always       -       82
188 Command_Timeout         0x0032   100   097   000    Old_age   Always       -       25770393781
189 High_Fly_Writes         0x003a   084   084   000    Old_age   Always       -       16
190 Airflow_Temperature_Cel 0x0022   061   061   045    Old_age   Always       -       39 (Min/Max 38/39)
194 Temperature_Celsius     0x0022   039   040   000    Old_age   Always       -       39 (0 16 0 0 0)
195 Hardware_ECC_Recovered  0x001a   034   013   000    Old_age   Always       -       212688305
197 Current_Pending_Sector  0x0012   100   099   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0010   100   099   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x003e   200   200   000    Old_age   Always       -       0
240 Head_Flying_Hours       0x0000   100   253   000    Old_age   Offline      -       42617 (160 246 0)
241 Total_LBAs_Written      0x0000   100   253   000    Old_age   Offline      -       3791056483
242 Total_LBAs_Read         0x0000   100   253   000    Old_age   Offline      -       1003117143

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

Some filesystems (e.g., btrfs with «duplicate» mode) can keep two copies of their metadata or your data, also protecting against bad sectors.

Trying to build php from source on Ubuntu 9.10 to enable GD2, but when i run dpkg-buildpackage, it just quits giving me this error:

QUILT_PATCHES=debian/patches quilt —quiltrc /dev/null pop -a -R || test $? = 2
Patch suhosin.patch does not remove cleanly (refresh it or enforce with -f)

make: *** [unpatch] Error 1
dpkg-buildpackage: error: fakeroot debian/rules clean gave error exit status 2

I’ve googled around, but i really can’t find what’s causing this, and what i should do about it…

any ideas?

Josh Lee's user avatar

Josh Lee

167k37 gold badges268 silver badges273 bronze badges

asked Nov 30, 2009 at 10:02

Guillaume's user avatar

Have you used source from debian package? If no, then you can have difficulties to apply patches from Debian. Debian uses primary clean sources (package_name.orig.tar.gz file) and patches (package_name.diff.gz). Don’t know about this particular problem, didn’t build packages for some time, but you could try to build it debian-way (http://www.debian.org/doc/FAQ/ch-pkg_basics.en.html#s-sourcepkgs). Ckech out original sources, then apply Debian patches, apply your patches (or the other order, don’t know which way should work), and finally build Debian packages from patched sources

answered Nov 30, 2009 at 10:40

MBO's user avatar

MBOMBO

29.9k5 gold badges50 silver badges52 bronze badges

1

I had similar trouble recently. What’s happening is that dpkg is trying to apply patches to the source code, after you’ve already applied a patch. It can’t apply them cleanly because they have gotten moved around by your modifications. I fiddled for a while, and found out that the easiest thing to do is to add the patch to Quilt and then build the package. BUT, the «patch directory» for quilt is DIFFERENT from the normal one, in a Debian package. It’s debian/patches rather than ./patches.

Anyway, look at section 6.4 in this page of the Debian package maintainer’s guide: http://www.debian.org/doc/maint-guide/ch-build.en.html

answered Mar 5, 2010 at 19:00

rescdsk's user avatar

rescdskrescdsk

8,6694 gold badges35 silver badges32 bronze badges

Asked
7 years, 5 months ago

Viewed
4k times

When I try to install anything on a linux server I always get the following error:

Last login: Sat Aug 22 10:25:09 2015 from 27.34.97.20
root@s3:~# sudo -i
root@s3:~# su
root@s3:~# apt-get install nginx
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
nginx-common nginx-full
Suggested packages:
fcgiwrap nginx-doc ssl-cert
The following packages will be REMOVED:
nginx-core
The following NEW packages will be installed:
nginx-full
The following packages will be upgraded:
nginx nginx-common
2 upgraded, 1 newly installed, 1 to remove and 14 not upgraded.
Need to get 0 B/479 kB of archives.
After this operation, 216 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
dpkg: warning: 'ldconfig' not found in PATH or not executable
dpkg: warning: 'start-stop-daemon' not found in PATH or not executable
dpkg: error: 2 expected programs not found in PATH or not executable
Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin
E: Sub-process /usr/bin/dpkg returned an error code (2)
root@s3:~#

asked Aug 22, 2015 at 15:04

Binod Lamsal's user avatar

9

Asked
7 years, 5 months ago

Viewed
4k times

When I try to install anything on a linux server I always get the following error:

Last login: Sat Aug 22 10:25:09 2015 from 27.34.97.20
root@s3:~# sudo -i
root@s3:~# su
root@s3:~# apt-get install nginx
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
nginx-common nginx-full
Suggested packages:
fcgiwrap nginx-doc ssl-cert
The following packages will be REMOVED:
nginx-core
The following NEW packages will be installed:
nginx-full
The following packages will be upgraded:
nginx nginx-common
2 upgraded, 1 newly installed, 1 to remove and 14 not upgraded.
Need to get 0 B/479 kB of archives.
After this operation, 216 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
dpkg: warning: 'ldconfig' not found in PATH or not executable
dpkg: warning: 'start-stop-daemon' not found in PATH or not executable
dpkg: error: 2 expected programs not found in PATH or not executable
Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin
E: Sub-process /usr/bin/dpkg returned an error code (2)
root@s3:~#

asked Aug 22, 2015 at 15:04

Binod Lamsal's user avatar

9

  • Печать

Страницы: [1]   Вниз


Автор
Тема: E: Sub-process /usr/bin/dpkg returned an error code (2)  (Прочитано 682 раз)

0 Пользователей и 1 Гость просматривают эту тему.

Оффлайн
lalalatry

Добрый день,вот такая штука… Знающие помогите

(Нажмите, чтобы показать/скрыть)


ТС не появлялся на Форуме более полугода по состоянию на 17/07/2019 (последняя явка: 17/10/2017). Модератором раздела принято решение закрыть тему.
—zg_nico

« Последнее редактирование: 17 Июля 2019, 08:48:25 от zg_nico »


Оффлайн
ARTGALGANO

lalalatry, версия ОС?
вручную из /var/lib/dpkg/info ничего не удаляли?


Оффлайн
SergeyIT

lalalatry, что устанавливаете?

Извините, я все еще учусь


  • Печать

Страницы: [1]   Вверх

0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии

А вот еще интересные материалы:

  • Яшка сломя голову остановился исправьте ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного исправьте ошибки
  • Ясность цели позволяет целеустремленно добиваться намеченного где ошибка
  • Dpf ошибка митсубиси паджеро спорт
  • Dpc watchdog violation ошибка синий экран