Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:coolo:alp:hostos:Staging:A
suse-module-tools
suse-module-tools-16.0.23.obscpio
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File suse-module-tools-16.0.23.obscpio of Package suse-module-tools
07070100000000000081A4000000000000000000000001631F4FD500000015000000000000000000000000000000000000002500000000suse-module-tools-16.0.23/.gitignore*~ \#* *.rej *.orig 07070100000001000041ED000000000000000000000002631F4FD500000000000000000000000000000000000000000000001F00000000suse-module-tools-16.0.23/.obs07070100000002000081A4000000000000000000000001631F4FD5000004CD000000000000000000000000000000000000002D00000000suse-module-tools-16.0.23/.obs/workflows.ymlworkflow: steps: - branch_package: source_project: home:mwilck:suse-module-tools source_package: suse-module-tools target_project: home:mwilck - configure_repositories: project: home:mwilck repositories: - name: openSUSE_Tumbleweed paths: - target_project: openSUSE:Factory target_repository: snapshot architectures: - x86_64 - i586 - name: openSUSE_Leap_15.4 paths: - target_project: openSUSE:Leap:15.4 target_repository: standard architectures: - x86_64 - name: SLE_15_SP4 paths: - target_project: SUSE:SLE-15-SP4:GA target_repository: pool architectures: - x86_64 - s390x - ppc64le - aarch64 - name: SLE_15_SP3 paths: - target_project: SUSE:SLE-15-SP3:GA target_repository: pool architectures: - x86_64 - s390x - ppc64le - aarch64 filters: event: pull_request 07070100000003000081A4000000000000000000000001631F4FD50000467E000000000000000000000000000000000000002200000000suse-module-tools-16.0.23/LICENSE GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., <http://fsf.org/> 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. {description} Copyright (C) {year} {fullname} This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. {signature of Ty Coon}, 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. 07070100000004000081A4000000000000000000000001631F4FD5000013BA000000000000000000000000000000000000002400000000suse-module-tools-16.0.23/README.md# suse-module-tools This package contains a collection of tools and configuration files for handling kernel modules and setting module parameters. The configuration files represent a carefully engineered, recommended default configuration. In certain cases, it may be necessary to modify or revert some of these settings. It's ok to do so, but make sure you know what you're doing if you do. Please don't edit any of the configuration files shipped in this package. Instead, copy the files from `/lib/modprobe.d` to `/etc/modprobe.d`, preserving the file name, and edit the copy under `/etc/modprobe.d`. Likewise for `/lib/depmod.d` vs. `/etc/depmod.d` and `/usr/lib/modules-load.d` vs. `/etc/modules-load.d`. To completely mask the directives in a configuration file, it's recommended to create a symlink to `/dev/null` with the same name as the file to be masked in the respective directory under `/etc`. E.g. to mask `/lib/modprobe.d/20-foo.conf`, run ln -s /dev/null /etc/modprobe.d/20-foo.conf ## Blacklisted file systems In the Linux kernel, file system types are implemented as kernel modules. While many of these file systems are well maintained, some of the older and less frequently used ones are not. This poses a security risk, because maliciously crafted file system images might open security holes when mounted either automatically or by an inadvertent user. These file systems are therefore **blacklisted** by default under openSUSE and SUSE Enterprise Linux. This means that the on-demand loading of file system modules at mount time is disabled. Blacklisting is accomplished by placing configuration files called `60-blacklist_fs-$SOME_FS.conf` under `/lib/modprobe.d`. The current list of blacklisted filesystems is: @FS_BLACKLIST@ # will be filled from spec file during package build ### CAVEAT In the very unlikely case that one of the blacklisted file systems is necessary for your system to boot, make sure you un-blacklist your file system before rebooting. ### Un-blacklisting a file system If a user tries to **mount(8)** a device with a blacklisted file system, the mount command prints an error message like this: mount: /mnt/mx: unknown filesystem type 'minix' (hint: possibly blacklisted, see mount(8)). (**mount(8)** can't distinguish between a file system for which no kernel module exists at all, and a file system for which a module exists which is blacklisted). Users who need the blacklisted file systems and therefore want to override the blacklisting can load the blacklisted module directly using `modprobe $SOME_FS` in a terminal. This will call a script that offers to "un-blacklist" the module for future use. # modprobe minix unblacklist: *** NOTE: minix will be loaded even if you answer "n" below. *** unblacklist: minix is currently blacklisted, do you want to un-blacklist it (y/n)? y unblacklist: minix un-blacklisted by creating /etc/modprobe.d/60-blacklist_fs-minix.conf If the user selects **y**, the module is un-blacklisted by creating a symlink to `/dev/null` (see above). Future attempts to mount minix file systems will work with no issue, even after reboot, because the kernel's auto-loading mechanism works for this file system again. If the user selects **n**, the module remains blacklisted. Regardless of the user's answer, the module will be loaded for the time being; i.e. subsequent **mount** commands for devices with this file system will succeed until the module is unloaded or the system is rebooted. For security reasons, it's recommended that you only un-blacklist file system modules that you know you'll use on a regular basis, and just enable them temporarily otherwise. ## Weak modules This package contains the script `weak-modules2` which is necessary to make 3rd party kernel modules installed for one kernel available to KABI-compatible kernels. SUSE ensures KABI compatibility over the life time of a service pack in SUSE Enterprise Linux. See the [SUSE SolidDriver Program](https://drivers.suse.com/doc/SolidDriver/) for details. ### Capturing log output from weak_modules2 Use the following environment variables: * WM2_VERBOSE: value from 0 (default, no logging) - 3 (tracing). the -v/--verbose option increases log level by one. * WM2_DEBUG: 0 (default) or 1. Enables verbose output of certain commands called by weak-modules2. Equivalent to --debug. * WM2_LOGFILE: redirect the output to the given file. ## Kernel scriptlet files The scripts in kernel-scriptlets directory are used internally by kernel packages. ### Capturing log output from kernel scripts * KERNEL_PACKAGE_SCRIPT_DEBUG when non-empty enables some extra output to kernel log. ## Kernel-specific sysctl settings This package installs the file `50-kernel-uname_r.conf` which makes sure that sysctl settings which are recommended for the currently running kernel are applied by **systemd-sysctl.service** at boot time. These settings are shipped in the file `/boot/sysctl.conf-$(uname -r)`, which is part of the kernel package. 07070100000005000081A4000000000000000000000001631F4FD5000001BA000000000000000000000000000000000000002E00000000suse-module-tools-16.0.23/boot-sysctl.service[Unit] Description=Apply Kernel Variables for %v from /boot DefaultDependencies=no Conflicts=shutdown.target Before=systemd-sysctl.service After=systemd-modules-load.service ConditionPathExists=!/usr/lib/modules/%v/sysctl.conf ConditionPathExists=/boot/sysctl.conf-%v RequiresMountsFor=/boot [Service] Type=oneshot ExecStart=/usr/lib/systemd/systemd-sysctl /boot/sysctl.conf-%v RemainAfterExit=yes [Install] WantedBy=systemd-sysctl.service 07070100000006000081A4000000000000000000000001631F4FD5000001E5000000000000000000000000000000000000003000000000suse-module-tools-16.0.23/depmod-00-system.conf# # /etc/depmod.conf - configuration file for the depmod(8) command, # for its format see depmod.conf(5). # # Please don't edit this file, place your settings into the /etc/depmod.d # directory. # search order: # 1 updates/ (KMPs) # 2 extra/ (KMPs or manually compiled modules) # 3 weak-updates/ (KMPs built for older kernels) # 4 kgraft/ (kgraft patches) # 5 everything else search updates extra weak-updates kgraft built-in # do not generate modules.*map files make_map_files no 07070100000007000081A4000000000000000000000001631F4FD500001FEA000000000000000000000000000000000000002A00000000suse-module-tools-16.0.23/driver-check.sh#!/bin/bash VERSION="0.6" MAINTAINER="Martin Wilck <mwilck@suse.com>" USAGE="Usage: ${0##*/} [-o|--out output-file]" errors=0 warnings=0 trap 'rm -rf "$tmp"' EXIT tmp=$(mktemp -d) find_usrmerge_boot() { local filename=$1 local kver=$2 local ext=${3:+."$3"} local f for f in "/usr/lib/modules/$kver/$filename$ext" "/boot/$filename-$kver$ext" do if [ -e "$f" ]; then echo "$f" return fi done echo "WARNING: find_usrmerge_boot: $filename$ext not found for kernel $kver" >&2 } find_depmod() { local _d [[ -x "$DEPMOD" ]] && return DEPMOD= for _d in /usr/sbin /sbin; do if [[ -x ${_d}/depmod ]]; then DEPMOD=${_d}/depmod break; fi done if [[ ! "$DEPMOD" ]]; then echo "ERROR: depmod is not installed - aborting" >&2 exit 1 fi } rpm() { # rpm tends to send localized error messages to stdout :-( LC_ALL=C command rpm "$@" } file_owner() { local f=$1 if (cd "$tmp/rpms"; grep -lFx "$f" *); then return fi rpm -qf "$f" } _explain_called=() explain() { local caller=${BASH_LINENO[0]} if test -n "${_explain_called[$caller]}"; then return fi _explain_called[$caller]=1 echo "$*" } error() { echo "ERROR: $*" let errors++ } warning() { echo "warning: $*" >&2 let warnings++ } check_system() { if test ! -x /usr/lib/module-init-tools/weak-modules2; then echo "This tool only works on SLE11 and later systems" >&2 exit 1 fi if ! zypper search >/dev/null; then echo "Cannot run zypper, please correct the above problem" >&2 exit 1 fi } check_rpm_V() { local attrs flags path # kernel packages contain the initrd with permissions 0644, # but dracut creates initrd with 0600. That's not an error. while read attrs flags path; do case $attrs in .M.......) if [[ "${path#/boot/initrd}" != "$path" && \ -f "$path" && \ $(stat -c %a "$path") = 600 ]]; then continue fi ;; esac echo "$attrs $flags $path" error "$rpm was not installed correctly (see above)" done } check_rpm() { local rpm=$1 name=${1%-*-*} out # ignore changes to %config and %doc files and ignore changed mtimes check_rpm_V < <(rpm -V "$rpm" | grep -Ev '^[^ ]{8,} [cd] |^\.{7}T\.* ') } check_kernel_package() { local kernel=$1 if ! rpm -q --qf '%{description}\n' "$kernel" | grep -q '^GIT '; then error "$kernel does not look like a SUSE kernel package (no commit id)" fi if ! rpm -q --qf '%{postin}\n' "$kernel" | grep -Eq 'weak-modules2|kernel-scriptlets/rpm-post'; then error "$kernel does not look like a SUSE kernel package (wrong %post script)" fi } check_krel() { local krel=$1 system_map module_symvers msg res args bad=false local mit_version system_map=$(find_usrmerge_boot System.map "$krel") module_symvers=$(find_usrmerge_boot symvers "$krel" gz) if ! test -e "$system_map"; then error "$system_map not found" bad=true fi if ! test -e "$module_symvers"; then error "$module_symvers not found" bad=true fi if $bad; then explain "Each kernel must install System.map and symvers.gz to be able to check module dependencies." return fi set -- $("$DEPMOD" --version | sed -rn 's/.* ([0-9]+)(\.([0-9]+)(\..*)?)?/\1 \3/p') if test -n "$1" -a -n "$2"; then let "mit_version = $1 * 100 + $2" elif test -n "$1" -a \! -n "$2" -a "$1" -gt 3; then let "mit_version = $1 * 100" else warning "Cannot determine module-init-tools version, this is a bug in the script" mit_version=0 fi # depmod -E was introduced in 3.10 if test "$mit_version" -ge 310; then gzip -cd <"$module_symvers" >"$tmp/symvers" args=(-E "$tmp/symvers") else args=(-F "$system_map") fi msg=$("$DEPMOD" -n -e "${args[@]}" "$krel" 2>&1 >/dev/null) res=$? if test -n "$msg" -o "$res" -ne 0; then echo "$msg" error "depmod $krel returned errors (exit code $res)" explain "depmod must pass without errors otherwise KMP scripts will break" fi } req_re='^(kernel\([^:]*:kernel[[:alnum:]_]*\)|ksym\([^:]*:(struct_module|module_layout)\)) = [0-9a-f]+' check_kmp() { local kmp=$1 prefix prev_krel krel path found_module=false if ! rpm -q --qf '%{postin}\n' "$kmp" | grep -Eq 'weak-modules2|kernel-scriptlets/kmp-post'; then error "$kmp does not look like a SUSE kernel module package (wrong %post)" fi if ! rpm -q -R "$kmp" | grep -Eq "$req_re"; then error "$kmp does not have proper dependencies" fi exec 3< <(sed -rn 's:^(/lib/modules)?/([^/]*)/(.*\.ko(\.[gx]z|\.zst)?)$:\1 \2 \3:p' \ "$tmp/rpms/$kmp") while read prefix krel path <&3; do found_module=true if test "$prefix" != "/lib/modules"; then error "$kmp installs modules outside of /lib/modules" continue fi if test -z "$prev_krel"; then prev_krel=$krel elif test "$prev_krel" != "$krel"; then error "$kmp installs modules for multiple kernel versions" fi case "$path" in updates/* | extra/*) ;; weak-updates/*) error "$kmp installs modules in weak-updates/ instead of updates/ or extra/" explain "The weak-modules directory is reserved for automatically generated symlinks" ;; *) error "$kmp installs modules in an invalid directory" explain \ "KMPs must install modules in the updates/ or extra/ subdirectories for the weak-modules2 script to work" ;; esac done if ! $found_module; then error "$kmp does not contain any modules" explain \ "A KMP must contain it's modules in the rpm filelist, otherwise weak-modules2 will not work" fi } check_ko() { local ko=$1 kmp bad=false case "$ko" in */weak-updates/*) if test -L "$ko"; then return fi esac kmp=$(file_owner "$ko") case "$kmp" in kernel-* | *-kmp-*) ;; *not\ owned\ by\ any\ package) error "$ko is not owned by any package" bad=true ;; *) error "$ko is not packaged as a KMP" bad=true ;; esac if $bad; then explain \ "External kernel modules must be packaged as KMPs, see http://developer.novell.com/wiki/index.php/Kernel_Module_Packages_Manuals" fi } options=$(getopt -n "${0##*/}" -o o:h --long out:,help -- "$@") if test "$?" -ne 0; then echo "$USAGE" >&2 exit 1 fi eval set -- "$options" logfile="driver-check-report.txt" while :; do case "$1" in -o | --out) logfile="$2" shift 2 ;; -h | --help) echo "${0##*/} $VERSION" echo "$USAGE" echo echo "Please report bugs and enhancement requests to $MAINTAINER" exit 0 ;; --) shift break ;; esac done if test $# -gt 0; then echo "Unrecognized arguments: $*" >&2 echo "$USAGE" >&2 exit 1 fi find_depmod check_system # set up redirection if test $logfile != "-"; then if test -e "$logfile"; then mv -f "$logfile" "$logfile~" fi if test -e /proc/self; then exec 99> >(cat >"$logfile") exec 1>&99 exec 2> >(tee -a /proc/self/fd/99 >&2) else exec 1>"$logfile" exec 2>"$logfile" warning "/proc not mounted" fi fi echo "${0##*/} $VERSION started at $(date -R)" >&2 smt=$(rpm -q --qf '%{n}-%{v}-%{r}\n' module-init-tools) || \ smt=$(rpm -q --qf '%{n}-%{v}-%{r}\n' suse-module-tools) check_rpm "$smt" mkdir -p "$tmp/rpms" found_kernel=false for rpm in $(rpm -qa --qf '%{n}-%{v}-%{r}\n' 'kernel-*' '*-kmp-*' | \ /usr/lib/rpm/rpmsort); do case "$rpm" in kernel-source-* | kernel-syms-* | kernel-*-debug* | kernel-*-man-* | \ kernel-*-devel-* | kernel-firmware-* | kernel-coverage-* | \ kernel-docs-* | kernel-devel-* | kernel-macros-* | kernel-install-tools-*) continue esac # store the filelist to speed up file_owner() rpm -ql "$rpm" >"$tmp/rpms/$rpm" check_rpm "$rpm" case "$rpm" in kernel-*) check_kernel_package "$rpm" found_kernel=true ;; *-kmp-*) check_kmp "$rpm" ;; esac done if ! $found_kernel; then warning "no kernel package found" fi for krel in /lib/modules/*/kernel; do krel=${krel%/kernel} krel=${krel##*/} check_krel "$krel" done modules=($(find /lib/modules/ -name '*.ko' -o -name '*.ko.[gx]z' -o -name '*.ko.zst')) for module in "${modules[@]}"; do check_ko "$module" done echo "Found $errors error(s) and $warnings warning(s)" >&2 if test "$logfile" != -; then echo "Report written to $logfile at $(date -R)" >&2 else echo "Report finished at $(date -R)" >&2 fi if test $errors -eq 0; then exit 0 else exit 1 fi 07070100000008000041ED000000000000000000000002631F4FD500000000000000000000000000000000000000000000002C00000000suse-module-tools-16.0.23/kernel-scriptlets07070100000009000081A4000000000000000000000001631F4FD500000BD5000000000000000000000000000000000000003800000000suse-module-tools-16.0.23/kernel-scriptlets/cert-script#!/bin/sh op=${0##*-} ca_check="" certs="" while true ; do case $1 in --ca-check) ca_check="$2" shift ;; --certs) certs="$2" shift ;; *) break ;; esac shift done is_efi () { local msg rc=0 # The below statement fails if mokutil isn't installed or UEFI is unsupported. # It doesn't fail if UEFI is available but secure boot is off. msg="$(mokutil --sb-state 2>&1)" || rc=$? [ -z "$KERNEL_PACKAGE_SCRIPT_DEBUG" ] || echo "$msg" return $rc } if ! is_efi; then [ -z "$KERNEL_PACKAGE_SCRIPT_DEBUG" ] || \ echo "$0: system doesn't support UEFI, skipping certificate handling" >&2 exit 0 fi if [ ! -w /sys/firmware/efi/efivars ]; then mkdir -p /run/suse-kernel-rpm-scriptlets if [ -n "$KERNEL_PACKAGE_SCRIPT_DEBUG" ] || \ [ ! -e /run/suse-kernel-rpm-scriptlets/cert-warning ]; then echo "$0: efivarfs is not writable, skipping certificate handling" >&2 fi touch /run/suse-kernel-rpm-scriptlets/cert-warning exit 0 fi run_mokutil () { [ -z "$KERNEL_PACKAGE_SCRIPT_DEBUG" ] || echo mokutil "$@" >&2 mokutil "$@" } [ -z "$KERNEL_PACKAGE_SCRIPT_DEBUG" ] || echo "cert $op" ca-check: "$ca_check" certs: "$certs" -- "$@" >&2 script_rc=0 case $op in pre) ;; post) MOK_ARGS="" # Only apply CA check on the kernel package certs (bsc#1173115) if [ -n "$ca_check" ] && mokutil -h | grep -q "ca-check"; then MOK_ARGS="${MOK_ARGS} --ca-check" fi # Kernel key needs to be enrolled even if it's in the kernel keyring (bsc#1191480) if [ -n "$ca_check" ] && mokutil -h | grep -q "ignore-keyring"; then MOK_ARGS="${MOK_ARGS} --ignore-keyring" fi # XXX: Only call mokutil if UEFI and shim are used for cert in $certs; do cert="/etc/uefi/certs/${cert}.crt" run_mokutil --import "$cert" --root-pw ${MOK_ARGS} rc=$? if [ $rc != 0 ] ; then script_rc=$rc echo "Failed to import $cert" >&2 fi done ;; preun) for cert in $certs; do cert="/etc/uefi/certs/${cert}.crt" # Here we queue the certificate for de-enrollment. If by postun # the certificate does not exist last kernel using it was # removed and we can queue it for de-enrollment with mokutil. # The .delete file must exist after package is removed so we cannot # add it to the rpm filelist to be removed by rpm. And if script is # interrupted it may remain. Do not fail when it exists (bsc#1191804). ln -f "$cert" "$cert.delete" ||: done ;; postun) for cert in $certs; do cert="/etc/uefi/certs/${cert}.crt" # If the certificate is now gone there are no users left # queue -> de-enrollment if ! test -e "$cert"; then run_mokutil --delete "$cert.delete" --root-pw rc=$? if [ $rc != 0 ] ; then script_rc=$rc echo "Failed to delete $cert" >&2 fi fi rm "$cert.delete" || script_rc=$? done ;; posttrans) ;; *) echo Unknown scriptlet "$op" >&2 script_rc=255 ;; esac exit $script_rc # vim: set sts=4 sw=4 ts=8 noet: 0707010000000A000081A4000000000000000000000001631F4FD500000ABC000000000000000000000000000000000000003900000000suse-module-tools-16.0.23/kernel-scriptlets/inkmp-script#!/bin/bash op=${0##*-} name="" version="" release="" kernelrelease="" flavor="" variant="" usrmerged="0" image="" certs="" while true ; do case $1 in --name) name="$2" shift ;; --version) version="$2" shift ;; --release) release="$2" shift ;; --kernelrelease) kernelrelease="$2" shift ;; --flavor) flavor="$2" shift ;; --variant) variant="$2" shift ;; --usrmerged) usrmerged="$2" shift ;; --image) image="$2" shift ;; --certs) certs="$2" shift ;; *) break ;; esac shift done wm2=/usr/lib/module-init-tools/weak-modules2 nvr="$name"-"$version"-"$release" if [ "$usrmerged" -ne 0 ] ; then modules_dir=/usr/lib/modules/$kernelrelease-$flavor system_map=${modules_dir}/System.map else modules_dir=/lib/modules/$kernelrelease-$flavor system_map=/boot/System.map-$kernelrelease-$flavor fi run_wm2() { [ -z "$KERNEL_PACKAGE_SCRIPT_DEBUG" ] || echo wm2 "$@" >&2 $wm2 "$@" } [ -z "$KERNEL_PACKAGE_SCRIPT_DEBUG" ] || \ echo KMP "$op" name: "$name" version: "$version" release: "$release" \ kernelrelease: "$kernelrelease" flavor: "$flavor" variant: "$variant" \ usrmerged: "$usrmerged" image: "$image" certs: "$certs" -- "$@" >&2 script_rc=0 case $op in pre) ;; post) if [ -x "$wm2" ]; then rpm -ql "$nvr" | INITRD_IN_POSTTRANS=1 run_wm2 --add-kernel-modules $kernelrelease-$flavor || script_rc=$? fi ;; preun) rpm -ql "$nvr" | sed -n '/\.ko\(\.xz\|\.gz\|\.zst\)\?$/p' > "/var/run/rpm-$nvr-modules" || script_rc=$? ;; postun) mapfile -t modules < "/var/run/rpm-$nvr-modules" rm -f "/var/run/rpm-$nvr-modules" # Only pass modules to weak-modules2 which have actually been removed. # Modules can still exist e.g. if a kernel subpackage is updated and # only the build number changed (kernel release remained the same); # in this case the resulting list of modules will actually be empty. # This is similar to the check for $system_map in rpm-script. for __i in "${!modules[@]}"; do if [[ -e "${modules[$__i]}" ]]; then unset -v modules["$__i"] fi done if [[ "${#modules[@]}" == 0 ]]; then echo "$nvr: no kernel modules removed" >&2 exit 0 fi if [ -x "$wm2" ]; then printf '%s\n' "${modules[@]}" | run_wm2 --remove-kernel-modules $kernelrelease-$flavor || script_rc=$? fi ;; posttrans) if test -x /usr/lib/module-init-tools/regenerate-initrd-posttrans; then /bin/bash -c 'set +e; /usr/lib/module-init-tools/regenerate-initrd-posttrans' || script_rc=$? fi ;; *) echo Unknown scriptlet "$op" >&2 exit 255 ;; esac exit $script_rc # vim: set sts=4 sw=4 ts=8 noet: 0707010000000B000081A4000000000000000000000001631F4FD5000006D5000000000000000000000000000000000000003700000000suse-module-tools-16.0.23/kernel-scriptlets/kmp-script#!/bin/bash op=${0##*-} name="" version="" release="" kernelrelease="" flavor="" usrmerged="" while true ; do case $1 in --name) name="$2" shift ;; --version) version="$2" shift ;; --release) release="$2" shift ;; --kernelrelease) kernelrelease="$2" shift ;; --flavor) flavor="$2" shift ;; --usrmerged) usrmerged="$2" shift ;; *) break ;; esac shift done wm2=/usr/lib/module-init-tools/weak-modules2 nvr="$name"-"$version"-"$release" run_wm2() { [ -z "$KERNEL_PACKAGE_SCRIPT_DEBUG" ] || echo wm2 "$@" >&2 $wm2 "$@" } [ -z "$KERNEL_PACKAGE_SCRIPT_DEBUG" ] || \ echo KMP "$op" name: "$name" version: "$version" release: "$release" \ kernelrelease: "$kernelrelease" flavor: "$flavor" \ usrmerged: "$usrmerged" -- "$@" >&2 script_rc=0 case $op in pre) ;; post) if [ -x $wm2 ]; then INITRD_IN_POSTTRANS=1 run_wm2 --add-kmp $nvr || script_rc=$? fi ;; preun) rpm -ql "$nvr" | sed -n '/\.ko\(\.xz\|\.gz\|\.zst\)\?$/p' > "/var/run/rpm-$nvr-modules" || script_rc=$? ;; postun) modules=( $(cat "/var/run/rpm-$nvr-modules") ) rm -f "/var/run/rpm-$nvr-modules" if [ ${#modules[*]} = 0 ]; then echo "WARNING: $nvr does not contain any kernel modules" >&2 exit 0 fi if [ -x $wm2 ]; then printf '%s\n' "${modules[@]}" | run_wm2 --remove-kmp "$nvr" || script_rc=$? fi ;; posttrans) if test -x /usr/lib/module-init-tools/regenerate-initrd-posttrans; then /bin/bash -c 'set +e; /usr/lib/module-init-tools/regenerate-initrd-posttrans' || script_rc=$? fi ;; *) echo Unknown scriptlet "$op" >&2 exit 255 ;; esac exit $script_rc # vim: set sts=4 sw=4 ts=8 noet: 0707010000000C000081A4000000000000000000000001631F4FD500001FB3000000000000000000000000000000000000003700000000suse-module-tools-16.0.23/kernel-scriptlets/rpm-script#!/bin/sh op=${0##*-} name="" version="" release="" kernelrelease="" flavor="" variant="" usrmerged="0" image="" certs="" while true ; do case $1 in --name) name="$2" shift ;; --version) version="$2" shift ;; --release) release="$2" shift ;; --kernelrelease) kernelrelease="$2" shift ;; --flavor) flavor="$2" shift ;; --variant) variant="$2" shift ;; --usrmerged) usrmerged="$2" shift ;; --image) image="$2" shift ;; --certs) certs="$2" shift ;; *) break ;; esac shift done wm2=/usr/lib/module-init-tools/weak-modules2 nvr="$name"-"$version"-"$release" if [ "$usrmerged" -ne 0 ] ; then modules_dir=/usr/lib/modules/$kernelrelease-$flavor system_map=${modules_dir}/System.map else modules_dir=/lib/modules/$kernelrelease-$flavor system_map=/boot/System.map-$kernelrelease-$flavor fi trigger_purge_kernels() { [ -z "$KERNEL_PACKAGE_SCRIPT_DEBUG" ] || echo Triggering purge-kernels >&2 touch /boot/do_purge_kernels } disarm_purge_kernels() { [ -z "$KERNEL_PACKAGE_SCRIPT_DEBUG" ] || echo Disarming purge-kernels >&2 rm -f /boot/do_purge_kernels } run_wm2() { [ -z "$KERNEL_PACKAGE_SCRIPT_DEBUG" ] || echo wm2 "$@" >&2 $wm2 "$@" } message_install_bl () { echo "You may need to setup and install the boot loader using the" echo "available bootloader for your platform (e.g. grub, lilo, zipl, ...)." } run_bootloader () { if [ -f /etc/sysconfig/bootloader ] && [ -f /boot/grub/menu.lst -o \ -f /etc/lilo.conf -o \ -f /etc/elilo.conf -o \ -f /etc/zipl.conf -o \ -f /etc/default/grub ] then return 0 else return 1 fi } [ -z "$KERNEL_PACKAGE_SCRIPT_DEBUG" ] || \ echo "$op" name: "$name" version: "$version" release: "$release" \ kernelrelease: "$kernelrelease" flavor: "$flavor" variant: "$variant" \ usrmerged: "$usrmerged" image: "$image" certs: "$certs" -- "$@" >&2 script_rc=0 case $op in pre) # see bug #259303 # this script runs when the kernel gets updated with YaST # YaST calls rpm always with -U # -U replaces all packages with the new one # rpm removes the files from the old packages after the postinstall script ran # this will double the required space below /boot # remove the files from the old packages to make room for the new initrd # rpm may complain about low disk space if /boot/vmlinux does not fit if [ "$YAST_IS_RUNNING" != "" ]; then mydf="$( POSIXLY_CORRECT=1 df -P /boot/ | awk '/^(\/|-[[:blank:]])/{ print $4}' )" if test "$mydf" != "" ; then echo "Free diskspace below /boot: $mydf blocks" # echo "512 byte blocks: $(( 2 * 1024 * 20 ))" if test "$mydf" -lt "40960" ; then echo "make room for new kernel '"$flavor"' because there are less than 20MB available." # disabled because it breaks patch rpms #rm -fv /boot/"$image"-*-"$flavor" rm -fv /boot/initrd-*-"$flavor" fi fi fi # On AArch64 we switched from 64k PAGE_SIZE to 4k PAGE_SIZE. Unfortunately # btrfs can only use file systems created with the same PAGE_SIZE. So we # check if the user has any btrfs file systems mounted and refuse to install # in that case. if [ $( uname -m ) = aarch64 -a \ "$( zgrep CONFIG_ARM64_64K_PAGES=y /proc/config.gz )" -a \ "$flavor" = default ]; then if [ "$FORCE_4K" = 1 ]; then # The user knows what he's doing, let him be. exit 0 fi if [ "$YAST_IS_RUNNING" = "instsys" ]; then # We're probably test installing the kernel, that should succeed exit 0 fi cat >&2 <<-EOF You are running on a 64kb PAGE_SIZE kernel. The default kernel switched to 4kb PAGE_SIZE which will prevent it from mounting btrfs or the swap partition. To ensure that your system still works, I am refusing to install this kernel. If you want to force installation regardlesss, reinstall with the environment variable FORCE_4K set to 1. To stay with a 64kb PAGE_SIZE kernel, please follow these steps: $ zypper in kernel-64kb [ reboot into the new kernel ] $ zypper rm kernel-default You will then be on the 64kb PAGE_SIZE kernel and can update your system normally. EOF script_rc=1 fi [ -z "$certs" ] || /usr/lib/module-init-tools/kernel-scriptlets/cert-$op --ca-check 1 --certs "$certs" "$@" || script_rc=$? ;; post) # Flag to trigger /etc/init.d/purge-kernels on next reboot (fate#312018) # ... but avoid the first installion (bsc#1180058) if [ "$1" -gt 1 ]; then trigger_purge_kernels || script_rc=$? fi for x in /boot/"$image" /boot/initrd; do rm -f $x ln -s ${x##*/}-"$kernelrelease"-"$flavor" $x done if [ "$usrmerged" -ne 0 ] ; then # compat stuff for /boot. # if /boot and /usr are not speparate partitions we can just link # the kernel there to save space. Otherwise copy. if mountpoint -q /boot || mountpoint -q /usr; then copy_or_link="cp -a --remove-destination" separate_boot='1' else copy_or_link="ln -sf" separate_boot="" fi # XXX: need to fix suse-module-tools for sysctl.conf and System.map for x in "$image" sysctl.conf System.map config; do if [ "$separate_boot" = 1 ] || [ ! -e /boot/$x-"$kernelrelease"-"$flavor" ]; then $copy_or_link .."$modules_dir"/$x /boot/$x-"$kernelrelease"-"$flavor" || script_rc=$? if [ -e "$modules_dir"/.$x.hmac ]; then $copy_or_link .."$modules_dir"/.$x.hmac /boot/.$x-"$kernelrelease"-"$flavor".hmac || script_rc=$? fi fi done fi # Add symlinks of compatible modules to /lib/modules/$krel/weak-updates/, # run depmod and mkinitrd if [ -x $wm2 ]; then run_wm2 --add-kernel "$kernelrelease"-"$flavor" || script_rc=$? else echo "$wm2 does not exist, please run depmod and mkinitrd manually" >&2 script_rc=1 fi if [ ! -e /.buildenv ] ; then if [ -f /etc/fstab ] ; then # only run the bootloader if the usual bootloader configuration # files are there -- this is different on every architecture initrd=initrd-"$kernelrelease"-"$flavor" if [ "$flavor" = rt ]; then default=force-default fi if [ -e /boot/$initrd -o ! -e "$modules_dir" ] && \ run_bootloader ; then [ -e /boot/$initrd ] || initrd= if [ -x /usr/lib/bootloader/bootloader_entry ]; then /usr/lib/bootloader/bootloader_entry \ add \ "$flavor" \ "$kernelrelease"-"$flavor" \ "$image"-"$kernelrelease"-"$flavor" \ $initrd \ $default || script_rc=$? else message_install_bl fi fi else message_install_bl fi fi [ -z "$certs" ] || /usr/lib/module-init-tools/kernel-scriptlets/cert-$op --ca-check 1 --certs "$certs" "$@" || script_rc=$? ;; preun) [ -z "$certs" ] || /usr/lib/module-init-tools/kernel-scriptlets/cert-$op --ca-check 1 --certs "$certs" "$@" || script_rc=$? ;; postun) # If a kernel package is removed before the next reboot, we assume that the # multiversion variable in /etc/zypp/zypp.conf is not configured and we delete # the flag again (fate#312018) disarm_purge_kernels if [ -e "$system_map" ]; then # the same package was reinstalled or just rebuilt, otherwise the files # would have been deleted by now # do not remove anything in this case (bnc#533766) exit 0 fi # Remove symlinks from "$modules_dir"/weak-updates/. if [ -x $wm2 ]; then run_wm2 --remove-kernel "$kernelrelease"-"$flavor" fi # remove fstab check once perl-Bootloader can cope with it if [ -f /etc/fstab ]; then if [ -x /usr/lib/bootloader/bootloader_entry ]; then /usr/lib/bootloader/bootloader_entry \ remove \ "$flavor" \ "$kernelrelease"-"$flavor" \ "$image"-"$kernelrelease"-"$flavor" \ initrd-"$kernelrelease"-"$flavor" fi fi [ -z "$certs" ] || /usr/lib/module-init-tools/kernel-scriptlets/cert-$op --ca-check 1 --certs "$certs" "$@" ;; posttrans) ;; *) echo Unknown scriptlet "$op" >&2 exit 255 ;; esac exit $script_rc # vim: set sts=4 sw=4 ts=8 noet: 0707010000000D000081A4000000000000000000000001631F4FD500000190000000000000000000000000000000000000003000000000suse-module-tools-16.0.23/kernel-sysctl.service[Unit] Description=Apply Kernel Variables for %v DefaultDependencies=no Conflicts=shutdown.target Before=systemd-sysctl.service After=systemd-modules-load.service ConditionPathExists=/usr/lib/modules/%v/sysctl.conf RequiresMountsFor=/boot [Service] Type=oneshot ExecStart=/usr/lib/systemd/systemd-sysctl /usr/lib/modules/%v/sysctl.conf RemainAfterExit=yes [Install] WantedBy=systemd-sysctl.service 0707010000000E000081A4000000000000000000000001631F4FD500001EA8000000000000000000000000000000000000002600000000suse-module-tools-16.0.23/kmp-install#!/usr/bin/perl # # KMP-INSTALL: Install specified kernel module packages and automatically # remove packages providing same-named modules. # # Copyright (c) 2014 SUSE # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. use strict; use warnings; use IO::Handle; use File::Find; my @zypper_cmd = qw(zypper); sub print_help { print "Usage: $0 [options] <package> ... Installs given packages and removes any KMPs that contain conficting module names. Run 'zypper help install' for the list of valid options. Additionally, the options --non-interactive and --non-interactive-include-reboot-patches can be used\n"; } sub add_package { my ($list, $attr) = @_; return unless $attr->[0] =~ /-kmp-/; my $new = { name => $attr->[0], version => $attr->[1], arch => $attr->[2], }; $new->{repo} = $attr->[3] if defined($attr->[3]); # old-version -> new-version $new->{version} =~ s/.*->\s*//; push(@$list, $new); } sub add_module { my ($package, $path) = @_; return unless $path =~ m@^/lib/modules/([^/]+)/.*/([^/]+\.ko(\.[gx]z)?|\.zst)$@; my ($version, $name) = ($1, $2); $name =~ s/-/_/g; $package->{modules} ||= []; push(@{$package->{modules}}, "$version/$name"); } sub query_installed_kmps { my $res = shift; my %seen; open(my $pipe, '-|', "rpm", "-qa", "--qf", '[%{n} %{v} %{r} %{arch} %{filenames}\n]', "*-kmp-*"); while (<$pipe>) { chomp; my ($n, $v, $r, $a, $file) = split(' '); next unless $file =~ m@^/lib/modules/.*/.*/.*\.ko(\.[gx]z|\.zst)?$@; my $nvra = "$n-$v-$r.$a"; if (!exists($seen{$nvra})) { add_package($res, [$n, "$v-$r", $a]); $seen{$nvra} = $res->[$#$res]; } add_module($seen{$nvra}, $file); } } sub fetch_packages { my $interactive = shift; my $new_pkgs = shift; my $remove_pkgs = shift; my @cmd = @zypper_cmd; push(@cmd, "--non-interactive") if !$interactive; push(@cmd, qw(-vv install --download-only)); push(@cmd, @_); pipe(READ, WRITE); my $pid = fork(); if (!$pid) { # child close(READ); open(STDOUT, ">&WRITE"); if (!$interactive) { open(NULL, '<', "/dev/null"); open(STDIN, "<&NULL"); close(NULL); open(NULL, '>', "/dev/null"); open(STDERR, ">&NULL"); close(NULL); } exec(@cmd); } # parent close(WRITE); my ($len, $buf, $last_line); my ($state, @cur_pkg); $state = 0; $last_line = ""; my $list; STDOUT->autoflush(1); while (($len = sysread(READ, $buf, 4096))) { print $buf if $interactive; my @lines = split(/\n/, $buf, -1); $lines[0] = $last_line . $lines[0]; # XXX: Assumes that the very last line is terminated by \n $last_line = pop(@lines); for my $l (@lines) { if ($state == 0 && $l =~ /^The following.* package.* going to be (installed|upgraded|downgraded|REMOVED):/) { if ($1 eq "REMOVED") { $list = $remove_pkgs; } else { $list = $new_pkgs; } $state = 1; next; } next unless $state == 1; if ($l eq "") { $state = 0; if (@cur_pkg) { add_package($list, \@cur_pkg); } @cur_pkg = (); next; } $l =~ s/ *$//; if ($l =~ /^[^ ]/) { if (@cur_pkg) { add_package($list, \@cur_pkg); } @cur_pkg = ($l); } if ($l =~ /^ /) { $l =~ s/^ *//; push(@cur_pkg, $l); } } } STDOUT->autoflush(0); close(READ); waitpid($pid, 0); return $?; } my %repo_cache; sub get_repo_cache { my $name = shift; my $res; if (exists($repo_cache{$name})) { return $repo_cache{$name}; } open(my $pipe, '-|', "zypper", "repos", $name); while (<$pipe>) { chomp; if (m@^MD Cache Path\s*:\s*(/.*)@) { $res = $1; $res =~ s:/raw/:/packages/:; $res =~ s/\s*$//; } } close($pipe); $repo_cache{$name} = $res; return $res; } sub find_fetched { my $packages = shift; my %local_packages; for $a (@_) { if ($a =~ /\.rpm$/ && -e $a) { open(my $pipe, '-|', "rpm", "-qp", "--qf", '%{n}-%{v}-%{r}.%{arch}', $a); my $nvra = <$pipe>; close($pipe); if (defined($nvra)) { $local_packages{$nvra} = $a; } } } for my $p (@$packages) { my $nvra = "$p->{name}-$p->{version}.$p->{arch}"; if ($p->{repo} eq "Plain RPM files cache") { if (exists($local_packages{$nvra})) { $p->{path} = $local_packages{$nvra}; } else { print STDERR "Cannot find package $p->{name}\n"; } next; } my $dir = get_repo_cache($p->{repo}); if (!$dir) { print STDERR "Cannot find zypp cache for repository $p->{repo} (package $p->{name})\n"; next; } my $file = "$nvra.rpm"; my $wanted = sub { $p->{path} = $File::Find::name if $_ eq $file; }; find($wanted, $dir); if (!$p->{path}) { print STDERR "Cannot find $file in zypp cache ($dir)\n"; next; } } for my $p (@$packages) { next unless $p->{path}; open(my $pipe, '-|', "rpm", "-qlp", $p->{path}); my @files = <$pipe>; close($pipe); for my $f (@files) { add_module($p, $f); } } } # treat -n, --non-interactive, -0 and --non-interactive-include-reboot-patches # as global zypper options my @save_argv = @ARGV; @ARGV=(); for my $a (@save_argv) { if ($a =~ /^-(h|-help)$/) { print_help(); exit 0; } elsif ($a =~ /^-(n$|-non-interactive$|0$|-non-interactive-)/) { push(@zypper_cmd, $a); } else { push(@ARGV, $a); } } if (!@ARGV) { print_help(); exit 1; } print "Fetching packages\n"; my (@new_pkgs, @remove_pkgs, @installed_pkgs); my $ret = fetch_packages(0, \@new_pkgs, \@remove_pkgs, @ARGV); if ($ret != 0) { print "zypper returned an error, retrying in interactive mode\n"; @new_pkgs = (); @remove_pkgs = (); $ret = fetch_packages(1, \@new_pkgs, \@remove_pkgs, @ARGV); } if ($ret != 0) { exit 1; } find_fetched(\@new_pkgs, @ARGV); query_installed_kmps(\@installed_pkgs); # Do not check packages to be updated/removed for module conflicts my (%new_pkgs, %remove_pkgs); for my $p (@remove_pkgs) { my $nvra = "$p->{name}-$->{version}.$p->{arch}"; $remove_pkgs{$nvra} = 1; } for my $p (@new_pkgs) { $new_pkgs{$p->{name}} = 1; } my @tmp = @installed_pkgs; @installed_pkgs = (); for my $p (@tmp) { my $nvra = "$p->{name}-$->{version}.$p->{arch}"; next if $new_pkgs{$p->{name}} || $remove_pkgs{$nvra}; push(@installed_pkgs, $p); } # check for conflicts my %new_modules; for my $p (@new_pkgs) { next unless $p->{modules}; for my $m (@{$p->{modules}}) { $new_modules{$m} = $p->{name}; } } my @conflicting_pkgs; for my $p (@installed_pkgs) { next unless $p->{modules}; for my $m (@{$p->{modules}}) { next unless exists($new_modules{$m}); print "Package $p->{name} conflicts with new package $new_modules{$m}\n"; push(@conflicting_pkgs, $p); last; } } # Install new packages, removing conflicting installed packages my @cmd = (@zypper_cmd, "install", @ARGV); for my $p (@conflicting_pkgs) { push(@cmd, "!$p->{name}.$p->{arch}=$p->{version}"); } print join(" ", "Running", @cmd), "\n"; if (system(@cmd) != 0) { exit 1; } exit 0; 0707010000000F000081ED000000000000000000000001631F4FD5000006BA000000000000000000000000000000000000002900000000suse-module-tools-16.0.23/lsinitrd-quick#! /bin/bash trap 'echo error in $BASH_COMMAND >&2; exit 1' ERR MG_CPIO=$'\x71\xc7' MG_CPIO1=070701 MG_GZ=$'\x1f\x8b' MG_GZ1=$'\x1f\x9e' MG_BZ="BZh" MG_XZ=$'\xfd7zXZ' MG_LZ4=$'\x02\x21' MG_LZO=$'\x89LZO' MG_ZSTD=$'\x28\xB5\x2F\xFD' check_fmt() { case $1 in $MG_CPIO*|$MG_CPIO1) echo cpio;; $MG_GZ*|$MG_GZ1*) echo gzip;; $MG_BZ*) echo bz2;; $MG_XZ*) echo xz;; $MG_LZ4*) echo lz4;; $MG_LZO*) echo lzo;; $MG_ZSTD*) echo zstd;; esac } uncomp() { case $1 in $MG_CPIO*|$MG_CPIO1) cat;; $MG_GZ*) zcat;; $MG_BZ*) bzcat;; $MG_XZ*) xzcat;; $MG_LZ4*) lz4 -d -c;; $MG_LZO*) lzop -d -c;; $MG_ZSTD*) zstd -d -c;; esac } check_size () { [[ "$SIZE" -gt $1 ]] || { echo "$INITRD: file too small, cannot read magic" >&2 exit 1 } } INITRD=$1 [[ "$INITRD" && -f "$INITRD" ]] || { echo "$INITRD: file not found" >&2 exit 1 } SIZE=$(stat -L -c %s "$INITRD") check_size 6 read -r -d'\0' -n 6 MAGIC <"$INITRD" FMT=$(check_fmt "$MAGIC") BYTES=0 if [[ ! $FMT ]]; then echo "$INITRD: unknown format" >&2 exit 1 elif [[ "$FMT" = cpio ]]; then # check for "early CPIO" image TMPFILE=$(mktemp "${TMPDIR:-/tmp}/initrd-XXXXXX") EARLY=$(cpio -t early_cpio "kernel/*/microcode/*.bin" \ <"$INITRD" 2>"$TMPFILE") BLOCKS=$(cut -d" " -f1 "$TMPFILE") rm -f "$TMPFILE" if [[ -z "$EARLY" ]]; then # just plain uncompressed cpio cpio -t <"$INITRD" 2>/dev/null exit fi BYTES=$((512*BLOCKS)) check_size $((BYTES + 6)) read -r -d '\0' -n 6 MAGIC \ < <(dd if="$INITRD" bs=1b count=1 skip=$BLOCKS 2>/dev/null) fi tail -c +$((BYTES + 1)) "$INITRD" | uncomp "$MAGIC" | cpio -t 2>/dev/null 07070100000010000081A4000000000000000000000001631F4FD5000001E8000000000000000000000000000000000000002800000000suse-module-tools-16.0.23/macros.initrd# Packages installing files and binaries that end up in the initrd should # call these macros in their post(trans) scriptlets to have the initrd # regenerated # See also fate#313506 %regenerate_initrd_post \ mkdir -p /run/regenerate-initrd/ \ touch /run/regenerate-initrd/all \ %nil %regenerate_initrd_posttrans \ if test -x /usr/lib/module-init-tools/regenerate-initrd-posttrans; then \ /bin/bash -c 'set +e; /usr/lib/module-init-tools/regenerate-initrd-posttrans' \ fi \ %nil 07070100000011000041ED000000000000000000000009631F4FD500000000000000000000000000000000000000000000002800000000suse-module-tools-16.0.23/modprobe.conf07070100000012000041ED000000000000000000000002631F4FD500000000000000000000000000000000000000000000003000000000suse-module-tools-16.0.23/modprobe.conf/aarch6407070100000013000081A4000000000000000000000001631F4FD500000069000000000000000000000000000000000000004800000000suse-module-tools-16.0.23/modprobe.conf/aarch64/50-blacklist-efifb.conf# does not work on aarch64 because PCI host bridge driver # remaps the bars (bsc#996080) blacklist efifb 07070100000014000041ED000000000000000000000002631F4FD500000000000000000000000000000000000000000000003000000000suse-module-tools-16.0.23/modprobe.conf/armv7hl07070100000015000081A4000000000000000000000001631F4FD500000053000000000000000000000000000000000000003C00000000suse-module-tools-16.0.23/modprobe.conf/armv7hl/40-apm.conf# /dev/apm_bios Advanced Power Management BIOS install char-major-10-134 /bin/true 07070100000016000041ED000000000000000000000002631F4FD500000000000000000000000000000000000000000000002F00000000suse-module-tools-16.0.23/modprobe.conf/common07070100000017000081A4000000000000000000000001631F4FD500000512000000000000000000000000000000000000004B00000000suse-module-tools-16.0.23/modprobe.conf/common/10-unsupported-modules.conf# # Every kernel module has a flag 'supported'. If this flag is not set loading # this module will taint your kernel. You will not get much help with a kernel # problem if your kernel is marked as tainted. In this case you firstly have # to avoid loading of unsupported modules. # # Setting allow_unsupported_modules 1 enables loading of unsupported modules # by modprobe, setting allow_unsupported_modules 0 disables it. This can # be overriden using the --allow-unsupported-modules commandline switch. # # CAUTION: In SUSE Linux Enterprise products, loading unsupported modules # is disabled by default. Re-enabling it is discouraged, as it may compromise # enterprise product supportability. # # SLE users, please read the documentation about kernel module support in the # SUSE Linux Enterprise Server Administration guide: # # https://www.suse.com/documentation/sles-15/book_sle_admin/data/sec_admsupport_kernel.html # # NOTE: Modules from SUSE partners delivered under the SUSE SolidDriver Program # are marked as "externally supported". Such modules are not regarded as # "unsupported" and thus unaffected by the "allow_unsupported_modules" flag. # # On openSUSE, the kernel doesn't have the feature to recognize supported modules, # and this flag has no effect. allow_unsupported_modules 0 07070100000018000081A4000000000000000000000001631F4FD500000015000000000000000000000000000000000000004400000000suse-module-tools-16.0.23/modprobe.conf/common/40-alias-autofs.confalias autofs autofs4 07070100000019000081A4000000000000000000000001631F4FD50000000F000000000000000000000000000000000000004100000000suse-module-tools-16.0.23/modprobe.conf/common/40-alias-nfs.confalias nfs4 nfs 0707010000001A000081A4000000000000000000000001631F4FD500000051000000000000000000000000000000000000004400000000suse-module-tools-16.0.23/modprobe.conf/common/40-alias-paride.conf# network block device alias block-major-45 pd alias block-major-47 pf 0707010000001B000081A4000000000000000000000001631F4FD5000002D8000000000000000000000000000000000000004400000000suse-module-tools-16.0.23/modprobe.conf/common/40-bttv_skip_it.conf# These devices have bt878 chip without PCI Subsystem ID. Without that info bttv # does not know how to treat them properly. Therefore we disable autoloading of # modules for these devices. # See https://bugzilla.novell.com/show_bug.cgi?id=149588 # To enable your device create a hardware configuration file for your device. # See man hwup for details. # You will probably have to specify an option to identify your card. Have a # look in /usr/src/linux/Documentation/video4linux/CARDLIST.bttv. alias pci:v0000109Ed0000036Esv00000000sd00000000bc04sc00i00 bttv_skip_it alias pci:v0000109Ed00000878sv00000000sd00000000bc04sc80i00 bttv_skip_it install bttv_skip_it echo "module alias skipped (bt878 chip without PCI Subsystem ID)" 0707010000001C000081A4000000000000000000000001631F4FD500000086000000000000000000000000000000000000003C00000000suse-module-tools-16.0.23/modprobe.conf/common/40-cifs.conf# cifs calls load_nls() # FIXME: determine the proper nls module based on fstab options instead # SUSE INITRD: cifs REQUIRES nls_utf8 0707010000001D000081A4000000000000000000000001631F4FD5000001A8000000000000000000000000000000000000005200000000suse-module-tools-16.0.23/modprobe.conf/common/50-blacklist-acpi_power_meter.conf# Blacklist acpi_power_meter. The device requires processing ACPI AML code to # update average power measurement. This may be at a high frequency and has # been observed executing every 500ms. This has a noticable impact on latency # sensitive applications that experience delays on workqueue executions. As # very few applications require the data, blacklist the module by default # (bnc#974373) blacklist acpi_power_meter 0707010000001E000081A4000000000000000000000001631F4FD500000029000000000000000000000000000000000000004700000000suse-module-tools-16.0.23/modprobe.conf/common/50-blacklist-bfusb.conf# Blue Fritz! USB dongle blacklist bfusb 0707010000001F000081A4000000000000000000000001631F4FD50000004E000000000000000000000000000000000000004900000000suse-module-tools-16.0.23/modprobe.conf/common/50-blacklist-dpt_i2o.conf# This module seems to be good for nothing. See bug 129301. blacklist dpt_i2o 07070100000020000081A4000000000000000000000001631F4FD5000000AF000000000000000000000000000000000000004700000000suse-module-tools-16.0.23/modprobe.conf/common/50-blacklist-evbug.conf# this is a debugging module which should only be loaded manually # (security sensitive - keystrokes logged to syslog) # 2021: only shipped on ppc64 / ppc64le blacklist evbug 07070100000021000081A4000000000000000000000001631F4FD5000005C5000000000000000000000000000000000000004400000000suse-module-tools-16.0.23/modprobe.conf/common/50-blacklist-fb.conf# list all framebuffer drivers, some of them tend to crash during boot # they are either compiled into the kernel, or vesafb is active # X works fine without them, rcfbset can load them if really required # sed -e '/\/drivers\/video\/.*\.\(o\|ko\)$/{s@^.*/@@;s@\..*$@@;p};d' # See also bsc#106715 blacklist backlight blacklist lcd # armv7hl still ships these blacklist sm501fb # bsc#846218 blacklist udlfb ## 2021: The drivers below aren't shipped any more # blacklist aty128fb # blacklist atyfb # blacklist cyber2000fb # blacklist g450_pll # blacklist hgafb # blacklist i2c-matroxfb # blacklist i810fb # blacklist intelfbdrv # blacklist intelfbhw # blacklist matroxfb_accel # blacklist matroxfb_base # blacklist matroxfb_crtc2 # blacklist matroxfb_DAC1064 # blacklist matroxfb_g450 # blacklist matroxfb_maven # blacklist matroxfb_misc # blacklist matroxfb_proc # blacklist matroxfb_Ti3026 # blacklist mdacon # blacklist neofb # blacklist pm2fb # blacklist pm3fb # blacklist radeonfb # blacklist rivafb # blacklist sisfb # blacklist sstfb # blacklist tdfxfb # blacklist tridentfb # blacklist vga16fb # blacklist vgastate # blacklist kyrofb # blacklist arcfb # blacklist cirrusfb # blacklist gx1fb # blacklist intelfb # blacklist macmodes # blacklist nvidiafb # blacklist s1d13xxxfb # blacklist savagefb # blacklist arkfb # blacklist carminefb # blacklist gxfb # blacklist hecubafb # blacklist lxfb # blacklist s3fb # blacklist viafb # blacklist vmlfb # blacklist vt8623fb 07070100000022000081A4000000000000000000000001631F4FD500000083000000000000000000000000000000000000004500000000suse-module-tools-16.0.23/modprobe.conf/common/50-blacklist-mtd.conf# These mtd drivers should be loaded manually. # bsc#51815 blacklist amd76xrom blacklist l440gx blacklist scb2_flash blacklist pci 07070100000023000081A4000000000000000000000001631F4FD5000000E6000000000000000000000000000000000000004B00000000suse-module-tools-16.0.23/modprobe.conf/common/50-blacklist-pata_acpi.conf# pata_acpi is useful for certain limited cases but it tries to attach any # controller with IDE class code causing more harm than good if loaded by # default. Blacklist it so that it can be used selectively. blacklist pata_acpi 07070100000024000081A4000000000000000000000001631F4FD500000051000000000000000000000000000000000000004900000000suse-module-tools-16.0.23/modprobe.conf/common/50-blacklist-usbcore.conf# usbcore ... module is loaded implicitly, ignore it otherwise blacklist usbcore 07070100000025000081A4000000000000000000000001631F4FD5000000B7000000000000000000000000000000000000004800000000suse-module-tools-16.0.23/modprobe.conf/common/50-blacklist-xircom.conf# tulip ... de4x5, xircom_tulip_cb, dmfe (...) handle same devices blacklist de4x5 # At least 2.4.3 and later xircom_tulip doesn't have that conflict # xircom_tulip_cb blacklist dmfe 07070100000026000081A4000000000000000000000001631F4FD500000066000000000000000000000000000000000000004800000000suse-module-tools-16.0.23/modprobe.conf/common/70-softdep-csiostor.conf# bsc#1100989: cxgb4 needs to be loaded before csiostor (Chelsio request) softdep csiostor pre: cxgb4 07070100000027000081A4000000000000000000000001631F4FD500000036000000000000000000000000000000000000004800000000suse-module-tools-16.0.23/modprobe.conf/common/70-softdep-dm_crypt.conf# dm-crypt requires essiv softdep dm-crypt pre: essiv 07070100000028000081A4000000000000000000000001631F4FD5000000A3000000000000000000000000000000000000004800000000suse-module-tools-16.0.23/modprobe.conf/common/70-softdep-ehci_hcd.conf# "Warning! ehci_hcd should always be loaded before uhci_hcd and ohci_hcd, not # after" (bnc#449853) softdep uhci-hcd pre: ehci-hcd softdep ohci-hcd pre: ehci-hcd 07070100000029000081A4000000000000000000000001631F4FD5000000AA000000000000000000000000000000000000004B00000000suse-module-tools-16.0.23/modprobe.conf/common/70-softdep-usb_storage.conf# uas devices can be unpredictably a fallback for both drivers must be present # (bnc#862397) # but avoid circular dependency (bsc#1168661) softdep usb_storage post: uas 0707010000002A000081A4000000000000000000000001631F4FD5000000B4000000000000000000000000000000000000004500000000suse-module-tools-16.0.23/modprobe.conf/common/80-options-cdrom.conf# There are repated reports of broken software polling the drive without using # O_NONBLOCK fighting with the user trying to open the tray (boo#1165047). options cdrom autoclose=0 0707010000002B000081A4000000000000000000000001631F4FD500000075000000000000000000000000000000000000004200000000suse-module-tools-16.0.23/modprobe.conf/common/80-options-ch.conf# SCSI changers can take 1h to initialize on module load, # triggering udev timeouts (bnc#760274). options ch init=0 0707010000002C000041ED000000000000000000000002631F4FD500000000000000000000000000000000000000000000002D00000000suse-module-tools-16.0.23/modprobe.conf/i3860707010000002D000081A4000000000000000000000001631F4FD5000000C5000000000000000000000000000000000000004100000000suse-module-tools-16.0.23/modprobe.conf/i386/40-alias-mwave.conf# Linux ACP modem (Mwave) # /dev/modems/mwave MWave modem firmware upload alias char-major-10-219 mwave # options mwave mwave_3780i_irq=10 mwave_3780i_io=0x130 mwave_uart_irq=3 mwave_uart_io=0x2f8 0707010000002E000081A4000000000000000000000001631F4FD50000007D000000000000000000000000000000000000004400000000suse-module-tools-16.0.23/modprobe.conf/i386/40-alias-thinkpad.conf# IBM thinkpad tpctl # see /usr/share/doc/packages/tpctl/ alias char-major-10-170 thinkpad # options thinkpad enable_smapi=0 0707010000002F000081A4000000000000000000000001631F4FD500000053000000000000000000000000000000000000003900000000suse-module-tools-16.0.23/modprobe.conf/i386/40-apm.conf# /dev/apm_bios Advanced Power Management BIOS install char-major-10-134 /bin/true 07070100000030000081A4000000000000000000000001631F4FD500000057000000000000000000000000000000000000003C00000000suse-module-tools-16.0.23/modprobe.conf/i386/40-sonypi.conf# sonypi driver (Sony laptops) alias char-major-10-250 sonypi options sonypi minor=250 07070100000031000081A4000000000000000000000001631F4FD500000020000000000000000000000000000000000000003D00000000suse-module-tools-16.0.23/modprobe.conf/i386/40-toshiba.confalias char-major-10-181 toshiba 07070100000032000081A4000000000000000000000001631F4FD5000000F4000000000000000000000000000000000000004C00000000suse-module-tools-16.0.23/modprobe.conf/i386/50-blacklist-i82875p_edac.conf# For some bridges both intel-agp and i82875p_edac are loaded. If i82875p_edac # is loaded first it will grab the device. Then intel-agp doesn't work. # Therefore we disable automatic loading of 82875p_edac. (Bug 213840) blacklist i82875p_edac 07070100000033000041ED000000000000000000000002631F4FD500000000000000000000000000000000000000000000002E00000000suse-module-tools-16.0.23/modprobe.conf/ppc6407070100000034000081A4000000000000000000000001631F4FD500000058000000000000000000000000000000000000004700000000suse-module-tools-16.0.23/modprobe.conf/ppc64/80-options-ib_mthca.conf# catas recovery conflicts with eeh (bsc#456389) options ib_mthca catas_reset_disable=1 07070100000035000041ED000000000000000000000002631F4FD500000000000000000000000000000000000000000000002E00000000suse-module-tools-16.0.23/modprobe.conf/s390x07070100000036000081A4000000000000000000000001631F4FD5000001A3000000000000000000000000000000000000004400000000suse-module-tools-16.0.23/modprobe.conf/s390x/40-alias-netiucv.conf# Copied over from modprobe.conf.s390 # Dropped obviously outdated statements. alias iucv0 netiucv alias iucv1 netiucv alias iucv2 netiucv alias iucv3 netiucv alias iucv4 netiucv alias iucv5 netiucv alias iucv6 netiucv alias iucv7 netiucv alias iucv8 netiucv alias iucv9 netiucv 07070100000037000081A4000000000000000000000001631F4FD50000001B000000000000000000000000000000000000004200000000suse-module-tools-16.0.23/modprobe.conf/s390x/40-alias-xpram.confalias block-major-35 xpram 07070100000038000081A4000000000000000000000001631F4FD50000006A000000000000000000000000000000000000004900000000suse-module-tools-16.0.23/modprobe.conf/s390x/50-blacklist-chsc_sch.conf# Blacklist the IBM s390 module for I/O dynamic configuration support # Bug bnc#478601 blacklist chsc_sch 07070100000039000081A4000000000000000000000001631F4FD5000000F7000000000000000000000000000000000000004900000000suse-module-tools-16.0.23/modprobe.conf/s390x/70-softdep-virtio_gpu.conf# The framebuffer console is built as a module on s390, because it is # useful only to a KVM guest. But then it should be loaded together # with the corresponding DRM driver. # SUSE INITRD: virtio_gpu REQUIRES fbcon softdep virtio_gpu post: fbcon 0707010000003A000041ED000000000000000000000002631F4FD500000000000000000000000000000000000000000000002F00000000suse-module-tools-16.0.23/modprobe.conf/x86_640707010000003B000081A4000000000000000000000001631F4FD500000022000000000000000000000000000000000000004500000000suse-module-tools-16.0.23/modprobe.conf/x86_64/40-alias-parport.confalias parport_lowlevel parport_pc 0707010000003C000081A4000000000000000000000001631F4FD50000004B000000000000000000000000000000000000004A00000000suse-module-tools-16.0.23/modprobe.conf/x86_64/40-alias-qemu-acpiphp.conf# QEMU/KVM can handle ACPI Hotplugging alias dmi:bvnQEMU:bvrQEMU:* acpiphp 0707010000003D000081A4000000000000000000000001631F4FD500000134000000000000000000000000000000000000004600000000suse-module-tools-16.0.23/modprobe.conf/x86_64/50-blacklist-isst.conf# Intel Speed Select Technology (ISST) # The isst_if_mbox_msr driver uses a modalias based on CPU family and model, # which is too unspecific. On large systems, this causes a lot of failing # modprobe attempts for this driver, leading to slow or even stalled boot # (bsc#1187196). blacklist isst_if_mbox_msr 0707010000003E000081A4000000000000000000000001631F4FD500000045000000000000000000000000000000000000004800000000suse-module-tools-16.0.23/modprobe.conf/x86_64/70-softdep-ata_piix.conf# ata_piix can't handle ICH6 in AHCI mode softdep ata_piix pre: ahci 0707010000003F000041ED000000000000000000000002631F4FD500000000000000000000000000000000000000000000002900000000suse-module-tools-16.0.23/modules-load.d07070100000040000081A4000000000000000000000001631F4FD50000003D000000000000000000000000000000000000003100000000suse-module-tools-16.0.23/modules-load.d/sg.conf# Ensure that the sg driver is loaded early (bsc#1036463) sg 07070100000041000081A4000000000000000000000001631F4FD5000004CC000000000000000000000000000000000000003600000000suse-module-tools-16.0.23/regenerate-initrd-posttrans#!/bin/sh # # Packages that install kernels or kernel-modules create a flag # # /run/regenerate-initrd/<kernel image> # # to have the initrd for <kernel image> generated, or # # /run/regenerate-initrd/all # # to have all initrds generated. This script is called from posttrans # and takes care of generating the initrds : ${DRACUT:=/usr/bin/dracut} if [ ! -x "$DRACUT" ]; then echo "${0##*/}: dracut is not installed, not rebuilding the initrd" >&2 exit 0 fi dir=/run/regenerate-initrd if ! test -d "$dir"; then exit 0 fi for f in "$dir"/*; do case $f in "$dir/*") [ -e "$f" ] || break;; esac # check if we are in a build chroot if ! [ -f /etc/fstab -a ! -e /.buildenv -a -x "$DRACUT" ] ; then echo "Please run \"$DRACUT -f --regenerate-all\" as soon as your system is complete." >&2 rm "$dir"/* exit 0 fi break done if test -e "$dir/all"; then rm "$dir"/* "$DRACUT" -f --regenerate-all exit fi err=0 for f in "$dir"/*; do case $f in "$dir/*") [ -e "$f" ] || break;; esac rm -f "$f" kver=${f##*/} [ -d /lib/modules/"$kver" ] || { echo $0: skippping invalid kernel version "$dir/$kver" continue } if ! "$DRACUT" -f --kver "$kver"; then err=$? fi done exit $err 07070100000042000081A4000000000000000000000001631F4FD500002785000000000000000000000000000000000000003100000000suse-module-tools-16.0.23/suse-module-tools.spec# # spec file for package suse-module-tools # # Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via https://bugs.opensuse.org/ # # missing in SLE15 (systemd-rpm-macros) %{!?_modulesloaddir: %global _modulesloaddir /usr/lib/modules-load.d} # Location for modprobe and depmod .conf files # # This assumes post-usr-merge (20210527) for Tumbleweed %if 0%{?suse_version} >= 1550 %global modprobe_dir /usr/lib/modprobe.d %global depmod_dir /usr/lib/depmod.d %global with_kernel_sysctl 1 # boot_sysctl may be dropped on TW when we can assume that nobody keeps # kernel packages around that store sysctl files under /boot %bcond_without boot_sysctl %else %global modprobe_dir /lib/modprobe.d %global depmod_dir /lib/depmod.d %global with_boot_sysctl 1 %endif %global sysctl_dropin %{_unitdir}/systemd-sysctl.service.d/50-kernel-uname_r.conf %global systemd_units %{?with_boot_sysctl:boot-sysctl.service} %{?with_kernel_sysctl:kernel-sysctl.service} # List of legacy file systems to be blacklisted by default %global fs_blacklist adfs affs bfs befs cramfs efs erofs exofs freevxfs hfs hpfs jfs minix nilfs2 ntfs omfs qnx4 qnx6 sysv ufs # List of all files installed under modprobe.d # Note: this list contains files installed by previous versions, like 00-system-937216.conf! %global modprobe_conf_files 00-system 00-system-937216 10-unsupported-modules 50-blacklist 60-blacklist_fs-* 99-local %global modprobe_conf_rpmsave %(echo "%{modprobe_conf_files}" | sed 's,\\([^ ]*\\),%{_sysconfdir}/modprobe.d/\\1.conf.rpmsave,g') Name: suse-module-tools Version: 16.0.23 Release: 0 Summary: Configuration for module loading and SUSE-specific utilities for KMPs License: GPL-2.0-or-later Group: System/Base URL: https://github.com/openSUSE/suse-module-tools Source0: %{name}-%{version}.tar.xz Source1: %{name}.rpmlintrc BuildRequires: systemd-rpm-macros Requires: /usr/bin/grep Requires: /usr/bin/gzip Requires: /usr/bin/sed Requires: coreutils Requires: findutils Requires: systemd-rpm-macros Requires: rpm Requires(post): /usr/bin/grep Requires(post): /usr/bin/sed Requires(post): coreutils Provides: suse-kernel-rpm-scriptlets = 0 Provides: udev-extra-rules = 0.3.0 Obsoletes: udev-extra-rules < 0.3.0 Provides: system-tuning-common-SUSE = 0.3.0 Obsoletes: system-tuning-common-SUSE < 0.3.0 # Use weak dependencies for dracut and kmod in order to # keep Ring0 lean. In normal deployments, these packages # will be available anyway. Recommends: dracut Recommends: kmod # This release requires the dracut module 90nvdimm Conflicts: dracut < 49.1 # TW: conflict with pre-usrmerge %if 0%{?suse_version} >= 1550 Conflicts: filesystem < 15.5-40.2 %endif %description This package contains helper scripts for KMP installation and uninstallation, as well as default configuration files for depmod and modprobe. %package legacy Summary: Legacy "weak-modules" script for Code10 Group: System/Base Requires: %{name} Requires: binutils Supplements: dkms %description legacy This package contains the legacy "weak-modules" script for kernel module package (KMP) support. It was replaced by "weak-modules2" in SLE 11 and later. It is still used by the DKMS module packaging framework. %prep %setup -q %build sed -i 's/@FS_BLACKLIST@.*/%{fs_blacklist}/' README.md %install install -d -m 755 "%{buildroot}%{modprobe_dir}" install -d -m 755 "%{buildroot}%{_sysconfdir}/modprobe.d" # keep /etc clean on Tumbleweed %if 0%{?suse_version} < 1550 cat > "%{buildroot}%{_sysconfdir}/modprobe.d/README" <<EOF Local configuration for modprobe(8) =================================== The distribution-provided modprobe configuration files have moved to %{modprobe_dir}. To modify the configuration, copy files from %{modprobe_dir} to this directory (%{_sysconfdir}/modprobe.d) and edit them here. See also %{modprobe_dir}/README, %{_defaultdocdir}/%{name}/README.md, and the man page modprobe.d(5). EOF %endif install -pm644 -t "%{buildroot}%{modprobe_dir}" modprobe.conf/common/*.conf if [ -d modprobe.conf/%{_arch} ]; then install -pm644 -t "%{buildroot}%{modprobe_dir}" modprobe.conf/%{_arch}/*.conf fi %ifarch i386 install -pm644 -t "%{buildroot}%{modprobe_dir}" modprobe.conf/x86_64/*.conf %endif %ifarch ppc64le install -pm644 -t "%{buildroot}%{modprobe_dir}" modprobe.conf/ppc64/*.conf %endif install -d -m 755 "%{buildroot}/%{depmod_dir}" install -d -m 755 "%{buildroot}%{_sysconfdir}/depmod.d" install -pm 644 "depmod-00-system.conf" "%{buildroot}%{depmod_dir}/00-system.conf" # "/usr/lib/module-init-tools" name hardcoded in KMPs, mkinitrd, etc. install -d -m 755 "%{buildroot}/usr/lib/module-init-tools" install -pm 755 -t "%{buildroot}/usr/lib/module-init-tools/" \ weak-modules{,2} driver-check.sh unblacklist lsinitrd-quick %if 0%{?suse_version} < 1550 # rpm macros and helper # The RPM Macros have been moved to the package rpm-config-SUSE after CODE15, thus are no longer # shipped here install -d -m 755 "%{buildroot}%{_rpmmacrodir}" install -pm 644 "macros.initrd" "%{buildroot}%{_rpmmacrodir}" %endif install -pm 755 "regenerate-initrd-posttrans" "%{buildroot}/usr/lib/module-init-tools/" install -d -m 755 "%{buildroot}/usr/lib/module-init-tools/kernel-scriptlets" install -pm 755 "kernel-scriptlets/cert-script" "%{buildroot}/usr/lib/module-init-tools/kernel-scriptlets" install -pm 755 "kernel-scriptlets/inkmp-script" "%{buildroot}/usr/lib/module-init-tools/kernel-scriptlets" install -pm 755 "kernel-scriptlets/kmp-script" "%{buildroot}/usr/lib/module-init-tools/kernel-scriptlets" install -pm 755 "kernel-scriptlets/rpm-script" "%{buildroot}/usr/lib/module-init-tools/kernel-scriptlets" for i in "pre" "preun" "post" "posttrans" "postun" ; do ln -s cert-script %{buildroot}/usr/lib/module-init-tools/kernel-scriptlets/cert-$i ln -s inkmp-script %{buildroot}/usr/lib/module-init-tools/kernel-scriptlets/inkmp-$i ln -s kmp-script %{buildroot}/usr/lib/module-init-tools/kernel-scriptlets/kmp-$i ln -s rpm-script %{buildroot}/usr/lib/module-init-tools/kernel-scriptlets/rpm-$i done install -d -m 755 "%{buildroot}%{_prefix}/bin" install -pm 755 kmp-install "%{buildroot}%{_bindir}/" # systemd service(s) to load kernel-specific sysctl settings install -d -m 755 "%{buildroot}%{_unitdir}/systemd-sysctl.service.d" echo '[Unit]' >"%{buildroot}%{sysctl_dropin}" %if %{with kernel_sysctl} install -pm 644 kernel-sysctl.service "%{buildroot}%{_unitdir}" echo 'Wants=kernel-sysctl.service' >>"%{buildroot}%{sysctl_dropin}" %endif %if %{with boot_sysctl} install -pm 644 boot-sysctl.service "%{buildroot}%{_unitdir}" echo 'Wants=boot-sysctl.service' >>"%{buildroot}%{sysctl_dropin}" %endif install -d -m 755 "%{buildroot}%{_modulesloaddir}" install -pm 644 -t "%{buildroot}%{_modulesloaddir}" modules-load.d/*.conf %ifarch ppc64 ppc64le install -d -m 755 %{buildroot}/usr/lib/systemd/system-generators install -pm 755 udev-trigger-generator %{buildroot}/usr/lib/systemd/system-generators %endif # udev rules (formerly system-tuning-common-SUSE, udev-extra-rules) install -d -m 755 %{buildroot}%{_udevrulesdir} install -pm 644 udevrules/*.rules %{buildroot}%{_udevrulesdir} mkdir -p %{buildroot}%{_defaultlicensedir} %if 0%{?suse_version} >= 1550 || 0%{?sle_version} >= 150100 for mod in %{fs_blacklist}; do echo "\ # DO NOT EDIT THIS FILE! # # The $mod file system is blacklisted by default because it isn't actively # supported by SUSE, not well maintained, or may have security vulnerabilites. blacklist $mod # The filesystem can be un-blacklisted by running \"modprobe $mod\". # See README.md in the %{name} package for details. install $mod /usr/lib/module-init-tools/unblacklist $mod; /sbin/modprobe --ignore-install $mod " \ >%{buildroot}%{modprobe_dir}/60-blacklist_fs-"$mod".conf done %endif %pre %service_add_pre %{systemd_units} # Avoid restoring old .rpmsave files in %posttrans for f in %{modprobe_conf_rpmsave}; do if [ -f ${f} ]; then mv -f ${f} ${f}.%{name} fi done if [ -f %{_sysconfdir}/depmod.d/00-system.conf.rpmsave ]; then mv -f %{_sysconfdir}/depmod.d/00-system.conf.rpmsave \ %{_sysconfdir}/depmod.d/00-system.conf.rpmsave.%{name} fi exit 0 %post %udev_rules_update %service_add_post %{systemd_units} exit 0 %preun %service_del_preun %{systemd_units} exit 0 %postun %udev_rules_update %service_del_postun_without_restart %{systemd_units} exit 0 %posttrans # If the user had modified any of the configuration files installed under # /etc, they'll now be renamed to .rpmsave files. Restore them. for f in %{modprobe_conf_rpmsave}; do if [ -f ${f} ]; then mv -fv ${f} ${f%.rpmsave} fi done if [ -f %{_sysconfdir}/depmod.d/00-system.conf.rpmsave ]; then mv -fv %{_sysconfdir}/depmod.d/00-system.conf.rpmsave \ %{_sysconfdir}/depmod.d/00-system.conf fi exit 0 %files %defattr(-,root,root) %license LICENSE %doc README.md %{modprobe_dir} %dir %{_sysconfdir}/modprobe.d %{depmod_dir} %dir %{_sysconfdir}/depmod.d %if 0%{?suse_version} < 1550 %{_sysconfdir}/modprobe.d/README %{_rpmmacrodir}/macros.initrd %endif %{_bindir}/kmp-install /usr/lib/module-init-tools %exclude /usr/lib/module-init-tools/weak-modules %{_unitdir}/*.service %{_unitdir}/systemd-sysctl.service.d %{_modulesloaddir} %{_udevrulesdir} %ifarch ppc64 ppc64le /usr/lib/systemd/system-generators %endif %files legacy %defattr(-,root,root) /usr/lib/module-init-tools/weak-modules %changelog 07070100000043000081A4000000000000000000000001631F4FD5000003F3000000000000000000000000000000000000003100000000suse-module-tools-16.0.23/udev-trigger-generator#! /bin/bash # Copyright (c) 2020 SUSE LLC # SPDX-License-Identifier: GPL-2.0-or-later # # bsc#1174287: On PowerPC, exclude memory devices from udev coldplug # # This generator creates a drop-in for systemd-udev-trigger.service # that overrides the default action, skipping coldplug for memory devices. export PATH=/usr/bin # /tmp may not be writable yet. Use a different TMPDIR that's guaranteed # to be writable. Needed for the "here-document" below. export TMPDIR=/dev/shm trap 'echo $0: error in "$BASH_COMMAND" >&2' ERR [[ $(uname -m) = ppc64le ]] || [[ $(uname -m) = ppc64 ]] || exit 0 case $(systemd-detect-virt) in none|powervm) ;; *) exit 0;; esac DIR=$1 [[ $DIR && -d "$DIR" ]] DROPIN="$DIR/systemd-udev-trigger.service.d" mkdir -p "$DROPIN" cat >"$DROPIN/30-skip-memory-devices.conf" <<EOF # generated by $0 [Service] ExecStart= ExecStart=/usr/bin/udevadm trigger --type=subsystems --action=add ExecStart=/usr/bin/udevadm trigger --type=devices --action=add --subsystem-nomatch=memory EOF 07070100000044000041ED000000000000000000000002631F4FD500000000000000000000000000000000000000000000002400000000suse-module-tools-16.0.23/udevrules07070100000045000081A4000000000000000000000001631F4FD500000797000000000000000000000000000000000000003800000000suse-module-tools-16.0.23/udevrules/42-usb-hid-pm.rules# do not edit this file, it will be overwritten on update # # Enable autosuspend for qemu emulated usb hid devices # Note that there are buggy qemu versions (0.13 & older) which # advertise remote wakeup support but don't actually implement # it correctly. This is the reason why we need a match for the # serial number here. Old, broken versions have serial "1". # It has been changed to "42" after fixing the bug to indicate # remote wakeup is working. ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Mouse", ATTR{serial}!="1", TEST=="power/control", ATTR{power/control}="auto" ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Tablet", ATTR{serial}!="1", TEST=="power/control", ATTR{power/control}="auto" ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Keyboard", ATTR{serial}!="1", TEST=="power/control", ATTR{power/control}="auto" # Dell DRAC 4 ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="413c", ATTR{idProduct}=="2500", TEST=="power/control", ATTR{power/control}="auto" # Dell DRAC 5 ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="413c", ATTR{idProduct}=="0000", TEST=="power/control", ATTR{power/control}="auto" # IBM remote access ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="04b3", ATTR{idProduct}=="4012", TEST=="power/control", ATTR{power/control}="auto" # Raritan Computer, Inc KVM. ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="14dd", ATTR{idProduct}=="0002", TEST=="power/control", ATTR{power/control}="auto" # USB HID devices that are internal to the machine should also be safe to autosuspend ACTION=="add", SUBSYSTEM=="usb", SUBSYSTEMS=="usb", ATTRS{removable}=="removable", GOTO="usb_hid_pm_end" ACTION=="add", SUBSYSTEM=="usb", SUBSYSTEMS=="usb", ATTRS{removable}=="unknown", GOTO="usb_hid_pm_end" ACTION=="add", SUBSYSTEM=="usb", ATTR{bInterfaceClass}=="03", ATTRS{removable}=="fixed", TEST=="../power/control", ATTR{../power/control}="auto" LABEL="usb_hid_pm_end" 07070100000046000081A4000000000000000000000001631F4FD500000926000000000000000000000000000000000000003A00000000suse-module-tools-16.0.23/udevrules/60-io-scheduler.rules# Set optimal IO schedulers for HDD and SSD # Copyright (c) 2021 SUSE LLC # ## DO NOT EDIT. ## # To modify the rules, copy this file to /etc/udev/rules.d/60-io-scheduler.rules # and edit the copy. # Please read the section "Tuning I/O performance" in the System Analysis and Tuning Guide # from the SUSE Documentation. # --- DO NOT EDIT THIS PART ---- SUBSYSTEM!="block", GOTO="scheduler_end" ACTION!="add|change", GOTO="scheduler_end" ENV{DEVTYPE}!="disk", GOTO="scheduler_end" # For dm devices, the relevant events are "change" events, see 10-dm.rules ACTION!="change", KERNEL=="dm-*", GOTO="scheduler_end" # "none" with no brackets means scheduler isn't configurable ATTR{queue/scheduler}=="none", GOTO="scheduler_end" # keep our hands off zoned devices, the kernel auto-configures them ATTR{queue/zoned}!="none", GOTO="scheduler_end" # Enforce "none" for multipath components. ENV{DM_MULTIPATH_DEVICE_PATH}=="1", ATTR{queue/scheduler}="none", GOTO="scheduler_end" # Enforce "none" for loop devices KERNEL=="loop[0-9]*", ATTR{queue/scheduler}="none", GOTO="scheduler_end" # --- EDIT BELOW HERE after copying to /etc/udev/rules.d --- # Uncomment these if you want to force virtual devices to use no scheduler # KERNEL=="vd[a-z]*", ATTR{queue/scheduler}="none", GOTO="scheduler_end" # KERNEL=="xvd[a-z]*", ATTR{queue/scheduler}="none", GOTO="scheduler_end" # Leave virtual devices untouched KERNEL=="vd[a-z]*", GOTO="scheduler_end" KERNEL=="xvd[a-z]*", GOTO="scheduler_end" # 1. BFQ scheduler for single-queue HDD ATTR{queue/rotational}!="0", TEST!="%S%p/mq/1", ATTR{queue/scheduler}="bfq", GOTO="scheduler_end" # 2. BFQ scheduler for every HDD, including "real" multiqueue # ATTR{queue/rotational}!="0", ATTR{queue/scheduler}="bfq", GOTO="scheduler_end" # 3. For "real" multiqueue devices, the kernel defaults to no IO scheduling # Uncomment this (and select your scheduler) if you need an IO scheduler for them # TEST=="%S%p/mq/1", ATTR{queue/scheduler}="kyber", GOTO="scheduler_end" # 4. BFQ scheduler for every device (uncomment if you need ionice or blk-cgroup features) # ATTR{queue/scheduler}="bfq", GOTO="scheduler_end" # 5. mq-deadline is the kernel default for devices with just one hardware queue # ATTR{queue/scheduler}="mq-deadline" # --- EDIT ABOVE HERE after copying to /etc/udev/rules.d --- LABEL="scheduler_end" 07070100000047000081A4000000000000000000000001631F4FD500000394000000000000000000000000000000000000003D00000000suse-module-tools-16.0.23/udevrules/80-hotplug-cpu-mem.rules# do not edit this file, it will be overwritten on update # # Hotplug physical CPU # SUBSYSTEM=="cpu", ACTION=="add", TEST=="online", ATTR{online}=="0", ATTR{online}="1" # # Hotplug physical memory. Instances of tmpfs are remounted so their # size are recalculated. This might be needed if some sizes were # specified relative to the total amount of memory (boo#869603). For # now make it simple and remount all tmpfs regardless of how their # size are specified. It should be handled by the kernel as it has a # lot of shortcomings anyways (tmpfs mounted by other processes, mount # namespaces, ...) # SUBSYSTEM=="memory", ACTION=="add", PROGRAM=="/usr/bin/uname -m", RESULT!="s390x", ATTR{state}=="offline", \ ATTR{state}="online", \ RUN+="/bin/sh -c ' \ while read src dst fs opts unused; do \ case $$fs in \ tmpfs) mount -o remount \"$$dst\" ;; \ esac \ done </proc/self/mounts" 07070100000048000081A4000000000000000000000001631F4FD500000163000000000000000000000000000000000000003E00000000suse-module-tools-16.0.23/udevrules/99-wakeup-from-idle.rules# enable usb and standard AT Keyboards as wakeup sources for suspend-to-idle (S2I) fate#323814 ACTION=="add", ATTR{power/wakeup}=="disabled", SUBSYSTEM=="serio", ATTR{description}=="i8042 KBD port", ATTR{power/wakeup}="enabled" ACTION=="add", ATTR{power/wakeup}=="disabled", SUBSYSTEM=="hid", ATTRS{bInterfaceProtocol}=="01", ATTR{power/wakeup}="enabled" 07070100000049000081ED000000000000000000000001631F4FD50000076F000000000000000000000000000000000000002600000000suse-module-tools-16.0.23/unblacklist#! /bin/sh # Copyright (c) 2021 SUSE LLC # SPDX-License-Identifier: GPL-2.0-or-later # Never unblacklist non-interactively if ! tty -s <&0; then exit 0 fi ME=$(basename "$0") if [ $UID -ne 0 ]; then echo "$ME: you must be root to run this program" >&2 exit 1 fi if [ $# -ne 1 ]; then echo "Usage: $ME module" >&2 exit 1 fi MODULE=$1 if [ -z "$MODULE" ] || \ [ ! -f /lib/modprobe.d/60-blacklist_fs-"$MODULE".conf -a \ ! -f /usr/lib/modprobe.d/60-blacklist_fs-"$MODULE".conf ]; then echo "$ME: Invalid or unknown module \"$MODULE\"" >&2 exit 1 fi CONF=/etc/modprobe.d/60-blacklist_fs-"$MODULE".conf if [ -L "$CONF" ]; then if [ x"$(readlink -f "$CONF")" = x/dev/null ]; then # already linked to /dev/null exit 0 else echo "$ME: $CONF is in unexpected state, exiting" >&2 exit 1 fi elif [ -f "$CONF" ]; then if ! grep -E -q "^[ ]*blacklist[ ]+$MODULE" "$CONF"; then # not blacklisted exit 0 fi if ! grep -E -q '^# __THIS FILE MAY BE MODIFIED__' "$CONF"; then echo "$ME: $CONF exists, cannot modify it" >&2 exit 1 fi elif [ -e "$CONF" ]; then echo "$ME: $CONF is in unexpected state, exiting" >&2 exit 1 fi echo "$ME: loading $MODULE file system module" >&2 _a= while [ -z "$_a" ]; do echo -n "$ME: Do you want to un-blacklist $MODULE permanently (<y>es/<n>o/n<e>ver)? " >&2 read _a case $_a in y|yes) _a=yes;; n|no) _a=no;; e|never) _a=never;; *) _a=;; esac done case $_a in no) echo "$ME: not un-blacklisting $MODULE" >&2 exit 0 ;; never) echo "$ME: creating $CONF" >&2 rm -f "$CONF" cat >$CONF <<EOF # created by $0 (user wants to never unblacklist this module) blacklist $MODULE EOF exit 0 ;; esac if ln -sf /dev/null "$CONF"; then echo "$ME: $MODULE un-blacklisted by creating $CONF" >&2 exit 0 else echo "$ME: Failed to create $CONF" >&2 exit 1 fi 0707010000004A000081A4000000000000000000000001631F4FD500002371000000000000000000000000000000000000002700000000suse-module-tools-16.0.23/weak-modules#! /bin/bash # This script is only needed to uninstall old KMPs when updating # SLE10 to SLE11+. weak-modules2 is the script what should be used by new # packages unset LANG LC_ALL LC_COLLATE NM= if command -v nm >/dev/null; then NM=nm elif command -v eu-nm >/dev/null; then NM=eu-nm else echo "ERROR: nm not found" >&2 exit 1 fi # Check if MODULE is compatible with kernel release KREL. module_is_compatible() { declare module=$1 krel=$2 module_krel=$(krel_of_module "$module") if [ ! -e $tmpdir/all-symvers-$krel-$module_krel ]; then # Symbols exported by the "new" kernel if [ ! -e $tmpdir/symvers-$krel ]; then if [ -e /boot/symvers-$krel.gz ]; then zcat /boot/symvers-$krel.gz \ | sed -r -ne 's:^0x0*([0-9a-f]+\t[0-9a-zA-Z_]+)\t.*:\1:p' fi > $tmpdir/symvers-$krel fi # Symbols that other add-on modules of the "old" kernel export # (and that this module may require) if [ ! -e $tmpdir/extra-symvers-$module_krel ]; then if [ -e /lib/modules/$module_krel/updates ]; then find /lib/modules/$module_krel/updates -name '*.ko' \ | xargs $NM -B \ | sed -nre 's:^0*([0-9a-f]+) A __crc_(.*):\1 \2:p' fi > $tmpdir/extra-symvers-$module_krel fi sort -u $tmpdir/symvers-$krel $tmpdir/extra-symvers-$module_krel \ > $tmpdir/all-symvers-$krel-$module_krel fi # If the module does not have modversions enabled, $tmpdir/modvers # will be empty. /sbin/modprobe --dump-modversions "$module" \ | sed -r -e 's:^0x0*([0-9a-f]+\t.*):\1:' \ | sort -u \ > $tmpdir/modvers # Only include lines of the second file in the output that don't # match lines in the first file. (The default separator is # <space>, so we are matching the whole line.) join -j 1 -v 2 $tmpdir/all-symvers-$krel-$module_krel \ $tmpdir/modvers > $tmpdir/join if [ ! -s $tmpdir/modvers ]; then echo "Warning: Module ${module##*/} from kernel $module_krel has no" \ "modversions, so it cannot be reused for kernel $krel" >&2 elif [ -s $tmpdir/join ]; then [ -n "$verbose" ] && echo "Module ${module##*/} from kernel $module_krel is not compatible" \ "with kernel $krel in symbols:" $(sed -e 's:.* ::' $tmpdir/join) elif [ "$krel" != "$module_krel" ]; then [ -n "$verbose" ] && echo "Module ${module##*/} from kernel $module_krel is compatible" \ "with kernel $krel" return 0 fi return 1 } # Compute the kernel release of a module. krel_of_module() { declare module=$1 set -- $(/sbin/modinfo -F vermagic "$module") echo "$1" } # Read a list of modules from standard input, convert the filenames into # absolute names, and compute the kernel release of each module. read_modules_list() { local saved_IFS=$IFS IFS=$'\n' modules=($(cat)) IFS=$saved_IFS for ((n = 0; n < ${#modules[@]}; n++)); do if [ ${modules[n]:0:1} != / ]; then modules[n]=$PWD/${modules[n]} fi if [ -f "${modules[n]}" ]; then module_krels[n]=$(krel_of_module "${modules[n]}") else # Try to extract the kernel release from the path set -- "${modules[n]#/lib/modules/}" module_krels[n]=${1%%/*} fi done } doit() { [ -n "$verbose" ] && echo "$@" [ -n "$dry_run" ] || "$@" } usage() { cat <<'EOF' Usage: ${0##*/} [options] {--add-modules|--remove-modules} ${0##*/} [options] {--add-kernel|--remove-kernel} {kernel-release} --add-modules Add a list of modules read from standard input. Create symlinks in compatible kernel's weak-updates/ directory. The list of modules is read from standard input. --remove-modules Remove compatibility symlinks from weak-updates/ directories for a list of modules. The list of modules is read from standard input. --add-kernel Add compatibility symlinks for all compatible modules to the specified or running kernel. --remove-kernel Remove all compatibility symlinks for the specified or current kernel. --verbose Print the commands executed. -dry-run Do not create/remove any files. EOF exit $1 } [ -e /etc/sysconfig/kernel ] && source /etc/sysconfig/kernel unset ${!changed_modules_*} ${!changed_initrd_*} module_has_changed() { declare module=$1 krel=$2 module=${module%.ko} module=${module##*/} eval "changed_modules_${krel//[^a-zA-Z0-9]/_}=$krel" case " $INITRD_MODULES " in *" $module "*) eval "changed_initrd_${krel//[^a-zA-Z0-9]/_}=$krel" ;; esac } options=`getopt -o h --long help,add-modules,remove-modules \ --long add-kernel,remove-kernel,dry-run,verbose -- "$@"` [ $? -eq 0 ] || usage 1 eval set -- "$options" while :; do case "$1" in --add-modules) add_modules=1 ;; --remove-modules) remove_modules=1 ;; --add-kernel) add_kernel=1 ;; --remove-kernel) remove_kernel=1 ;; --dry-run) dry_run=1 ;; --verbose) verbose=1 ;; -h|--help) usage 0 ;; --) shift break ;; esac shift done if [ "$add_modules$remove_modules$add_kernel$remove_kernel" != 1 ]; then usage 1 fi if [ -n "$add_kernel" -o -n "$remove_kernel" ]; then [ $# -gt 1 ] && usage 1 else [ $# -ne 0 ] && usage 1 fi tmpdir=$(mktemp -td ${0##*/}.XXXXXX) trap "rm -rf $tmpdir" EXIT if [ -n "$add_modules" ]; then read_modules_list || exit 1 if [ ${#modules[@]} -gt 0 ]; then for krel in $(ls /lib/modules/); do [ -e /boot/symvers-$krel.gz ] || continue for ((n = 0; n < ${#modules[@]}; n++)); do module=${modules[n]} module_krel=${module_krels[n]} case "$module" in /lib/modules/$krel/*) continue ;; esac subpath=${module#/lib/modules/$module_krel/updates} weak_module=/lib/modules/$krel/weak-updates/${subpath#/} if [ -r "$weak_module" ]; then weak_krel=$(krel_of_module "$weak_module") if [ "$weak_krel" != "$module_krel" ] && [ "$(printf "%s\n" "$weak_krel" "$module_krel" \ | /usr/lib/rpm/rpmsort | head -n 1)" = \ "$module_krel" ]; then # Keep modules from more recent kernels. [ -n "$verbose" ] && echo \ "Keeping module ${module##*/} from kernel $weak_krel for kernel $krel" continue fi fi if module_is_compatible $module $krel; then doit mkdir -p $(dirname $weak_module) doit ln -sf $module $weak_module module_has_changed $module $krel fi done done fi elif [ -n "$remove_modules" ]; then read_modules_list || exit 1 if [ ${#modules[@]} -gt 0 ]; then krels=($(ls /lib/modules/ | /usr/lib/rpm/rpmsort -r)) for krel in "${krels[@]}"; do [ -e /boot/symvers-$krel.gz ] || continue for ((n = 0; n < ${#modules[@]}; n++)); do module=${modules[n]} [ -e "$module" ] && continue module_krel=${module_krels[n]} subpath=${module#/lib/modules/$module_krel/updates} weak_module=/lib/modules/$krel/weak-updates/${subpath#/} if [ "$(readlink "$weak_module")" = "$module" ]; then [ -n "$verbose" ] && echo \ "Removing compatible module ${subpath#/} from kernel $krel" doit rm -f "$weak_module" for krel2 in "${krels[@]}"; do [ -e /boot/symvers-$krel2.gz ] || continue module=/lib/modules/$krel2/updates/${subpath#/} [ -e "$module" ] || continue if module_is_compatible "$module" "$krel2"; then [ -n "$verbose" ] && echo \ "Adding compatible module ${module##*/} from kernel $krel2 instead" doit ln -s "$module" "$weak_module" break fi done doit rmdir --parents --ignore-fail-on-non-empty \ "$(dirname "$weak_module")" module_has_changed $module $krel fi done done fi elif [ -n "$add_kernel" ]; then add_krel=${1:-$(uname -r)} if [ ! -e /boot/symvers-$add_krel.gz ]; then echo "Symvers dump file /boot/symvers-$add_krel.gz" \ "not found" >&2 exit 1 fi for krel in $(ls /lib/modules/ | /usr/lib/rpm/rpmsort -r); do [ "$add_krel" = "$krel" ] && continue [ -d /lib/modules/$krel/updates ] || continue for module in $(find /lib/modules/$krel/updates -name '*.ko'); do subpath=${module#/lib/modules/$krel/updates} weak_module=/lib/modules/$add_krel/weak-updates/${subpath#/} [ -e "$weak_module" ] && continue if module_is_compatible $module $add_krel; then doit mkdir -p $(dirname $weak_module) doit ln -sf $module $weak_module fi done done elif [ -n "$remove_kernel" ]; then remove_krel=${1:-$(uname -r)} weak_modules=/lib/modules/$remove_krel/weak-updates doit rm -rf "$weak_modules" fi for krel in ${!changed_modules_*}; do krel=${!krel} [ -e /boot/System.map-$krel ] || continue /sbin/depmod -ae -F /boot/System.map-$krel $krel done for krel in ${!changed_initrd_*}; do krel=${!krel} [ -e /boot/System.map-$krel ] || continue image= for x in vmlinuz image vmlinux linux bzImage uImage Image; do if [ -f /boot/$x-$krel ]; then image=$x break fi done if [ -n "$image" ]; then if [ -x /sbin/mkinitrd ]; then /sbin/mkinitrd -k /boot/$image-$krel -i /boot/initrd-$krel else echo "Please run mkinitrd as soon as your system is complete." >&2 fi fi done # vim:shiftwidth=4 softtabstop=4 0707010000004B000081A4000000000000000000000001631F4FD50000601B000000000000000000000000000000000000002800000000suse-module-tools-16.0.23/weak-modules2#! /bin/bash ############################################################################## # How it works: # * Kernels install modules below /lib/modules/$krel/kernel/. # * KMPs install modules below /lib/modules/$krel/updates/ or .../extra/. # * Symbolic links to modules of compatible KMPs are created under # /lib/modules/$krel/weak-updates/{updates,extra}/... (the original path # below /lib/modules/$other_krel is used). # * Depmod searches the directories in this order: updates/, extra/, # weak-updates/, kernel/ (see /etd/depmod.conf or # /etc/depmod.d/00-system.conf for details). # * Compatibility of a kernel with a KMP is defined as: The KMP is built # for the same flavor as the kernel and after adding the KMP modules to # the kernel, depmod -e -E Module.symvers reports no errors about # missing symbols or different symbol checksums. See the # has_unresolved_symbols() function for details. # # * At KMP install time (function add_kmp()), we create symbolic links # for all kernels that this KMP is compatible with. We skip kernels that # already contain symbolic links to a newer KMP of the same name, # contain the KMP itself or another version in updates/ or extra/ or # have overlapping module names with other KMPs in the respective # kernel (this should not happen). # * At kernel install time (functions add_kernel()), we create symbolic # links for each compatible KMP, unless the KMP or a different one with # overlapping module names is present in updates/ or extra/ (KMP build # against $krel can be installed before a kernel with that version). # When multiple KMPs of the same name are compatbile, we chose the one # with the highest version number. This is repeated when subsequent # subpackages (main or -extra) of that kernel are installed. # * At KMP removal time (function remove_kmp()), the modules and their # symlinks are removed and, where possible, replaced by symlinks to the # newest of the remaining compatible version of that KMP. # * [NOT IMPLEMENTED] When a kernel subpackage is removed, symlinks to # KMPs that become incompatible are removed as well. This is not # implemented, because removing the main subpackage and only keeping # the -base package AND having KMPs installed is not an expected # scenario, and implementing this would only slow down kernel updates. # * When the kernel is removed (function remove_kernel()), it's # weak-updates directory is also removed. # # naming conventions used in this script: # $kmp: name-version-release of a kmp, e.g kqemu-kmp-default-1.3.0pre11_2.6.25.16_0.1-7.1 # $kmpshort: name of a kmp, e.g kqemu-kmp-default # $basename: portion of $kmp up to the "-kmp-" part, e.g kqemu # $flavor: flavor of a kmp or kernel, e.g default # $krel: kernel version, as in /lib/modules/$krel # $module: full path to a module below updates/ # $symlink: full path to a module symlink below weak-updates/ # # files in $tmpdir: # krel-$kmp: kernel version for which $kmp was built # modules-$kmp: list of modules in $kmp (full paths) # basenames-$kmp: list of basenames of modules in $kmp # kmps: list of kmps, newest first # : ${DRACUT:=/usr/bin/dracut} find_lsinitrd() { local lsi LSINITRD= for lsi in /usr/lib/module-init-tools/lsinitrd-quick /usr/bin/lsinitrd; do if [[ -x $lsi ]]; then LSINITRD=$lsi break fi done if [[ ! "$LSINITRD" ]]; then echo "$0: could not find lsinitrd" >&2 exit 1 fi dlog "LSINITRD=$LSINITRD" } find_depmod() { local _d [[ -x "$DEPMOD" ]] && return DEPMOD= for _d in /usr/sbin /sbin; do if [[ -x ${_d}/depmod ]]; then DEPMOD=${_d}/depmod break; fi done if [[ ! "$DEPMOD" ]]; then echo "ERROR: depmod is not installed - aborting" >&2 exit 1 fi dlog "DEPMOD=$DEPMOD" } find_usrmerge_boot() { local filename=$1 local kver=$2 local ext=${3:+."$3"} local f for f in "/usr/lib/modules/$kver/$filename$ext" "/boot/$filename-$kver$ext" do if [ -e "$f" ]; then echo "$f" return fi done log "WARNING: find_usrmerge_boot: $filename$ext not found for kernel $kver" } log() { [ $opt_verbose -gt 0 ] && echo "$@" >&2 return 0 } dlog() { [ $opt_verbose -gt 1 ] && echo "$@" >&2 return 0 } doit() { if [ -n "$doit" ]; then # override "$@" return fi log "$@" if [ -z "$opt_dry_run" ]; then "$@" else : fi } strip_mod_extensions() { sed -rn '/^_kernel_$/p;s/\.ko(\.[gx]z|\.zst)?$//p' } # Name of the symlink that makes a module available to a given kernel symlink_to_module() { local module=$1 krel=$2 echo /lib/modules/$krel/weak-updates/${module#/lib/modules/*/} } # Is a kmp already present in or linked to from this kernel? __kmp_is_present() { local kmp=$1 krel=$2 if [ $krel = "$(cat $tmpdir/krel-$kmp)" ]; then return 0 fi local module symlink while read module; do symlink=$(symlink_to_module $module $krel) [ $module -ef $symlink -o $module = "$(readlink $symlink)" ] || return 1 done < $tmpdir/modules-$kmp return 0 } kmp_is_present() { __kmp_is_present "$1" "$2" local res=$? dlog "kmp_is_present: kmp=$1 krel=$2 => $res" return $res } # Add the modules of a kmp to /lib/modules/$krel add_kmp_modules() { local kmp=$1 krel=$2 basedir=$3 [ -n "$kmp" ] || return 0 local module symlink while read module; do symlink=$(symlink_to_module $module $krel) doit mkdir -p ${opt_debug:+-v} $basedir${symlink%/*} || exit 1 doit ln -sf ${opt_debug:+-v} $module $basedir$symlink || exit 1 dlog "add_kmp_modules: added $module to $krel" done < $tmpdir/modules-$kmp } # Remove the modules of a kmp from /lib/modules/$krel remove_kmp_modules() { local kmp=$1 krel=$2 basedir=$3 [ -n "$kmp" ] || return 0 local module symlink while read module; do symlink=$(symlink_to_module $module $krel) doit rm -f ${opt_debug:+-v} $basedir$symlink dlog "remove_kmp_modules: removed $module from $krel" done < $tmpdir/modules-$kmp } # Create a temporary working copy of /lib/modules/$1 create_temporary_modules_dir() { local modules_dir=/lib/modules/$1 basedir=$2 local opt_v=${opt_debug:+-v} mkdir -p $opt_v $basedir$modules_dir/weak-updates ln -s $opt_v $modules_dir/kernel $basedir$modules_dir/kernel eval "$(find $modules_dir -path "$modules_dir/modules.*" -prune \ -o -path "$modules_dir/kernel" -prune \ -o -type d -printf "mkdir -p $opt_v $basedir%p\n" \ -o -printf "ln -s $opt_v %p $basedir%p\n" )" } # Check for unresolved symbols has_unresolved_symbols() { local krel=$1 basedir=$2 output status args sym_errors _f if [ ! -e "$tmpdir/symvers-$krel" ]; then _f=$(find_usrmerge_boot symvers "$krel" gz) if [ -n "$_f" ]; then dlog "has_unresolved_symbols: found $_f" zcat "$_f" >"$tmpdir/symvers-$krel" fi fi if [ -e $tmpdir/symvers-$krel ]; then args=(-E $tmpdir/symvers-$krel) else echo "WARNING: symvers.gz not found for $krel, symbol resolution will be unreliable" >&2 _f=$(find_usrmerge_boot System.map "$krel") if [ -n "$_f" ]; then args=(-F "$_f") else echo "WARNING: System.map not found for $krel, symbol resolution may fail" >&2 fi fi output="$("$DEPMOD" -b "$basedir" -ae "${args[@]}" $krel 2>&1)" status=$? if [ $status -ne 0 ]; then echo "$output" >&2 echo "depmod exited with error $status" >&2 return 0 fi sym_errors=$(echo "$output" | \ grep -E ' (needs unknown|disagrees about version of) symbol ') if [ -n "$sym_errors" ]; then [ -z "$opt_debug" ] || echo "$sym_errors" >&2 return 0 fi dlog "has_unresolved_symbols: no errors found for $krel" return 1 } # KMPs can only be added if none of the module basenames overlap basenames_are_unique() { local kmp=$1 krel=$2 basedir=$3 dir for dir in $basedir/lib/modules/$krel/{weak-updates,updates,extra}/; do if [ ! -d "$dir" ]; then continue fi local overlap="$(comm -1 -2 $tmpdir/basenames-$kmp \ <(find "$dir" -not -type d -printf '%f\n' | sort -u))" if [ -n "$overlap" ]; then dlog "basenames_are_unique: found name overlap for $kmp in $dir: " $overlap return 1 fi done dlog "basenames_are_unique: $kmp is unique in $basedir" return 0 } # Can a kmp be replaced by a different version of the same kmp in a kernel? # Set the old kmp to "" when no kmp is to be removed. __can_replace_kmp() { local old_kmp=$1 new_kmp=$2 krel=$3 local basedir=$tmpdir/$krel local weak_updates=/lib/modules/$krel/weak-updates/ [ -d "$basedir" ] || \ create_temporary_modules_dir "$krel" "$basedir" # force doit() to execute the commands (in $tmpdir) doit=1 remove_kmp_modules "$old_kmp" "$krel" "$basedir" if ! basenames_are_unique "$new_kmp" "$krel" "$basedir"; then doit=1 add_kmp_modules "$old_kmp" "$krel" "$basedir" return 1 fi doit=1 add_kmp_modules "$new_kmp" "$krel" "$basedir" if has_unresolved_symbols "$krel" "$basedir"; then doit=1 remove_kmp_modules "$new_kmp" "$krel" "$basedir" doit=1 add_kmp_modules "$old_kmp" "$krel" "$basedir" return 1 fi return 0 } can_replace_kmp() { __can_replace_kmp "$1" "$2" "$3" local res=$? dlog "can_replace_kmp: old=$1 new=$2 krel=$3 => $res" return $res } # Figure out which modules a kmp contains check_kmp() { local kmp=$1 # Make sure all modules are for the same kernel set -- $(sed -re 's:^/lib/modules/([^/]+)/.*:\1:' \ $tmpdir/modules-$kmp \ | sort -u) if [ $# -ne 1 ]; then echo "Error: package $kmp seems to contain modules for multiple" \ "kernel versions" >&2 return 1 fi echo $1 > $tmpdir/krel-$kmp dlog "check_kmp: $kmp contains modules for $1" # Make sure none of the modules are in kernel/ or weak-updates/ if grep -qE -e '^/lib/modules/[^/]+/(kernel|weak-updates)/' \ $tmpdir/modules-$kmp; then echo "Error: package $kmp must not install modules into " \ "kernel/ or weak-updates/" >&2 return 1 fi sed -e 's:.*/::' $tmpdir/modules-$kmp \ | sort -u > $tmpdir/basenames-$kmp dlog "check_kmp: $kmp contains: " $(cat $tmpdir/basenames-$kmp) } # Figure out which kmps there are, and which modules they contain # set basename to '*' to find all kmps of a given flavor find_kmps() { local basename=$1 flavor=$2 local kmp for kmp in $(rpm -qa --qf '%{n}-%{v}-%{r}\n' --nodigest --nosignature "$basename-kmp-$flavor"); do dlog "find_kmps: looking at $kmp" if rpm -q --qf '[%{providename}\n]' --nodigest --nosignature "$kmp" | \ grep -q '^kmp_in_kernel$'; then # KMP built directly from the kernel spec file (fate#319339) continue fi rpm -ql --nodigest --nosignature "$kmp" \ | sed -nr 's:^(/usr)?(/lib/modules/[^/]+/.+\.ko)(\.[gx]z|\.zst)?$:\2\3:p' \ > $tmpdir/modules-$kmp if [ $? != 0 ]; then echo "WARNING: $kmp does not contain any kernel modules" >&2 rm -f $tmpdir/modules-$kmp continue fi check_kmp $kmp || return 1 done printf "%s\n" $tmpdir/basenames-* \ | sed -re "s:$tmpdir/basenames-::" \ | /usr/lib/rpm/rpmsort -r \ > $tmpdir/kmps dlog "find_kmps: kmps found: " $(cat $tmpdir/kmps) } __previous_version_of_kmp() { local new_kmp=$1 krel=$2 local module symlink old_kmp while read module; do symlink=$(symlink_to_module $module $krel) [ -e "$symlink" ] || continue [ -L "$symlink" ] || return old_kmp=$(grep -l "$(readlink "$symlink")" $tmpdir/modules-* | sed 's:.*/modules-::' ) || return # The package %NAME must be the same [ "${old_kmp%-*-*}" == "${new_kmp%-*-*}" ] || return # The other kmp must be older while read kmp; do [ "$kmp" == "$old_kmp" ] && return [ "$kmp" == "$new_kmp" ] && break done <$tmpdir/kmps done < $tmpdir/modules-$new_kmp echo "$old_kmp" } previous_version_of_kmp() { local old="$(__previous_version_of_kmp "$1" "$2")" local res=$? dlog "previous_version_of_kmp: kmp=$1 krel=$2 => $old" echo "$old" return $res } get_initrd_basenames() { $LSINITRD /boot/initrd-$1 | \ sed -rn 's:.*\<lib/modules/.*/::p' | \ strip_mod_extensions INITRD_MODULES= . /etc/sysconfig/kernel &>/dev/null printf '%s\n' $INITRD_MODULES } # test if rebuilding initrd is needed for $krel. # stdin - list of changed modules ("_kernel_" for the whole kernel) needs_initrd() { local krel=$1 # Don't generate an initrd for kdump here. It's done automatically with mkdumprd when # /etc/init.d/boot.kdump is called to load the kdump kernel. See mkdumprd(8) why # it is done this way. if [[ "$krel" == *kdump* ]] ; then return 1 fi if ! [ -f /etc/fstab -a ! -e /.buildenv -a -x "$DRACUT" ] ; then echo "Please run \"$DRACUT -f /boot/initrd-$krel $krel\" as soon as your system is complete." >&2 return 1 fi # KMPs can force initrd rebuild with %kernel_module_package -b that sets # this variable if test -n "$KMP_NEEDS_MKINITRD" && \ ! test "$KMP_NEEDS_MKINITRD" -eq 0 2>/dev/null; then dlog "needs_initrd: yes, KMP_NEEDS_MKINITRD=$KMP_NEEDS_MKINITRD" return 0 fi local changed_basenames=($(strip_mod_extensions | sort -u)) dlog "needs_initrd: changed_basenames: " $changed_basenames if [ "$changed_basenames" = "_kernel_" ]; then dlog "needs_initrd: yes, kernel package" return 0 fi if [ ! -e /boot/initrd-$krel ]; then dlog "needs_initrd: yes, initrd doesn't exist yet" return 0 fi local initrd_basenames=($(get_initrd_basenames "$krel" | sort -u)) dlog "needs_initrd: initrd_basenames: " $initrd_basenames local i=($(join <(printf '%s\n' "${changed_basenames[@]}") \ <(printf '%s\n' "${initrd_basenames[@]}") )) log "changed initrd modules for kernel $krel: ${i[@]-none}" if [ ${#i[@]} -gt 0 ]; then dlog "needs_initrd: yes, modules changed" return 0 fi dlog "needs_initrd: no" return 1 } # run depmod and rebuild initrd for kernel version $krel # stdin - list of changed modules ("_kernel_" for a whole kernel) run_depmod_build_initrd() { local krel=$1 local status=0 local system_map if [ -d /lib/modules/$krel ]; then system_map=$(find_usrmerge_boot System.map "$krel") if [ -n "$system_map" ]; then doit "$DEPMOD" -F "$system_map" -ae "$krel" || return 1 fi fi if needs_initrd $krel; then local image x for x in vmlinuz image vmlinux linux bzImage uImage Image zImage; do image=$(find_usrmerge_boot "$x" "$krel") [ -z "$image" ] || break done if [ -n "$image" ]; then if test -n "$INITRD_IN_POSTTRANS"; then mkdir -p /run/regenerate-initrd doit touch /run/regenerate-initrd/$krel else doit "$DRACUT" -f /boot/initrd-$krel $krel status=$? fi else echo "WARNING: kernel image for $krel not found!" >&2 fi fi return $status } walk_kmps() { local krel=$1 local kmps=( $(cat $tmpdir/kmps) ) while :; do [ ${#kmps[@]} -gt 0 ] || break local added='' skipped='' n kmp for ((n=0; n<${#kmps[@]}; n++)); do kmp=${kmps[n]} [ -n "$kmp" ] || continue dlog "walk_kmps: checking $kmp for $krel" if kmp_is_present $kmp $krel; then log "Package $kmp does not need to be added to kernel $krel" kmps[n]='' continue fi local old_kmp=$(previous_version_of_kmp $kmp $krel) if can_replace_kmp "$old_kmp" $kmp $krel; then remove_kmp_modules "$old_kmp" "$krel" add_kmp_modules "$kmp" "$krel" if [ -z "$old_kmp" ]; then log "Package $kmp added to kernel $krel" else log "Package $old_kmp replaced by package $kmp in kernel $krel" fi added=1 kmps[n]='' continue fi dlog "walk_kmps: skipped $kmp" skipped=1 done [ -n "$added" -a -n "$skipped" ] || break done } kernel_changed() { local krel=$1 flavor=${1##*-} local system_map=$(find_usrmerge_boot System.map "$krel") if [ -z "$system_map" ]; then # this kernel does not exist anymore dlog "kernel_changed: kernel removed" return 0 fi if [ ! -d /lib/modules/$krel ]; then # a kernel without modules - rebuild initrd nevertheless (to mount the # root fs, etc). dlog "kernel_changed: kernel without modules" elif find_kmps '*' $flavor; then walk_kmps "$krel" fi echo "_kernel_" | run_depmod_build_initrd "$krel" } add_kernel() { local krel=$1 kernel_changed $krel } remove_kernel() { local krel=$1 local dir=/lib/modules/$krel if [ -d $dir/weak-updates ]; then rm -rf $dir/weak-updates fi # If there are no KMPs left, remove the empty directory rmdir $dir 2>/dev/null } add_kernel_modules() { local krel=$1 cat >/dev/null kernel_changed $krel } remove_kernel_modules() { local krel=$1 cat >/dev/null # FIXME: remove KMP symlinks that no longer work kernel_changed $krel } add_kmp() { local kmp=$1 kmpshort=${1%-*-*} local basename=${kmpshort%-kmp-*} flavor=${kmpshort##*-} local system_map # Find the kmp to be added as well as any previous versions find_kmps "$basename" "$flavor" || return 1 local dir krel status for dir in /lib/modules/*; do krel=${dir#/lib/modules/} case "$krel" in *-$flavor) ;; *) continue esac dlog "add_kmp: processing $kmp for $krel" [ -d $dir ] || continue system_map=$(find_usrmerge_boot System.map "$krel") [ -n "$system_map" ] || continue if opt_debug=1 has_unresolved_symbols "$krel" "/"; then echo "Warning: /lib/modules/$krel is inconsistent" >&2 echo "Warning: weak-updates symlinks might not be created" >&2 fi if kmp_is_present $kmp $krel; then log "Package $kmp does not need to be added to kernel $krel" run_depmod_build_initrd "$krel" <$tmpdir/basenames-$kmp || \ status=1 continue fi local old_kmp=$(previous_version_of_kmp $kmp $krel) if can_replace_kmp "$old_kmp" $kmp $krel; then remove_kmp_modules "$old_kmp" "$krel" add_kmp_modules "$kmp" "$krel" if [ -z "$old_kmp" ]; then log "Package $kmp added to kernel $krel" run_depmod_build_initrd "$krel" <$tmpdir/basenames-$kmp || \ status=1 else log "Package $old_kmp replaced by package $kmp in kernel $krel" cat $tmpdir/basenames-{$old_kmp,$kmp} \ | run_depmod_build_initrd "$krel" || status=1 fi else dlog "add_kmp: skipped $kmp" fi done dlog "add_kmp: status=$status" return $status } remove_kmp() { local kmp=$1 kmpshort=${1%-*-*} local basename=${kmpshort%-kmp-*} flavor=${kmpshort##*-} # Find any previous versions of the same kmp find_kmps "$basename" "$flavor" || return 1 # Read the list of module names from standard input # (This kmp may already have been removed!) sed 's:^/usr::' > $tmpdir/modules-$kmp check_kmp "$kmp" || return 1 local dir krel status system_map for dir in /lib/modules/*; do krel=${dir#/lib/modules/} case "$krel" in *-$flavor) ;; *) continue esac [ -d $dir ] || continue system_map=$(find_usrmerge_boot System.map "$krel") [ -n "$system_map" ] || continue dlog "remove_kmp: processing $kmp for $krel" if kmp_is_present $kmp $krel; then local other_found=0 inconsistent=0 if opt_debug=1 has_unresolved_symbols "$krel" "/" \ >$tmpdir/unresolved-"$krel" 2>&1; then inconsistent=1 fi if [ $krel != "$(cat $tmpdir/krel-$kmp)" ]; then remove_kmp_modules "$kmp" "$krel" fi local other_kmp while read other_kmp; do [ "$kmp" != "$other_kmp" ] || continue other_found=1 dlog "remove_kmp: checking other KMP $other_kmp" if can_replace_kmp "" "$other_kmp" "$krel"; then add_kmp_modules "$other_kmp" "$krel" break fi done < $tmpdir/kmps if [ -n "$other_kmp" ]; then log "Package $kmp replaced by package $other_kmp in kernel $krel" cat $tmpdir/basenames-{$kmp,$other_kmp} \ | run_depmod_build_initrd "$krel" || status=1 else log "Package $kmp removed from kernel $krel" if [ $other_found -eq 1 ]; then log "Weak-updates symlinks to no other $kmpshort package could be created" if [ $inconsistent -eq 1 ]; then echo "Warning: /lib/modules/$krel was inconsistent before removal of $kmp" >&2 [ -s $tmpdir/unresolved-"$krel" ] && \ cat $tmpdir/unresolved-"$krel" fi fi run_depmod_build_initrd "$krel" <$tmpdir/basenames-$kmp || \ status=1 fi rm -f $tmpdir/unresolved-"$krel" fi done dlog "remove_kmp: status=$status" return $status } help() { cat <<EOF ${0##*/} --add-kmp kmp-name-version-release To be called in %post of kernel module packages. Creates symlinks in compatible kernel's weak-updates/ directory and rebuilds the initrd if needed. ${0##*/} --remove-kmp kmp-name < module-list To be called in %postun of kernel module packages. Removes weak-updates/ symlinks for this KMP. As the KMP doesn't exist in the RPM database at this point, the list of modules has to be passed on standard input. Rebuilds the initrd if needed. ${0##*/} --add-kernel kernel-release To be called in %post of the kernel base package. Adds compatibility symlinks for all compatible KMPs and rebuilds the initrd if needed. ${0##*/} --remove-kernel kernel-release To be called in %postun of the kernel base package. Removes all compatibility symlinks. ${0##*/} --add-kernel-modules kernel-release < module-list To be called in %post of kernel subpackages that only contain modules (i.e. not kernel-*-base). Adds newly available compatibity symlinks and rebuilds the initrd if needed. ${0##*/} --remove-kernel-modules kernel-release < module-list To be called in %postun of kernel subpackages that only contain modules (i.e. not kernel-*-base). Removes no longer working compatibity symlinks and rebuilds the initrd if needed. ${0##*/} --verbose ... Print commands as they are executed and other information. ${0##*/} --dry-run ... Do not perform any changes to the system. Useful together with --verbose for debugging. EOF } usage() { echo "Usage:" help | sed -n 's/^[^[:blank:]]/ &/p' } ############################################################################## save_argv=("$@") options=`getopt -o vh --long add-kernel,remove-kernel,add-kmp,remove-kmp \ --long add-kernel-modules,remove-kernel-modules \ --long usage,help,verbose,dry-run,debug,logfile: -- "$@"` if [ $? -ne 0 ]; then usage >&2 exit 1 fi eval set -- "$options" mode= opt_logfile=$WM2_LOGFILE case $WM2_VERBOSE in [0-3]) opt_verbose=$WM2_VERBOSE ;; *) opt_verbose=0 ;; esac case $WM2_DEBUG in 1) opt_debug=1 ;; *) opt_debug= ;; esac while :; do case "$1" in --add-kernel | --remove-kernel | --add-kernel-modules | \ --remove-kernel-modules | --add-kmp | --remove-kmp ) mode="$1" ;; -v | --verbose) opt_verbose=$((opt_verbose + 1)) ;; --dry-run) opt_dry_run=1 ;; --debug) opt_debug=1 ;; --logfile) shift opt_logfile=$1 ;; --usage) usage exit 0 ;; -h | --help) help exit 0 ;; --) shift break ;; esac shift done err= case "$mode" in "") err="Please specify one of the --add-* or --remove-* options" ;; --add-kernel | --remove-kernel) if [ $# -gt 1 ]; then err="Too many arguments to $mode" fi [ $# -eq 1 ] || set -- $(uname -r) ;; *) if [ $# -ne 1 ]; then err="Option $mode requires exactly one argument" fi ;; esac if [ -n "$err" ]; then echo "ERROR: $err" >&2 usage >&2 exit 1 fi if [ -n "$opt_logfile" ]; then [ "${opt_logfile#/}" != "$opt_logfile" ] || opt_logfile="/var/log/$opt_logfile" echo "${0##/*}: appending output to $opt_logfile" >&2 exec 2>>"$opt_logfile" fi if [ $opt_verbose -gt 2 ]; then set -x # tracing will print everything, no need to print in log() opt_verbose=$((opt_verbose - 3)) fi #unset LANG LC_ALL LC_COLLATE find_depmod find_lsinitrd tmpdir=$(mktemp -d /var/tmp/${0##*/}.XXXXXX) trap "rm -rf $tmpdir" EXIT shopt -s nullglob case $mode in --add-kernel) add_kernel "$1" ;; --remove-kernel) remove_kernel "$1" ;; --add-kernel-modules) add_kernel_modules "$1" ;; --remove-kernel-modules) remove_kernel_modules "$1" ;; --add-kmp) add_kmp "$1" ;; --remove-kmp) remove_kmp "$1" esac # vim:shiftwidth=4 softtabstop=4 07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000B00000000TRAILER!!!263 blocks
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor