- How to work with Alpine Linux. There is an official Alpine Linux image available, along with various tags for various release versions. By default, there is only a root account. Alpine Linux comes with BusyBox, a suite of Unix utilities. To run a base Alpine Linux image, use the command docker run with flags to initialize and tag for Alpine.
- By default, bash is not included with BusyBox and Alpine Linux. The postmarketOS project, which is designed to run on mobile devices, is based on Alpine Linux. Many Docker images are also based upon Alpine, and you may install bash shell in Docker-based images too. This page shows how to install a bash shell in Alpine Linux using the apk command.
- 3Installing packages
- 3.2Setting up Xorg
First of all, make sure the sudo package is installed in your Alpine Linux system. By default, sudo is not installed. To install sudo in Alpine Linux as root user, run: # apk update # apk add sudo. Next, let us create a new user in Alpine Linux and grant sudo privileges to the newly created user. Create a sudo user in Alpine Linux.
Start by booting up Alpine (see these instructions on how to do that)
When you Alpine is up and running, do the initial setup.
# setup-alpine
# setup-xorg-base
Install basic desktop system and gnome packages. As of right now, these are in the testing repo.
This might take a few minutes depending on your network speed.
# apk add gnome
If you want to you can also install additional GNOME apps for a more complete GNOME experience with:
# apk add gnome-apps
Setting up udev
You'll have to enable udev in order for GNOME to function properly.
# apk add udev
# rc-update add udev
# rc-update add udev-trigger
# rc-update add udev-settle
Setting up Xorg
Even when using GNOME Wayland you'll still need a setup Xorg for XWayland.
Video packages
$ apk search xf86-video
Then install the driver matching to your card, e.g. if you have an Intel iGPU:
# apk add xf86-video-intel
Also add the mesa-dri-swrast package:
# apk add mesa-dri-swrast
Input packages
Usually libinput is the best choice, as it's integrated best with GNOME and offers advanced functionality (e.g. palm rejection for touchpads).
# apk add xf86-input-libinput
Start GDM and login with your user. You need a user other than root for this to succeed, since GDM will refuse starting if no user accounts (meaning accounts with a UID >= 1000) are available.
rc-service gdm start
Once you have verified that it actually works you can make gdm start up at boot:
rc-update add gdm
If you want to use the gnome-terminal/other terminal applications you will need to install bash. If you want a typical bash setup also enable bash completion:
Alpine Linux Bash Path
# apk add bash
# apk add bash-completion
If you are unable to login, check /var/log/gdm/greeter.log, there may be output there from X to indicate failed modules, etc.
If logging in from GDM returns to logging screen, try
# apk add bash
(bug report: #10953 sorry cannot link yet)
If you want to run glibc programs in Alpine Linux, there are a few ways of doing so. You could install glibc as additional to musl (you would have to do this manually), or you could do it the easy way and use either Flatpak (the easiest) or a chroot.
Because there are different use cases, this is just a slight overview about what's possible and what's intelligent.
- 1Your options
- 1.2Chroot
Flatpak
Flatpak is by far the easiest method of running any graphical glibc program on Alpine.Firstly install it.
Then you can run any Flatpak application:
It is recommended to enable Flathub using it's instructions here, as most glibc programs you might need will be packaged there.
You can then install applications from it, for example:
Chroot
Gentoo Linux
Select a stage3 from here and portage latest from here at gentoo/snapshots/portage-latest.tar.xz.
First,
Enter the chroot:
And voilĂ , you have your working Gentoo chroot!
You can now take a look at Gentoo'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.
Here is a wrapper script that is similar to arch-chroot
when you frequently reuse this chroot:
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.
Alpine Linux Bash Commands
Contents of gentoo-chroot.sh
Do at chmod +x gentoo-chroot.sh
to get it to work.
Arch Linux
Either use pacstrap (included with the arch-install-scripts package) or an Arch bootstrap image:
Once that is done, update the system and install the desired package(s) (denoted by 'foo' in this example):
Debian
Alpine Linux Bash App
Use the provided debootstrap package to create the Debian chroot. --arch
is optional, depending of your needs.
On the linux-grsec kernel, you will need to relax chroot limitations:
You can now use apt-get
to install needed packages.