Diskussion:Archiso: Unterschied zwischen den Versionen

Aus wiki.archlinux.de
(edit)
(Aufräumen)
Zeile 2: Zeile 2:




[[Category:Live Arch systems]]
 
[[Category:Getting and installing Arch]]


'''Archiso''' is a small set of bash scripts  
'''Archiso''' is a small set of bash scripts  


=== Installing packages ===


[[Edit]] the lists of packages in {{ic|packages.i686}}, {{ic|packages.x86_64}}, or {{ic|packages.both}} to indicate which packages are to be installed on the live medium. The suffix here indicates which architecture the packages are available.
=== Login manager ===
 
 
Rebuilds can be sped up slightly by editing the pacstrap script (located at /bin/pacstrap) and changing the following at line 361:
 
Before:
 
if ! pacman -r "$newroot" -Sy "${pacman_args[@]}"; then
 
After:
 
if ! pacman -r "$newroot" -Sy --needed "${pacman_args[@]}"; then
 
This increases the speed of the initial bootstrap, since it doesn't have to download and install any of the base packages that are already installed.
 
 


{{Note|If you want to use a [[window manager]] in the Live CD then you must add the necessary and correct [[video drivers]], or the WM may freeze on loading.}}
== Tips and tricks ==


=== Installation without Internet access ===


{{Move|Installation without Internet access|seems like this could stand alone}}
If you wish to install the archiso (e.g. [https://www.archlinux.org/download/ the official monthly release]) as it is without an Internet connection, or, if you do not want to download the packages you want again:
First, follow the [[Installation guide]], skipping the [[Installation guide#Connect to the Internet]] section, until the [[Installation guide#Install the base packages]] step.
{{Note|Before performing the other [[Installation guide#Configure the system]] steps (e.g. locale, keymap, etc.), it is necessary to get rid of the trace of the Live environment (in other words, the customization of archiso which does not fit a non-Live environment).}}
Wo gibt es das Script????


== Configuration ==
== Configuration ==
Zeile 22: Zeile 53:
Generally, every administrative task that you would normally do after a fresh install except for package installation can be scripted into {{ic|''archlive''/airootfs/root/customize_airootfs.sh}}. It has to be written from the perspective of the new environment, so {{ic|/}} in the script means the root of the live-iso which is to be created.
Generally, every administrative task that you would normally do after a fresh install except for package installation can be scripted into {{ic|''archlive''/airootfs/root/customize_airootfs.sh}}. It has to be written from the perspective of the new environment, so {{ic|/}} in the script means the root of the live-iso which is to be created.


When {{ic|~/archlive/airootfs/root/customize_airootfs.sh}} is executed and a new user is created, the files from the skel directory will automatically be copied over to the new home folder, permissions set right.


==== Custom local repository ====
 
 
 
 
 
 
 
 
 
Ab hier kann wahrscheinlich alles weg!!!


{{Merge|Pacman tips#Custom local repository|Move the general information (e.g. repo tree) into the main article.}}
{{Merge|Pacman tips#Custom local repository|Move the general information (e.g. repo tree) into the main article.}}
Zeile 127: Zeile 168:


In this way packages for x86_64 and i686 will be installed with their own pacman configuration file.
In this way packages for x86_64 and i686 will be installed with their own pacman configuration file.
=== Adding files to image ===
{{Note|You must be root to do this, do not change the ownership of any of the files you copy over, '''everything''' within the airootfs directory must be root owned. Proper ownerships will be sorted out shortly.}}
The airootfs directory acts as an overlay, think of it as root directory '/' on your current system, so any files you place within this directory will be copied over on boot-up.
So if you have a set of iptables scripts on your current system you want to be used on you live image, copy them over as such:
# cp -r /etc/iptables ~/archlive/airootfs/etc
Placing files in the users home directory is a little different. Do not place them within {{ic|airootfs/home}}, but instead create a skel directory within {{ic|airootfs/}} and place them there. We will then add the relevant commands to the {{ic|customize_airootfs.sh}} which we are going to use to copy them over on boot and sort out the permissions.
First, create the skel directory:
# mkdir ~/archlive/airootfs/etc/skel
Now copy the 'home' files to the skel directory, e.g for {{ic|.bashrc}}:
# cp ~/.bashrc ~/archlive/airootfs/etc/skel/
When {{ic|~/archlive/airootfs/root/customize_airootfs.sh}} is executed and a new user is created, the files from the skel directory will automatically be copied over to the new home folder, permissions set right.
Similarly, some care is required for special configuration files that reside somewhere down the hierarchy. As an example the {{ic|/etc/X11/xinit/xinitrc}} configuration file resides on a path that might be overwritten by installing a package. To place the configuration file one should put the custom {{ic|xinitrc}} in {{ic|~/archlive/airootfs/etc/skel/}} and then modify {{ic|customize_airootfs.sh}} to move it appropriately.
=== Boot Loader ===
The default file should work fine, so you should not need to touch it.
Due to the modular nature of isolinux, you are able to use lots of addons since all *.c32 files are copied and available to you. Take a look at the [http://syslinux.zytor.com/wiki/index.php/SYSLINUX official syslinux site] and the [https://projects.archlinux.org/archiso.git/tree/configs/syslinux-iso/boot-files archiso git repo]. Using said addons, it is possible to make visually attractive and complex menus. See [http://syslinux.zytor.com/wiki/index.php/Comboot/menu.c32 here].
=== Login manager ===
Starting X at boot is done by enabling your login manager's [[systemd]] service. If you know which .service file needs a softlink: Great. If not, you can easily find out in case you are using the same program on the system you build your iso on. Just use:
$ ls -l /etc/systemd/system/display-manager.service
Now create the same softlink in {{ic|~/archlive/airootfs/etc/systemd/system}}. For LXDM:
# ln -s /usr/lib/systemd/system/lxdm.service ~/archlive/airootfs/etc/systemd/system/display-manager.service
This will enable LXDM at system start on your live system.
Alternatively you can just enable the service in {{ic|airootfs/root/customize_airootfs.sh}} along with other services that are enabled there.
If you want the graphical environment to actually start automatically during boot make sure to edit {{ic|airootfs/root/customize_airootfs.sh}} and replace
systemctl set-default multi-user.target
with
systemctl set-default graphical.target
=== Changing Automatic Login ===
The configuration for getty's automatic login is located under {{ic|airootfs/etc/systemd/system/getty@tty1.service.d/autologin.conf}}.
You can modify this file to change the auto login user:
[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin '''isouser''' --noclear %I 38400 linux
Or remove it altogether to disable auto login.
== Build the ISO ==
Now you are ready to turn your files into the .iso which you can then burn to CD or USB:
First create the {{ic|out/}} directory,
# mkdir ~/archlive/out/
then inside {{ic|~/archlive}}, execute:
# ./build.sh -v
The script will now download and install the packages you specified to {{ic|work/*/airootfs}}, create the kernel and init images, apply your customizations and finally build the iso into {{ic|out/}}.
=== Rebuild the ISO ===
Rebuilding the iso after modifications is not officially supported. However, it is easily possible by applying two steps. First you have to remove lock files in the work directory:
# rm -v work/build.make_*
Furthermore it is required to edit the script {{ic|airootfs/root/customize_airootfs.sh}}, and add an {{ic|id}} command in the beginning of the {{ic|useradd}} line as shown here. Otherwise the rebuild stops at this point because the user that is to be added already exists [https://bugs.archlinux.org/task/41865].
{{Style|typo?}}
! id arch && useradd -m -p "" -g users -G "adm,audio,floppy,log,network,rfkill,scanner,storage,optical,power,wheel" -s /usr/bin/zsh arch
Also remove persistent data such as created users or symlinks such as {{ic|/etc/sudoers}}.
{{Expansion|Report more data that needs to be removed or reset.}}
Rebuilds can be sped up slightly by editing the pacstrap script (located at /bin/pacstrap) and changing the following at line 361:
Before:
if ! pacman -r "$newroot" -Sy "${pacman_args[@]}"; then
After:
if ! pacman -r "$newroot" -Sy --needed "${pacman_args[@]}"; then
This increases the speed of the initial bootstrap, since it doesn't have to download and install any of the base packages that are already installed.
== Using the ISO ==
See the [[:Category:Getting and installing Arch#Installation methods]] section for various options.
== Tips and tricks ==
=== Installation without Internet access ===
{{Move|Installation without Internet access|seems like this could stand alone}}
If you wish to install the archiso (e.g. [https://www.archlinux.org/download/ the official monthly release]) as it is without an Internet connection, or, if you do not want to download the packages you want again:
First, follow the [[Installation guide]], skipping the [[Installation guide#Connect to the Internet]] section, until the [[Installation guide#Install the base packages]] step.
==== Install the archiso to the new root ====
Instead of installing the packages with {{ic|pacstrap}} (which would try to download from the remote repositories), copy ''everything'' in the live environment to the new root:
# time cp -ax / /mnt
{{Note|The option ({{ic|-x}}) excludes some special directories, as they should not be copied to the new root.}}
Then, copy the kernel image to the new root, in order to keep the integrity of the new system:
# cp -vaT /run/archiso/bootmnt/arch/boot/$(uname -m)/vmlinuz /mnt/boot/vmlinuz-linux
After that, generate a fstab as described in [[Installation guide#Fstab]].
==== Chroot and configure the base system ====
Next, chroot into your newly installed system:
# arch-chroot /mnt /bin/bash
{{Note|Before performing the other [[Installation guide#Configure the system]] steps (e.g. locale, keymap, etc.), it is necessary to get rid of the trace of the Live environment (in other words, the customization of archiso which does not fit a non-Live environment).}}
===== Restore the configuration of journald =====
[https://projects.archlinux.org/archiso.git/tree/configs/releng/airootfs/root/customize_airootfs.sh#n19 This customization of archiso] will lead to storing the system journal in RAM, it means that the journal will not be available after reboot:
# sed -i 's/Storage=volatile/#Storage=auto/' /etc/systemd/journald.conf
===== Remove special udev rule =====
[https://projects.archlinux.org/archiso.git/tree/configs/releng/airootfs/etc/udev/rules.d/81-dhcpcd.rules This rule of udev] starts the dhcpcd automatically if there are any wired network interfaces.
# rm /etc/udev/rules.d/81-dhcpcd.rules
===== Disable and remove the services created by archiso =====
Some service files are created for the Live environment, please disable the services and remove the file as they are unnecessary for the new system:
# systemctl disable pacman-init.service choose-mirror.service
# rm -r /etc/systemd/system/{choose-mirror.service,pacman-init.service,etc-pacman.d-gnupg.mount,getty@tty1.service.d}
# rm /etc/systemd/scripts/choose-mirror
===== Remove special scripts of the Live environment =====
There are some scripts installed in the live system by archiso scripts, which are unnecessary for the new system:
# rm /etc/systemd/system/getty@tty1.service.d/autologin.conf
# rm /root/{.automated_script.sh,.zlogin}
# rm /etc/mkinitcpio-archiso.conf
# rm -r /etc/initcpio
===== Importing archlinux keys =====
In order to use the official repositories, we need to import the archlinux master keys ([[pacman/Package signing#Initializing the keyring]]). This step is usually done by pacstrap but can be achieved with
# pacman-key --init
# pacman-key --populate archlinux
{{Note| Keyboard or mouse activity is needed to generate entropy and speed-up the first step.}}
===== Configure the system =====
Now you can follow the skipped steps of the [[Installation guide#Configure the system]] section (setting a locale, timezone, hostname, etc.) and finish the installation by creating an initial ramdisk as described in [[Installation guide#Initramfs]].
===== Enable graphical login (optional) =====
If using a display manager like GDM, you may want to change the systemd default target from multi-user.target to one that allows graphical login.
# systemctl disable multi-user.target
# systemctl enable graphical.target
== See also ==
=== Documentation and tutorials ===
* [https://projects.archlinux.org/archiso.git  Archiso project page]
* [https://projects.archlinux.org/archiso.git/tree/docs Official documentation]
=== Example customization template ===
* [http://easy.open.and.free.fr/didjix/ A live DJ distribution powered by ArchLinux and built with Archiso]

Version vom 19. Dezember 2017, 11:58 Uhr

Das folgende ist aus der englischen Wiki und dient als Bearbeitungsvorlage.



Archiso is a small set of bash scripts


Login manager

Rebuilds can be sped up slightly by editing the pacstrap script (located at /bin/pacstrap) and changing the following at line 361:

Before:

if ! pacman -r "$newroot" -Sy "${pacman_args[@]}"; then

After:

if ! pacman -r "$newroot" -Sy --needed "${pacman_args[@]}"; then

This increases the speed of the initial bootstrap, since it doesn't have to download and install any of the base packages that are already installed.


Tips and tricks

Installation without Internet access

Vorlage:Move

If you wish to install the archiso (e.g. the official monthly release) as it is without an Internet connection, or, if you do not want to download the packages you want again:

First, follow the Installation guide, skipping the Installation guide#Connect to the Internet section, until the Installation guide#Install the base packages step.


Vorlage:Note




Wo gibt es das Script????

Configuration

  • the airootfs directory - this directory acts as an overlay and it is where you make all the customizations.

Generally, every administrative task that you would normally do after a fresh install except for package installation can be scripted into archlive/airootfs/root/customize_airootfs.sh. It has to be written from the perspective of the new environment, so / in the script means the root of the live-iso which is to be created.

When ~/archlive/airootfs/root/customize_airootfs.sh is executed and a new user is created, the files from the skel directory will automatically be copied over to the new home folder, permissions set right.






Ab hier kann wahrscheinlich alles weg!!!

Vorlage:Merge Vorlage:Out of date

You can also create a custom local repository for the purpose of preparing custom packages or packages from AUR/ABS. When doing so with packages for both architectures, you should follow a certain directory order to not run into problems.

For instance:

  • ~/customrepo
    • ~/customrepo/x86_64
      • ~/customrepo/x86_64/foo-x86_64.pkg.tar.xz
      • ~/customrepo/x86_64/customrepo.db.tar.gz
      • ~/customrepo/x86_64/customrepo.db (symlink created by repo-add)
    • ~/customrepo/i686
      • ~/customrepo/i686/foo-i686.pkg.tar.xz
      • ~/customrepo/i686/customrepo.db.tar.gz
      • ~/customrepo/i686/customrepo.db (symlink created by repo-add)

You can then add your repository by putting the following into ~/archlive/pacman.conf, above the other repository entries (for top priority):

# custom repository
[customrepo]
SigLevel = Optional TrustAll
Server = file:///home/user/customrepo/$arch

So, the build scripts just look for the appropriate packages.

If this is not the case you will be running into error messages similar to this:

error: failed to prepare transaction (package architecture is not valid)
:: package foo-i686 does not have a valid architecture

Preventing installation of packages belonging to base group

By default, /usr/bin/mkarchiso, a script which is used by ~/archlive/build.sh, calls one of the Vorlage:Pkg named pacstrap without the -i flag, which causes Pacman to not wait for user input during the installation process.

When blacklisting base group packages by adding them to the IgnorePkg line in ~/archlive/pacman.conf, Pacman asks if they still should be installed, which means they will when user input is bypassed. To get rid of these packages there are several options:

  • Dirty: Add the -i flag to each line calling pacstrap in /usr/bin/mkarchiso.
  • Clean: Create a copy of /usr/bin/mkarchiso in which you add the flag and adapt ~/archlive/build.sh so that it calls the modified version of the mkarchiso script.
  • Advanced: Create a function for ~/archlive/build.sh which explicitly removes the packages after the base installation. This would leave you the comfort of not having to type enter so much during the installation process.

Installing packages from multilib

To install packages from the multilib repository you have to create two pacman configuration files: one for x86_64 and one for i686. Copy pacman.conf to pacmanx86_64.conf and pacmani686.conf. Uncomment the following lines to enable multilib in pacmanx86_64.conf:

pacmanx86_64.conf
[multilib]
SigLevel = PackageRequired
Include = /etc/pacman.d/mirrorlist

Then edit build.sh with an editor. Replace the following lines:

build.sh
run_once make_pacman_conf

# Do all stuff for each airootfs
for arch in i686 x86_64; do
    run_once make_basefs
    run_once make_packages
done

run_once make_packages_efi

for arch in i686 x86_64; do
    run_once make_setup_mkinitcpio
    run_once make_customize_airootfs
done

with:

build.sh
cp -v releng/pacmanx86_64.conf releng/pacman.conf
run_once make_pacman_conf

# Do all stuff for each airootfs
for arch in x86_64; do
    run_once make_basefs
    run_once make_packages
    run_once make_packages_efi
    run_once make_setup_mkinitcpio
    run_once make_customize_airootfs
done

echo make_pacman_conf i686
cp -v releng/pacmani686.conf releng/pacman.conf
cp -v releng/pacmani686.conf ${work_dir}/pacman.conf


for arch in i686; do
    run_once make_basefs
    run_once make_packages
    run_once make_packages_efi
    run_once make_setup_mkinitcpio
    run_once make_customize_airootfs
done

In this way packages for x86_64 and i686 will be installed with their own pacman configuration file.