[arch-general] Installing base unattended without specific packages

Eli Schwartz eschwartz at archlinux.org
Thu May 16 14:51:17 UTC 2019

On 5/16/19 7:44 AM, Sefa Eyeoglu via arch-general wrote:
> On Mittwoch, 15. Mai 2019 15:12:13 CEST Eli Schwartz via arch-general wrote:
>> On 5/14/19 5:08 PM, Sefa Eyeoglu via arch-general wrote:
>>> Hey fellow Arch Users,
>>> I am currently playing around with the GitLab CI and automatic building of
>>> Arch packages. My modified Arch Linux Docker image should include base
>>> and base- devel, but without all of the kernel and hardware stuff.
>>> This is the command, that does not work as expected:
>>> pacman -Syu --needed --noconfirm --noprogressbar --ignore linux,linux-
>>> firmware base base-devel git
>>> The packages linux and linux-firmware still get installed. I would prefer
>>> if there would be a way to install base, but without all of the
>>> irrelevant stuff for containers. I would propose something like
>>> base-container for this group.
>> The --ignore flag does not do what you think it does, it just has the
>> same result as if you had listed it in pacman.conf in IgnorePkg
>> Note the documentation: "Directs pacman to ignore upgrades of package
>> even if there is one available."
>> If you explicitly specify both packages on the command-line (which you
>> did when you listed "base") then they will still get installed.
>> Actually, pacman will interactively prompt you about whether you
>> actually want to install them, and --noconfirm will default to "yes".
>> This is relevant e.g. when you have "linux" ignored because you don't
>> want to upgrade it with every pacman -Syu, but you do want to,
>> occasionally, update it manually -- if IgnorePkg stopped you from
>> specifying it on the command line, then it would be literally impossible
>> to ever update, without modifying your config files in /etc, then
>> running a manual update, then reverting your config files in /etc.
>> I do not foresee us changing --ignorepkg to operate with a different
>> codepath following different rules that differ from IgnorePkg, both
>> because I think this is misuse of the feature, and because users will
>> then confuse the two and think they are the same when they are not.
>> ...
>> OTOH you can achieve your desired goal like this:
>> $ pacman -Sqg base| grep -Fxv -f <(printf 'linux-firmware\nlinux\n')
>> # see list of packages in base, minus two that you want to exclude
>> This list can be further piped to pacman -S -
> Thanks for all of your replies. I just decided on just removing linux and 
> linux-firmware afterwards, as it is the cleanest solution for me. As it is just 
> a docker image I am building I don't really care about build time as it is 
> built weekly and just used for packaging. I was just hoping, that there would 
> be an easy way to exclude packages from a group uninteractively. But just 
> removing them is good enough for me. Thanks for all your suggestions though.

pacman is not designed to be scriptable, you could however use pacutils.

$ pacsift --repo core --exact --group base | pacsift --exact --invert
--name linux --name linux-firmware | sudo pacinstall.

Honestly, using a pipeline of simple unix tools seems reasonable to me.

Far more reasonable than removing the packages after the fact, since
docker layers will result in you carrying around the uninstalled content
anyway, unless you are already doing semi-complicated scripting things
in a single docker run command.

Eli Schwartz
Bug Wrangler and Trusted User

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 1601 bytes
Desc: OpenPGP digital signature
URL: <https://lists.archlinux.org/pipermail/arch-general/attachments/20190516/8a3144d1/attachment.sig>

More information about the arch-general mailing list