ถือแพคเกจกลับจากการอัพเดตโดยไม่มี APT Pin


14

ฉันรู้เกี่ยวกับการปักหมุดแพ็คเกจด้วย Apt นั่นไม่ใช่สิ่งที่ฉันต้องการจะทำ มีการตอบคำถามอื่น ๆ ด้วยการใช้การปักหมุดหรือการใช้หมุดชั่วคราว ฉันไม่ต้องการทำสิ่งนี้

สิ่งที่ฉันต้องการทำคือเก็บแพ็คเกจกลับในลักษณะเดียวกับที่เคอร์เนลได้รับ:

# apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages have been kept back:
  linux-generic-pae linux-headers-generic-pae linux-image-generic-pae
The following packages will be upgraded:

ฉันต้องการเพิ่มtomcat-*และmysql-*และsun-*ในรายการนี้ ในอดีตมีพารามิเตอร์การตั้งค่าการทำเช่นนี้ ฉันมักจะคิดว่ามันเป็นสิ่งที่ชอบApt::Get::HoldPkgsหรือApt::HoldPkgsแต่ฉันไม่สามารถหาได้

apt-get installฉันต้องการที่จะมีแพคเกจเหล่านี้จัดขึ้นจากการปรับปรุงจนกว่าฉันจะขอให้พวกเขาโดยเฉพาะกับ

ผมพบว่าการกำหนดค่าapt-get Apt::NeverAutoRemoveฉันจะทำสิ่งที่ฉันต้องการหรือไม่

คำถามที่เพิ่มเข้ามา:ฉันสังเกตเห็นว่าApt::NeverAutoRemoveและApt::Never-MarkAuto-Sections(ในกลุ่มอื่น ๆ ) ยังไม่มีการจัดทำเอกสารเท่าที่ฉันเห็น พวกเขาไม่ได้อยู่ใน manpages ไม่เป็นและaptitude::Keep-Unused-Patternaptitude::Get-Root-Command

มีเอกสารที่ครอบคลุมและครบถ้วนapt.confหรือไม่


ตัวอย่างเคอร์เนลขึ้นอยู่กับความแตกต่างระหว่างupgradeและdist-upgradeและไม่สามารถกำหนดค่าบนพื้นฐานต่อแพคเกจ
enzotib

ระเบิด! (ขออภัย ... ) ฉันยังคงเชื่อว่ามันเคยถูกกำหนดค่า; จะไม่แปลกใจฉันว่ามันล้าสมัยในขณะนี้
เหม่ย

1
ผมไม่ได้บอกว่าไม่สามารถทำได้ผมว่าตัวอย่างเคอร์เนลไม่เหมาะสมเพราะความจริงที่ว่า "แพคเกจได้รับการเก็บรักษาไว้กลับ" ไม่ได้ขึ้นอยู่กับการตั้งค่าใด ๆ แต่จากความหมายของคำสั่งของupgrade apt-get
enzotib

คำตอบนี้ขอถามUbuntu.com/questions/18654/…ดูเหมือนจะไม่ใช้ pinnig
enzotib

ฉันเห็นสิ่งเหล่านั้น ฉันหวังว่าจะมีพารามิเตอร์ apt.conf - ความหวังที่ไร้ประโยชน์ตอนนี้ก็ปรากฏขึ้น dpkg --set-selectionsผมเอนเอียงไปใช้ ฉันพบคำถามที่แนะนำการใช้ dpkg และการใช้ความถนัดไม่เทียบเท่า (กล่าวคือ dpkg ไม่เคารพการตั้งค่าความถนัด)
เหม่ย

คำตอบ:


15

dpkg --set-selectionsคำตอบคือการใช้งาน หากคุณเรียกใช้คำสั่งdpkg --get-selectionsคุณสามารถดูสิ่งที่ตั้งไว้แล้ว:

$ dpkg --get-selections | head
acct                                            install
adduser                                         install
apparmor                                        install
apparmor-utils                                  install
apt                                             install
apt-transport-https                             install
apt-utils                                       install
aptitude                                        install
at                                              install
auditd                                          install

พิจารณาในกรณีนี้แพคเกจdnsutils:

$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be upgraded:
  bind9-host dnsutils libbind9-60 libdns64 libisc60 libisccc60 libisccfg60 liblwres60
8 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,257kB of archives.
After this operation, 0B of additional disk space will be used.
Do you want to continue [Y/n]? n
Abort.

ตอนนี้ขอเปลี่ยนมัน - วางแพ็คเกจไว้:

$ echo dnsutils hold | sudo dpkg --set-selections

ตรวจสอบผลลัพธ์:

$ dpkg --get-selections | grep dnsutils
dnsutils                                        hold

ลองอัปเดตอีกครั้ง:

$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages have been kept back:
  bind9-host dnsutils libbind9-60 libdns64 libisc60 libisccfg60 liblwres60
The following packages will be upgraded:
  libisccc60
1 upgraded, 0 newly installed, 0 to remove and 7 not upgraded.
Need to get 29.9kB of archives.
After this operation, 0B of additional disk space will be used.
Do you want to continue [Y/n]? n
Abort.

ตอนนี้dnsutils- และแพ็คเกจที่เกี่ยวข้อง - กำลังถูกระงับเช่นเดียวกับที่เราต้องการ


คุณควรพิจารณาให้ข้อมูลบางอย่างเกี่ยวกับการใช้rootบัญชีของคุณ
enzotib

การเข้าสู่ระบบในฐานะรูทนั้นง่ายกว่ามาก อย่างไรก็ตามการใช้sudoในสถานที่ที่เหมาะสมเป็นการปฏิบัติที่ดีกว่า ในตัวอย่างคำสั่งapt-get upgradeและdpkg --set-selectionsต้องการการเข้าถึงรูทดังนั้นsudoควรใช้สำหรับคำสั่งเหล่านี้ คนอื่น ๆ ควรเป็นอย่างที่เป็นอยู่
เหม่ย

ฉันรู้อย่างสมบูรณ์แบบว่าจะใช้ sudo ได้อย่างไรและเมื่อใดฉันแนะนำให้อธิบายอย่างชัดเจนว่าในคำตอบสำหรับผู้เริ่มต้น
enzotib

นั่นคือสิ่งที่ฉันคิดว่าคุณหมายถึง ฉันชี้แจงในความคิดเห็น ... ฉันได้แก้ไขคำตอบด้วยตอนนี้
เหม่ย

-1

หน้าคนจาก APT-MARK

APT-MARK(8)                                                            APT                                                            APT-MARK(8)

NAME
       apt-mark - show, set and unset various settings for a package

SYNOPSIS
       apt-mark {-f=filename | {auto | manual} pkg...  | {showauto | showmanual} [pkg...] } | {-v | --version} | {-h | --help}

       apt-mark {hold | unhold | install | remove | purge} pkg...  | {showhold | showinstall | showremove | showpurge} [pkg...]

DESCRIPTION
       apt-mark can be used as a unified front-end to set various settings for a package, such as marking a package as being
       automatically/manually installed or changing dpkg selections such as hold, install, deinstall and purge which are respected e.g. by
       apt-get dselect-upgrade or aptitude.

AUTOMATICALLY AND MANUALLY INSTALLED PACKAGES
       When you request that a package is installed, and as a result other packages are installed to satisfy its dependencies, the dependencies
       are marked as being automatically installed, while the package you installed explicitly is marked as manually installed. Once an
       automatically installed package is no longer depended on by any manually installed package it is considered no longer needed and e.g.
       apt-get or aptitude will at least suggest removing them.

       auto
           auto is used to mark a package as being automatically installed, which will cause the package to be removed when no more manually
           installed packages depend on this package.

       manual
           manual is used to mark a package as being manually installed, which will prevent the package from being automatically removed if no
           other packages depend on it.

       showauto
           showauto is used to print a list of automatically installed packages with each package on a new line. All automatically installed
           packages will be listed if no package is given. If packages are given only those which are automatically installed will be shown.

       showmanual
           showmanual can be used in the same way as showauto except that it will print a list of manually installed packages instead.

   Options
       -f=filename, --file=filename
           Read/Write package stats from the filename given with the parameter filename instead of from the default location, which is
           extended_status in the directory defined by the Configuration Item: Dir::State.

PREVENT CHANGES FOR A PACKAGE
       hold
           hold is used to mark a package as held back, which will prevent the package from being automatically installed, upgraded or removed.

       unhold
           unhold is used to cancel a previously set hold on a package to allow all actions again.

       showhold
           showhold is used to print a list of packages on hold in the same way as for the other show commands.

SCHEDULE PACKAGES FOR INSTALL, REMOVE AND PURGE
       Some front-ends like apt-get dselect-upgrade can be used to apply previously scheduled changes to the install state of packages. Such
       changes can be scheduled with the install, remove (also known as deinstall) and purge commands. Packages with a specific selection can be
       displayed with showinstall, showremove and showpurge respectively. More information about these so called dpkg selections can be found in
       dpkg(1).

OPTIONS
       -h, --help
           Show a short usage summary.

       -v, --version
           Show the program version.

       -c, --config-file
           Configuration File; Specify a configuration file to use. The program will read the default configuration file and then this
           configuration file. If configuration settings need to be set before the default configuration files are parsed specify a file with the
           APT_CONFIG environment variable. See apt.conf(5) for syntax information.

       -o, --option
           Set a Configuration Option; This will set an arbitrary configuration option. The syntax is -o Foo::Bar=bar.  -o and --option can be
           used multiple times to set different options.

FILES
       /var/lib/apt/extended_states
           Status list of auto-installed packages. Configuration Item: Dir::State::extended_states.

SEE ALSO
       apt-get(8),aptitude(8),apt.conf(5)

DIAGNOSTICS
       apt-mark returns zero on normal operation, non-zero on error.

BUGS
       APT bug page[1]. If you wish to report a bug in APT, please see /usr/share/doc/debian/bug-reporting.txt or the reportbug(1) command.

AUTHORS
       Mike O'Connor

       APT team

NOTES
        1. APT bug page
           http://bugs.debian.org/src:apt

APT 1.2.10                                                      25 September 2015                                                     APT-MARK(8)
โดยการใช้ไซต์ของเรา หมายความว่าคุณได้อ่านและทำความเข้าใจนโยบายคุกกี้และนโยบายความเป็นส่วนตัวของเราแล้ว
Licensed under cc by-sa 3.0 with attribution required.