You are not logged in.

#1 2014-01-31 14:16:25

Rexilion
Member
Registered: 2013-12-23
Posts: 784

64bit kernel with 32bit userspace + pacman integration

There have been quite some questions about this topic. Sometimes leading even leading to frustration.

Luckily, a nice writeup was made here with a nice addition to integrate this nicely here.

Since there is no 32bit PAE kernel distributed by ArchLinux, using a 64bit kernel to enable NX is the only option. But since it only has 1G of memory, I do not wish to install a 64bit userspace + 32bit multilib.

However, the *exact* steps have been quite a guess (and there is no wiki). That is why I'm writing this down.

  • Let's start with the main configuration: pacman.conf

    We need to comment out the Architecture stanza. It's funky. Why? Because it actually has two unrelated purposes:

    • As a documented feature, it provides protection against installing incorrect packages from another architecture

    • The undocumented feature is the fact that it's literal value is used to replace '$arch' variables in repo URL's

    ...
    #Architecture = auto
    ...

    Syncing your local repo's just broke as '$arch' is no longer defined (try it now). I ditched /etc/pacman.d/mirrorlist and did this with my remote repo URL's:

    ...
    # custom repo for 64bit kernel
    [x86_64-kernel]
    Server = file:///home/$user/x86_64-kernel/
    
    ...
    
    [core]
    Server = http://ftp.nluug.nl/pub/os/Linux/distr/archlinux/core/os/i686
    
    ...
    
    [extra]
    Server = http://ftp.nluug.nl/pub/os/Linux/distr/archlinux/extra/os/i686
    
    ...
    
    [community]
    Server = http://ftp.nluug.nl/pub/os/Linux/distr/archlinux/community/os/i686
    ...

    Notice the new custom repo at the top of the file. Adapt your pacman.conf to contain this custom repo as well. Make sure you place it before the [core] repo or whatever other repo is providing your current kernel. The order matters.

    Furthermore, I rewrote the configuration file to not depend on variable substitution. One could argue that substituting $repo was unnecessary, but that does not really matter.

  • Second, we setup the repository as a normal user. This can be done by a regular user in a safe way since the packages are all signed. So tampering with packages will not work. You could even dedicate a cron script with a dedicated user to this purpose (which is overkill).

    mkdir /home/$user/x86_64-kernel/
  • Third, we use a small script to handle this custom repo. We place it at /home/$user/x86_64-kernel.sh . Subsitute the variable R_REPO with your favorite ArchLinux mirror. Make sure this URL points to a 64bit core repository.

    #!/bin/bash
    
    set -e
    set -o pipefail
    
    L_REPO=/home/$user/x86_64-kernel/
    R_REPO=http://ftp.nluug.nl/pub/os/Linux/distr/archlinux/core/os/x86_64/
    
    cd "$L_REPO"
    wget -nv "$R_REPO"/core.db -O core.db
    
    DESC=$(tar -tf core.db | grep '^linux-[0-9.-]*/desc$' | tail -n1)
    KERNELPKG=$(tar -xf core.db "$DESC" -O | grep -A1 '^%FILENAME%$' | tail -n1)
    
    if ! [[ -f "$KERNELPKG" ]]; then
    	wget -nv "$R_REPO"/"$KERNELPKG"
    	wget -nv "$R_REPO"/"$KERNELPKG".sig
    	repo-add -q x86_64-kernel.db.tar.gz "$KERNELPKG"
    fi
  • Now we are in fact done with the configuration. Substiture $user for your current user in all the sections and do the following:

     # create repo, this script also updates it when newer 64bit kernels arrive
    user $ bash /home/$user/x86_64-kernel.sh
    # update pacman's database
    root # pacman -Syy
    # install 64bit kernel
    root # pacman -S linux

Pacman will be able to update this kernel as long as you run x86_64-kernel.sh every once in a while. I put it in XFCE session startup to run at each session login. You could do this with cron as well.

I tested what hapenned if something went wrong with this repo. Pacman handles this very nicely actually. If you delete the repository, it will complain but not immediatly install the 32bit kernel given you have a 64bit already installed with this repo.

A final note: If you build a lot of packages you could run into trouble. Someone in the forums made a good suggestion about that here -> ("init=linux32 /usr/lib/systemd/..."). This is a nice system-wide way to trick your buildsystem into believing it's a 32bit machine. This is sometimes required. I don't use as I don't have a problem with it. But keep this in mind.

EDIT: Fixed update script to overwrite core.db and not create new ones like core.db.n .

Last edited by Rexilion (2014-02-01 15:41:29)


fs/super.c : "Self-destruct in 5 seconds.  Have a nice day...\n",

Offline

#2 2014-01-31 15:59:07

nomorewindows
Member
Registered: 2010-04-03
Posts: 3,408

Re: 64bit kernel with 32bit userspace + pacman integration

There is a linux-pae repo at http://pae.archlinux.ca.


I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces...
Look ma, no mouse.

Offline

#3 2014-01-31 16:07:27

Rexilion
Member
Registered: 2013-12-23
Posts: 784

Re: 64bit kernel with 32bit userspace + pacman integration

That is nice. Pity I did not know about this earlier. However, my method allows me to stick with the official packages. Thanks though!


fs/super.c : "Self-destruct in 5 seconds.  Have a nice day...\n",

Offline

Board footer

Powered by FluxBB