{"id":10880,"date":"2025-06-10T02:00:00","date_gmt":"2025-06-10T06:00:00","guid":{"rendered":"https:\/\/www.both.org\/?p=10880"},"modified":"2025-06-04T17:45:14","modified_gmt":"2025-06-04T21:45:14","slug":"how-to-selectively-apply-updates","status":"publish","type":"post","link":"https:\/\/www.both.org\/?p=10880","title":{"rendered":"How to selectively apply updates"},"content":{"rendered":"<div class=\"pld-like-dislike-wrap pld-template-1\">\r\n    <div class=\"pld-like-wrap  pld-common-wrap\">\r\n    <a href=\"javascript:void(0)\" class=\"pld-like-trigger pld-like-dislike-trigger  \" title=\"\" data-post-id=\"10880\" data-trigger-type=\"like\" data-restriction=\"cookie\" data-already-liked=\"0\">\r\n                        <i class=\"fas fa-thumbs-up\"><\/i>\r\n                <\/a>\r\n    <span class=\"pld-like-count-wrap pld-count-wrap\">    <\/span>\r\n<\/div><\/div>\n<p>I\u2019ve installed Fedora Linux on a Raspberry Pi, but my <code>\/boot<\/code> partition has filled up. I haven\u2019t explored what is taking too much space, but in the meantime that means I can only keep a few kernels installed at any one time, or the <code>\/boot<\/code> partition fills up:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># df -h \/boot\nFilesystem      Size  Used Avail Use% Mounted on\n\/dev\/mmcblk0p2  974M  725M  182M  80% \/boot<\/code><\/pre>\n\n\n\n<p>Whenever I apply updates, I have to be careful not to install a new kernel without meaning to. Here\u2019s how I selectively apply updates, <em>excluding<\/em> any kernel packages:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"list-the-updates\">List the updates<\/h2>\n\n\n\n<p>I don\u2019t run a graphical desktop on the Raspberry Pi; instead, I\u2019m using it entirely <a href=\"https:\/\/www.both.org\/?p=10813\">from the command line<\/a>. To check what updates are available for my system, I use the <strong>dnf<\/strong> command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># dnf list --updates\nUpdating and loading repositories:\nRepositories loaded.\nAvailable upgrades\ncoreutils.aarch64           9.6-4.fc42        updates\ncoreutils-common.aarch64    9.6-4.fc42        updates\nkernel.aarch64              6.14.9-300.fc42   updates\nkernel-core.aarch64         6.14.9-300.fc42   updates\nkernel-modules.aarch64      6.14.9-300.fc42   updates\nkernel-modules-core.aarch64 6.14.9-300.fc42   updates\nperf.aarch64                6.14.9-300.fc42   updates\nsystemd.aarch64             257.6-1.fc42      updates\nsystemd-libs.aarch64        257.6-1.fc42      updates\nsystemd-networkd.aarch64    257.6-1.fc42      updates\nsystemd-pam.aarch64         257.6-1.fc42      updates\nsystemd-resolved.aarch64    257.6-1.fc42      updates\nsystemd-shared.aarch64      257.6-1.fc42      updates\nsystemd-sysusers.aarch64    257.6-1.fc42      updates\nsystemd-udev.aarch64        257.6-1.fc42      updates\nvim-common.aarch64          2:9.1.1418-1.fc42 updates\nvim-data.noarch             2:9.1.1418-1.fc42 updates\nvim-enhanced.aarch64        2:9.1.1418-1.fc42 updates\nvim-filesystem.noarch       2:9.1.1418-1.fc42 updates\nvim-minimal.aarch64         2:9.1.1418-1.fc42 updates\nxxd.aarch64                 2:9.1.1418-1.fc42 updates<\/code><\/pre>\n\n\n\n<p>That\u2019s a lot of updates, but I can\u2019t just install <em>all of them<\/em> or I\u2019ll fill up my <code>\/boot<\/code> partition. Instead, I need to tell <strong>dnf<\/strong> to only update certain packages and not others.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"excluding-packages-from-an-update\">Excluding packages from an update<\/h2>\n\n\n\n<p>One way to be selective about which packages to update is to use the <em>exclude<\/em> option. This is a list or pattern match of which packages to <em>not<\/em> include in the update. The syntax looks like <code>-x PACKAGE-SPEC,...<\/code> or <code>--exclude=PACKAGE-SPEC,...<\/code>.<\/p>\n\n\n\n<p>I find it\u2019s easiest to use a wildcard here to not include the kernel updates. Just for reference, the kernel packages all start with the word <code>kernel<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># dnf list --updates | grep kernel\nUpdating and loading repositories:\nRepositories loaded.\nkernel.aarch64              6.14.9-300.fc42   updates\nkernel-core.aarch64         6.14.9-300.fc42   updates\nkernel-modules.aarch64      6.14.9-300.fc42   updates\nkernel-modules-core.aarch64 6.14.9-300.fc42   updates<\/code><\/pre>\n\n\n\n<p>So if I want to update all packages <em>except<\/em> for the kernel, I can add the <code>-x<\/code> option to my <strong>dnf<\/strong> command like this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># dnf update -x 'kernel*'<\/code><\/pre>\n\n\n\n<p>This applies all of the outstanding updates such as coreutils, perf, systemd, vim, and xxd. But it does not update my kernel.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"automate-it\">Automate it<\/h2>\n\n\n\n<p>The Linux philosophy for sysadmins is David\u2019s list of excellent advice for anyone who manages Linux systems. Item 8 on this list is that you should <a href=\"https:\/\/www.both.org\/?p=7547\">always use shell scripts<\/a> where you can, because that makes it easier to do your work. And in this case, I like to use a shell script so that I don\u2019t accidentally forget to <em>exclude<\/em> the kernel when I update my system.<\/p>\n\n\n\n<p>I created a shell script called <code>update<\/code> that is just a few lines: The first line applies updates <em>except<\/em> for the kernel. The second line lists any available updates; that way, I\u2019ll have a reminder if I still need to update my kernel.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\ndnf update -x 'kernel*'\ndnf list --updates<\/code><\/pre>\n\n\n\n<p>When I run this, my script automatically runs <strong>dnf<\/strong> to update the system <em>except<\/em> for the kernel. At the end, it lists the remaining updates, which shows that I have a kernel update available:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># bin\/update\nUpdating and loading repositories:\nRepositories loaded.\n\n...\n\nTransaction Summary:\n Upgrading:         17 packages\n Replacing:         17 packages\n\nTotal size of inbound packages is 26 MiB. Need to download 26 MiB.\nAfter this operation, 463 KiB extra will be used (install 109 MiB, remove 109 MiB).\nIs this ok &#91;y\/N]: y\n\n...\n\nComplete!\nUpdating and loading repositories:\nRepositories loaded.\nAvailable upgrades\nkernel.aarch64              6.14.9-300.fc42 updates\nkernel-core.aarch64         6.14.9-300.fc42 updates\nkernel-modules.aarch64      6.14.9-300.fc42 updates\nkernel-modules-core.aarch64 6.14.9-300.fc42 updates<\/code><\/pre>\n\n\n\n<p>And that\u2019s my reminder that I need to update the kernel. That requires a few extra steps, but I can do that later. Until then, the rest of my system is up-to-date.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here\u2019s how I selectively apply updates, excluding any kernel packages.<\/p>\n","protected":false},"author":33,"featured_media":3307,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[5,682],"tags":[91,97],"class_list":["post-10880","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","category-updates","tag-linux","tag-sysadmin"],"modified_by":"Jim Hall","_links":{"self":[{"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts\/10880","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/users\/33"}],"replies":[{"embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10880"}],"version-history":[{"count":1,"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts\/10880\/revisions"}],"predecessor-version":[{"id":10881,"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/posts\/10880\/revisions\/10881"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=\/wp\/v2\/media\/3307"}],"wp:attachment":[{"href":"https:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10880"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10880"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.both.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10880"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}