ArchLinux offline pseudo-installation step by step

This article was sent to me by our friend Hugo Florentino via email, where he tells us about his experience trying to install ArchLinux without having any repository at hand, just using the installation disk

Pseudo-installation

A couple of days ago I downloaded the ArchLinux ISO to do a home installation. Having previously used other distributions that allow you to install at least a minimum base from CD, I wanted to do something similar, but curiously, the Arch installation process is not designed for a computer that does not have Internet access (side effects of developers living in the first world).

In my case, I already had Windows 7 (with its boot and system partition) and Fedora (with its swap and its dedicated / boot partition) on my disk. The idea was then to get Arch installed where Fedora was previously, without destroying Windows in the process.

ArchLinux offline pseudo-installation

Well, I booted from the Arch CD, choosing x86_64, and without much ado left me at a console. I thought, "Wow, these guys are serious about not being a rookie distro ... okay, let's play along then and see what happens."

I listed the directory where I was to see if there was any documentation and I discovered that there was indeed a text with an elementary installation guide. I wrote what was relevant on a piece of paper (I don't have a printer at home) and got to work.

The first thing I did was change the keyboard layout to Spanish from Spain, which was easier than I expected (there is even a curiously called us-accents):

loadkeys es

The next thing was to mount an external disk to save a copy of the MBR in case of problems and to save the important information that I had in my Fedora:

mkdir -p / mnt / tmp1 && mount / dev / sdb1 / mnt / tmp1 dd if = / dev / sda of = / mnt / tmp1 / mbr.bin bs = 512 count = 1

Fortunately Arch's LiveCD supports NTFS and has built-in Midnight comander (MC), so in no time I finished saving the rest of the information.

I then unmounted the disk, removed the temporary directory, and physically removed the external disk to reduce the risk of potential "cagastrophes."

umount /mnt/tmp1 && rmdir /mnt/tmp1

So I formatted my partitions, mounted the root and boot partition, and turned on swap:

mkfs -t ext4 / dev / sda3 mkfs -t ext4 / dev / sda6 mount / dev / sda6 / mnt mkdir -p / mnt / boot mount / dev / sda3 / mnt / boot swapon / dev / sda5

The next step was my first hurdle:

pacstrap /mnt base

Arch naturally tried looking for the repositories databases on one of the mirrors, and not being able to find any, everything pacstrap It did was create a directory structure in / mnt, very organized, but obviously empty.

On the phone, I asked a couple of friends who use Arch if there was no way to install without internet access at least the same packages that are on the LiveCD, without having a repository copied to disk either, and they told me that at least they did not know how to do it.

I found the tech 'challenge' interesting, so I thought, 'If Arch is able to log in in LiveCD mode, it should be able to install to a hard drive in at least that same mode,' so I tried manually copying the files and following the rest of the tutorial (with the odd minor change) to see what happened:

rsync -avl / {bin, etc, home, lib, lib64, opt, root, sbin, srv, usr, var} / mnt arch-chroot / mnt genfstab -p / >> / etc / fstab echo hpc> / etc / hostname ln -sf / usr / share / zoneinfo / Cuba / etc / localtime locale-gen

The next step was my next hurdle:

mkinitcpio -p linux

This command produced some errors, after reading the command manual and the contents of the files /etc/mkinitcpio.conf y /etc/mkinitcpio.d/linux.preset, I understood that the command could not find the file vmlinuz-linux, so I pressed Ctrl + D to exit the chroot environment, and looked for any file that looked like it:

find / -type f -iname "*vmlinuz*"

It happens that Arch's LiveCD mounts the boot files under the directory / run /, so I decided to copy them to me / boot / to have them handy within my chroot environment:

cp /run/archiso/bootmnt/arch/boot/[memtest,intel_ucode.img} / mnt / boot / cp / run / archiso / bootmnt / arch / boot / x86_64 / * / mnt / boot / arch-chroot / mnt

As another error I found experimenting with mkinitcpio was that the label of the root partition could not be found, I wrote down its UUID (which I identified using the blkid command) to use with the command, which finally looked like this:

mkinitcpio -p linux -k /boot/vmlinuz root=UUID=d85938aa-83b8-431c-becb-9b5735264912

This time the build ended successfully, only with a couple of warnings of modules that could not be found, but in my case were not needed. Just in case, I rebuilt the fstab, but this time specifying UUID:

genfstab -U -p / > /etc/fstab

I thought: oh well, finally progress. And I went on to change the password and install a bootloader.

passwd grub-install --target = i386-pc --recheck / dev / sda grub-mkconfig -o /boot/grub/grub.cfg

Finally, and to be methodical, I pressed Ctrl + D again to exit the chrooted environment, disassembled everything and restarted to see what happened:

umount / mnt / boot umount / mnt reboot

The computer restarted showing the Grub menu with Arch (Windows did not appear anywhere), so I selected it and everything seemed to be loading fine until ... the system indicated that there had been errors that I should check with the following command:

journalctl -xb

Analyzing the errors, I saw that most could be ignored, but the last one was unusual, telling me that plymouth could not be found.

I immediately thought, Plymouth ??? Why the heck does a console boot environment need something like this? That doesn't seem very KISS to say. I certainly have not put it, nor do I need it. "

But to be practical, I thought: "Well, but at least it should be referenced in some file, let's see ...":

find /etc -type f -print0 | xargs -0 grep -i "plymouth"

Surprisingly, no file with the text string "plymouth" appeared in the configuration directory. I thought then: «Oh, so… you force yourself with me? then let's see how you assimilate a 'cannon' ”(as we say in Cuba), and“ I built ”plymouth from scratch:

vi / usr / bin / plymouth chmod 755 / usr / bin / plymouth

For those of you wondering what I put in that file, here is the content in its glorious entirety:

#! / bin / sh exit

I rebooted again expecting some error and ... surprisingly, systemd was happy to have found that "essential component", because it finished the startup process and without further delay it left me in the console. Since I couldn't believe my eyes, I decided to "uninstall" plymouth and reboot, to see what happened:

rm -fr / usr / bin / plymouth reboot

Strangely, this time the system started quietly without further annoying me with Plymouth's absence. (No comment)

Adding Windows to GRUB

It was then to add the Windows entry to GRUB. As the traditional routes did not work (the combination of grub-mkconfig with os-prober didn't seem to be working well), I decided to create the entry manually, for which I needed to detect the Windows bootloader string and the UUID of the boot partition:

mkdir -p / mnt / winboot && mount / dev / sda1 / mnt / winboot grub-probe --target = hints_string / mnt / winboot / bootmgr grub-probe --target = fs_uuid / mnt / winboot / bootmgr

This respectively returned these two strings to me:

--hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1
DC788F27788EFF8E

In this way I verified that the UUID returned was the same that was obtained for that partition when executing the blkid command. It was then necessary to generate a custom grub entry with said data:

vi /etc/grub.d/40_custom

In its content:

#! / bin / sh exec tail -n +3 $ 0 # This file provides an easy way to add custom menu entries. Simply type the # menu entries you want to add after this comment. Be careful not to change # the 'exec tail' line above. menuentry "Microsoft Windows 7 SP1" --class windows --class os {insmod part_msdos insmod ntfs insmod search_fs_uuid insmod ntldr search --fs-uuid --set = root --hint-bios = hd0, msdos1 --hint-efi = hd0, msdos1 --hint-baremetal = ahci0, msdos1 DC788F27788EFF8E ntldr / bootmgr}

After completing this step, I decided to set Windows as the default operating system, so that my wife does not panic and my niece can play her Barbies when she comes. For this I simply edited the file / Etc / default / grub and I set the input to launch by default and the timeout to just 3 seconds.

GRUB_DEFAULT = 2 GRUB_TIMEOUT = 3

It only remained to regenerate the GRUB configuration again, and restart:

grub-mkconfig -o /boot/grub/grub.cfg reboot

Fortunately, everything went as expected. I selected the Windows entry and it started happily.

So as you can see, at least one ArchLinux offline pseudo-installation can be done step by step without being online only with the CD, although obviously, what will be installed on the hard disk is essentially a LiveCD, but at least it can boot a system, copy files, and run some applications.

Luckily Sandy (KZKG ^ Gaara) stopped by and copied the Arch repo (for which I am very grateful), so I plan to finish doing a real offline installation soon, but this would be another story. What I can assure you is that for a long time I have been missing this kind of fun experimentation a bit. In fact, if I had time, connectivity in the house and certain material conditions ensured, I would probably try to make a custom distribution based on LFS, which would be a much more fun project. 😉


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   peterczech said

    Hope you give FreeBSD Elav a try.
    As for your guide, very very very good and complete ...

    1.    Ramp said

      How changeable you are. I assure you, you will get bored with FreeBSD in a few months.

      1.    lf said

        Interesting information, however I still do not see guides to install arch in systems with UEFI, do the archers have new PCs?

        1.    elav said

          The installation with UEFI in ArchLinux is simplified by installing Antergos, you only have to create a partition in Fat32 with less than 500MB and automatically (when you boot the USB with UEFI), Antergos will mark the partition as / boot.

      2.    peterczech said

        That's why I change ... To not change anymore I go from Linux to BSD: D.

    2.    peterczech said

      Change made and written guide: D.

    1.    ozkar said

      Keep using Arch, when I go to Havana I'll pick it up.

  2.   Alex said

    I have an Arch Linux iso on my usb I didn't dare to use it due to lack of time.
    I'm going to take a good review of the article and then use it!

  3.   Warheart said

    Excellent article, by the way it reminds me of the odyssey I went through to install Arch via WIFI with a BCM4312.

  4.   kalevito said

    Elav, excuse the question but I am new to linux, I have only used ubuntu and arch linux catches my attention. My friends say that I will not be able to install it because it is for experts, but seeing your offline tutorial, I think that following step by step I can do it, it is a challenge for me to install it. Only I want to do it with the Internet, there my question: do you have or when will you do a tutorial with so much detail (like this one) to install it?

    1.    daekko said

      The guide is published on this site. https://blog.desdelinux.net/guia-de-instalacion-de-arch-linux-2014/

      😀 So using the guide and paying attention to what is done we will have an installation without complications, luck!

    2.    elav said

      You can still install Antergos, which is Archlinux but with an "Ubuntu" installation .. 😀

  5.   aphanic said

    In Arch there is another alternative installation medium to the official images called Archboot that, unlike the official images, contains the [core] repository (and something else), useful for offline installations (it is also a hybrid architecture, it works for i686 and for x86_64).

    The bad thing is that it occupies 1GB right now (it used to occupy much less years ago) that would have to be downloaded before ... and without a stable connection to do that initial download is complicated.

    I leave you here a link in case it is useful to you: https://wiki.archlinux.org/index.php/archboot

    1.    elav said

      Interesting, I didn't know him 😀

    2.    Hugo said

      Well, curiously, a while ago I tried archboot and when I get to the pacstrap part it tells me that it cannot find the ntfs-3g package 🙁

      It also has other peculiarities, such as that it does not include mc or manual pages, and it needs a lot of ram to install. It doesn't seem like a well-polished solution.

  6.   Max Steel said

    The truth is that there is a very simple way to install arch offline and which I had to do the classic trial and error to install it on my home PC (where I don't have internet).

    For this you obviously need some other PC with arch and internet connection. Just make a pacman -Syu first and then a pacman -Sw base (plus everything you want to install obviously). Copy all the files from the pacman cache to a usb stick and also the database files (/var/lib/pacman/sync/{core.db, extra.db, community.db}.

    Then proceed to do the normal arch installation, but before getting to the point of making the pacstrap - d / mnt base (or whatever, I say everything from memory>. <) You have to edit precisely pacstrap (with vi or whatever you prefer or bring the installation disk) and almost to the end there is a line that refers to "pacman -Syy", we simply delete it. Following this we copy the pacman database files to their corresponding place (all the .db files to / var / lib / pacman / sync), and the cache files to the cache directory.

    So now we do proceed with pacstrap -loquenomeaccord / mnt base and everything else.

    All that I say from memory, so there may be some detail that I have gone, such as the cache files I do not remember exactly where they go but it should be in / var / cache / pacman / pkg or if it cannot be specified in pacstrap seems to me.

  7.   Leonel said

    They could do a cfdisk tutorial with double or triple boot 🙁, bes what I need to install arch

    1.    Hugo said

      There really isn't much to say about cfdisk as it is not complex at all, and in fact the installation guide referenced above basically shows how to use it. But if you have other systems installed you could use something more friendly, perhaps Gparted. For Windows there is a free tool (although unfortunately not free) called Easeus Partition Master that you could use, it seems to work very well.

      For the rest I am glad that you found the article interesting, I did not see the great merit of my experience, but Elav encouraged me to prepare something about it.