Chroot-script for removerepos in opensuse leap 15.4


Through a chroot-script, I am trying to disable using the following script the openSUSE repositories.


zypper mr -d 1
zypper mr -d 2
zypper mr -d 3
zypper mr -Ka

The error: “zypper: command not found”.

What I need is, when the Backports are being downloaded from “” in the second stage, this step skip automatically, because my computer is in a local domain that does not reach that URL.


Did you check value of PATH environment variable when script runs?

The complete error:

+ zypper mr -d 1
/mnt/var/adm/autoinstall/scripts/ line2: zypper: command not found

I add in the autoyast the parameter:

<chrooted config:type="boolean">true</chrooted>

And now, the error is:

System management is blocked by application with pid 3891 (/usr/bin/ruby.ruby2.5).
Please close the application before trying again.

Complete script now:

    <chroot-scripts config:type="list">
	    <chrooted config:type="boolean">true</chrooted>
zypper removerepo repo-source 1
zypper removerepo repo-source 2
zypper removerepo repo-source 3
zypper removerepo repo-source 4
zypper removerepo repo-source 5
zypper mr -Ka

I never use ar or rr or mr with zypper. I simply change the content of /etc/zypp/repos.d/ to exclude *.repo files I don’t want enabled, and include those I do. I do this via simple filename changes with mc, to end or not with “o”. It’s quick and easy, very little typing involved.

Read documentation where id talks about setting ZYPP_LOCKFILE_ROOT to avoid it.

That’s bad idea. The repository definition will be installed again should package providing it be updated. This happens, even if not that often. Modified file will not be overwritten. Besides, are you sure repository numbers never change? Using names is less fragile.

Finally, as already mentioned, there is no need to use zypper, you can just edit repository definition directly.

Apart from the very obvious fact that this is about non-interactive installation so suggesting interactive tool means you did not even attempt to understand the question, renaming these particular repository definitions is bad idea as I already explained.

I don’t assume all OPs are clueless. Understanding how repo files are used, and renaming files with mv rather than zypper mr could conceivably avoid OP’s issue.

Explained where and when? Renames of /etc/zypp/repos.d/* has been SOP here for well over a decade. Files in /etc/zypp/repos.d/ not ending in *.repo IME are normally ignored by zypper and YaST, but may be discarded via an offline upgrade.


Thank you very much for your help.
Do you mean renaming the repositories in the script like this?

echo "Rename Repositories"
mv /etc/zypp/repos.d/openSUSE-Leap-15.4-1.repo /etc/zypp/repos.d/NoUse1
mv /etc/zypp/repos.d/repo-backports-update.repo /etc/zypp/repos.d/NoUse2
mv /etc/zypp/repos.d/repo-sle-update.repo /etc/zypp/repos.d/NoUse3

I do not mean renaming them. Just set to disabled.

andrei@leap154:~> cat /etc/zypp/repos.d/repo-sle-update.repo
name=Update repository with updates from SUSE Linux Enterprise 15

Just change enabled=1 to enabled=0.

SOLVED! Thanks for your help!

echo "Rename Repositories"
mv /etc/zypp/repos.d/openSUSE-Leap-15.4-1.repo /etc/zypp/repos.d/openSUSE-Leap-15.4-1.repoX
mv /etc/zypp/repos.d/repo-backports-update.repo /etc/zypp/repos.d/repo-backports-update.repoX
mv /etc/zypp/repos.d/repo-sle-update.repo /etc/zypp/repos.d/repo-sle-update.repoX

Package management ignores /etc/zypp/repos.d/ files that do not end in .repo, effectively disabling them. Andrei’s method is the official method. I do it my way to keep the file file content unmodified and thus the timestamp unmodified, so that I may know by viewing a directory list whether all is as I left it:

# ls -gG /etc/zypp/repos.d/*.repo
-rw-r--r-- 1 176 Jun 10  2020 /etc/zypp/repos.d/FCL.repo
-rw-r--r-- 1 219 Jun  8  2022 /etc/zypp/repos.d/KDE3.repo
-rw-r--r-- 1 153 Jun  8  2022 /etc/zypp/repos.d/NonOSS.repo
-rw-r--r-- 1 143 Jun  8  2022 /etc/zypp/repos.d/OSS.repo
-rw-r--r-- 1 235 Jun  8  2022 /etc/zypp/repos.d/Packman.repo
-rw-r--r-- 1 270 Jun  8  2022 /etc/zypp/repos.d/PackmanE.repo
-rw-r--r-- 1 129 Jun  8  2022 /etc/zypp/repos.d/Update.repo
-rw-r--r-- 1 239 Jun  8  2022 /etc/zypp/repos.d/UpdateBP.repo
-rw-r--r-- 1 145 Jun  8  2022 /etc/zypp/repos.d/UpdateNonOSS.repo
-rw-r--r-- 1 135 Jun  8  2022 /etc/zypp/repos.d/UpdateSLE.repo
-rw-r--r-- 1 310 Apr 25 17:19 /etc/zypp/repos.d/homeBelphegorBelbelKDE3.repo
-rw-r--r-- 1 192 Feb  8 21:10 /etc/zypp/repos.d/openh264.repo

Jun 8 2022 is the date 15.4 was officially released.

1 Like