sudo swupd update
swupd将Clear Linux OS安装与上游更新和软件相链接。
描述
它是如何工作的
例子
快速参考
相关主题
描述
swupd有两个主要功能:
通过安装软件包而不是软件包来管理软件并替换APT或YUM。
检查系统更新并安装它们。
swupd在后台管理重叠的依赖关系,确保所有软件在整个系统中兼容。它可用于验证操作系统、清理缓存文件和修复问题。
包包含交付软件功能所需的一切。它们是由透明Linux操作系统管理的最小粒度组件。当安装一个软件时,一个包带有它的所有依赖项,而不是下载一系列包依赖项。
版本控制
使用包管理器来监控软件版本兼容性或比较许多Linux发行版上的多个系统可能很麻烦。
使用Clear Linux操作系统swupd,版本控制发生在单个文件级别。这意味着Clear Linux操作系统会生成一个全新的操作系统版本,对系统进行任何软件更改,包括软件降级或删除。这种滚动发布版本模型类似于git内部版本跟踪,其中跟踪任何单个文件提交,并在更改时向前移动指针。
代表操作系统当前版本的数字描述了操作系统上所有软件的版本。每个构建都由一组特定的包组成,这些包由特定版本的包组成。在日常工作中,这对于需要确定哪些系统没有最新的安全补丁,或者哪些软件组合已经过测试的系统管理员来说很重要。相同数量的每一个版本都保证包含相同版本的软件,因此运行相同版本的Clear Linux操作系统的两个系统之间没有歧义。
更新
Clear Linux操作系统默认情况下会强制定期更新操作系统,并根据版本服务器自动检查更新。内容服务器为所有版本提供文件和元数据内容,并且可以与版本服务器相同。内容url服务器以清单的形式提供元数据,清单列出并描述文件内容、符号链接和目录。此外,实际内容以归档文件的形式提供给客户端。 使用Clear Linux操作系统的软件更新也很有效。与基于包的发行版不同,swupd只更新已更改的文件,而不是整个包。例如,操作系统安全补丁小到15 KB是很常见的。使用二进制增量,Clear Linux操作系统只能应用所需的内容。 有关如何为Clear Linux操作系统生成更新内容的详细信息,请参见混合工具。
它是如何工作的
先决条件
该设备位于连接良好的网络上。 该设备能够连接到更新服务器。默认服务器是:http://update.clearlinux.org
更新
默认情况下,Clear Linux操作系统更新是自动的,但是只能根据需要进行设置。swupd确保定期更新简单安全。它还可以检查当前安装的文件和软件的有效性,并可以纠正任何问题。
清单
Clear Linux操作系统软件更新内容由数据和元数据组成。数据是最终保存在操作系统中的文件。元数据包含向操作系统文件系统正确提供数据以及更新系统和向操作系统添加或删除附加内容的相关信息。 清单大多是描述内容的散列列表。每个包都有自己的清单文件。有一个描述所有清单的主清单文件,将所有清单联系在一起。 完整文件、包和增量包
为了加快更新和优化内容传递,通过以下方法之一获得提供给系统的更新数据: 在每个版本中,总是为每个文件生成完整文件。这允许任何Clear Linux操作系统直接获得每个版本的内容的精确副本。例如,如果操作系统验证需要替换单个文件,则使用该选项。 有些版本提供包。它们结合了许多文件,以加快安装媒体和大型更新的创建。 增量包是只包含更新(二进制差异)的包的优化版本。没有原始文件内容就不能使用它们。
捆绑搜索
swupd在下载清单数据中搜索与术语匹配的包。每次搜索只输入一个术语或带连字符的术语。使用命令人swupd了解更多信息。
只返回基本包。包可以通过包含包含其他包。有关更多详细信息,请参见包定义文件及其子目录包。 已经安装的包会在搜索结果中标记(已安装)。 或者,您可以在GitHub*上查看我们的捆绑包。
例子
示例1:禁用和启用自动更新
默认情况下,Clear Linux操作系统更新是自动的,但是只能根据需要进行设置。
验证您当前的自动更新设置。
sudo swupd autoupdate
输出:
enabled
禁用自动更新。
sudo swupd autoupdate --disable
输出:
警告:禁用自动更新可能会使您不符合您的信息技术策略
运行systemctl禁用更新
已创建symlink/etc/system d/system/swupd-upd . service→/dev/null。
已创建symlink/etc/system d/system/swupd-upd . timer→/dev/null。
Warning: disabling automatic updates may take you out of compliance with your IT policy
Running systemctl to disable updates
Created symlink /etc/systemd/system/swupd-update.service → /dev/null.
Created symlink /etc/systemd/system/swupd-update.timer → /dev/null.
手动检查更新。
sudo swupd check-update
确定您需要的更新后,安装一个更新。
sudo swupd update --version <version number>
重新启用自动安装。
sudo swupd autoupdate --enable
示例2:查找并安装Kata容器*
Kata容器是一种流行的容器实现。与其他容器实现不同,每个Kata容器都有自己的内核实例,并在自己的虚拟机上运行,以提高安全性。Clear Linux操作系统使安装变得非常容易,因为您只需要添加一个包来使用Kata容器:容器-virt,尽管有许多依赖关系。另外,看看我们的教程:Kata容器*。
找到正确的包。
要返回搜索字符串的所有可能匹配项,请输入swupd搜索,然后输入“kata”: sudo swupd search kata
输出应该类似于:
Bundle with the best search result:
containers-virt - Run container applications from Dockerhub in lightweight virtual machines
This bundle can be installed with:
swupd bundle-add containers-virt
Alternative bundle options are
cloud-native-basic - Contains ClearLinux native software for Cloud
注意
如果您的搜索没有产生特定术语的结果,请缩短搜索术语。例如,用kube代替kubernetes。
添加捆绑包。
sudo swupd bundle-add containers-virt
注意
要添加多个包,请添加一个空格,后跟包名。 成功安装的输出应该类似于:
Downloading packs...
Extracting containers-virt pack for version 24430
...50%
Extracting kernel-container pack for version 24430
...100%
Starting download of remaining update content. This may take a while...
...100%
Finishing download of update content...
Installing bundle(s) files...
...100%
Calling post-update helper scripts.
Successfully installed 1 bundle
示例3:验证并纠正系统文件不匹配
swupd可以确定系统目录和文件是否已被添加、覆盖、删除或修改(例如,权限)。
sudo swupd diagnose
swupd监视的所有目录都根据清单数据进行验证。哈希不匹配标记如下:
Verifying version 23300
Verifying files
...0%
Hash mismatch for file: /usr/bin/chardetect
...
...
Hash mismatch for file: /usr/lib/python3.6/site-packages/urllib3/util/wait.py
...100%
Inspected 237180 files
423 files did not match
Verify successful
在这种情况下,安装在默认安装之上的Python*包被标记为不匹配。swupd可以根据命令行选项来忽略或修复问题。
swupd可以纠正它检测到的任何问题。可以添加附加指令,包括要忽略的目录的白名单。
以下命令修复问题,删除未知项目,并忽略匹配/usr/lib/python的文件或目录:
sudo swupd repair --picky --picky-whitelist=/usr/lib/python
快速参考
swupd info
返回当前安装的版本和更新服务器。
swupd update <version number>
特定版本的更新或最新版本的更新(如果不使用参数)。
swupd bundle-list [–all]
列出已安装的包。
swupd bundle <search term>
查找包含您的搜索词的包。
swupd bundle-add <bundle name>
添加一个包。
swupd bundle-remove <bundle name>
移除包。
swupd –help
列出其他swupd命令。
man swupd
打开swupd手册页。
有关更多详细信息,请参考GitHub上的swupd源文档。 相关主题 autospec 搅拌器 可用捆绑包
swupd
swupd links a Clear Linux* OS installation with upstream updates and software.
Description
swupd has two main functions:
- Manage software and replace APT or YUM, by installing bundles rather than packages.
- Check for system updates and install them.
swupd manages overlapping dependencies behind the scenes, ensuring that all software is compatible across the system. It can be used to verify the OS, clean cached files, and fix issues.
Bundles contain everything needed to deliver a software capability. They are the smallest granularity component that is managed by Clear Linux OS. A bundle comes with all of its dependencies rather than downloading a cascade of package dependencies when installing a piece of software.
Versioning
Using package managers to monitor software version compatibility or compare multiple systems on many Linux distributions can be cumbersome.
With Clear Linux OS swupd, versioning happens at the individual file level. This means Clear Linux OS generates an entirely new OS version with any set of software changes to the system, including software downgrades or removals. This rolling release versioning model is similar to git internal version tracking, where any of the individual file commits are tracked and move the pointer forward when changed.
A number that represents the current release of the OS describes the versions of all the software on the OS. Each build is composed of a specific set of bundles made from a particular version of packages. On a daily basis, this matters to system administrators who need to determine which of their systems do not have the latest security fixes, or which combinations of software have been tested. Every release of the same number is guaranteed to contain the same versions of software, so there’s no ambiguity between two systems running the same version of Clear Linux OS.
Updating
Clear Linux OS enforces regular updating of the OS by default and automatically checks for updates against a version server. The content server provides the file and metadata content for all versions and can be the same as the version server. The content url server provides metadata in the form of manifests, which list and describe file contents, symlinks, and directories. Additionally, the actual content is provided to clients in the form of archive files.
Software updates with Clear Linux OS are also efficient. Unlike package-based distributions, swupd only updates files that have changed, rather than entire packages. For example, it is quite common for an OS security patch to be as small as 15 KB. Using binary deltas, Clear Linux OS is able to apply only what is needed.
For details on how to generate update content for Clear Linux OS, see the mixer tool.
How it works
Prerequisites
- The device is on a well-connected network.
- The device is able to connect to an update server. The default server is: http://update.clearlinux.org
Updates
Clear Linux OS updates are automatic by default, but can be set to occur only on demand. swupd makes sure that regular updates are simple and secure. It can also check the validity of currently installed files and software, and can correct any problems.
Manifests
The Clear Linux OS software update content consists of data and metadata. The data is the files that end up in the OS. The metadata contains relevant information to properly provision the data to the OS file system, as well as update the system and add or remove additional content to the OS.
The manifests are mostly long lists of hashes that describe content. Each bundle gets its own manifest file. There is a master manifest file that describes all manifests to tie it all together.
Fullfiles, packs, and delta packs
To speed up updates and optimize content delivery, update data provisioned to a system is obtained by one of the following methods:
- Fullfiles are always generated for every file in every release. This allows any Clear Linux OS to obtain the exact copy of the content for each version directly. This is used if the OS verification needs to replace a single file, for instance.
- Packs are available for some releases. They combine many files to speed up the creation of installation media and large updates.
- Delta packs are an optimized version of packs that only contain updates (binary diffs). They cannot be used without having the original file content.
Bundle search
swupd searches download manifest data for bundles that match the term. Enter only one term, or hyphenated term, per search. Use the command man swupd to learn more.
Only the base bundle is returned. Bundles can contain other bundles via includes. For more details, see Bundle Definition Files and its subdirectory bundles.
Bundles that are already installed are marked (installed) in search results.
Optionally, you can review our bundles on GitHub*.
Examples
Example 1: Disable and enable automatic updates
Clear Linux OS updates are automatic by default, but can be set to occur only on demand.
-
Verify your current auto-update setting.
sudo swupd autoupdate
Output:
Enabled
-
Disable automatic updates.
sudo swupd autoupdate --disable
Output:
Warning: disabling automatic updates may take you out of compliance with your IT policy Running systemctl to disable updates Created symlink /etc/systemd/system/swupd-update.service → /dev/null. Created symlink /etc/systemd/system/swupd-update.timer → /dev/null.
-
Check manually for updates.
sudo swupd check-update
-
Install an update after identifying one that you need.
sudo swupd update --version <version number>
-
Re-enable automatic installs.
sudo swupd autoupdate --enable
Example 2: Find and install Kata Containers*
Kata Containers is a popular container implementation. Unlike other container implementations, each Kata Container has its own kernel instance and runs on its own VM for improved security.
Clear Linux OS makes it very easy to install, since you only need to add one bundle to use Kata Containers: containers-virt, despite a number of dependencies. Also, check out our tutorial: Kata Containers*.
-
Find the correct bundle.
To return all possible matches for the search string, enter swupd search, followed by ‘kata’:
sudo swupd search kata
The output should be similar to:
Bundle with the best search result: containers-virt - Run container applications from Dockerhub in lightweight virtual machines This bundle can be installed with: swupd bundle-add containers-virt Alternative bundle options are cloud-native-basic - Contains ClearLinux native software for Cloud
Note
If your search does not produce results with a specific term, shorten the search term. For example, use kube instead of kubernetes.
-
Add the bundle.
sudo swupd bundle-add containers-virt
Note
To add multiple bundles, add a space followed by the bundle name.
The output of a successful installation should be similar to:
Downloading packs... Extracting containers-virt pack for version 24430 ...50% Extracting kernel-container pack for version 24430 ...100% Starting download of remaining update content. This may take a while... ...100% Finishing download of update content... Installing bundle(s) files... ...100% Calling post-update helper scripts. Successfully installed 1 bundle
Example 3: Verify and correct system file mismatch
swupd can determine whether system directories and files have been added to, overwritten, removed, or modified (e.g., permissions).
sudo swupd diagnose
All directories that are watched by swupd are verified according to the manifest data. Hash mismatches are flagged as follows:
Verifying version 23300 Verifying files ...0% Hash mismatch for file: /usr/bin/chardetect ... ... Hash mismatch for file: /usr/lib/python3.6/site-packages/urllib3/util/wait.py ...100% Inspected 237180 files 423 files did not match Verify successful
In this case, Python* packages that were installed on top of the default install were flagged as mismatched. swupd can be directed to ignore or fix issues based on command line options.
swupd can correct any issues it detects. Additional directives can be added including a white list of directories to be ignored.
The following command repairs issues, removes unknown items, and ignores files or directories matching /usr/lib/python
:
sudo swupd repair --picky --picky-whitelist=/usr/lib/python
Quick reference
swupd info
Returns the currently installed version and update servers.
swupd update <version number>
Updates to a specific version or updates to latest version if no arguments are used.
swupd bundle-list [–all]
Lists installed bundles.
swupd bundle <search term>
Finds a bundle that contains your search term.
swupd bundle-add <bundle name>
Adds a bundle.
swupd bundle-remove <bundle name>
Removes a bundle.
swupd –help
Lists additional swupd commands.
man swupd
Opens the swupd man page.
Refer to swupd source documentation on GitHub for more details.
https://docs.01.org/clearlinux/latest/guides/clear/swupd.html?highlight=update%20command