archlinux / archinstall

Arch Linux installer - guided, templates etc.
GNU General Public License v3.0
5.82k stars 508 forks source link

Encryption error with homeloop.key #767

Closed 144 closed 2 years ago

144 commented 2 years ago

Hey, I've been trying to use the Git version of archinstall with the following disk layout:

{
    "/dev/sda": {
        "partitions": [
            {
                "boot": true,
                "encrypted": false,
                "filesystem": {
                    "format": "fat32"
                },
                "format": true,
                "mountpoint": "/boot",
                "size": "513MB",
                "start": "5MB",
                "type": "primary"
            },
            {
                "encrypted": true,
                "filesystem": {
                    "format": "ext4"
                },
                "format": true,
                "mountpoint": "/",
                "size": "20GB",
                "start": "518MB",
                "type": "primary"
            },
            {
                "encrypted": true,
                "filesystem": {
                    "format": "ext4"
                },
                "format": true,
                "generate-encryption-key-file": true,
                "mountpoint": "/home",
                "size": "100%",
                "start": "20.5GB",
                "type": "primary"
            }
        ],
        "wipe": true
    }
}

And that's the output:

Hardware model detected: innotek GmbH VirtualBox; UEFI mode: True
Processor model detected: Intel(R) Core(TM) i5-7400 CPU @ 3.00GHz
Memory statistics: 3454196 available out of 4006184 total installed
Virtualization detected: oracle; is VM: True
Graphics devices detected: dict_keys(['VMware SVGA II Adapter'])
Disk states before installing: {'blockdevices': [{'name': 'loop0', 'fstype': 'squashfs', 'fsver': '4.0', 'label': None, 'uuid': None, 'fsavail': '0', 'fsuse%': '100%', 'mountpoints': ['/run/archiso/airootfs'], 'type': 'loop', 'size': '700.3M'}, {'name': 'sda', 'fstype': None, 'fsver': None, 'label': None, 'uuid': None, 'fsavail': None, 'fsuse%': None, 'mountpoints': [None], 'type': 'disk', 'size': '48G'}, {'name': 'sr0', 'fstype': 'iso9660', 'fsver': 'Joliet Extension', 'label': 'ARCH_202111', 'uuid': '2021-11-23-23-10-35-00', 'fsavail': '0', 'fsuse%': '100%', 'mountpoints': ['/run/archiso/bootmnt'], 'type': 'rom', 'size': '879.3M'}]}
Testing connectivity to the Arch Linux mirrors ...
Unknown blockdevice type for /dev/sr0: rom
Unknown blockdevice type for /dev/sr0: rom
Verifying that additional packages exist (this might take a few seconds)
Hardware time and other post-configuration steps might be required in order for NTP to work. For more information, please check the Arch wiki.
-- Guided template chosen (with below config) --
{
    "audio": null,
    "bootloader": "grub-install",
    "desktop-environment": "kde",
    "dry-run": false,
    "gfx_driver": "VMware / VirtualBox (open-source)",
    "harddrives": [
        "/dev/sda"
    ],
    "hostname": "arch",
    "kernels": [
        "linux"
    ],
    "keyboard-layout": "us",
    "mirror-region": {
        "Poland": {
            "http://arch.midov.pl/arch/$repo/os/$arch": true,
            "http://arch.nixlab.pl/$repo/os/$arch": true,
            "http://ftp.icm.edu.pl/pub/Linux/dist/archlinux/$repo/os/$arch": true,
            "http://ftp.psnc.pl/linux/archlinux/$repo/os/$arch": true,
            "http://ftp.vectranet.pl/archlinux/$repo/os/$arch": true,
            "http://mirror.juniorjpdj.pl/archlinux/$repo/os/$arch": true,
            "http://mirror.onet.pl/pub/mirrors/archlinux/$repo/os/$arch": true,
            "http://mirror.sfinae.tech/pub/mirrors/archlinux/$repo/os/$arch": true,
            "http://repo.skni.umcs.pl/archlinux/$repo/os/$arch": true,
            "https://arch.midov.pl/arch/$repo/os/$arch": true,
            "https://arch.nixlab.pl/$repo/os/$arch": true,
            "https://ftp.icm.edu.pl/pub/Linux/dist/archlinux/$repo/os/$arch": true,
            "https://ftp.psnc.pl/linux/archlinux/$repo/os/$arch": true,
            "https://mirror.juniorjpdj.pl/archlinux/$repo/os/$arch": true,
            "https://mirror.sfinae.tech/pub/mirrors/archlinux/$repo/os/$arch": true,
            "https://repo.skni.umcs.pl/archlinux/$repo/os/$arch": true
        }
    },
    "nic": {
        "NetworkManager": true,
        "nic": "Use NetworkManager (necessary to configure internet graphically in GNOME and KDE)"
    },
    "ntp": true,
    "packages": [
        "firefox"
    ],
    "profile": {
        "path": "/usr/lib/python3.9/site-packages/archinstall-2.3.0.dev0-py3.9.egg/archinstall/profiles/desktop.py"
    },
    "script": "guided",
    "swap": true,
    "sys-encoding": "utf-8",
    "sys-language": "en_US",
    "timezone": "Europe/Warsaw"
}
{
    "/dev/sda": {
        "partitions": [
            {
                "boot": true,
                "encrypted": false,
                "filesystem": {
                    "format": "fat32"
                },
                "format": true,
                "mountpoint": "/boot",
                "size": "513MB",
                "start": "5MB",
                "type": "primary"
            },
            {
                "encrypted": true,
                "filesystem": {
                    "format": "ext4"
                },
                "format": true,
                "mountpoint": "/",
                "size": "20GB",
                "start": "518MB",
                "type": "primary"
            },
            {
                "encrypted": true,
                "filesystem": {
                    "format": "ext4"
                },
                "format": true,
                "generate-encryption-key-file": true,
                "mountpoint": "/home",
                "size": "100%",
                "start": "20.5GB",
                "type": "primary"
            }
        ],
        "wipe": true
    }
}
Creating a new partition label on /dev/sda
Adding partition to BlockDevice(/dev/sda, size=48.0GB, free_space=51.5GB, bus_type=sata), 5MB->513MB
Getting mount information for device path /dev/sda1
Formatting /dev/sda1 -fat32
Marking partition Partition(path=/dev/sda1, size=0.5, PARTUUID=38ad4803-ef45-416c-99b4-0586f19b449e, fs=fat32) as bootable.
Setting boot on on (parted) partition index 1
Adding partition to BlockDevice(/dev/sda, size=48.0GB, free_space=5225kB+51.0GB, bus_type=sata), 518MB->20GB
Getting mount information for device path /dev/sda2
Encrypting Partition(path=/dev/sda2, size=18.1, PARTUUID=a38c71df-2eb0-447a-8cb7-0c292ab8a5d8, fs=None) (This might take a while)
Getting mount information for device path /dev/mapper/ainstloop
Formatting /dev/mapper/ainstloop -ext4
Adding partition to BlockDevice(/dev/sda, size=48.0GB, free_space=5225kB+5243kB+31.5GB, bus_type=sata), 20.5GB->100%
Getting mount information for device path /dev/sda3
Encrypting Partition(path=/dev/sda3, size=28.9, PARTUUID=92e3c9cf-7a07-43a8-a73f-c4b9b15e2146, fs=None) (This might take a while)
Getting mount information for device path /dev/mapper/ainsthomeloop
Formatting /dev/mapper/ainsthomeloop -ext4
Getting mount information for device path /dev/mapper/ainstloop
Mounting / to /mnt/archinstall/ using Partition(path=/dev/mapper/ainstloop, size=18.1, PARTUUID=None, parent=/dev/sda2, fs=ext4)
Mounting Partition(path=/dev/mapper/ainstloop, size=18.1, PARTUUID=None, parent=/dev/sda2, fs=ext4) to /mnt/archinstall/
Getting mount information for device path /mnt/archinstall/
Mounting /boot to /mnt/archinstall/boot using Partition(path=/dev/sda1, size=0.5, PARTUUID=38ad4803-ef45-416c-99b4-0586f19b449e, fs=fat32)
Mounting Partition(path=/dev/sda1, size=0.5, PARTUUID=38ad4803-ef45-416c-99b4-0586f19b449e, fs=fat32) to /mnt/archinstall/boot
Getting mount information for device path /mnt/archinstall/boot
Getting mount information for device path /dev/mapper/ainsthomeloop
[Errno 2] No such file or directory: '/etc/cryptsetup-keys.d/homeloop.key'
Torxed commented 2 years ago

I will look in to this before tagging the release, as this would be a blocker for multi-partition-encryption.

Torxed commented 2 years ago

It didn't specify on which line in the installer it happened? Like a Python traceback or anything? I really need to add that to the log file, it used to be there but got weeded out in some changes.

I suspect it's here: https://github.com/archlinux/archinstall/blob/070d088462aeabdc4e62893829a024b5a36b5e00/archinstall/lib/installer.py#L205-L206

But I'm not entirely sure how this can happen as we have a check for this just two lines above: https://github.com/archlinux/archinstall/blob/070d088462aeabdc4e62893829a024b5a36b5e00/archinstall/lib/installer.py#L199-L200

As well as a check when calling luks.add_key(): https://github.com/archlinux/archinstall/blob/070d088462aeabdc4e62893829a024b5a36b5e00/archinstall/lib/luks.py#L156-L158

Got it: screenshot

It's the chmod that's not working.