一直使用icinga2监控信息设备的运行状态,今天打算从2.10升级到2.11,本来一次普通的升级结果不小心搞得服务不可用,教训——头晕的时候不要随便按回车键。
原本提示包的依赖关系出现了问题:
代码语言:javascript复制# apt install icinga2
Reading package lists... Done
Building dependency tree
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:
icinga2-bin : Depends: libboost-context1.67.0 but it is not installable
Depends: libboost-coroutine1.67.0 but it is not installable
Depends: libboost-date-time1.67.0 but it is not installable
Depends: libboost-filesystem1.67.0 but it is not installable
Depends: libboost-program-options1.67.0 but it is not installable
Depends: libboost-regex1.67.0 but it is not installable
Depends: libboost-system1.67.0 but it is not installable
Depends: libboost-thread1.67.0 but it is not installable
E: Unable to correct problems, you have held broken packages.
然后我试着用aptitude去自己解决,就此跳进坑里(默认是Y,回车就执行了):
代码语言:javascript复制# aptitude install icinga2
The following packages will be REMOVED:
libboost-atomic1.62.0{u} libboost-chrono1.62.0{u} libboost-date-time1.62.0{u} libboost-program-options1.62.0{u} libboost-regex1.62.0{u}
libboost-thread1.62.0{u} libyajl2{u} php-htmlpurifier{u}
The following packages will be upgraded:
icinga2 icinga2-bin{b} icinga2-common icinga2-doc
4 packages upgraded, 0 newly installed, 8 to remove and 92 not upgraded.
Need to get 9,526 kB of archives. After unpacking 728 kB will be used.
The following packages have unmet dependencies:
icinga2-bin : Depends: libboost-context1.67.0 which is a virtual package and is not provided by any available package
Depends: libboost-coroutine1.67.0 which is a virtual package and is not provided by any available package
Depends: libboost-date-time1.67.0 which is a virtual package and is not provided by any available package
Depends: libboost-filesystem1.67.0 which is a virtual package and is not provided by any available package
Depends: libboost-program-options1.67.0 which is a virtual package and is not provided by any available package
Depends: libboost-regex1.67.0 which is a virtual package and is not provided by any available package
Depends: libboost-system1.67.0 which is a virtual package and is not provided by any available package
Depends: libboost-thread1.67.0 which is a virtual package and is not provided by any available package
icinga2-ido-mysql : Depends: icinga2-bin (= 2.10.5-1.stretch) but 2.11.3-1.stretch is to be installed
Depends: icinga2-common (= 2.10.5-1.stretch) but 2.11.3-1.stretch is to be installed
The following actions will resolve these dependencies:
Remove the following packages:
1) icinga2 [2.10.5-1.stretch (icinga-stretch, now)]
2) icinga2-bin [2.10.5-1.stretch (icinga-stretch, now)]
3) icinga2-ido-mysql [2.10.5-1.stretch (icinga-stretch, now)]
Accept this solution? [Y/n/q/?]
The following packages will be REMOVED:
dbconfig-common{u} icinga2{a} icinga2-bin{a} icinga2-common{u} icinga2-doc{u} icinga2-ido-mysql{a} libboost-atomic1.62.0{u} libboost-chrono1.62.0{u}
libboost-date-time1.62.0{u} libboost-program-options1.62.0{u} libboost-regex1.62.0{u} libboost-thread1.62.0{u} libyajl2{u} php-htmlpurifier{u}
0 packages upgraded, 0 newly installed, 14 to remove and 91 not upgraded.
Need to get 0 B of archives. After unpacking 24.8 MB will be freed.
Do you want to continue? [Y/n/?]
(Reading database ... 64567 files and directories currently installed.)
Removing icinga2-ido-mysql (2.10.5-1.stretch) ...
Determining localhost credentials from /etc/mysql/debian.cnf: succeeded.
Removing dbconfig-common (2.0.8) ...
Removing icinga2 (2.10.5-1.stretch) ...
Removing icinga2-bin (2.10.5-1.stretch) ...
Removing icinga2-common (2.10.5-1.stretch) ...
..........
等我回过神来,icinga2已经被删除了
吓得我赶紧去debian的官网,找到了这个包,原来在 stretch-backports 下面
代码语言:javascript复制https://packages.debian.org/stretch-backports/libboost-context1.67.0
找到了地方就好办了。
修改/etc/apt/sources.list
添加一行
代码语言:javascript复制deb http://mirrors.163.com/debian/ stretch-backports main
重新安装icinga2和icinga2-ido-mysql
代码语言:javascript复制# apt update
# aptitude install icinga2
The following NEW packages will be installed:
icinga2 icinga2-bin{a} icinga2-common{a} icinga2-doc{a} libboost-atomic1.67.0{a} libboost-chrono1.67.0{a} libboost-context1.67.0{a}
libboost-coroutine1.67.0{a} libboost-date-time1.67.0{a} libboost-filesystem1.67.0{a} libboost-program-options1.67.0{a} libboost-regex1.67.0{a}
libboost-system1.67.0{a} libboost-thread1.67.0{a}
0 packages upgraded, 14 newly installed, 0 to remove and 91 not upgraded.
Need to get 12.3 MB of archives. After unpacking 46.3 MB will be used.
Do you want to continue? [Y/n/?] y
Get: 1 https://packages.icinga.com/debian icinga-stretch/main amd64 icinga2-common all 2.11.3-1.stretch [159 kB]
Get: 2 https://packages.icinga.com/debian icinga-stretch/main amd64 icinga2-bin amd64 2.11.3-1.stretch [3,130 kB]
......
Get: 14 https://packages.icinga.com/debian icinga-stretch/main amd64 icinga2-doc all 2.11.3-1.stretch [6,127 kB]
Fetched 12.3 MB in 15min 41s (13.0 kB/s)
(Reading database ... 63665 files and directories currently installed.)
Preparing to unpack .../00-icinga2-common_2.11.3-1.stretch_all.deb ...
Unpacking icinga2-common (2.11.3-1.stretch) ...
Selecting previously unselected package libboost-context1.67.0:amd64.
Preparing to unpack .../01-libboost-context1.67.0_1.67.0-13 deb10u1~bpo9 1_amd64.deb ...
Unpacking libboost-context1.67.0:amd64 (1.67.0-13 deb10u1~bpo9 1) ...
......
# apt install icinga2-ido-mysql
......
# dpkg -l icinga2
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
-=================================-=====================-=====================-========================================================================
ii icinga2 2.11.3-1.stretch amd64 host and network monitoring system
虽然是新安装了一遍,但因为配置文件都保留了,可以立刻启动服务。也算相当于升级完成,搞定。
最后说明下,Debian的所谓backports就是后一代版本的包提前试用:
Backports are packages taken from the next Debian release (called "testing"), adjusted and recompiled for usage on Debian stable. Because the package is also present in the next Debian release, you can easily upgrade your stable backports system once the next Debian release comes out.