pve 被我在 debian 中 apt remove 了,付费 100 求解决

2023-07-18 14:23:06 +08:00
 hanssx

事情起因

今天用 pve 所在 debian 系统,apt install nut ,用于 ups 管理,发现报错

W: (pve-apt-hook) !! WARNING !!
W: (pve-apt-hook) You are attempting to remove the meta-package 'proxmox-ve'!
W: (pve-apt-hook) 
W: (pve-apt-hook) If you really want to permanently remove 'proxmox-ve' from your system, run the following command
W: (pve-apt-hook) 	touch '/please-remove-proxmox-ve'
W: (pve-apt-hook) run apt purge proxmox-ve to remove the meta-package
W: (pve-apt-hook) and repeat your apt invocation.
W: (pve-apt-hook) 
W: (pve-apt-hook) If you are unsure why 'proxmox-ve' would be removed, please verify
W: (pve-apt-hook) 	- your APT repository settings
W: (pve-apt-hook) 	- that you are using 'apt full-upgrade' to upgrade your system
E: Sub-process /usr/share/proxmox-ve/pve-apt-hook returned an error code (1)
E: Failure running script /usr/share/proxmox-ve/pve-apt-hook

后面经过一番搜索,才发现应该是收费订阅服务的问题,导致我现在用不了 apt 。

噩梦开始

然后我就去网上搜了,按照网上文章 https://blog.51cto.com/sery/2178466 的评论:

这个问题解决了,方法如下; mkdir /usr/share/proxmox-ve && touch /usr/share/proxmox-ve/pve-apt-hook && chmod 0755 /usr/share/proxmox-ve/pve-apt-hook ## pve 6.x buster 版本 ## pve 7.x bullseye 版本 记得替换版本代号 echo "deb http://mirrors.ustc.edu.cn/proxmox/debian/pve/ bullseye pve-no-subscription" > /etc/apt/sources.list.d/pve-no-sub.list apt update && apt dist-upgrade

还有 https://www.guoguo.it/2021/01/proxmox-ve%E6%B7%BB%E5%8A%A0%E7%A4%BE%E5%8C%BA%E6%BA%90%E7%9A%84%E4%B8%80%E4%BA%9B%E5%9D%91/ 里面的说法

致命操作

我进行了如下查看

root@pve:~# ls -l /etc/apt/sources.list.d/
total 8
-rw-r--r-- 1 root root 71 Dec 25  2022 pve-enterprise.list
-rw-r--r-- 1 root root 80 Dec 25  2022 pve-no-subscription.list

root@pve:~# cat /etc/apt/sources.list.d/pve-enterprise.list 
#deb https://enterprise.proxmox.com/debian/pve bullseye pve-enterprise
root@pve:~# cat /etc/apt/sources.list.d/pve-no-subscription.list 
deb https://mirrors.ustc.edu.cn/proxmox/debian/pve bullseye pve-no-subscription

进行了如下备份操作,

root@pve:~# mv /etc/apt/sources.list.d/pve-enterprise.list /etc/apt/sources.list.d/pve-enterprise.list.bak
root@pve:~# mv /usr/share/proxmox-ve/pve-apt-hook /usr/share/proxmox-ve/pve-apt-hook.bak
root@pve:~# cat /usr/share/proxmox-ve/pve-apt-hook
cat: /usr/share/proxmox-ve/pve-apt-hook: No such file or directory
root@pve:~# touch /usr/share/proxmox-ve/pve-apt-hook
root@pve:~# chmod 0755 /usr/share/proxmox-ve/pve-apt-hook


然后开始 apt install ,没想到 install 操作连带着 remove ,没仔细看直接同意 Y 了

root@pve:~# apt update
root@pve:~# apt install nut nut-server nut-client nut-cgi
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  proxmox-mail-forward proxmox-offline-mirror-docs proxmox-offline-mirror-helper
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
  apache2 apache2-bin apache2-data apache2-utils chrony gcc-12-base libabsl20220623 libaom3 libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap
  libavif15 libc-bin libc-l10n libc6 libdav1d6 libgav1-1 libgd3 libgmp10 libgnutls-dane0 libgnutls30 libjansson4 libldap-2.5-0 libldap-common liblerc4 libltdl7
  libnghttp2-14 libnutscan2 libpve-common-perl librav1e0 libsasl2-2 libsasl2-modules-db libssl3 libstdc++6 libsvtav1enc1 libtiff6 libupsclient6 libwebp7 libxpm4
  libyuv0 libzstd1 locales proxmox-widget-toolkit
Suggested packages:
  apache2-doc apache2-suexec-pristine | apache2-suexec-custom www-browser networkd-dispatcher glibc-doc libnss-nis libnss-nisplus libgd-tools dns-root-data
  nut-monitor nut-i2c nut-ipmi nut-modbus nut-snmp nut-xml
Recommended packages:
  libsasl2-modules
The following packages will be REMOVED:
  libgnutlsxx28 lxc-pve proxmox-ve pve-container pve-ha-manager pve-manager qemu-server
The following NEW packages will be installed:
  apache2 apache2-bin apache2-data apache2-utils gcc-12-base libabsl20220623 libaom3 libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libavif15
  libdav1d6 libgav1-1 libgd3 libldap-2.5-0 libldap-common liblerc4 libnutscan2 librav1e0 libssl3 libsvtav1enc1 libtiff6 libupsclient6 libwebp7 libxpm4 libyuv0
  nut nut-cgi nut-client nut-server
The following packages will be upgraded:
  chrony libc-bin libc-l10n libc6 libgmp10 libgnutls-dane0 libgnutls30 libjansson4 libltdl7 libnghttp2-14 libpve-common-perl libsasl2-2 libsasl2-modules-db
  libstdc++6 libzstd1 locales proxmox-widget-toolkit
17 upgraded, 31 newly installed, 7 to remove and 582 not upgraded.

我没注意看

The following packages will be REMOVED:
  libgnutlsxx28 lxc-pve proxmox-ve pve-container pve-ha-manager pve-manager qemu-server

然后就同意 Y 了,结果

Removing proxmox-ve (7.3-1) ...
Removing pve-manager (7.3-4) ...
Removing pve-ha-manager (3.5.1) ...
Removing pve-container (4.4-2) ...
Removing lxc-pve (5.0.0-3) ...
Removing 'diversion of /usr/share/apparmor-features/features to /usr/share/apparmor-features/features.stock by lxc-pve'
Removing libgnutlsxx28:amd64 (3.7.1-5+deb11u2) ...
Removing qemu-server (7.3-2) ...

现状

现在开着的虚拟机不敢关了,pve 所在 debian 也不敢重启,pve web 肯定是登录不进去了,重新装也装不了。。

root@pve:~# apt install proxmox-ve
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 lxc-pve : Depends: libgnutlsxx28 but it is not installable
E: Unable to correct problems, you have held broken packages.
root@pve:~# apt install libgnutlsxx28
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package libgnutlsxx28 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'libgnutlsxx28' has no installation candidate
root@pve:~# qm
bash: qm: command not found

哪位朋友有时间帮忙解决一下,付费 100 以表谢意。

3485 次点击
所在节点    Linux
26 条回复
blankmiss
2023-07-18 14:30:33 +08:00
我之前升级 PVE 失败 也把 pve 删掉了 后面把虚拟机文件备份 以后重新安装了
blankmiss
2023-07-18 14:31:05 +08:00
@blankmiss 重新安装系统,我是 DELL 洋垃圾 可以用 idrac 远程安装
hymzhek
2023-07-18 14:38:14 +08:00
ssh 还能进去吧 还原 /etc/apt/sources.list.d/ 里的文件 那个几个包装回去呢
blankmiss
2023-07-18 14:47:24 +08:00
还有一种方法 挂载一个 pve 的系统镜像或者相同版本的 debian 镜像 通过 apt 本地镜像源 安装你要的包
hanssx
2023-07-18 14:48:31 +08:00
@blankmiss 师傅,虚拟机文件备份是怎么备份的,现在 PVE 备份虚拟机是没办法操作了,因为 PVE 功能基本上在 debian 上被 remove 了


@hymzhek 能进去,现在里面的虚拟机还开着正常用呢,不敢关了,哥,这个操作靠谱不,我怕崩了,怎么备份一下再操作呢。。
ochatokori
2023-07-18 14:51:40 +08:00
apt 这个真的是坑,什么时候 apt 才能在移除包时加个二次确认
hymzhek
2023-07-18 14:52:47 +08:00
@hanssx #5 先把 nut nut-server nut-client nut-cgi 这些包 删了 然后 还原备份过的文件 apt update apt install proxmox-ve 最多 ssh 把虚拟机硬盘文件复制出来
blankmiss
2023-07-18 14:52:54 +08:00
![]( https://mjj.today/i/Wq6M74)
hymzhek
2023-07-18 14:53:28 +08:00
@ochatokori #6 本来有 hook 脚本 他看那个坑人的教程 给删了
blankmiss
2023-07-18 14:55:54 +08:00
这个目录 有虚拟机文件/dev/mapper/ , /etc/pve/ 配置 和 /var/lib/vz/ 镜像和杂七杂八的
blankmiss
2023-07-18 15:01:24 +08:00
我说的是教你 怎么备份然后重装,不是教你修复现在的系统。我当时就是这么重新恢复的
defunct9
2023-07-18 15:03:46 +08:00
开 ssh ,让我上去看看
villivateur
2023-07-18 15:08:41 +08:00
这个帖子,刚看到标题就莫名喜感,然后前几楼的头像让我没绷住,然后楼上又是著名的 ssh 哥,今天的快乐源泉就是这个帖子了。

正经答:先备份重要数据,虚拟机文件应该不会被删,先备份。然后卸载你误操作装的包,再安装你误操作删掉的包。
qW7bo2FbzbC0
2023-07-18 15:14:20 +08:00
我也遇到过,不是生产环境,直接按照官方安装方法给安装回去就行了,小问题
zljklang
2023-07-18 15:16:56 +08:00
看下这个日志/var/log/apt/history.log 卸载了那些,重新安装下
NSAgold
2023-07-18 15:24:26 +08:00
找另一台设备,在 linux 桌面环境下开 virtmanager 远程连接到你这台 pve 的 kvm 环境看看能不能把虚拟机配置备份了先,然后把镜像也备份了。
之后试着把你删了的包装回去试试
bjzhush
2023-07-18 15:26:44 +08:00
@defunct9 让你 ssh 上去表演个 sudo rm -rf / 吗?
deorth
2023-07-18 16:27:38 +08:00
你就当现在是个纯 debian ,按官方那个在 debian 上安装 pve 的教程走一遍就行了
gromit1337
2023-07-18 18:24:00 +08:00
@defunct9 你发了这么多句,有没有人让你看过啊
defunct9
2023-07-18 18:38:12 +08:00
@gromit1337 经常有人让我上去看

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/957699

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX