Difference between revisions of "Alpine"

From Steak Wiki
Jump to navigationJump to search
 
(26 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
+
Alpine is great. A minimalist, graceful, stable OS. Similar to sucklessOS.
==Building a package in Alpine==
+
<small>
 +
==General Tips==
 +
===Building a package in Alpine===
  
 
https://wiki.alpinelinux.org/wiki/Category_talk:Developer_Documentation#Building_from_source_and_creating_packages
 
https://wiki.alpinelinux.org/wiki/Category_talk:Developer_Documentation#Building_from_source_and_creating_packages
Line 6: Line 8:
 
https://wiki.alpinelinux.org/wiki/Custom_Kernel
 
https://wiki.alpinelinux.org/wiki/Custom_Kernel
  
==Xorg video playback stutters upon suspend / resume==
+
===Xorg video playback stutters upon suspend / resume===
  
 
I added the following configuration to xorg.conf
 
I added the following configuration to xorg.conf
Line 24: Line 26:
 
solution:
 
solution:
 
  python3 /usr/local/bin/ztdl
 
  python3 /usr/local/bin/ztdl
 +
 +
===Cloning HDD===
 +
 +
When cloning a hdd, do the
 +
following:
 +
*clonezilla or otherwise rsync partitions and recreate partitions to similar boundaries
 +
by default clonezilla might fail, due to -C not being set. There is an icds option for restore, but it can either be edited into /usr/sbin/ocs-onthefly  for partclone or just rsync then:
 +
*edit etc fstab  uuids
 +
*edit (boot partition) grub/grub.cfg root=uuid=whatever to root=/dev/sda3
 +
*can also be in /dev/sda1 - extlinux.conf
 +
NOTE: normal editing of extlinux.conf can also be done with the extlinux in /etc/
 +
 +
===Kernel, Initramfs recovery===
 +
If upgrade fails halfway through for any reason (hdd failing, system in a broken state), you may be left with a unbootable machine. Keep an extra /boot/vmlinuz-lts and /boot/initramfs-lts and also a copy of that kernels /lib/modules/<kernelvers> around in case. I keep mine in a folder named /boot/recovery. Backup hdds help here. If you have a corrupt initramfs, or kernel, move the old files back over to /boot from another machine. Now, from the alpine machine (not from a different dist chroot, which didn't work for me btw), boot up, and run mkinitfs again. The command is easy to mess up, so here's the correct one (as of 3.12)
 +
mkinitfs -c /etc/mkinitfs/mkinitfs.conf -b / <kernelvers>
 +
 +
The kernel vers for the new kernel can be found from /lib/modules. It should also have a folder, as the script will load modules into the initramfs
 +
ref:
 +
https://wiki.alpinelinux.org/wiki/Running_Alpine_in_a_Docker_Container
 +
 +
https://wiki.alpinelinux.org/wiki/NVME
 +
 +
https://wiki.alpinelinux.org/wiki/Bootloaders
 +
 +
https://wiki.alpinelinux.org/wiki/Setting_up_a_software_RAID_array
 +
 +
===UTF-8 Characters===
 +
If you see certain foreign language characters not showing up correctly, you can try installing different fonts.
 +
apk search ttf
 +
But I found that changing in FF opensans to sans-serif fixed some of them for me. opensans had partial support for international characters.
 +
 +
===History File Size===
 +
Alpine uses ash, not bash.
 +
printenv
 +
Histfilesize / histsize should be set correctly.
 +
 +
===Search for package===
 +
There's obv
 +
apk search <packagename>
 +
but, there is also
 +
apk search -v --description 'something descriptive'
 +
e.g.
 +
apk search -v --description 'browser'
 +
 +
===Search for who owns a certain file===
 +
apk info -W ./somefile.so
 +
Some info options (omitted a few):<pre>
 +
Info options:
 +
  -L, --contents          List contents of the PACKAGE
 +
  -e, --installed        Check if PACKAGE is installed
 +
  -W, --who-owns          Print the package owning the specified file
 +
  -R, --depends          List packages that the PACKAGE depends on
 +
  -r, --rdepends          List all packages depending on PACKAGE
 +
  --replaces              List packages whom files PACKAGE might replace
 +
  -w, --webpage          Show URL for more information about PACKAGE
 +
  -s, --size              Show installed size of PACKAGE
 +
  -d, --description      Print description for PACKAGE
 +
  -a, --all              Print all information about PACKAGE
 +
</pre>
 +
===apk Update Between Versions===
 +
* A couple releases are supported for a while. So even if a new one is out, the older one may still have updates.
 +
* Follow directions on Wiki for upgrade.
 +
* If you run out of space in boot (as I did) just back up or delete the old kernel and initramfs (they will be in a folder, e.g. 202012) then mkinitfs and grub-mkimage again. should boot.
 +
* If you get errors on apk, there is an apk fix. This might also run mkinitfs and grub again.
 +
 +
===lbu===
 +
With diskless installs, by default it will only save changes if you do
 +
lbu_commit -d
 +
BUT, the changes saved are only in etc and what directories you specify.
 +
BUT, another trap, /etc/init.d/ does NOT save. No matter what you do.
 +
The work around is issue 119 in aports on the gitlab, i.e.
 +
https://gitlab.alpinelinux.org/alpine/aports/-/issues/119
 +
use a symbolic link in /etc/init.d/ and lbu add the symbolic link.
 +
That will be retained over reboots.
 +
 +
===Misc===
 +
 +
/etc/local.d
 +
Allows for boot / shutdown scripts
 +
 +
/etc/apk/world
 +
Lists all packages installed.
 +
 +
 +
'''text files''':
 +
 +
Alpine uses a lot of text files for configuration. Text files are holy because they are accessible, editable, and in plain sight. DBs, hidden files, and registries are evil (when used for program flags/switches). Text files (in Alpine) are also minimal, and obvious where they are located. This makes editing / customization accessible to the novice user.
  
 
==Links==
 
==Links==
[https://wiki.alpinelinux.org/wiki/Configure_Wake-on-LAN Configure_Wake-on-LAN]
+
https://wiki.alpinelinux.org/wiki/Configure_Wake-on-LAN Configure_Wake-on-LAN
 +
 
 +
gcompat - way to run glibc programs
 +
 
 +
https://wiki.alpinelinux.org/wiki/Running_glibc_programs
 +
 
 +
https://ariadne.space/2021/04/25/why-apk-tools-is-different-than-other-package-managers/
 +
 
 +
https://wiki.alpinelinux.org/w/index.php?title=Mailing_lists
 +
 
 +
 
 +
 
 +
</small>
 +
 
 +
{{GNU\Linux}}

Latest revision as of 14:20, 26 October 2024

Alpine is great. A minimalist, graceful, stable OS. Similar to sucklessOS.

General Tips

Building a package in Alpine

https://wiki.alpinelinux.org/wiki/Category_talk:Developer_Documentation#Building_from_source_and_creating_packages

https://wiki.alpinelinux.org/wiki/Custom_Kernel

Xorg video playback stutters upon suspend / resume

I added the following configuration to xorg.conf

Section "Device"
  Identifier "Intel Graphics"
  Driver "intel"
  Option "AccelMethod" "uxa"
EndSection

This seems to resolve video playback issues. What happens is that the video will not play, though audio will. Only the first frame or so is visible. Video seems to be unable to display. This is a documented fix. The important part is AccelMethod. https://wiki.archlinux.org/index.php/Intel_Graphics Also documented in forums that I can't seem to find at the moment.

Python3 Script Won't Run

$ ztdl
env: can't execute python

solution:

python3 /usr/local/bin/ztdl

Cloning HDD

When cloning a hdd, do the following:

  • clonezilla or otherwise rsync partitions and recreate partitions to similar boundaries

by default clonezilla might fail, due to -C not being set. There is an icds option for restore, but it can either be edited into /usr/sbin/ocs-onthefly for partclone or just rsync then:

  • edit etc fstab uuids
  • edit (boot partition) grub/grub.cfg root=uuid=whatever to root=/dev/sda3
  • can also be in /dev/sda1 - extlinux.conf

NOTE: normal editing of extlinux.conf can also be done with the extlinux in /etc/

Kernel, Initramfs recovery

If upgrade fails halfway through for any reason (hdd failing, system in a broken state), you may be left with a unbootable machine. Keep an extra /boot/vmlinuz-lts and /boot/initramfs-lts and also a copy of that kernels /lib/modules/<kernelvers> around in case. I keep mine in a folder named /boot/recovery. Backup hdds help here. If you have a corrupt initramfs, or kernel, move the old files back over to /boot from another machine. Now, from the alpine machine (not from a different dist chroot, which didn't work for me btw), boot up, and run mkinitfs again. The command is easy to mess up, so here's the correct one (as of 3.12)

mkinitfs -c /etc/mkinitfs/mkinitfs.conf -b / <kernelvers>

The kernel vers for the new kernel can be found from /lib/modules. It should also have a folder, as the script will load modules into the initramfs ref: https://wiki.alpinelinux.org/wiki/Running_Alpine_in_a_Docker_Container

https://wiki.alpinelinux.org/wiki/NVME

https://wiki.alpinelinux.org/wiki/Bootloaders

https://wiki.alpinelinux.org/wiki/Setting_up_a_software_RAID_array

UTF-8 Characters

If you see certain foreign language characters not showing up correctly, you can try installing different fonts.

apk search ttf

But I found that changing in FF opensans to sans-serif fixed some of them for me. opensans had partial support for international characters.

History File Size

Alpine uses ash, not bash.

printenv

Histfilesize / histsize should be set correctly.

Search for package

There's obv

apk search <packagename> 

but, there is also

apk search -v --description 'something descriptive'

e.g.

apk search -v --description 'browser'

Search for who owns a certain file

apk info -W ./somefile.so

Some info options (omitted a few):

Info options:
  -L, --contents          List contents of the PACKAGE
  -e, --installed         Check if PACKAGE is installed
  -W, --who-owns          Print the package owning the specified file
  -R, --depends           List packages that the PACKAGE depends on
  -r, --rdepends          List all packages depending on PACKAGE
  --replaces              List packages whom files PACKAGE might replace
  -w, --webpage           Show URL for more information about PACKAGE
  -s, --size              Show installed size of PACKAGE
  -d, --description       Print description for PACKAGE
  -a, --all               Print all information about PACKAGE

apk Update Between Versions

  • A couple releases are supported for a while. So even if a new one is out, the older one may still have updates.
  • Follow directions on Wiki for upgrade.
  • If you run out of space in boot (as I did) just back up or delete the old kernel and initramfs (they will be in a folder, e.g. 202012) then mkinitfs and grub-mkimage again. should boot.
  • If you get errors on apk, there is an apk fix. This might also run mkinitfs and grub again.

lbu

With diskless installs, by default it will only save changes if you do

lbu_commit -d

BUT, the changes saved are only in etc and what directories you specify. BUT, another trap, /etc/init.d/ does NOT save. No matter what you do. The work around is issue 119 in aports on the gitlab, i.e.

https://gitlab.alpinelinux.org/alpine/aports/-/issues/119

use a symbolic link in /etc/init.d/ and lbu add the symbolic link. That will be retained over reboots.

Misc

/etc/local.d

Allows for boot / shutdown scripts

/etc/apk/world

Lists all packages installed.


text files:

Alpine uses a lot of text files for configuration. Text files are holy because they are accessible, editable, and in plain sight. DBs, hidden files, and registries are evil (when used for program flags/switches). Text files (in Alpine) are also minimal, and obvious where they are located. This makes editing / customization accessible to the novice user.

Links

https://wiki.alpinelinux.org/wiki/Configure_Wake-on-LAN Configure_Wake-on-LAN

gcompat - way to run glibc programs

https://wiki.alpinelinux.org/wiki/Running_glibc_programs

https://ariadne.space/2021/04/25/why-apk-tools-is-different-than-other-package-managers/

https://wiki.alpinelinux.org/w/index.php?title=Mailing_lists