You are not logged in.

#1 2020-02-03 17:47:57

rokidakota
Member
Registered: 2014-11-22
Posts: 40

[SOLVED] Can not arch-chroot to grub-mkconfig

Hi,

I've been trying to repair my grub for 2 days with no luck.

I need to run grub-mkconfig. That throws

grub-probe: error: failed to get canonical path of `airootfs`

I read that the solution is to run

arch-chroot /mnt

where I mounted the partition I need.
That gives me

chroot: failed to run command /bin/bash

.
I tried to do

$ mount--bind /x /mnt/x

where x was dev, sys, proc, run. Then

arch-chroot

gives me

proc already mounted on /proc

.

How can I make arch-chroot work?

ps. I have booted from a usb stick with Arch.

Last edited by rokidakota (2020-02-05 10:19:06)

Offline

#2 2020-02-03 17:52:57

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,102

Re: [SOLVED] Can not arch-chroot to grub-mkconfig

Mount your root to /mnt and your /boot - if applicable - to /mnt/boot , run arch-chroot. This shouldn't fail, should this still fail, post the exact GRUB mkconfig command you are trying and

lsblk -f
ls -l /mnt
ls -l /mnt/boot

Offline

#3 2020-02-03 18:37:49

rokidakota
Member
Registered: 2014-11-22
Posts: 40

Re: [SOLVED] Can not arch-chroot to grub-mkconfig

I'm not sure I mounted the right thing.

$ lsblk -f
NAME   FSTYPE      FSVER LABEL       UUID                                 FSAVAIL FSUSE% MOUNTPOINT
loop0  squashfs    4.0                                                          0   100% /run/archiso/sfs/airootfs
sda                                                                                      
├─sda1 vfat        FAT32             B3B1-BCE1                             134.1M    55% /mnt
└─sda2 crypto_LUKS 1                 0bef26b1-1590-4550-9665-xxxxxx                
sdb                                                                                      
└─sdb1 ext4        1.0               778ef320-7dcc-41bc-bcfa-xxxxxxx                
sdc    iso9660           ARCH_202002 2020-02-01-06-56-28-00                              
├─sdc1 iso9660           ARCH_202002 2020-02-01-06-56-28-00                     0   100% /run/archiso/bootmnt
└─sdc2 vfat        FAT16 ARCHISO_EFI 0F01-CE05                                           

$ ls -l /mnt 
total 76612
drwxr-xr-x   4 root root     4096 Jan 31 13:20 FOOBAR_EFI
-rwxr-xr-x   1 root root        2 Feb  3 16:39 VERSION
drwxr-xr-x   2 root root     4096 Feb  3 17:32 bin
drwxr-xr-x   3 root root     4096 Feb  2 20:50 boot
-rwxr-xr-x   1 root root     2503 Feb  3 16:44 buildconfig
-rwxr-xr-x   1 root root       86 Feb  3 16:44 config
drwxr-xr-x   2 root root     4096 Feb  3 16:33 dev
drwxr-xr-x   4 root root     4096 Feb  2 20:50 efi
drwxr-xr-x   5 root root     4096 Feb  3 17:31 etc
drwxr-xr-x   5 root root     4096 Feb  2 18:16 grub
drwxr-xr-x   2 root root     4096 Feb  3 16:39 hooks
-rwxr-xr-x   1 root root     2093 Feb  3 16:39 init
-rwxr-xr-x   1 root root 20847041 Feb  3 16:59 initramfs-linux.img
-rwxr-xr-x   1 root root 41532248 Feb  3 16:59 initramfs-linux-fallback.img
-rwxr-xr-x   1 root root    13140 Feb  3 16:39 init_functions
-rwxr-xr-x   1 root root  3121152 Feb  2 18:16 intel-ucode.img
drwxr-xr-x   2 root root     4096 Feb  2 18:16 memtest86+
drwxr-xr-x   2 root root     4096 Feb  3 16:33 new_root
dr-xr-xr-x 159 root root        0 Feb  3 16:04 proc
drwxr-xr-x  22 root root      560 Feb  3 16:05 run
drwxr-xr-x   2 root root     4096 Feb  3 16:33 sys
drwxr-xr-x   2 root root     8192 Feb  2 18:16 syslinux
drwxr-xr-x   2 root root     4096 Feb  3 16:33 tmp
drwxr-xr-x   7 root root     4096 Feb  3 16:33 usr
drwxr-xr-x   5 root root     4096 Feb  3 17:31 var
-rwxr-xr-x   1 root root  6445440 Feb  2 18:16 vmlinuz-5.4-x86_64
-rwxr-xr-x   1 root root  6400384 Feb  2 18:16 vmlinuz-linux

$ ls /mnt/boot
total 4
drwxr-xr-x 5 root root 4096 Feb  2 20:50 grub

I'm trying to make it boot from the encrypted partition. There are some random folders from experimenting...

Offline

#4 2020-02-03 18:39:45

rokidakota
Member
Registered: 2014-11-22
Posts: 40

Re: [SOLVED] Can not arch-chroot to grub-mkconfig

Do you mean that /mnt/boot should be the decrypted boot folder from sda2?

Offline

#5 2020-02-03 18:46:36

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,102

Re: [SOLVED] Can not arch-chroot to grub-mkconfig

No, the decrypted folder should be /mnt granted that that's your root partition (or is it? your root partition should be mounted to /mnt your ESP to /mnt/boot after) , your ESP should then be on /mnt/boot (this doesn't actually matter all that much, but I've no idea what and how you've set it up, is GRUB and it's config on the ESP or does it load that from the decrypted main disk? )

You have a random hodgepodge of files and directories that have no reason to be on your ESP on your ESP. Also seeing that vmlinuz, is this actually a Manjaro install?

The partition you've currently mounted to /mnt is your ESP, that has no reason to be there, if your intention is to chroot.

Last edited by V1del (2020-02-03 18:50:21)

Offline

#6 2020-02-03 19:12:49

rokidakota
Member
Registered: 2014-11-22
Posts: 40

Re: [SOLVED] Can not arch-chroot to grub-mkconfig

I should have asked earlier how to do this.

I've worked with Arch on a 256 Gb SSD for years (drive A). It was using bios encryption.

I got a larger SSD (drive B). I wanted to disable bios encryption, set up LUKS in drive B, move everything from A to B.

Friends recommended me to try Manjaro, so I did install it on drive B. B1 is root, B2 is the rest, encrypted with LUKS.
So far all god, two drives, two systems.

I decided I prefer Arch. Since Manjaro did set up LUKS, I thought I could make use of it.
I tried to move files from A (Arch, 256 Gb) to partitions B1 and B2.
And that's where I'm at now.

Should I open a new thread and ask if it's possible to move from a non-encrypted ssd to a larger encrypted ssd
without reinstalling everything?

Offline

#7 2020-02-03 19:56:31

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,102

Re: [SOLVED] Can not arch-chroot to grub-mkconfig

Possible? Of course, but doing it properly requires a bit of an understanding of how the partitions and system is set up, and I'm unsure as to what way potential left over files from manjaro - if not purged entirely - will conflict if you simply copy over the data. Given the state of affairs I'd highly recommend you properly start from scratch following the Arch wiki, it will clear up a few concepts you don't seem to be familiar with right now.

If you still want to try without a reinstall:

First of all to map your As and Bs to actual devices as detected according to the output above: /dev/sda is your B /dev/sda1 is your ESP and not your root partition, /dev/sda2 hence is the Manjaro root partition and /dev/sdb1 your A and hence your existing Arch installs root (note here that neither sda nor sdb are reliable, always double check with UUIDs/partition counts that you are still manipulating the same device).

So what you will want to do is mount /dev/sda2 (probably /mnt as we will reuse it) and /dev/sdb1 somewhere clean up everything on /dev/sda2 that isn't $HOME do something similar to https://wiki.archlinux.org/index.php/Rs … tem_backup to transfer your Arch install. Then reconfigure fstab/GRUB as necessary. See https://wiki.archlinux.org/index.php/Mi … _to_Bottom as well

Offline

#8 2020-02-04 11:40:31

rokidakota
Member
Registered: 2014-11-22
Posts: 40

Re: [SOLVED] Can not arch-chroot to grub-mkconfig

Thank you very much for your help smile

I already had set up sda2 (the Manjaro root partition) by rsyncing from sdb1 (the Arch install root), with the --delete option and other options to ensure permissions and users are the same, also adjusted fstab copying the corresponding line from the Manjaro fstab.

What confuses me is going from one partition to two partitions. The linked articles don't mention that situation.
Specifically, how to set up sda1 (the ESP) that used to be a Manjaro ESP.

Should I delete every file in sda1 and try that step again?

This is what I do when I boot with the Arch USB stick:

$ mount /dev/sda1 /mnt

# In /etc/default/grub
GRUB_ENABLE_CRYPTODISK=y
GRUB_CMDLINE_LINUX="cryptdevice=/dev/sdb2:luks5"

# edit /etc/mkinitcpio.conf
# add: crypto lvm2

# edit /etc/mkinitcpio.d/linux.preset
# substitute: /boot for /mnt
# so mkinitcpio works

$ mkinitcpio -p linux

$ grub-install --target=x86_64-efi --bootloader-id=GRUB --efi-directory=/mnt/efi --boot-directory=/mnt/b
oot

$ grub-mkconfig -o whatever

The last command always fails, and that's how I got to post my original question. /etc points to the temporary system created by the Arch USB stick

ps. Sorry for not using the correct terminology. I just learned what ESP means.

Last edited by rokidakota (2020-02-04 11:44:38)

Offline

#9 2020-02-04 12:20:27

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,102

Re: [SOLVED] Can not arch-chroot to grub-mkconfig

I'd indeed suggest you remove everything on /dev/sda1. You keep trying to use your ESP as your root partition, don't do that. You also shouldn't change around or work with files provided by the stick as opposed to stuff that's actually on your system partition.

Then mount your actual root (sda2) to /mnt , remove whatever's currently in /mnt/boot, then mount the ESP sda1 to /mnt/boot then run arch-chroot.

You should be on your Arch's root partition. with /boot being your ESP. From there, adjust the /etc/default/grub config and double check and fix your fstab ("/dev/sda2" should be / and "/dev/sda1" /boot but ensure you use UUIDs/cryptdevice names here) adjust mkinitcpio.conf run

mkinitcpio -p linux
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg

Offline

#10 2020-02-04 17:26:36

rokidakota
Member
Registered: 2014-11-22
Posts: 40

Re: [SOLVED] Can not arch-chroot to grub-mkconfig

Thank you very much V1del! smile I'm very close smile

Now I see grub when it starts, then it asks me for the password, but never continues.
Stuck at "A password is required to access the X volume:"
The cursor blinks forever. Is there an error log at this stage?

BTW. By removing everything on /dev/sda1 mkinitcpio would no longer work, as some linux images were required. I copied them from my working Arch disk, from it's /boot folder.

Last edited by rokidakota (2020-02-04 17:40:03)

Offline

#11 2020-02-04 21:13:50

rokidakota
Member
Registered: 2014-11-22
Posts: 40

Re: [SOLVED] Can not arch-chroot to grub-mkconfig

I removed 'quiet' at the grub menu and see

:: running early hook [udev]
Starting version 244.1-1-arch
:: running early hook [lvm2]
:: running hook [udev]
:: Triggering uevents...
:: running hook [keymap]
:: Loading keymap...done.
:: running hook [encrypt]

A password is required to access the xxx volume:
Enter passphrase for /dev/sda2: _

Update: I guess I have to study this: https://bbs.archlinux.org/viewtopic.php?id=212515

Update 2: found. I need to press the ECO key to make it work. https://bbs.archlinux.org/viewtopic.php?id=252406

I'm very thankful for V1del's help. And j83a sharing his discovery.


I leave here how I did the arch-chroot part to experiment with mkinitcpio.conf, fstab, grub.cfg

# boot from USB stick
$ loadkeys dvorak-programmer
$ lsblk # in the same SSD there are two partitions: NONENCRYPTED (for booting) and ENCRYPTED (with data and the OS)
$ cryptsetup luksOpen /dev/ENCRYPTED crypthome
$ mount /dev/mapper/crypthome /mnt
$ mount /dev/NONENCRYPTED /mnt/boot
$ arch-chroot /mnt
$ setfont ter-p22n
# now play with /etc/mkinitcpio.conf, /etc/fstab, /etc/default/grub

Last edited by rokidakota (2020-02-05 10:17:18)

Offline

Board footer

Powered by FluxBB