nyuuzyou/wikis huggingface dataset:
Suspend on LID close

This article explains how to make your laptop go to Suspend when closing the LID.
== acpid2 ==
acpid2 (provided by package ) is a flexible and extensible daemon with Netlink support for delivering ACPI events.
The default handler script () installed with the package provides support for suspend on LID close out of the box.
We recommend installing along with to get support for pre/post suspend hooks etc.
# Install and : 
# Enable and start the acpid daemon: 
== Busybox acpid ==
This can be done via Busybox acpid with a hook in :
# with zzz: 
# or with pm-utils: 
# or with raw variant: 
Make the hook executable:
That should be it. To make sure that the acpid daemon is running, execute:
== elogind ==
Use elogind to trigger suspend and use doas to grant normal user such permissions.
Install elogind:
 apk add elogind
 rc-update add elogind
 rc-service elogind start
Now suspend on lid close should be working as expected.
For normal user to trigger suspend, install doas:
 apk add doas
Configure doas in /etc/doas.conf:
 permit nopass $USER as root cmd /bin/loginctl
You should now be able to suspend the computer as a normal user, using the full path to executable.
= See Also =
* zzz
* pm-suspend vs systemd...
* Archwiki pm-utils (archived page)
Category:Power Management
category: Desktop
Syslog

Syslog collects log data from multiple programs either to RAM or to a file, and handles log rotation (similar to journald on systemd-based systems). Alpine installs syslog as provided by per default, but it also packages other implementations, such as , and logbookd.
== busybox syslog ==
=== Running syslogd ===
Depending on how you have installed Alpine, it is already running (check with ps a | grep syslogd). Otherwise enable it at boot and start it with the following commands:
=== Configuration ===
Edit to change the options used when running syslogd. All available options can be looked up with syslogd --help.
=== Reading logs ===
When -C is enabled in the configuration:
== Writing logs ==
Many applications are able to write to the syslog by default (e.g. sshd). If you wish to write manually to it, use the logger program.
== See also ==
* Gentoo Wiki - Logging
category:System Administration
TODO:apk

=TODO: apk=
==Documentation==
* Document current apk internals.
* Define 'virtual', 'alternative', and their proper use.
==Alternatives==
Where more than one package provides the same file or facility, allow the user to choose which implementation to prefer.
==Plugable Layouts==
===Flat===
Existing layout with most binaries and libraries in common directories. Only a single version of a package may be installed and only one package providing a given file or facility may be installed.
===/pkg===
 /pkg/apk-tools/3.0.0
 /pkg/apk-tools/2.7.1
 /pkg/apk-tools/default -> 3.0.0
Each package is installed in it's own versioned directory allowing different versions and of the same package and multiple packages which provide the same file to coexist and be selected between as needed.
===/app===
 /app/webserver/20170406
 /app/webserver/20170514
 /app/webserver/production -> 20170406
 /app/webserver/testing -> 20170514
A a complete set of packages and their dependencies needed to provide an application with a consistent environment for deployment. Generally specifies exact versions of every dependency and is updated as a unit.
==Manifests==
apk manifest [-v] (<pkg>|<.apk>)...
Generate a manifest of files contained within the specified package(s)/apk(s).
Current default format is:
sumfunc:checksum path
With verbose flag:
pkgname: sumfunc:checksum path
Proposed canonical format:
pkg:arch/pkgname-pkgver	mode	user:group	size	timestamp	sumfunc:checksum	path
===TODO Items:===
* Define a canonical default manifest format which contains all available metadata in a reliably parsable format.
* Add ability to specify manifest format and fields in a manner similar to 'stat'.
* Add ability to select a subset of files to display in a manner similar to tar. (i.e. 'etc/' or 'lib/*.so')
* Add ability to generate manifest from a filesystem directory structure or path list.
* (DONE - kaniini) Add ability to generate manifest for .apk file in addition to installed packages.
==.apk Generator==
apk gen --key-file=... --control-dir=... --data-dir=...
Generates a well-formed .apk from a key file and two filesystem directories -- one for the control portion and one for the data portion.
===TODO Items:===
* Document current WIP (kaniini).
* Add ability to use an archive as the source for control or data directories.
* Add ability to use a pre-generated manifest as the source file list and provider of package's file meta-data.
==pax Archive Tool==
apk archive list -f file.apk [pattern list...]
apk archive extract -f file.apk [pattern list...]
apk archive create -f file.apk [file list...]
apk archive append -f file.apk [file list...]
Low-level tools to manipulate .apk archives directly.
===TODO Items:===
* Define proper applet and command names.
* Determine appropriate flags.
* Provide ability to supply include/exclude file/pattern list on STDIN, on the command line, or listed in external files.
Category:Package Manager
TTY Autologin

This page documents how to setup autologin to tty. Once configured, when computer is powered on, you will be logged in automatically without typing password. Note that, if someone else starts up your computer, they will be able to access your account and your personal data. 
== By using agetty==
Install : 
Edit to use agetty
Example for the virtual terminal tty1:
tty1::respawn:/sbin/agetty --autologin root tty1 linux
Example inittab entry for a serial terminal on ttys01:
ttyS0::respawn:/sbin/agetty --autologin root ttyS0 vt100
== By making your own autologin wrapper ==
Create a script, called autologin, around and moving it in and editing to specify the use of instead of .
# Create and edit the autologin wrapper script as follows:
# Remember to make the scripts executable: 
# The script executes the login binary (part of busybox) which will be searched in $PATH. As parameters are passed:
#: -f flag which stands for "Do not authenticate (user already authenticated)"
#: username in this example is root but if you created a new user, its username can be used instead.
# Open and replace ":respawn:/sbin/getty" with ":respawn:/sbin/getty -n -l /usr/sbin/autologin" for each TTY you want to enable autologin.
#: The getty's -n flag do not prompt the user for a login name
#: The getty's -l flag invokes a custom login instead of ; in our case it is set to invoke 
# To perform such a replacement on all TTYs, the following command can be used:
#: "@" is used as a delimiter
#: The -i flag edits the file in-place
== Use greetd ==
The Greetd display manager has a text based greeter that can be configured to autologin.
== See also ==
* Busybox init source, substantial comments documenting /etc/inittab are at the bottom
* Linux-Stuff: Log in automatically to a console when Linux boots
* AutoLogin - Gumstix User Wiki
* Busybox getty arguments
* agetty(8) Manual Page
Category:Display Managers
Category:Desktop
Tmux

is a terminal multiplexer. It's a good tool for e.g. remote support. It can also be used to start a command you want to keep running after you close your console session (you can later on attach to your running session).
= Install =
In order to use you will have to install it:
= Usage =
== Start a new session ==
To create a session you just enter:
== List existing sessions ==
When you have started some session(s) you can list them:
You might get a list that looks like this:
0: 1 windows (created Wed Oct 24 15:12:12 2012) [126x35]
1: 1 windows (created Wed Oct 24 15:14:44 2012) [126x35]
== Attach to a existing session ==
Lets say you want to attach to a existing session (e.g. the above 1: 1 windows session).
== Controlling a session ==
While inside a session, you can control it using keyboard shortcuts. We will only describe some of those alternatives.
=== Get help ===
One of the most useful commands is the one that gives you 'help'.
While in your session, click:
(Do not press/hold when clicking )
=== Detach from a session ===
Sometimes it's useful to just detach from a session without killing it.
=== Close or kill a session ===
To 'kill' a session:
Confirm by clicking when prompted.
You can also 'kill' your session by entering:
= Other terminal multiplexers =
A similar tool is which is documented here.
Category:Shell
Tor

The Onion Routing (Tor) project, aims to have a way to use the internet with as much privacy as possible, and the idea was to route traffic through multiple servers and encrypt it each step of the way.
== Installation ==
The Tor daemon can be installed using the package. Use OpenRC to manage the tor service.
== Configuration == 
=== Tor service ===
Tor reads its configurations from the file by default, or if the latter is not found, from . A example configuration with documentation is in the file . Logs are written to by default.
The default configuration should work fine for most Tor users.
If Tor connections are blocked in your country, use package for a transparent proxy soloution. To allow your tor daemon to use lyrebird, add the following line to your tor config file as follows:
For config changes in to take effect (re)start the tor daemon: 
=== Firefox browser ===
To use the Tor service running on the local host, configure Firefox browser as follows: 
* In , select .
* Enter host with port (SOCKS v5).
== Tractor == 
The Tractor tool available as package can be used to control the Tor daemon using the versatile GSettings for a personalized TOR experience. The GUI front-end Carburetor for Tractor is also available as package. 
== See also ==
* postmarketOS wiki
* ArchWiki Tor
* Official Tor website
Category:Networking 
Category:Proxy Server
Traffic monitoring

This is to show a few tools that can be used to monitor traffic on an Alpine Linux firewall, either to track down specific issues, to establish a traffic baseline, etc. This is not a comprehensive guide to each tool, since that can be found elsewhere on the internet.
== iptraf-ng ==
Available from community repository (Alpine v3.10 and up). No switches are needed. Good tool for seeing statistical view of traffic, either layer 2 or 3.
== iftop ==
Available from community repository (Alpine v3.10 and up). No switches needed. Graphical view of traffic by connection.
== nload ==
Available from community repository (Alpine v3.10 and up). No switches needed, another graphical traffic viewer by connection.
More are available, but that is a start...
Category:Networking Category:Monitoring
Twm

twm (Tab Window Manager) is the standard window manager for the X Window System since version X11R4.
== Installation ==
Install X11 and set it up using the setup-xorg-base script.
Install twm 
In home directory create a file named ".xinitrc":
Or, if you prefer nano text editor
Write to file: 
Save the file.
If doing no further configuration, you will also need xterm to open apps:
Start the X window manager
You will be greeted with a black screen. Hold left mouse button and select "XTerm". Type in a program name to launch it.
== Configuration == 
=== Keyboard layout ===
The keyboard layout defaults to US qwerty. If you use an alternative layout (e.g. Colemak) you can install setxkbmap:
Then switch to another layout (example for colemak):
=== Customizing twm ===
twm can be extensively modified. The default system-wide default configuration file for twm is and the per-user configuration is . The user file completely overrides the system, so it's recommended to start modifications by copying the system-wide file to the per-user file.
Some very basic customizations which many users do are below:
=== Add basic alt+tab support===
The following can be added to the config enable basic alt+tab support for rapidly switching windows to the front:
"Tab" = m : root|window|frame|title : f.circleup
=== Add maximize, and close buttons ===
First install some bitmaps for the buttons:
Then edit the config file and add the following:
Function "maximize" { f.fullzoom f.focus f.nop }
RightTitleButton "icon"=f.function "maximize"
RightTitleButton "xlogo11"=f.delete
== Troubleshooting ==
== See also ==
Category:Desktop
Category:Window Managers
UEFI Secure Boot

Refer UEFI page for info other than Secure boot.
== Mounting ESP ==
Prepare mount point for UEFI partition (ESP) at :
Add the following line to :
Mount it:
== Generating own UEFI keys ==
Install package :
Before creating new keys and modifying EFI variables, it is advisable to backup the current variables, so that they may be restored in case of error:
Generate your self-signed PK, KEK and db key, including .esl and .auth files:
Now you can uninstall if you want:
== Generating Unified Kernel Image ==
Install package , , and :
Adjust parameter cmdline in . It should not contain an initrd= parameter! Example of a valid cmdline:
cmdline="root=UUID=<uuid-of-your-root-fs> modules=ext4"
Run kernel hooks:
Disable trigger:
Add boot entry:
Note: This procedure only needs to be done once; after that the Unified Kernel Image will be generated automatically every time the kernel is upgraded.
== Enrolling UEFI keys ==
Copy all *.esl, *.auth files from to a FAT formatted file system (you can use EFI system partition).
Launch firmware setup utility and enrol db, KEK and PK certificates (in this order!). Firmwares have various different interfaces; the following steps for ThinkPad T14s are just an example.
# Reboot system and enter ThinkPad Setup (F1).
# Go to Security > Secure Boot
# Change Secure Boot to Enabled
# Reset to Setup Mode
# Go to Key Management
# Authorized Signature Database (DB)
#* Enroll DB > select your Flash Drive > select db.auth
#* Delete DB > delete Microsoft certificates (optional)
# Key Exchange Key (KEK)
#* Enroll KEK > select your Flash Drive > select KEK.auth
#* Delete KEK > delete Microsoft certificates (optional)
# Platform Key (PK) > Enroll PK > select your Flash Drive > select PK.auth (this MUST be the last!)
# Go to top, Restart > Exit Saving Changes
Some devices, such as HP Pavilion laptops, cannot enroll keys through the interface. Instead, you must follow the following steps (steps 1-5 and 9-12 may vary depending on the computer, they are for HP Pavilion laptops as an example):
# Reboot system and enter HP Bios Setup Utility (F10).
# Go to System Configuration
# Change Secure Boot to Disabled
# Select Clear All Secure Boot Keys
# Press F10 to save settings
# Reboot system and enter Alpine Linux
# Enable the Community Repository
# Run the following commands: 
# Reboot system and enter HP Bios Setup Utility (F10).
# Go to System Configuration
# Change Secure Boot to Enabled
# Press F10 to save settings
Note: If you needed to use sbctl, you will have to run sbctl sign /boot/efi/Alpine/linux-lts.efi every time you upgrade the kernel. You should not need to disable secure boot, so long as you sign the new Unified Kernel Image before you reboot.
== See also ==
* Initramfs init
* mkinitfs-bootparam(7)
== Resources ==
* Sakaki's EFI Install Guide/Configuring Secure Boot - Gentoo Wiki
* Unified Extensible Firmware Interface/Secure Boot - ArchWiki
* efi-mkuki: EFI Unified Kernel Image Maker (used by the package)
Category:Booting Category:UEFI
Udhcpc

This page documents the working of default DHCP client udhcpc from Busybox.
== Configuration ==
The default DHCP client udhcpc from busybox gets invoked by the networking scripts and when "dhcp" is added to the interface name in the file . 
The default behavior of udhcpc is driven by the script 
Entries in for DHCP interfaces will drive the udhcpc command line. For example:
 
will set these parameters on the command line:
The hostname will send the DHCP option to the server to tell the server the name of this client.
You can add arbitrary command line parameters to the udhcpc_opts setting in . See the example of udhcpc_opts in the main networking article.
The default configuration of udhcpc may be overridden by . Please see for how the values are used.
 accepts the following key:value pairs:
key 	default value	possible values 	meaning
RESOLV_CONF	 	no ; NO ; - 	do not overwrite or alternative path for
NO_DNS 	- 	<list of iface names>	Prevent overwriting of on a per-interface basis
NO_GATEWAY 	- 	<list of iface names>	List of interfaces where DHCP routes are ignored
IF_METRIC 	- 	<metric value> 	offset value for routing metric
IF_PEER_DNS	yes 	<anything but yes> 	please use RESOLV_CONF or NO_DNS instead
Example :
Custom scripts can be added as and to be run before/after deconfig/renew/bound DHCP events. The custom scripts must be set as executable by root, e.g. chmod 744. Refer an example custom script
== Troubleshooting ==
=== Change MTU for ADSL ===
As an example, could contain, to change the interface MTU from the default (1500) to 1492, which is useful if on ADSL that uses PPPoE (which uses 8 bytes for its own header):
I needed to restart my firewall (which replaces the iptables script from Alpine) when the client binds to a new IP, so I added the following line in the function bound(), right after 'resolvconf':
The reload drops all firewall rules, re-acquires the Internal and external IPs, and re-writes the rules. I'm sure there is a better way.
== See Also ==
Busybox udhcpc Readme
Category:Networking
Category:Embedded Systems
Uncomplicated Firewall

UFW stands for Uncomplicated Firewall, and is a program for managing a netfilter firewall. It provides a command line interface and aims to be uncomplicated and easy to use.
== Installation ==
UFW can be found in the community repository. Read Alpine_Linux_package_management#Repository_pinning to enable the community repository.
Once the community repository has been enabled, UFW can be installed by issuing the following command:
== Basic configuration ==
The following is a simple configuration that will deny all incoming and outgoing data communication by default and allow incoming SSH, outgoing DNS and NTP traffic: 
ufw default deny incoming
ufw default deny outgoing
ufw limit SSH # open SSH port and protect against brute-force login attacks
ufw allow out 123/udp # allow outgoing NTP (Network Time Protocol)
# The following instructions will allow apk to work:
ufw allow out DNS # allow outgoing DNS
ufw allow out 80/tcp # allow outgoing HTTP traffic
The following lines are only needed the first time you install the package:
Check the status of UFW:
== Diskless mode ==
If you have installed Alpine Linux as diskless then you need to use Alpine Local Backup (lbu) to save your UFW configuration. UFW data is stored in , therefore use the following commands to save the UFW configuration:
== See also ==
* nftables: kernel subsystem that does the actual filtering and its user-space utilities.
Category:Networking
Category:Security
Upgrade to repository main

= How to upgrade to signed repositories =
From Alpine 1.9 alpha18 and newer the packages and repositories are signed. Due to this change the index format changed. Index was also renamed from APK_INDEX.gz to APKINDEX.tar.gz.
We used this occation to also merge the core and extra repositories into a single repository: main.
If you boot from CF, USB, or cdrom and run from tmpfs, then it's just a matter of replacing the boot media and reboot. If you boot and run from a harddisk, then it's really recommended to reinstall the system.
This document shows how to upgrade to the signed 'main' repository if you still want to try it. It might work, it might not.
== Make backup ==
Before you start, you should make a backup of your configuration. This can be done with the lbu utility.
 lbu package backup.apkovl.tar.gz
Copy the backup.apkovl.tar.gz to a safe place. Might be handy in case the upgrade fail and you end up reinstalling.
== Upgrading basic packages ==
Then you will need a newer version of apk-tools. Use wget to download a static version of apk.
 wget http://dl-3.alpinelinux.org/alpine/v1.9/apk.static
 chmod +x apk.static
Verify that the apk version is atleast 2.0_rc1.
 ./apk.static --version
Now, replace the 'core' and 'extra' repositories with 'main' in '/etc/apk/repositories' with a text editor. 
 vi /etc/apk/repositories
Then upgrade latest alpine-base, which will include the needed keys.
 ./apk.static add --update-cache --upgrade --allow-untrusted alpine-base
Now we should have the keys and latest apk-tools. Start the upgrade and re-install of the recompiled and signed packages.<BR>
Note: It might work, it might break your system, so, again, make sure you have that backup.
 apk upgrade --available
If things went well, it should be a matter of rebooting and you are done.
 reboot
Category:Installation
Category:Package Manager
Upgrading Alpine - CD v1.8.x

== Alpine that runs from CD ==
This document applies to alpine which is burnt/booted from CD.<BR>
All examples/instructions/actions mentioned in this document should be executed on the box that you are planning to upgrade (unless you are instructed otherwise).
== Download a new alpine release ==
Note: This document does not describe how you download and burning a CD by using alpine.<BR>
We assume that you download/burn the 'iso' file on a separate computer that has a CD-burner and software that can burn ISO-files.
Start downloading a new '.iso' and a '.sha1' file 
Check integrity of the downloaded files
The output of the above command should say 'OK'.<BR>
If says 'FAILED', delete the tar.gz file and download it again.
Burn the 'iso' file to a empty CD and label it 'alpine-1.8.3-i386.iso'<BR>
Note: Burning a 'iso' file is not done the same way as you would do when burning .jpg or other files to a CD!
Note: Continue working on the box that you are upgrading
== Replace CD ==
1. Unmount the old CD.
1. Eject, remove old CD, insert the new CD that you labeled 'alpine-1.8.3-i386.iso', close the CD-tray.
1. Mount the new CD
== Save changes ==
Now that all upgrades are done, we should save our settings to our media (which you hopefully have backed up).
== Rebooting ==
In most cases you will need to reboot Alpine (specially if there are changes in the kernel):
Note: If you know what you are doing, you might not need to reboot.<BR>But make sure that all services affected by the upgrade are restarted.
Category:Installation
Upgrading Alpine - HD v1.8.x

== Alpine that runs on HD ==
This document applies to alpine which is installed on HardDisk(HD), CompactFlash(CF) or USB.<BR>
All examples/instructions/actions mentioned in this document should be executed on the box that you are planning to upgrade (unless you are instructed otherwise).
== Download a new alpine release ==
Start by checking that you have enough space on your media.<BR>
You need at least 350MB available space.
Start downloading a new '.tar.gz' and a '.sha1' file 
{{Cmd|cd /media/$LBU_MEDIA
wget -c https://web.archive.org/web/20101206020622/http://dl-3.alpinelinux.org/alpine/v1.8/usbdrive/alpine-1.8.3-i386.tar.gz
wget http://dev.alpinelinux.org/alpine/v1.8/usbdrive/alpine-1.8.3-i386.tar.gz.sha1
Check integrity of the downloaded files (it might take some time)
The output of the above command should say 'OK'.<BR>
If says 'FAILED', delete the tar.gz file and download it again.
== Extract the 'tar.gz' ==
Remove old packages dir 
Back up file that you have modified (below is a list of files that might need backing up)<BR>
syslinux.cfg: You might have modified it to show console on a serial port
Extract content of archive
Restore your backed up files (in case you had any)
Make sure that all files are permanently saved in right place 
== Clean up ==
Clean up the downloaded/unpacked files
== Save changes ==
Now that all upgrades are done, we should save our settings to our media (which you hopefully have backed up).
== Rebooting ==
In most cases you will need to reboot Alpine (specially if there are changes in the kernel):
Note: If you know what you are doing, you might not need to reboot.<BR>But make sure that all services affected by the upgrade are restarted.
Category:Installation