<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Gregor</id>
	<title>Alpine Linux - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Gregor"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/Gregor"/>
	<updated>2026-05-01T14:31:41Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Software_management&amp;diff=22058</id>
		<title>Software management</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Software_management&amp;diff=22058"/>
		<updated>2022-07-04T12:29:59Z</updated>

		<summary type="html">&lt;p&gt;Gregor: Adding a description of how to use the chrooted glibc directly from the host, and cleaning up a bit&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;If you want to run [https://www.gnu.org/software/libc/ glibc] programs in Alpine Linux, there are a few ways of doing so. You can install the [https://git.adelielinux.org/adelie/gcompat gcompat] compatibility layer, you can install glibc alongside [https://musl.libc.org/ musl] (manually, as it isn&#039;t packaged), or you could do it the easy way and use either Flatpak (the easiest) or a chroot.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because there are different use cases, this is just a slight overview about what&#039;s possible and what&#039;s sensible.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Your options =&lt;br /&gt;
&lt;br /&gt;
== gcompat ==&lt;br /&gt;
&lt;br /&gt;
[https://git.adelielinux.org/adelie/gcompat gcompat] is the go-to compatibility layer for Alpine users.&lt;br /&gt;
&lt;br /&gt;
 {{cmd|apk add gcompat}}&lt;br /&gt;
&lt;br /&gt;
After that you run your binaries as normal.&lt;br /&gt;
&lt;br /&gt;
== Flatpak ==&lt;br /&gt;
&lt;br /&gt;
Flatpak is by far the easiest method of running any graphical glibc program on Alpine.&lt;br /&gt;
Firstly install it.&lt;br /&gt;
&lt;br /&gt;
 {{cmd|doas apk add flatpak}}&lt;br /&gt;
&lt;br /&gt;
Then you can run any Flatpak application:&lt;br /&gt;
&lt;br /&gt;
 {{cmd|flatpak run &amp;lt;flatpak name&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
It is recommended to enable [https://flathub.org Flathub] using its instructions [https://flatpak.org/setup/Alpine/ here], as most glibc programs you might need will be packaged there.&lt;br /&gt;
&lt;br /&gt;
You can then install applications from it, for example:&lt;br /&gt;
&lt;br /&gt;
 {{cmd|flatpak install com.valvesoftware.Steam}}&lt;br /&gt;
&lt;br /&gt;
== Chroot ==&lt;br /&gt;
&lt;br /&gt;
An option that&#039;s easier to generalize to other glibc applications is installing a glibc-based distribution into a chroot. You can then either chroot into it, or use a symlink and some configuration to make its glibc (and associated libraries) usable from Alpine.&lt;br /&gt;
&lt;br /&gt;
After setting up a chroot using any of the methods described below, the loader can be set up in Alpine like so (these instructions are for a Debian chroot in /var/chroots/debian, on x86_64, but can be adapted to other systems by using the appropriate paths):&lt;br /&gt;
&lt;br /&gt;
 mkdir -p /lib64&lt;br /&gt;
 ln -s /var/chroots/debian/lib/x86_64-linux-gnu/ld-2.33.so /lib64&lt;br /&gt;
 printf &#039;/var/chroots/debian/lib/x86_64-linux/gnu\n/var/chroots/debian/usr/lib/x86_64-linux-gnu\n&#039; &amp;gt; /etc/ld.so.conf&lt;br /&gt;
 /var/chroots/debian/sbin/ldconfig&lt;br /&gt;
&lt;br /&gt;
=== Gentoo Linux ===&lt;br /&gt;
&lt;br /&gt;
Select a stage3 from [https://www.gentoo.org/downloads/ here] and portage latest from [https://www.gentoo.org/downloads/mirrors/ here] at gentoo/snapshots/portage-latest.tar.xz.&lt;br /&gt;
&lt;br /&gt;
First,&lt;br /&gt;
&lt;br /&gt;
 sudo apk add xz&lt;br /&gt;
&lt;br /&gt;
Enter the chroot:&lt;br /&gt;
 mkdir ~/chroot&lt;br /&gt;
 cd ~/chroot&lt;br /&gt;
 tar -xvf stage3-*.tar.xz&lt;br /&gt;
 tar -xvf portage-latest.tar.xz&lt;br /&gt;
 mv portage usr&lt;br /&gt;
 sudo mount --bind /dev dev&lt;br /&gt;
 sudo mount --bind /sys sys&lt;br /&gt;
 sudo mount -t proc proc proc&lt;br /&gt;
 cp /etc/resolv.conf etc&lt;br /&gt;
 sudo chroot . /bin/bash&lt;br /&gt;
&lt;br /&gt;
And voilà, you have your working Gentoo chroot!&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now take a look at [https://wiki.gentoo.org/wiki/Handbook:Main_Page Gentoo&#039;s Handbook] to find out how you can configure and install your system, or simply extract/copy the program you need to run in your chroot enviroment and execute it.&lt;br /&gt;
&lt;br /&gt;
Here is a wrapper script that is similar to &amp;lt;code&amp;gt;arch-chroot&amp;lt;/code&amp;gt; when you frequently reuse this chroot:&lt;br /&gt;
&lt;br /&gt;
Also, create an account with the same user name as host current user to the chroot or make changes to the userspec option to chroot line.&lt;br /&gt;
&lt;br /&gt;
{{Cat|gentoo-chroot.sh|&amp;lt;nowiki&amp;gt;!/bin/bash&lt;br /&gt;
CHROOT_PATH=&amp;quot;/home/$USER/chroot&amp;quot;&lt;br /&gt;
cd $CHROOT_PATH&lt;br /&gt;
mount | grep $CHROOT_PATH/dev || sudo mount --bind /dev dev&lt;br /&gt;
mount | grep $CHROOT_PATH/sys || sudo mount --bind /sys sys&lt;br /&gt;
mount | grep $CHROOT_PATH/proc || sudo mount -t proc proc proc&lt;br /&gt;
cp /etc/resolv.conf etc&lt;br /&gt;
sudo chroot --userspec=$USER:users . /bin/bash&lt;br /&gt;
echo &amp;quot;You must manually unmount $CHROOT_PATH/dev, $CHROOT_PATH/sys, $CHROOT_PATH/proc.&amp;quot;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Do at &amp;lt;code&amp;gt;chmod +x gentoo-chroot.sh&amp;lt;/code&amp;gt; to get it to work.&lt;br /&gt;
&lt;br /&gt;
=== Arch Linux ===&lt;br /&gt;
&lt;br /&gt;
Either use &#039;&#039;&#039;pacstrap&#039;&#039;&#039; (included with the arch-install-scripts package) or an Arch bootstrap image:&lt;br /&gt;
&lt;br /&gt;
  sudo apk add arch-install-scripts&lt;br /&gt;
  mkdir ~/chroot &amp;amp;&amp;amp; cd ~/chroot&lt;br /&gt;
  curl -O https://mirrors.edge.kernel.org/archlinux/iso/latest/archlinux-bootstrap-2021.04.01-x86_64.tar.gz{{dead link}}&lt;br /&gt;
  sudo tar xzf archlinux-bootstrap-2021.04.01-x86_64.tar.gz &amp;amp;&amp;amp; rm archlinux-bootstrap-2021.04.01-x86_64.tar.gz&lt;br /&gt;
  sudo sed -i &#039;/evowise/s/^#//&#039; root.x86_64/etc/pacman.d/mirrorlist&lt;br /&gt;
  sudo sed -i &#039;/CheckSpace/s/^/#/&#039; root.x86_64/etc/pacman.conf&lt;br /&gt;
  sudo arch-chroot root.x86_64&lt;br /&gt;
  [chroot]# pacman-key --init&lt;br /&gt;
  [chroot]# pacman-key --populate archlinux&lt;br /&gt;
&lt;br /&gt;
Once that is done, update the system and install the desired package(s) (denoted by &#039;&#039;&amp;quot;foo&amp;quot;&#039;&#039; in this example):&lt;br /&gt;
  &lt;br /&gt;
  [chroot]# pacman -Syu &#039;&#039;foo&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Debian ===&lt;br /&gt;
&lt;br /&gt;
Use the provided debootstrap package to create the Debian chroot. &amp;lt;code&amp;gt;--arch&amp;lt;/code&amp;gt; is optional, depending of your needs.&lt;br /&gt;
&lt;br /&gt;
On the &#039;&#039;&#039;linux-grsec&#039;&#039;&#039; kernel, you will need to relax chroot limitations:&lt;br /&gt;
&lt;br /&gt;
  sudo apk add debootstrap&lt;br /&gt;
  for i in /proc/sys/kernel/grsecurity/chroot_*; do echo 0 | sudo tee $i; done&lt;br /&gt;
  mkdir ~/chroot&lt;br /&gt;
  sudo debootstrap --arch=i386 wheezy ~/chroot http://http.debian.net/debian/&lt;br /&gt;
  for i in /proc/sys/kernel/grsecurity/chroot_*; do echo 1 | sudo tee $i; done&lt;br /&gt;
  sudo chroot ~/chroot /bin/bash&lt;br /&gt;
&lt;br /&gt;
You can now use &amp;lt;code&amp;gt;apt-get&amp;lt;/code&amp;gt; to install needed packages.&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Installation]]&lt;/div&gt;</summary>
		<author><name>Gregor</name></author>
	</entry>
</feed>