You are not logged in.

#1 2023-04-01 12:36:20

0rd0N@t
Member
Registered: 2023-04-01
Posts: 4

[SOLVED] Custom ISO with packages usable by pacstrap/pacman

I'd like to create a custom ISO for a completely offline system installation.

My needs (in short):

I plan to create an Arch ISO very similar to the original, maybe with some few packages more, but being able to perform a full Arch installation by fetching the packages to copy directly from the custom ISO itself (also if they might become outdated), not from somewhere else.

My needs (additional notes):

I'm aware the keys and the packages might become old soon. That's not a problem: once the new system is installed and goes online (maybe also weeks later, after the installation), I will recreate the pacman DB (maybe reinitialising it from scratch, if necessary) and sync everything. But, in the meantime, I can have a working Arch system, with all its typical Unix tools for scripting, testing, etc., despite the limitation of its temporary offline use.

My problem (in short):

I've found a lot of tutorials explaining in detail how to create a custom ISO with Archiso, booting it and working live, maybe with Xfce and also with other userful DEs/programs... but, in the end, when you try to install a new system from those custom ISOs, pacstrap still fetches its packages from the Internet repos... this way, there's no point in producing a new, ISO, any effort is useless: you can use the official Arch one for this purpose, it would be the same...

My problem (in detail):

I've also found some other sources explaining how to temporarily export the packages from an already working and updated Arch system, e.g. setting up a temporary webserver with Python http.server... but this way you still need LAN access (althought no Internet) and (worse!)... an already working system to create a new one! at this point, it would be simpler to clone this first system to a new one with Clonezilla or ddrescue or something...

My problem (final):

I plan to create a custom ISO for Arch install from scratch; its main purpose should be the system installation, not necessarily an extended live use...

  • ... without the need for Internet (nor LAN) access for packages installation

  • ... without the need of other machines, or webservers, or other entities for packages installation

So, pacstrap should be able to fetch the all the desired, limited, pre-decided (maybe just base, base-devel, vim and no X) packages from the ISO content itself, in order to install them in the new system. This custom ISO should contain everything, at least for a base system.

The most useful suggestion I found is here: a new (repeated) download, followed by repo-add...

So, I suppose that during the creation of this custom ISO with Archiso...

  • ...I should also create another local offline repository inside the ISO-to-be (in order not to depend on USB keys, etc.) and force pacstrap to use it without looking elsewhere... also, this would be a second local repository copy, since the original, already existing and populated path, could not be used for installation purposes, since both extracting airootfs.sfs or copying the live environment's root file system are discouraged techniques...

Can you please point me to the right tool and documentation to perform this job as described above? Given the flexibility of Arch, I think it's possible, and maybe there's an easier way than the one I described...

Many thanks, and sorry if this question has already been asked in other ways before (I'm not able to find any proper suggestion searching on the web). Also sorry if this is not the correct section for this question.

Last edited by 0rd0N@t (2023-04-01 21:09:28)

Offline

#2 2023-04-01 13:16:56

philo
Member
Registered: 2015-01-26
Posts: 251

Re: [SOLVED] Custom ISO with packages usable by pacstrap/pacman

That sounds heretical...

Offline

#3 2023-04-01 13:24:50

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,691

Re: [SOLVED] Custom ISO with packages usable by pacstrap/pacman

Easiest way is to use a separate drive for the packages.

https://wiki.archlinux.org/title/Offline_installation

Offline

#4 2023-04-01 14:41:46

0rd0N@t
Member
Registered: 2023-04-01
Posts: 4

Re: [SOLVED] Custom ISO with packages usable by pacstrap/pacman

philo wrote:

That sounds heretical...

?

Scimmia wrote:

Easiest way is to use a separate drive for the packages.

https://wiki.archlinux.org/title/Offline_installation

Thanks. Now I must find the right way to include this offline repository inside the file system of the ISO-to-be and to tell pacman to use it only.

I'm sure I've already seen some similar project on Git* time ago, but I'm not able to find it anymore...

Offline

#5 2023-04-01 15:57:40

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,714
Website

Re: [SOLVED] Custom ISO with packages usable by pacstrap/pacman

It sounds like all you really need is the pacman.conf specifying as a mirror "Server = file:///..." to a local source.  Whether that source is in the iso itself or on another filesystem on the same usb is up to you - the latter case seems better to me as you could have the iso mount the other filesystem at boot up and use it as the "mirror" to get all dbs and packages.  But with it being separate filesystem, you could update all these dbs and package files without having to recreate the iso.


To Be A Dev: propose idea; invite feedback; mock, ridicule, and ostracize any critical feedback; but be warm and kind to those who kiss your ring.

Offline

#6 2023-04-01 21:04:23

0rd0N@t
Member
Registered: 2023-04-01
Posts: 4

Re: [SOLVED] Custom ISO with packages usable by pacstrap/pacman

Thanks for the feedback.

Other reasons behind my interest in installing Arch in different, maybe unusual, ways, also comes from the fact that:

  • at home I have limited, slow connectivity, and my Arch machines are growing in number, so the need to «share» a common package repository in order to globally download only once;

  • at work, where I also install Arch VMs (less frequently), I have a non-practical configuration for come-and-go VMs (e.g. static IPs, proxy servers to set, different ones according to the workplace...), so it would be easier for me to have a comprehensive ISO and a do-it-all unattended script (which I have already made) in order to perform «linear» installations (without thinking about remote SSH control, etc.).

Trilby wrote:

all you really need is the pacman.conf specifying as a mirror "Server = file:///..." to a local source.

the [source on another filesystem] seems better to me as you could have the iso mount the other filesystem at boot up and use it as the "mirror" to get all dbs and packages. 

you could update all these dbs and package files without having to recreate the iso.

I'll also need the ISOs (less frequently), but your suggestion gives me another idea: those scenarios could be merged in a single one:

  • I could mantain ad upgrade a (partial) local repository in the releng workdir, just with what I need (e.g. a base sytem, plus maybe a bare GNOME, etc.), which could feed all my home Arch boxes;

  • 3-4 times per year I could «freeze» in an updated ISO this mantained folder, so I could perform «updated» offline installations at work (and also elsewhere), when needed.

Thanks again for all the ideas. As for me, this topic could be closed; if I encounter difficulties in developing, I'll open another one with the technical details.

Offline

#7 2023-04-03 07:02:21

0rd0N@t
Member
Registered: 2023-04-01
Posts: 4

Re: [SOLVED] Custom ISO with packages usable by pacstrap/pacman

Just to let you know... it worked, at the first try!

To not forget, and hoping to be useful to somebody else too, here's the steps I followed (kept at the bare minimum, without changing the ISO name, etc.).

Phase 1: From an already working Arch system, with Internet connection

Update the packages the usual way.

sudo pacman -S archiso

# The temporary directory in which we'll download the packages, create the ISO, etc.
sudo mkdir -v /archiso
sudo chown -cR myuser:myuser /archiso

cp -dRv /usr/share/archiso/configs/releng/ /archiso

/archiso/releng/pacman.conf is kept as default, no changes.

# The repository.
mkdir -v /archiso/releng/airootfs/rep
sudo mkdir -v /tmp/blankdb

cd /archiso/releng/airootfs/rep
pacman -Syw --cachedir . --dbpath /tmp/blankdb base base-devel efibootmgr grub linux mkinitcpio os-prober rsync tree vim

repo-add ./custom.db.tar.gz ./*[^sig]

/archiso/releng/airootfs/etc/pacman.conf is edited as below (commented lines are not shown here):

[options]
HoldPkg     = pacman glibc
Architecture = auto

ParallelDownloads = 5

SigLevel    = Required DatabaseOptional
LocalFileSigLevel = Optional

[custom]
SigLevel = Optional TrustAll
Server = file:///rep

Finally we create the ISO:

cd /archiso

sudo mkarchiso -v /archiso/releng

Phase 2: Test the ISO by booting it (for instance, I created an empty EFI VM under VirtualBox, standard settings but no Internet, no ping, no network card at all, etc.)

I followed the standard steps from the installation guide, except for the following sections, which I skipped:

  • 1.2 Verify signature

  • 1.7 Connect to the internet

  • 1.8 Update the system clock

  • 2.1 Select the mirrors

Then I installed everything from the local cache, inside the ISO (below two minutes of activity):

pacstrap -K /mnt base base-devel efibootmgr grub linux mkinitcpio os-prober rsync tree vim

Finally I installed a boot loader...

grub-install --target=x86_64-efi --efi-directory=MY-MOUNTPOINT --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg

... and rebooted. System installed. Everything worked perfectly.

A possible next revision would be to also integrate yay (which at the moment I only use for google-chrome), not only in the ISO for live use (here's how to do it), but also to install it in the new system (always offline). Maybe not with pacstrap, but with a few steps more, with makepkg... mainly to understand how it works... I think another local repo (with AUR packages) could be required...

A new exercise, but less urgent...

Thanks again!

Offline

Board footer

Powered by FluxBB