After a lot of yak shaving, I managed to add some debugging to apt:
apt/apt-pkg/contrib/fileutl.cc:3364
return _error->Error("Could not switch saved set-user-ID (expected %lu
got %lu)", (unsigned long) pw->pw_uid, (unsigned long) suid);
(added the typecast to be sure printf isn't doing anything unexpected)
This returns:
Reading package lists... Done
E: Method gave invalid 400 URI Failure message: Could not switch saved
[set-user-ID] (expected 42 got 2752512)
Comparing these two values:
42 0x2A
2752512 0x2A0000
uid_t is defined as:
/usr/include/sparc64-linux-gnu/sys/types.h:typedef __uid_t uid_t;
/usr/include/sparc64-linux-gnu/bits/types.h:__STD_TYPE __UID_T_TYPE
__uid_t; /* Type of user identifications. */
/usr/include/sparc64-linux-gnu/bits/typesizes.h:#define __UID_T_TYPE
__U32_TYPE
/usr/include/sparc64-linux-gnu/bits/types.h:#define __U32_TYPE
unsigned int
struct passwd uses:
__uid_t pw_uid; /* User ID. */