• Inconsistent results for checking whether the OS is 32 or 64 bit

    From Adam Funk@a24061@ducksburg.com to comp.sys.raspberry-pi on Wed Jul 17 15:03:00 2024
    From Newsgroup: comp.sys.raspberry-pi

    Hi

    I have a Pi 4 B that I use headlessly over SSH. I can't remember
    whether I installed the 32-bit or 64-bit OS on it, but different
    commands found on the web give different results.

    $ uname -m
    aarch64

    $ getconf LONG_BIT
    32

    $ dpkg --print-architecture
    armhf

    Which one is right?

    Thanks
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Theo@theom+news@chiark.greenend.org.uk to comp.sys.raspberry-pi on Wed Jul 17 16:50:59 2024
    From Newsgroup: comp.sys.raspberry-pi

    Adam Funk <a24061@ducksburg.com> wrote:
    Hi

    I have a Pi 4 B that I use headlessly over SSH. I can't remember
    whether I installed the 32-bit or 64-bit OS on it, but different
    commands found on the web give different results.

    $ uname -m
    aarch64

    $ getconf LONG_BIT
    32

    $ dpkg --print-architecture
    armhf

    Which one is right?

    That sounds like a 32 bit OS on 64 bit hardware. Not sure if uname -m is
    the kernel or the hardware, but perhaps you're running a 32 bit userland on
    a 64 bit kernel?

    Seems that Pi OS switched to a 64 bit kernel on the Pi4 in March 2023: https://github.com/raspberrypi/firmware/issues/1795

    It looks like 'getconf' returns glibc parameters, which would be 32 bit on a
    32 bit userland.

    Theo
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From nospam.Dan.Clough@nospam.Dan.Clough@f1.n770.z15354.fidonet.org (Dan Clough) to Adam Funk on Wed Jul 17 12:23:00 2024
    From Newsgroup: comp.sys.raspberry-pi

    Adam Funk wrote to All <=-

    I have a Pi 4 B that I use headlessly over SSH. I can't remember
    whether I installed the 32-bit or 64-bit OS on it, but different
    commands found on the web give different results.

    $ uname -m
    aarch64

    $ getconf LONG_BIT
    32

    $ dpkg --print-architecture
    armhf

    Which one is right?

    On my Pi4B, which I know has a 64-bit OS installed, I get:

    $ uname -m
    aarch64

    $ getconf LONG_BIT
    64

    dpkg --print-architecture
    arm64

    So.... I'd say you have a 32-bit OS installed.

    The "uname -m" reports on the device HARDWARE, not software/kernel, so
    your results make sense.



    ... So easy, a child could do it. Child sold separately.
    === MultiMail/Linux v0.52
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.sys.raspberry-pi on Wed Jul 17 22:00:51 2024
    From Newsgroup: comp.sys.raspberry-pi

    On Wed, 17 Jul 2024 15:03:00 +0100, Adam Funk wrote:

    I have a Pi 4 B that I use headlessly over SSH. I can't remember whether
    I installed the 32-bit or 64-bit OS on it, but different commands found
    on the web give different results.

    Try looking at a representable executable, e.g. /bin/bash:

    file /bin/bash

    On my (admittedly AMD64) machine, I get

    /bin/bash: ELF 64-bit LSB pie executable, ...

    but that initial part should not be architecture-specific.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From nospam.Christian.Vanguers@nospam.Christian.Vanguers@f2226.n292.z2.fidonet.org (Christian Vanguers) to Adam Funk on Thu Jul 18 11:11:18 2024
    From Newsgroup: comp.sys.raspberry-pi


    Hello Adam!

    17 Jul 24 15:03, you wrote to all:

    $ uname -m
    aarch64

    This shows your kernel is 64-bit

    $ getconf LONG_BIT
    32

    This indicates that the user applications are compiled for a 32-bit architecture.

    $ dpkg --print-architecture
    armhf

    This shows the distribution you have installed is for the 32-bit ARM architecture

    Which one is right?

    The mix you have is because Raspbian (Raspberry Pi OS) can be installed with a 64-bit kernel while using 32-bit user space applications.
    It is a common configuration to maximize compatibility while allowing the benefits of a 64-bit kernel.

    If you want to run a fully 64-bit system on your RPi 4B, I'm afraid you got to reinstall.

    Otherwise it's not a problem at all to run a 32-bit user space on a 64-bit kernel. But be aware that some packages or apps may have copatibility issues.


    Christian
    LPIC-1/LPIC-2/LPIC-3 Security certified

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From druck@news@druck.org.uk to comp.sys.raspberry-pi on Thu Jul 18 21:29:14 2024
    From Newsgroup: comp.sys.raspberry-pi

    On 17/07/2024 23:11, Christian Vanguers wrote:
    The mix you have is because Raspbian (Raspberry Pi OS) can be installed with a
    64-bit kernel while using 32-bit user space applications.
    It is a common configuration to maximize compatibility while allowing the benefits of a 64-bit kernel.

    I ran that configuration on my Pi 4B's for years.

    If you want to run a fully 64-bit system on your RPi 4B, I'm afraid you got to
    reinstall.

    You can just install a fresh 64 bit Bookworm and set it all up again
    from scratch. But if you have a lot of customisation of your existing
    system it is fairly straightforward to move to from 32 bit Buster to 64
    bit Buster. You can then upgrade from Buster to Bookworm if desired.

    1. Fully upgrade your existing 32 bit system
    2. Make a list of all installed 32 bit packages
    3. Install the 64 bit image of the same OS release on a new card
    (or another partition on a SSD, which is easier)
    4. Fully update the new 64 bit system
    5. Make a list of the installed 64 bit packages
    6. Install any packages you had installed on the 32 bit system that
    aren't on the 64 bit one (if available)
    7. Copy over your /home and /root folder from the 32 bit system
    8. Copy over your /etc folder from the 32 bit system
    9. Reboot

    Step 8 is the bit which could give problems, but I didn't encounter any
    by following the above as the package versions are identical which
    generally means the configuration files are compatible.

    Steps 7 & 8 ensure the machine key and all ssh keys are preserved, so
    the machine will slot back to your network with trusted relationships maintained.

    ---druck

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Adam Funk@a24061@ducksburg.com to comp.sys.raspberry-pi on Sun Jul 21 19:23:09 2024
    From Newsgroup: comp.sys.raspberry-pi

    On 2024-07-17, Christian Vanguers wrote:

    17 Jul 24 15:03, you wrote to all:

    $ uname -m
    aarch64

    This shows your kernel is 64-bit

    $ getconf LONG_BIT
    32

    This indicates that the user applications are compiled for a 32-bit architecture.

    $ dpkg --print-architecture
    armhf

    This shows the distribution you have installed is for the 32-bit ARM architecture

    Which one is right?

    The mix you have is because Raspbian (Raspberry Pi OS) can be installed with a
    64-bit kernel while using 32-bit user space applications.

    OK, that makes sense because I also get

    $ file /lib/systemd/systemd
    /lib/systemd/systemd: ELF 32-bit LSB pie executable, ARM, [ETC.]

    It is a common configuration to maximize compatibility while allowing the benefits of a 64-bit kernel.

    I'm starting to wonder if I just moved the SD card and external USB
    drive from a 2 to a 4B when I got the 4B and kept upgrading. Would
    that explain this situation?



    If you want to run a fully 64-bit system on your RPi 4B, I'm afraid you got to
    reinstall.

    Oh, I'm not surprised by that. It will be a bit of a nuisance because
    the SD card is only used for /boot --- everything else is on the
    external drive.
    --
    The Internet is like a big city: it has plenty of bright lights and
    excitement, but also dark alleys down which the unwary get mugged.
    (Charlie Gibbs)
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Adam Funk@a24061@ducksburg.com to comp.sys.raspberry-pi on Sun Jul 21 19:24:56 2024
    From Newsgroup: comp.sys.raspberry-pi

    On 2024-07-17, Theo wrote:

    Adam Funk <a24061@ducksburg.com> wrote:
    Hi

    I have a Pi 4 B that I use headlessly over SSH. I can't remember
    whether I installed the 32-bit or 64-bit OS on it, but different
    commands found on the web give different results.

    $ uname -m
    aarch64

    $ getconf LONG_BIT
    32

    $ dpkg --print-architecture
    armhf

    Which one is right?

    That sounds like a 32 bit OS on 64 bit hardware. Not sure if uname -m is
    the kernel or the hardware, but perhaps you're running a 32 bit userland on
    a 64 bit kernel?

    That does seem to be the case.


    Seems that Pi OS switched to a 64 bit kernel on the Pi4 in March 2023: https://github.com/raspberrypi/firmware/issues/1795

    "After updating 32 bit Raspi OS Pi 4 is on 64bit kernel" --- yes, that
    would explain it. Thanks!



    It looks like 'getconf' returns glibc parameters, which would be 32 bit on a 32 bit userland.

    Theo
    --
    Master Foo once said to a visiting programmer: "There is more
    Unix-nature in one line of shell script than there is in ten
    thousand lines of C." ---Eric Raymond
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Theo@theom+news@chiark.greenend.org.uk to comp.sys.raspberry-pi on Mon Jul 22 11:35:18 2024
    From Newsgroup: comp.sys.raspberry-pi

    Adam Funk <a24061@ducksburg.com> wrote:
    I'm starting to wonder if I just moved the SD card and external USB
    drive from a 2 to a 4B when I got the 4B and kept upgrading. Would
    that explain this situation?

    It looks like it was changed in an update. I think the Pi maintains
    multiple kernels in /boot, so it's possible the same SD card will boot with
    a 64-bit kernel on a Pi4 and 32-bit kernel on a Pi2 (especially the v1.0 Pi2 with a Cortex A7 which doesn't support 64 bit).

    So it may not be that moving the card has affected it, just that the single
    '32 bit' Pi OS boots a different kernel depending on which hardware you put
    the card into.

    (this has caused some troubles for build systems which use uname -m to work
    out whether to build 32 or 64: it returns 64, but the right answer is 32.
    The same would happen with a 32 bit chroot on a 64 bit x86)

    Theo
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Adam Funk@a24061@ducksburg.com to comp.sys.raspberry-pi on Mon Jul 22 14:27:57 2024
    From Newsgroup: comp.sys.raspberry-pi

    On 2024-07-22, Theo wrote:

    Adam Funk <a24061@ducksburg.com> wrote:
    I'm starting to wonder if I just moved the SD card and external USB
    drive from a 2 to a 4B when I got the 4B and kept upgrading. Would
    that explain this situation?

    It looks like it was changed in an update. I think the Pi maintains
    multiple kernels in /boot, so it's possible the same SD card will boot with
    a 64-bit kernel on a Pi4 and 32-bit kernel on a Pi2 (especially the v1.0 Pi2 with a Cortex A7 which doesn't support 64 bit).

    Right.


    So it may not be that moving the card has affected it, just that the single '32 bit' Pi OS boots a different kernel depending on which hardware you put the card into.

    Well, if I had done a fresh install on a 4B, I would have picked the
    64-bit option, so the 32-bit userland is a vestige of that.


    (this has caused some troubles for build systems which use uname -m to work out whether to build 32 or 64: it returns 64, but the right answer is 32. The same would happen with a 32 bit chroot on a 64 bit x86)

    Ouch. Fortunately I haven't run into that.
    --
    With the breakdown of the medieval system, the gods of chaos, lunacy,
    and bad taste gained ascendancy. ---Ignatius J Reilly
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From druck@news@druck.org.uk to comp.sys.raspberry-pi on Mon Jul 22 21:17:02 2024
    From Newsgroup: comp.sys.raspberry-pi

    On 22/07/2024 11:35, Theo wrote:
    Adam Funk <a24061@ducksburg.com> wrote:
    I'm starting to wonder if I just moved the SD card and external USB
    drive from a 2 to a 4B when I got the 4B and kept upgrading. Would
    that explain this situation?

    It looks like it was changed in an update. I think the Pi maintains
    multiple kernels in /boot, so it's possible the same SD card will boot with
    a 64-bit kernel on a Pi4 and 32-bit kernel on a Pi2 (especially the v1.0 Pi2 with a Cortex A7 which doesn't support 64 bit).

    Yes there are multiple kernels, and on suitable machines you can change
    from 32 to a 64 bit kernel by putting this in line /boot/config.txt

    arm_64bit=1

    ---druck
    --- Synchronet 3.20a-Linux NewsLink 1.114