Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of automatically updating software package in Debian system

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to solve the problem of automatic update software package of Debian system. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

I do not know since when, after my computer is connected to the Internet every day, it is constantly downloading data, and the status bar shows that the Internet speed reaches 1 to 2 megabits per second. I didn't care much at first, but then because the bandwidth was all occupied by this mysterious download, I didn't even browse the web properly, so I decided to solve the problem. Let's record the process of solving this problem.

First of all, I used a real-time speed monitoring program called nethogs to see which process was occupying the bandwidth. I found that it was the system's APT package management tool that occupied the bandwidth. I thought it must be the system performing automatic updates. After killing the process, I went to Google to see how to turn off the automatic update of the APT package management tool. The solution offered by people on the Internet is mostly the same: modify the configuration file of APT.

APT's configuration file for automatic updates is located in "/ etc/apt/apt.conf.d/20auto-upgrades", and the

APT::Periodic::Update-Package-Lists "1"; APT::Periodic::Unattended-Upgrade "1"

Change to

APT::Periodic::Update-Package-Lists "0"; APT::Periodic::Unattended-Upgrade "0"

Among them

APT::Periodic::Update-Package-Lists; automatically runs apt-get update,1 once a day to enable it, and 0 to disable it.

APT::Periodic::Unattended-Upgrade; runs the unattended-upgrade security upgrade script once a day, with 1 to enable and 0 to disable.

However, there was no egg use, and APT performed an automatic update after booting the next day, and what is even weirder is that it will run again soon after killing the APT process. Only then did I realize that APT doesn't automatically put itself into memory to run. It must have been called by another process. After opening the process manager, look at the dependency of the APT process, and found that it really has a parent process named packagekit, I checked that packagekit is a system designed to simplify the installation and update of software for Linux distributions, it provides a unified front end for different package management tools, you can use it in different Linux distributions to manage software packages.

By default, my system starts the packgekit service at boot time to view the startup unit of packagekit:

Cat / lib/systemd/system/packagekit.service

[Unit] Description=PackageKit Daemon# competes for does not know how to do anything on ostree-managed systems;# currently the design is to have dedicated daemons like# eos-updater and rpm-ostree, and gnome-software talks to those.ConditionPathExistscompetitions Type=dbusBusName=org.freedesktop.PackageKitUser=rootExecStart=/usr/lib/packagekit/packagekitd

Each time the system starts up, the unit starts and the / usr/lib/packagekit/packagekitd command is executed, and packagekit will call up APT to download the package that needs to be updated during operation.

Knowing that these problems will naturally be solved, disable this service: systemctl disable packagekit.service.

Or simply delete the packagekit.service in the / lib/systemd/system/ directory (of course, you can move this file to another place and put it back when you use it later)

Since then, the system has never performed an automatic update.

[attached]

Nethohs is a command-line tool that can monitor the network in real time according to the process. It can dynamically display the network traffic information of the process communicating at a certain time.

Under Debian/Ubuntu, install it using apt-get install nethogs.

Or compile and install:

Wget-c https://github.com/raboof/nethogs/archive/v0.8.5.tar.gztar xf v0.8.5.tar.gz cd. / nethogs-0.8.5/make & & make install

If the compilation fails, you need to install the dependent library

Apt-get install libncurses5-dev libpcap-dev

Use

Root@zsimline$ nethogsNetHogs version 0.8.5-2+b1PID USER PROGRAM DEV SENT RECEIVED 2181 mxsyx / usr/share/code/code usb0 0.449 0.900 KB/sec1598 mxsyx / usr/lib/chromium/chromium usb0 0.031 0.018 KB/sec? Root unknown TCP 0.000 0.000 KB/sec TOTAL 0.480 0.917 KB/se

Specify the network card

Root@zsimline$ nethogs wlan0 # snooping wlan0root@zsimline$ nethogs-a # snooping all network cards

Specify refresh rate-d seconds (default is 1)

Root@zsimline$ nethogs-d 2

Specify the number of refreshes-c number (unlimited by default)

Root@zsimline$ nethogs-c 10

Interactive mode

After entering nethogs, you can use the following interactive command:

Q: exit

S: sort by send traffic

R: sort by traffic

M: modify the network speed unit (KB, B, MB) and KB/s

This is the end of this article on "how to solve the problem of automatically updating software packages in Debian system". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report