<?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=Manoel</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=Manoel"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/Manoel"/>
	<updated>2026-04-30T14:18:14Z</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=27139</id>
		<title>Software management</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Software_management&amp;diff=27139"/>
		<updated>2024-08-25T00:06:47Z</updated>

		<summary type="html">&lt;p&gt;Manoel: GlibMus-HQ!&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), containers 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;
= Your options =&lt;br /&gt;
&lt;br /&gt;
== gcompat ==&lt;br /&gt;
&lt;br /&gt;
gcompat is the go-to compatibility layer for Alpine users.&lt;br /&gt;
&lt;br /&gt;
 {{cmd|apk add {{pkg|gcompat}}}}&lt;br /&gt;
&lt;br /&gt;
After that you run your binaries as normal.&lt;br /&gt;
&lt;br /&gt;
== GlibMus-HQ ==&lt;br /&gt;
&lt;br /&gt;
GlibMus-HQ is the go-to compatibility layer for Alpine users. Made in C++, it offers enhanced compatibility.&lt;br /&gt;
&lt;br /&gt;
Before running the shell script, ensure you have the necessary dependencies: sudo and bash. Install them with the following command:&lt;br /&gt;
&lt;br /&gt;
 {{cmd|apk add {{pkg|sudo bash git}}}}&lt;br /&gt;
&lt;br /&gt;
Next, clone the repository, navigate to the directory, make the script executable, and run it:&lt;br /&gt;
&lt;br /&gt;
 {{cmd|git clone https://gitlab.com/manoel-linux1/GlibMus-HQ.git&lt;br /&gt;
cd GlibMus-HQ &lt;br /&gt;
chmod a+x compile-your_arch-alpine-linux.sh&lt;br /&gt;
./compile-your_arch-alpine-linux.sh}}&lt;br /&gt;
&lt;br /&gt;
After completing these steps, you can run your binaries as usual.&lt;br /&gt;
&lt;br /&gt;
To update GlibMus-HQ, simply repeat the installation steps.&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|apk add {{pkg|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;
{{cmd|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;
{{cmd|doas apk add {{pkg|xz}}}}&lt;br /&gt;
&lt;br /&gt;
Enter the chroot:&lt;br /&gt;
{{cmd|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;
doas mount --bind /dev dev&lt;br /&gt;
doas mount --bind /sys sys&lt;br /&gt;
doas mount -t proc proc proc&lt;br /&gt;
cp /etc/resolv.conf etc&lt;br /&gt;
doas 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 || doas mount --bind /dev dev&lt;br /&gt;
mount | grep $CHROOT_PATH/sys || doas mount --bind /sys sys&lt;br /&gt;
mount | grep $CHROOT_PATH/proc || doas mount -t proc proc proc&lt;br /&gt;
cp /etc/resolv.conf etc&lt;br /&gt;
doas 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;
{{cmd|doas apk add {{pkg|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-x86_64.tar.gz&lt;br /&gt;
doas tar xzf archlinux-bootstrap-x86_64.tar.gz &amp;amp;&amp;amp; rm archlinux-bootstrap-x86_64.tar.gz&lt;br /&gt;
doas sed -i &#039;/evowise/s/^#//&#039; root.x86_64/etc/pacman.d/mirrorlist&lt;br /&gt;
doas sed -i &#039;/CheckSpace/s/^/#/&#039; root.x86_64/etc/pacman.conf&lt;br /&gt;
doas 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;
{{cmd|[chroot]# pacman -Syu &#039;&#039;foo&#039;&#039;}}&lt;br /&gt;
&lt;br /&gt;
=== Debian ===&lt;br /&gt;
{{todo|gresec referencs need to be cleanly removed from this section.}}&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 https://deb.debian.org/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;
== Containers ==&lt;br /&gt;
&lt;br /&gt;
It&#039;s also possible to use Docker or Podman containers with a helper like Distrobox. This allows using graphical programs easily and doesn&#039;t require root privileges once set up.&lt;br /&gt;
&lt;br /&gt;
{{cmd|# apk add {{pkg|distrobox}}}}&lt;br /&gt;
&lt;br /&gt;
=== Distrobox + Podman ===&lt;br /&gt;
&lt;br /&gt;
{{cmd|# apk add {{pkg|podman}}}}&lt;br /&gt;
&lt;br /&gt;
Then set up rootless Podman, following [[Podman|these steps]].&lt;br /&gt;
You&#039;ll need to mount your root as shared for Distrobox to function.&lt;br /&gt;
&lt;br /&gt;
Fill in {{path|/etc/local.d/mount-rshared.start}} like so:&lt;br /&gt;
&lt;br /&gt;
{{cmd|#!/bin/sh&lt;br /&gt;
mount --make-rshared /}}&lt;br /&gt;
&lt;br /&gt;
Mark it as executable.&lt;br /&gt;
&lt;br /&gt;
{{cmd|# chmod +x /etc/local.d/mount-rshared.start}}&lt;br /&gt;
&lt;br /&gt;
Then autostart its service.&lt;br /&gt;
&lt;br /&gt;
{{cmd|# rc-update add local default&lt;br /&gt;
&amp;amp;#35; rc-service local start}}&lt;br /&gt;
&lt;br /&gt;
Finally you can create a container using your chosen image.&lt;br /&gt;
&lt;br /&gt;
{{cmd|$ distrobox create --image debian --name debian&lt;br /&gt;
$ distrobox enter debian}}&lt;br /&gt;
&lt;br /&gt;
It may also be necessary to allow X authorization for GUI programs to work.&lt;br /&gt;
&lt;br /&gt;
{{cmd|$ xhost +si:localuser:$USER}}&lt;br /&gt;
&lt;br /&gt;
== Chroot + Bubblewrap ==&lt;br /&gt;
&lt;br /&gt;
It&#039;s also possible to use a Debian system chroot with Bubblewrap. This allows running programs without root.&lt;br /&gt;
&lt;br /&gt;
{{cmd|# apk add bubblewrap debootstrap&lt;br /&gt;
&amp;amp;#35; mkdir -p /var/chroots/debian&lt;br /&gt;
&amp;amp;#35; debootstrap --arch amd64 stable /var/chroots/debian/ https://deb.debian.org/debian}}&lt;br /&gt;
&lt;br /&gt;
Finally we can make an alias for bwrap.&lt;br /&gt;
&lt;br /&gt;
{{cmd|$ alias glibc{{=}}&amp;quot;LANG{{=}}en_US.UTF-8 bwrap --bind /var/chroots/debian / --dev-bind /dev /dev --proc /proc --bind /sys /sys --bind /run /run --bind /home /home --ro-bind /etc/resolv.conf /etc/resolv.conf --ro-bind /etc/passwd /etc/passwd --ro-bind /etc/group /etc/group&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
To run programs that use X11/Xorg you can use: &lt;br /&gt;
{{cmd|$ alias glibcX11{{=}}&amp;quot;LANG{{=}}en_US.UTF-8 bwrap --bind /var/chroots/debian / --dev-bind /dev /dev --proc /proc --bind /sys /sys --bind /run /run --bind /home /home --ro-bind /etc/resolv.conf /etc/resolv.conf --ro-bind /etc/passwd /etc/passwd --ro-bind /etc/group /etc/group --bind /tmp/.X11-unix/X0 /tmp/.X11-unix/X0 --setenv DISPLAY :0&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
In this case you might need to use xhost to allow local connections, e.g.:&lt;br /&gt;
{{cmd|# xhost + local:}}&lt;br /&gt;
&lt;br /&gt;
Now we can invoke glibc-built binaries like so:&lt;br /&gt;
{{cmd|$ glibc ./binary}} or {{cmd|$ glibcX11 ./binary}} &lt;br /&gt;
&lt;br /&gt;
For updating the Chroot or installing dependencies we can mount it and then login as root:&lt;br /&gt;
{{cmd|# mount --bind /dev /var/chroots/debian/dev&lt;br /&gt;
&amp;amp;#35; mount --bind /proc /var/chroots/debian/proc&lt;br /&gt;
&amp;amp;#35; chroot /var/chroots/debian /bin/bash&lt;br /&gt;
&amp;amp;#35; apt update &amp;amp;&amp;amp; apt upgrade}}&lt;br /&gt;
&lt;br /&gt;
After installing what you might want to umount the binds for dev and proc to avoid issues. &lt;br /&gt;
{{cmd|# umount /var/chroots/debian/dev}}&lt;br /&gt;
{{cmd|# umount /var/chroots/debian/proc}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Installation]]&lt;/div&gt;</summary>
		<author><name>Manoel</name></author>
	</entry>
</feed>