How to get regular stuff working: Difference between revisions

From Alpine Linux
(rephrased sentence to add clarity, added info on lsusb,lspci and less)
Line 4: Line 4:
{{Main|GNU core utilities}}
{{Main|GNU core utilities}}


Most of the basic file, shell and text manipulation utilities commonly grouped under [https://en.wikipedia.org/wiki/List_of_GNU_Core_Utilities_commands Core Utilities] are provided by [[BusyBox]]. To replace it with original {{pkg|coreutils}} package:
Most of the basic file, shell and text manipulation utilities commonly grouped under [https://en.wikipedia.org/wiki/List_of_GNU_Core_Utilities_commands Core Utilities] are provided by [[BusyBox]]. To replace it with original {{pkg|coreutils}} package:{{Cmd|# apk add {{pkg|coreutils}}}}


{{Cmd|# apk add {{pkg|coreutils}}}}
== Util-linux  ==
 
A set of approximately 100 basic Linux system utilities not included in GNU Core Utilities, such as <code>mount</code>, <code>cfdisk</code>, <code>more</code>, <code>lsblk</code> and <code>kill</code> are maintained under [https://en.wikipedia.org/wiki/Util-linux Util-linux]. To have the complete {{pkg|util-linux}} package:{{Cmd|# apk add {{pkg|util-linux}}}}


== Util-linux  ==
The full featured file pager utility <code>less</code> can be installed from the {{pkg|less}} package.
A set of approximately 100 basic Linux system utilities not included in GNU Core Utilities, such as <code>mount</code>, <code>cfdisk</code>, <code>more</code>, <code>lsblk</code> and <code>kill</code> are maintained under [https://en.wikipedia.org/wiki/Util-linux Util-linux]. To have the complete {{pkg|util-linux}} package:
{{Cmd|# apk add {{pkg|util-linux}}}}


== Search utilities  ==
== Search utilities  ==
Standard search tools <code>grep</code> and <code>find</code> can be installed by installing the packages {{pkg|grep}} and {{pkg|findutils}} as follows:
 
{{Cmd|# apk add  {{pkg|grep}} {{pkg|findutils}} }}
Standard search tools <code>grep</code> and <code>find</code> can be installed by installing the packages {{pkg|grep}} and {{pkg|findutils}} as follows:{{Cmd|# apk add  {{pkg|grep}} {{pkg|findutils}} }}


== Bash shell ==  
== Bash shell ==  
{{Main|Change default shell}}
{{Main|Change default shell}}
The default shell used by Alpine Linux is the busybox variant of the [[BusyBox#Ash_shell|ash shell]]. To install {{pkg|bash}}:
The default shell used by Alpine Linux is the busybox variant of the [[BusyBox#Ash_shell|ash shell]]. To install {{pkg|bash}} shell: {{Cmd|# apk add {{pkg|bash}} {{pkg|bash-completion}}}}
{{Cmd|# apk add {{pkg|bash}} {{pkg|bash-completion}}}}


== Hardware Management ==
== Hardware Management ==
Line 29: Line 28:
== Disk Management ==
== Disk Management ==


Managing (removable) disks is much easier with udisks.
Managing (removable) disks is much easier with udisks. {{Cmd|# apk add {{pkg|udisks2}}}}


{{Cmd|# apk add {{pkg|udisks2}}}}
To see the mounted disks:{{Cmd|# udisksctl status}}
 
To see the mounted disks:
 
{{Cmd|# udisksctl status}}


== Network Management ==
== Network Management ==
For network, you may want to install {{pkg|iproute2}}.


{{Cmd|# apk add {{pkg|iproute2}}}}  
For network, you may want to install {{pkg|iproute2}}. {{Cmd|# apk add {{pkg|iproute2}}}}  


== Subpackages and missing functionality  ==
== Subpackages and missing functionality  ==
In Alpine Linux, binary packages are thinned out and split into subpackages to give you more control over what you install, which in turn keeps your environment as small and efficient as possible. When a package is installed in Alpine Linux, no assumption is made on what subpackage the user wants, so one may get the false impression of missing functionality.


For eg: the {{pkg|networkmanager}} package for [https://networkmanager.dev/ NetworkManager], a popular network configuration tool is split into 20+ subpackages. If the user installs {{pkg|networkmanager}} package, usual commands like <Code>nmcli</Code>, <Code>nmtui</Code> will not be available. Similarly installing {{pkg| network-manager-applet}} will not allow you to manage Wifi networks. In Alpine Linux, the user is expected to identify and add the required subpackages e.g. {{pkg|networkmanager-cli}}, {{pkg|networkmanager-tui}} & {{pkg|networkmanager-wifi}} to get above functionalities. In other Linux distributions, above features plus unwanted features like bluetooth, adsl, wwan, vpn, l2tp, ppp etc are installed along with their dependencies.
In Alpine Linux, binary packages are thinned out and split into subpackages to give more control over what features are installed and keeps the installation as small and efficient as possible. When a package is installed in Alpine Linux, no assumption is made on what features the user wants, so the user might get a false impression of missing functionality.
 
For eg: the {{pkg|networkmanager}} package for [https://networkmanager.dev/ NetworkManager], a popular network configuration tool is split into 20+ subpackages based on features. If the user installs {{pkg|networkmanager}} package or {{pkg|network-manager-applet}} only the NetworkManager utility and the applet will get installed. To manage Wifi networks or to use commands like <Code>nmcli</Code> and <Code>nmtui</Code> the user is expected to add the required subpackages {{pkg|networkmanager-wifi}}, {{pkg|networkmanager-cli}} and {{pkg|networkmanager-tui}} respectively to get above functionalities. In other Linux distributions when NetworkManager is installed, all the features like wifi, applet, nmtui, nmcli, bluetooth, adsl, wwan, vpn, l2tp, ppp etc are automatically installed along with their dependencies.  


Use [https://pkgs.alpinelinux.org/packages package database] or {{Codeline|<Code>apk search <pkgname></Code>}} to find subpackages related to a package.
Use [https://pkgs.alpinelinux.org/packages package database] or {{Codeline|<Code>apk search <pkgname></Code>}} to find subpackages related to a package.


== Development environment ==
== Development environment ==

Revision as of 15:26, 15 February 2025

Alpine Linux is built around Musl libc and BusyBox. This makes it small and very resource efficient. The utilities in BusyBox generally have fewer options and hence missing some functionality when used to daily drive. This page explains how to get the regular utilities working as found in other Linux distributions.

Core utilities

Most of the basic file, shell and text manipulation utilities commonly grouped under Core Utilities are provided by BusyBox. To replace it with original coreutils package:

# apk add coreutils

Util-linux

A set of approximately 100 basic Linux system utilities not included in GNU Core Utilities, such as mount, cfdisk, more, lsblk and kill are maintained under Util-linux. To have the complete util-linux package:

# apk add util-linux

The full featured file pager utility less can be installed from the less package.

Search utilities

Standard search tools grep and find can be installed by installing the packages grep and findutils as follows:

# apk add grep findutils

Bash shell

The default shell used by Alpine Linux is the busybox variant of the ash shell. To install bash shell:

# apk add bash bash-completion

Hardware Management

Install pciutils and usbutils for identifying and configuring PCI and USB hardware using the full featured version of lspci and lsusb commands respectively.

# apk add pciutils usbutils

The packages hwdata-pci and hwdata-usb are dependencies for the above utilities and they are installed automatically. These packages can be removed once the hardware configuration has been completed.

Disk Management

Managing (removable) disks is much easier with udisks.

# apk add udisks2

To see the mounted disks:

# udisksctl status

Network Management

For network, you may want to install iproute2.

# apk add iproute2

Subpackages and missing functionality

In Alpine Linux, binary packages are thinned out and split into subpackages to give more control over what features are installed and keeps the installation as small and efficient as possible. When a package is installed in Alpine Linux, no assumption is made on what features the user wants, so the user might get a false impression of missing functionality.

For eg: the networkmanager package for NetworkManager, a popular network configuration tool is split into 20+ subpackages based on features. If the user installs networkmanager package or network-manager-applet only the NetworkManager utility and the applet will get installed. To manage Wifi networks or to use commands like nmcli and nmtui the user is expected to add the required subpackages networkmanager-wifi, networkmanager-cli and networkmanager-tui respectively to get above functionalities. In other Linux distributions when NetworkManager is installed, all the features like wifi, applet, nmtui, nmcli, bluetooth, adsl, wwan, vpn, l2tp, ppp etc are automatically installed along with their dependencies.

Use package database or apk search <pkgname> to find subpackages related to a package.

Development environment

Compiling in Alpine Linux may be more challenging because it uses musl-libc instead of glibc. The build-base meta package provides regular compiler stuff such as binutils, gcc, g++, make etc..

# apk add build-base

The alpine-sdk meta package is provided to build packages for Alpine Linux. It includes abuild, build-base, and git.

# apk add alpine-sdk

To install CMake:

# apk add cmake extra-cmake-modules

ccache and a lot other tools are also available in Alpine Linux.