You are not logged in.

#1 2014-05-30 03:58:21

hack.augusto
Member
From: Brazil
Registered: 2008-08-28
Posts: 124

Minimal arch linux image

I'm setting up packer + vagrant/docker + ansible to build/configure all machines that I need from development to production, and I want to build the smallest possible image to get started. The reason is that I want throw away machines, the whole process to be fast (image download included), and to play around with Arch (I might end up using another more stable distribution, "better" suited for production environments, but right now I'm learning the tools and I want to do it with Arch).

Currently I have looked at ArchIso, ArchBoot, and Varch. Right now I think I will use ArchBoot, and although I have an overall view of what it does I don't know which mkinitcpio hooks I can throw away to reduce the image overall size.

I'm just looking for some thoughts and general pointers to reduce Arch's ISO size to it's very minimal, my current line of thought is to remove i686 (ArchBoot does that but it's network image is around 310M) and setup the system with the very minimal for ansible and pacman to work.

Side question: Is the `--root` option in pacman broken (Actually, what could I be doing wrong)? It is returning 255 with the following message [Pacman v4.1.2 - libalpm v8.0.2]:

% pacman -r /home/hack/archiso -Sb base
error: failed to initialize alpm library (could not find or read directory)

Last edited by hack.augusto (2014-05-30 05:02:01)

Offline

#2 2014-05-30 04:55:37

HalosGhost
Forum Moderator
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 2,095
Website

Re: Minimal arch linux image

Please post the whole error output along with the verbatim command which produced that output.

All the best,

-HG

Offline

#3 2014-05-30 05:00:05

hack.augusto
Member
From: Brazil
Registered: 2008-08-28
Posts: 124

Re: Minimal arch linux image

@HalosGhost That is all the output, I added the prompt + command line

pacman is running fine without the `--root` flag, here is the ldd to show the libraries version. I tried absolute/relative path, to install a group or a package, to run as root or as a normal user, to use `--root` and `-r`, and even copying the libalpm to the new root directory, at this point I'm just wildly guessing.

# ldd /usr/bin/pacman
        linux-vdso.so.1 (0x00007fff8e4d8000)
        libalpm.so.8 => /usr/lib/libalpm.so.8 (0x00007f2f6effd000)
        libarchive.so.13 => /usr/lib/libarchive.so.13 (0x00007f2f6ed5d000)
        libc.so.6 => /usr/lib/libc.so.6 (0x00007f2f6e9af000)
        libgpgme.so.11 => /usr/lib/libgpgme.so.11 (0x00007f2f6e779000)
        libcurl.so.4 => /usr/lib/libcurl.so.4 (0x00007f2f6e50b000)
        libcrypto.so.1.0.0 => /usr/lib/libcrypto.so.1.0.0 (0x00007f2f6e105000)
        libacl.so.1 => /usr/lib/libacl.so.1 (0x00007f2f6defc000)
        libattr.so.1 => /usr/lib/libattr.so.1 (0x00007f2f6dcf7000)
        libexpat.so.1 => /usr/lib/libexpat.so.1 (0x00007f2f6dacd000)
        liblzo2.so.2 => /usr/lib/liblzo2.so.2 (0x00007f2f6d8ac000)
        liblzma.so.5 => /usr/lib/liblzma.so.5 (0x00007f2f6d689000)
        libbz2.so.1.0 => /usr/lib/libbz2.so.1.0 (0x00007f2f6d479000)
        libz.so.1 => /usr/lib/libz.so.1 (0x00007f2f6d263000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f2f6f22d000)
        libassuan.so.0 => /usr/lib/libassuan.so.0 (0x00007f2f6d052000)
        libgpg-error.so.0 => /usr/lib/libgpg-error.so.0 (0x00007f2f6ce4d000)
        libssh2.so.1 => /usr/lib/libssh2.so.1 (0x00007f2f6cc24000)
        libssl.so.1.0.0 => /usr/lib/libssl.so.1.0.0 (0x00007f2f6c9b7000)
        libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0x00007f2f6c76c000)
        libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x00007f2f6c48b000)
        libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x00007f2f6c259000)
        libcom_err.so.2 => /usr/lib/libcom_err.so.2 (0x00007f2f6c055000)
        libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f2f6be37000)
        libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f2f6bc33000)
        libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0x00007f2f6ba26000)
        libkeyutils.so.1 => /usr/lib/libkeyutils.so.1 (0x00007f2f6b822000)
        libresolv.so.2 => /usr/lib/libresolv.so.2 (0x00007f2f6b60b000)

Last edited by hack.augusto (2014-05-30 05:52:21)

Offline

#4 2014-05-30 06:18:47

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

Re: Minimal arch linux image

This is what pacstrap is for...

Offline

#5 2014-05-30 12:50:06

hack.augusto
Member
From: Brazil
Registered: 2008-08-28
Posts: 124

Re: Minimal arch linux image

@Scimmia Thanks for your answer, but I cannot understand what you are trying to say, pacstrap is just a wrapper utility, it creates some folders, calls `pacman -r` as I did, and copy some files. Here is the source code

I just tried to create all folders like pacstrap does, did not work:

# pacman -r $newroot/ -Sb base
error: failed to initialize alpm library (could not find or read directory)
root ~ # tree $newroot
/root/archiso
├── dev
├── etc
├── proc
├── run
├── sys
├── tmp
├── usr
│   └── lib
│       ├── libalpm.so -> libalpm.so.8.0.2
│       ├── libalpm.so.8 -> libalpm.so.8.0.2
│       └── libalpm.so.8.0.2
└── var
    ├── cache
    │   └── pacman
    │       └── pkg
    ├── lib
    │   └── pacman
    └── log

15 directories, 3 files

Last edited by hack.augusto (2014-05-30 13:52:38)

Offline

#6 2014-05-30 14:18:35

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

Re: Minimal arch linux image

No, that's not all it does. Seriously, just try it.

Your bigger problem is the use of -Sb, though.

Offline

#7 2014-05-31 20:56:25

hack.augusto
Member
From: Brazil
Registered: 2008-08-28
Posts: 124

Re: Minimal arch linux image

Okay, here is what I got:

pacman need it's local database and the folders under var, so it's just a matter of creating the directories and using the flag `-y`:

mkdir -m 0755 -p "$newroot"/var/{cache/pacman/pkg,lib/pacman}
pacman -r $newroot -Sy pacman python2 linux

This is a 137M download, but it is a 487M install, now I'm gonna play with image compression and see how much I can get out of it.

Edit: I also made a smaller version of pacstrap that does not require you to use a mount point as the root, and it mount the {proc,sys,udev,tmp...} for you (which is unecessary for myself) here it is.

Last edited by hack.augusto (2014-05-31 21:56:42)

Offline

#8 2014-06-03 02:22:33

stevenhoneyman
Member
From: England
Registered: 2014-05-25
Posts: 241

Re: Minimal arch linux image

Not sure if it'd be any different for you, but there's always the archlinux-bootstrap archives that could give you a starting point (80MB archive for i686):

https://mirrors.kernel.org/archlinux/iso/2014.05.01/

https://wiki.archlinux.org/index.php/In … trap_Image

Offline

#9 2014-06-03 03:21:14

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: Minimal arch linux image

This might be an excellent starting point if you're looking for a minimal Docker Archlinux base image. There's a link on that page to the script used to generate that image. I think that may be what you're looking for.

Scott

Last edited by firecat53 (2014-06-03 03:21:31)

Offline

Board footer

Powered by FluxBB