FS#42257 - [pacman] pacman.conf, change "Architecture = auto" to actual architecture

Attached to Project: Arch Linux
Opened by Max Bruckner (FSMaxB) - Sunday, 05 October 2014, 12:15 GMT
Last edited by Allan McRae (Allan) - Wednesday, 08 October 2014, 01:10 GMT
Task Type Feature Request
Category Packages: Core
Status Closed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Currently there's this line in /etc/pacman.conf
Architecture = auto

This creates problems when chrooting from a system with a 64 bit kernel to an i686 archlinux installation. In this case when installing software without changing "auto" to "i686", pacman will install x86_64 packages into the i686 system.

This is a problem for example when working with containers or remastering the installer ISO, because it's easy to forget to change pacman.conf before installing software.

Therefore I suggest changing it to
Architecture = i686
in the i686 version of the package and to
Architecture = x86_64
in the x86_64 version of the package.
This task depends upon

Closed by  Allan McRae (Allan)
Wednesday, 08 October 2014, 01:10 GMT
Reason for closing:  Won't implement
Comment by Allan McRae (Allan) - Sunday, 05 October 2014, 13:06 GMT
I chroot into an i686 system with Architecture = auto from a 64 bit one and update all the time. No problems...

Can you post a pacman debug log of the failing?
Comment by Max Bruckner (FSMaxB) - Sunday, 05 October 2014, 13:34 GMT
Okay, I mounted the airootfs.img from the i686 directory of the install cd, used arch-chroot to chroot into, did "pacman -Sy" and then "pacman -S vim --debug 2>1 | tee pacman.debug"

The attachment contains the output of the second command.

In this case pacman didn't install anything because of missing keys ( because I didn't -Syu ) but it clearly documents that it's downloading the x86_64 packages, not the i686 ones!
Comment by Allan McRae (Allan) - Sunday, 05 October 2014, 13:38 GMT
That is not debug output. You want "2>&1"
Comment by Max Bruckner (FSMaxB) - Sunday, 05 October 2014, 13:41 GMT
pacman -S is behaving fine actually, the problem seems to be "pacman -Sy" and "pacman -Syy"

This time I used "pacman -Syy 2>&1 | tee pacman-Syy.debug"
Comment by Max Bruckner (FSMaxB) - Sunday, 05 October 2014, 13:44 GMT
Let me explain my last point:

When I change Architecture to i686, then "pacman -Syy", then change Architecture to auto and do "pacman -S", everything works fine. But as soon as I do "pacman -Sy" (even without 2 y) again, it replaces the database files with the x86_64 ones.
Comment by Allan McRae (Allan) - Sunday, 05 October 2014, 13:53 GMT
How are you using arch-chroot? You will need to run "setarch i686 arch-chroot /path" or equivalently "linux32 arch-chroot ...".

If you run "uname" within your chroot, you will see pacman is detecting your actual architecture correctly.
Comment by Max Bruckner (FSMaxB) - Sunday, 05 October 2014, 14:00 GMT
No, I didn't use setarch. I meant this as a feature request concerning the default value of "Architecture" in "pacman.conf" only to get rid of this potential point of failure. It's just a convenience thing.
Comment by Max Bruckner (FSMaxB) - Sunday, 05 October 2014, 14:15 GMT
I just thought that things are easier if they "just work", so you can update packages inside a 32 bit chroot without having to think about the architecture. Of course it isn't perfect to chroot without setarch, but I don't think there are much packages that call "uname" on installation. "grep -r uname | wc -l" in /var/abs shows 85 matches, probably most, if not all of them call uname only at compile time, so it should be reasonably safe to update a system via chroot without using setarch.
Comment by Allan McRae (Allan) - Sunday, 05 October 2014, 14:19 GMT
The whole point of the Architecture config is to not allow you to install packages for a different architecture. So installing i686 packages on an x86_64 system will fail whether it is set to auto or i686.
Comment by Max Bruckner (FSMaxB) - Sunday, 05 October 2014, 14:29 GMT
So you agree that it doesn't make sense to install non i686 packages in a system where the i686 version of pacman has been installed. Therefore it should be no problem to put "Architecture = i686" in pacman.conf.i686 and "Architecture = x86_64" in pacman.conf.x86_64
Comment by Allan McRae (Allan) - Sunday, 05 October 2014, 15:00 GMT
I think it makes no sense to enter an i686 chroot from and x86_64 system without using setarch/linux32. Anything beyond that I consider the fault of the user.
Comment by Max Bruckner (FSMaxB) - Sunday, 05 October 2014, 15:04 GMT
There are some users out there ( I'd say it's the majority ) that don't even know about setarch (like my past self for example).
Comment by Max Bruckner (FSMaxB) - Sunday, 05 October 2014, 15:21 GMT
If you tell me a good reason ( that I can understand, preferably ) why "Architecture" should remain "auto", I'll be statisfied. I'm just trying to understand why it is the way it is and if there is a reason that I wasn't able to come up with. If there isn't, I don't see why not to change it.
Comment by Allan McRae (Allan) - Monday, 06 October 2014, 00:13 GMT
To build an i686 chroot on x86_64 you only need to do this is Architecture = auto

# mkdir -p /home/chroot/tmp/var/lib/pacman/
# setarch i686 sudo pacman -r /home/chroot/tmp -Sy base

And given you will fail to install packages without using setarch with Architecture - auto or Architecture = i686, you have not given a good reason to change it.
Comment by Max Bruckner (FSMaxB) - Tuesday, 07 October 2014, 09:59 GMT
Ok, now I see, installing a container with "setarch i686 sudo pacman ..." isn't possible without having "Architecture" set to "auto". Also "auto" enables copying pacman.conf across architectures ( except for the multilib repositories ). You have convinced me that changing the default isn't desirable, thanks.

Loading...