e2fsprogs logsave Ubuntu 安装失败 unable to make backup link of ‘./usr/bin/chattr‘

news/2025/2/14 6:12:33/

最近给服务器从 Ubuntu 18.04 LTS 升级到 20.04 LTS,过程中崩溃,重新尝试执行,提示依赖错误。这时候 apt install 所有的东西都会报错,提示依赖不满足。(这里的报错忘了复制了)执行 apt upgrade 也是一样。(之前一直执着于这一步的报错,百般搜索没能解决问题,大致就是不同的包需求的版本互相不匹配了)

然后按照提示执行 apt --fix-broken install 就会出现下面的报错。

root@server:~# apt --fix-broken install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  bluez-obexd cryptsetup cryptsetup-bin dconf-cli gir1.2-accountsservice-1.0 gir1.2-atspi-2.0
  gir1.2-gck-1 gir1.2-gcr-3 gir1.2-gdm-1.0 gir1.2-geoclue-2.0 gir1.2-gnomebluetooth-1.0
  gir1.2-gnomedesktop-3.0 gir1.2-graphene-1.0 gir1.2-gweather-3.0 gir1.2-ibus-1.0
  gir1.2-mutter-6 gir1.2-nm-1.0 gir1.2-nma-1.0 gir1.2-rsvg-2.0 gir1.2-soup-2.4
  gir1.2-upowerglib-1.0 gjs gnome-session-bin gnome-session-common gnome-shell-common
  gnupg-l10n gnupg-utils gpg-wks-server ibus-data libaom0 libatasmart4 libblockdev-fs2
  libblockdev-loop2 libblockdev-part-err2 libblockdev-part2 libblockdev-swap2
  libblockdev-utils2 libblockdev2 libcairo-gobject-perl libcairo-perl libcamel-1.2-62
  libcdio-cdda2 libcdio-paranoia2 libcdio17 libcroco3 libcue2 libdvdread7 libebackend-1.2-10
  libebook-1.2-20 libebook-contacts-1.2-2 libebook-contacts-1.2-3 libecal-2.0-1
  libedata-book-1.2-26 libedata-cal-2.0-1 libedataserver-1.2-24 libexempi3 libexempi8
  libexiv2-27 libextutils-depends-perl libextutils-pkgconfig-perl libfile-copy-recursive-perl
  libgail-3-0 libgexiv2-2 libgif7 libgjs0g libglib-object-introspection-perl libglib-perl
  libgmime-3.0-0 libgnome-autoar-0-0 libgsf-1-114 libgsf-1-common libgutenprint-common
  libgutenprint2 libgutenprint9 libinstpatch-1.0-2 libmetacity1 libmozjs-52-0 libmozjs-68-0
  libmtp-common libmtp-runtime libmtp9 libmutter-6-0 liboauth0 libparted-fs-resize0
  libperl5.26 libphonenumber7 libprotobuf10 libpython2.7 libqpdf21 libtracker-control-2.0-0
  libtracker-miner-2.0-0 libtracker-sparql-2.0-0 libudisks2-0 libusbmuxd4 libvpx6
  libzeitgeist-2.0-0 linux-headers-4.15.0-166 linux-headers-4.15.0-166-generic
  linux-image-4.15.0-166-generic linux-modules-4.15.0-166-generic
  linux-modules-extra-4.15.0-166-generic mate-desktop-common metacity-common onboard-common
  pkg-config printer-driver-gutenprint python-crypto python-talloc python3-ibus-1.0 qpdf
  run-one sgml-base tracker tracker-extract tracker-miner-fs udisks2 xubuntu-icon-theme
  xwayland yaru-theme-gnome-shell yelp-xsl zenity-common
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
  atril atril-common brltty brltty-x11 e2fsprogs initramfs-tools initramfs-tools-bin
  initramfs-tools-core klibc-utils libatrildocument3 libatrilview3 libbrlapi0.7 libklibc
  liblouis20 libpcre2-32-0 libsoup2.4-1 libsynctex2 libwebkit2gtk-4.0-37 logsave lz4
Suggested packages:
  caja unrar brltty-speechd console-braille gpart fuse2fs e2fsck-static
Recommended packages:
  gvfs e2fsprogs-l10n
The following NEW packages will be installed:
  initramfs-tools initramfs-tools-core klibc-utils libbrlapi0.7 liblouis20 libpcre2-32-0
  libsynctex2 libwebkit2gtk-4.0-37 logsave lz4
The following packages will be upgraded:
  atril atril-common brltty brltty-x11 e2fsprogs initramfs-tools-bin libatrildocument3
  libatrilview3 libklibc libsoup2.4-1
10 upgraded, 10 newly installed, 0 to remove and 921 not upgraded.
3 not fully installed or removed.
Need to get 0 B/19.1 MB of archives.
After this operation, 71.1 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 248701 files and directories currently installed.)
Preparing to unpack .../e2fsprogs_1.45.5-2ubuntu1.1_amd64.deb ...
Unpacking e2fsprogs (1.45.5-2ubuntu1.1) over (1.44.1-1ubuntu1.4) ...
dpkg: error processing archive /var/cache/apt/archives/e2fsprogs_1.45.5-2ubuntu1.1_amd64.deb (--unpack):
 unable to make backup link of './usr/bin/chattr' before installing new version: Operation not permitted
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
dpkg: considering deconfiguration of e2fsprogs, which would be broken by installation of logsave ...
dpkg: no, e2fsprogs is essential, will not deconfigure
 it in order to enable installation of logsave
dpkg: error processing archive /var/cache/apt/archives/logsave_1.45.5-2ubuntu1.1_amd64.deb (--unpack):
 installing logsave would break existing software
Errors were encountered while processing:
 /var/cache/apt/archives/e2fsprogs_1.45.5-2ubuntu1.1_amd64.deb
 /var/cache/apt/archives/logsave_1.45.5-2ubuntu1.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
这一步的报错的主要信息有下面的两个。

2ubuntu1.1_amd64.deb (--unpack):
 unable to make backup link of './usr/bin/chattr' before installing new version: Operation not permitted
这个提示 chattr 的一开始没听过,直接被我忽略了,甚至怀疑和 ssh 有关,后面证明这个报错才是关键。之后的报错其实是后来的结果和提示,我却一直拿下面的内容搜索,但是一直搜索不到有用的内容。大概就是说 e2fsprogs 和 logsave 在安装的时候出问题了。e2fsprogs 都是系统底层的关键库,和文件系统相关,那如果坏了可能就得重装系统了……

dpkg: considering deconfiguration of e2fsprogs, which would be broken by installation of logsave ...
dpkg: no, e2fsprogs is essential, will not deconfigure
 it in order to enable installation of logsave
之后重新回来搜索第一个 chattr 的报错,结果找到了下面的链接,最终引导我解决了问题。上面第一个报错说 无法给 chattr 做备份链接,Operation not permitted。这就很有意思了,我是 root 都不允许。结果证实还是经验少,这个报错是经典的 chattr 用来管理文件安全的一个报错。除了我们习惯的 chmod 对用户的读写执行进行约束,chattr 也可以进一步约束文件不可以删除或者只可以 append 等等,具体大家可以 google 一下 chattr 这个库。

https://forum.howtoforge.com/threads/big-mistake-removed-e2fsprogs.75729/
https://forum.howtoforge.com/threads/big-mistake-removed-e2fsprogs.75729/
事后推测原因是 chattr 这个库坏了,而这个库给很多系统敏感文件都加了禁止删除,包括他自己。更新这个库的时候应该要把这些库文件的禁止删除取消,但是它在这里出问题了。于是按照连接中的方法,去下载了 e2fsprogs 的 pkg 包。

https://ubuntu.pkgs.org/20.04/ubuntu-updates-main-amd64/e2fsprogs_1.45.5-2ubuntu1.1_amd64.deb.html
https://ubuntu.pkgs.org/20.04/ubuntu-updates-main-amd64/e2fsprogs_1.45.5-2ubuntu1.1_amd64.deb.html
下载后的 pkg 包是可以解压的,解压以后,在解压后的 /usr/bin/ 可以找到 chattr and lsattr 这两个可执行文件。于是我们用这里的 chattr 取消系统里 chattr 和 lsattr 的保护,然后手动删除。

./chattr -ia /usr/bin/chattr
./chattr -ia /usr/bin/lsattr
rm /usr/bin/chattr 
rm /usr/bin/lsattr 
之后 apt upgrade ,安装顺利进行,问题解决
————————————————
原文链接:https://blog.csdn.net/Haulyn5/article/details/127495565


http://www.ppmy.cn/news/41330.html

相关文章

若依项目springcloud启动

若依项目springcloud启动 参考:http://doc.ruoyi.vip/ruoyi-cloud/document/hjbs.html 1、概述 1.1、学习前提 熟练使用springboot相关技术了解springcloud相关技术电脑配置可以支持 1.2、需要的配置 JDK > 1.8 (推荐1.8版本) Mysql > 5.7.0 (推荐5.7版…

动力节点-SpringBoot3第九章了解AOT和GraalVM

9 了解AOT和GraalVM 9.1 提供性能的技术 什么是AOT: Ahead-of-Time Compilation :预编译(提前编译)它在 JEP-295 中描述,并在 Java 9 中作为实验性功能添加。 AOT是提升Java程序性能的一种方法,特别是提供…

LeetCode414_414. 第三大的数

LeetCode414_414. 第三大的数 一、描述 给你一个非空数组,返回此数组中 第三大的数 。如果不存在,则返回数组中最大的数。 示例 1: 输入:[3, 2, 1] 输出:1 解释:第三大的数是 1 。示例 2: …

本地Linux服务器安装宝塔面板,并内网穿透实现公网远程登录

文章目录前言1. 安装宝塔2. 安装cpolar内网穿透3. 远程访问宝塔4. 固定http地址5. 配置二级子域名6. 测试访问二级子域名转发自CSDN远程穿透的文章:Linux安装宝塔,并实现公网远程登录宝塔面板【内网穿透】 前言 宝塔面板作为建站运维工具,它…

【c语言】一维数组***特性、存储原理

创作不易&#xff0c;本篇文章如果帮助到了你&#xff0c;还请点赞支持一下♡>&#x16966;<)!! 主页专栏有更多知识&#xff0c;如有疑问欢迎大家指正讨论&#xff0c;共同进步&#xff01; 给大家跳段街舞感谢支持&#xff01;ጿ ኈ ቼ ዽ ጿ ኈ ቼ ዽ ጿ ኈ ቼ ዽ ጿ…

Mac 上如何安装Mysql

1、首先&#xff0c;登陆Mysql的 官网&#xff1a; https://www.mysql.com/downloads/ 2、进入官网后&#xff0c;页面拉到最下面&#xff0c;找到 Mysql Community&#xff08;GPL&#xff09; Downloads&#xff0c;点击进入下载 3、然后选择&#xff1a;Mysql Community S…

“微天气” - 一个基于微信小程序的智能天气预报体验

“微天气” - 一个基于微信小程序的智能天气预报体验 一、引言 微信小程序是一种不用下载就能使用的应用&#xff0c;也是一项创新&#xff0c;经过将近两年的发展&#xff0c;已经构造了新的微信小程序开发环境和开发者生态。微信小程序也是这么多年来中国IT行业里一个真正能…

Reactor线程模型

Reactor线程模型1. 概念2.角色3.模型类型单Reactor-单线程单Reactor-多线程⭐主从Reactor-多线程Code design(参考zk)1. 创建服务, 创建服务上下文工厂2. 初始化服务上下文工厂配置3. 启动服务, 从里往外(worker > selector > accept)依次进行启动线程4. Accept Thread中…