You are not logged in.

#1 2022-12-08 00:58:38

HumungusFungus
Member
Registered: 2022-12-08
Posts: 15

[SOLVED]Arch-chroot from arch iso on USB boot, luksdev encrypted drive

So I had a working arch build which I used every day with no issues, but changed the name of one of the system files accidentally, I think it was linux-lts-fallback.img or something. After that I was unable to log back into it, so I tried booting into a live environment using a usb to arch-chroot into my filesystem and just name my file back to it's original name. I first did

mount /dev/sda1 /mnt

to mount it, but there's also an sda2 but whenever I try to mount that it says "wrong fs type, bad option, bad super lock on /dev/sda2, missing codepage or helper program, or other error", not sure if that's an issue or not.

So I tried using "arch-chroot /mnt" but I got an error:

chroot: failed to run command /bin/bash: no such file or directory

even though I had previously done the command

pacstrap /mnt base linux linux-firmware

although even that got an error "could not open file /mnt/var/cache/pacman/pkg/iptables-1:1.8.8-2-x86_64.pkg.tar.zst.part: Invalid arguement"

If anyone knows the next step forward, I would greatly appreciate it, I hope I can recover my filesystem and continue using it like I used to.

Last edited by HumungusFungus (2022-12-09 01:21:12)

Offline

#2 2022-12-08 01:16:54

loqs
Member
Registered: 2014-03-06
Posts: 17,323

Re: [SOLVED]Arch-chroot from arch iso on USB boot, luksdev encrypted drive

After the chroot failed what is the output of

ls /mnt
mount
parted -l
blkid

See pastebin to post commands outputs from the live media.

Offline

#3 2022-12-08 06:23:42

growler
Member
Registered: 2022-09-26
Posts: 25

Re: [SOLVED]Arch-chroot from arch iso on USB boot, luksdev encrypted drive

Ubuntu-based live system with "chroot-rescue-scan" helper?

https://mxlinux.org/wiki/system/chroot-rescue-scan/

Offline

#4 2022-12-08 11:03:18

HumungusFungus
Member
Registered: 2022-12-08
Posts: 15

Re: [SOLVED]Arch-chroot from arch iso on USB boot, luksdev encrypted drive

loqs wrote:

After the chroot failed what is the output of

ls /mnt
mount
parted -l
blkid

See pastebin to post commands outputs from the live media.

Output of:
ls /mnt:
http://0x0.st/odSJ.txt

mount:
http://0x0.st/odSv.txt

parted -l
http://0x0.st/odSx.txt

blkid
http://0x0.st/odSY.txt

Offline

#5 2022-12-08 11:17:09

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,660

Re: [SOLVED]Arch-chroot from arch iso on USB boot, luksdev encrypted drive

According to those outputs it's most likely you actually intend to mount your nvme drive partitions and sda is your live usb

Unmount /dev/sda1 from /mnt/boot and /mnt, mount /dev/nvme0n1p2 to /mnt and /dev/nvme0n1p1 to /mnt/boot after

Since you seem confused by this, which instructions did you follow to install Arch?

Last edited by V1del (2022-12-08 11:18:32)

Online

#6 2022-12-08 14:06:52

HumungusFungus
Member
Registered: 2022-12-08
Posts: 15

Re: [SOLVED]Arch-chroot from arch iso on USB boot, luksdev encrypted drive

V1del wrote:

According to those outputs it's most likely you actually intend to mount your nvme drive partitions and sda is your live usb

Unmount /dev/sda1 from /mnt/boot and /mnt, mount /dev/nvme0n1p2 to /mnt and /dev/nvme0n1p1 to /mnt/boot after

Yeah this worked! However, there's another issue now after this. My drive is encrypted with luksdev,  but when booting up I get an error

mount: /new_root: special device /dev/mapper/luksdev does not exist. 

I'm not sure what causes this error...

V1del wrote:

Since you seem confused by this, which instructions did you follow to install Arch?

my first issue when I tried to arch-chroot was that/mnt/proc didn't exist, and so when I tried to find a fix for that I found this and followed it to install
and yes, I am quite confused by this

Offline

#7 2022-12-08 14:11:29

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

Re: [SOLVED]Arch-chroot from arch iso on USB boot, luksdev encrypted drive

How did you configure mkinitcpio?

Offline

#8 2022-12-08 14:59:59

HumungusFungus
Member
Registered: 2022-12-08
Posts: 15

Re: [SOLVED]Arch-chroot from arch iso on USB boot, luksdev encrypted drive

Scimmia wrote:

How did you configure mkinitcpio?

like this:
http://0x0.st/od1y.txt

Offline

#9 2022-12-08 15:31:47

seth
Member
Registered: 2012-09-03
Posts: 51,041

Re: [SOLVED]Arch-chroot from arch iso on USB boot, luksdev encrypted drive

HOOKS=(base udev autodetect modconf kms keyboard keymap consolefont block filesystems fsck)

Is that the mkinitcpio.conf of the install iso?
Otherwise you seem to have kinda missed https://wiki.archlinux.org/title/Dm-cry … figuration

V1del wrote:

which instructions did you follow to install Arch?

Not "how did you try to fix the arch-chroot situation"
What tutorial did you originally follow to install archlinux?

Online

#10 2022-12-08 16:01:17

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,773

Re: [SOLVED]Arch-chroot from arch iso on USB boot, luksdev encrypted drive

HumungusFungus, please edit your thread title (by editing your first post) and remove the pointless plea.  Perhaps read the article linked in my signature.

Also note that two highly respected users have observed that you don't seem to really understand how you installed things in the first place.  I agree.  Go back and READ the links you are being provided.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#11 2022-12-08 16:41:57

HumungusFungus
Member
Registered: 2022-12-08
Posts: 15

Re: [SOLVED]Arch-chroot from arch iso on USB boot, luksdev encrypted drive

seth wrote:
HOOKS=(base udev autodetect modconf kms keyboard keymap consolefont block filesystems fsck)

Is that the mkinitcpio.conf of the install iso?

yes, I also have another mkinitcpio.conf which seems to contain all the required parameters from your link, it contains:

HOOKS=(base udev autodetect keyboard keymap modconf block encrypt filesystem fsck)
seth wrote:
V1del wrote:

which instructions did you follow to install Arch?

Not "how did you try to fix the arch-chroot situation"
What tutorial did you originally follow to install archlinux?

ohhhh I just followed the archinstall script, and used the archwiki to guide me

Last edited by HumungusFungus (2022-12-08 16:43:18)

Offline

#12 2022-12-08 17:07:47

HumungusFungus
Member
Registered: 2022-12-08
Posts: 15

Re: [SOLVED]Arch-chroot from arch iso on USB boot, luksdev encrypted drive

ewaller wrote:

HumungusFungus, please edit your thread title (by editing your first post) and remove the pointless plea.  Perhaps read the article linked in my signature.

I have adjusted the thread title to something I hope is more appropriate, based on the very helpful article in your signature.

ewaller wrote:

Also note that two highly respected users have observed that you don't seem to really understand how you installed things in the first place.  I agree.  Go back and READ the links you are being provided.

You're right, I don't really understand what's going on, but I did read the links provided to me.

I read growler's link on the chroot-rescue script, and it looks really promising, but I just don't have any spare usb's to attempt their solution, the only one I have is one borrowed from an acquaintance used to boot into the live arch environment, and due to me not being on the best of terms with said acquaintance... I'm just not able to ask for another usb to boot Ubuntu and test out growler's answer. I don't have the resources for now, and so I couldn't comment on whether it worked or not because I couldn't test it.

I read Seth's link as well, and recently replied to it.

I highly appreciate what everyone in this thread has done for me, and I sincerely apologise if my replies aren't helpful, or suggest that I am in any way not reading the resources generously given to me, by highly respected users no less. I am quite new here and not used to the norms or etiquette here, but I'm open to learning and wish to be better.

Offline

#13 2022-12-08 20:46:15

seth
Member
Registered: 2012-09-03
Posts: 51,041

Re: [SOLVED]Arch-chroot from arch iso on USB boot, luksdev encrypted drive

yes, I also have another mkinitcpio.conf

What do you mean by "other mkinitcpio.conf"? There's only one mkinitcpio.conf - /etc/mkinitcpio.conf
Any other file w/ the same basename is irrelevant.
So which one is it, which one did you post and if it was the wrong one, please post the correct one.

Did you maybe rebuild the initramfs from the wrong™ mkinitcpio.conf?

Coming back to

. My drive is encrypted with luksdev,  but when booting up I get an error

mount: /new_root: special device /dev/mapper/luksdev does not exist.

I'm not sure what causes this error...

Booting up what? The installed system? The install iso?
When booting the install iso and

V1del wrote:

mount /dev/nvme0n1p2 to /mnt and /dev/nvme0n1p1 to /mnt/boot

, what's the output of "lsblk -f"?

Online

#14 2022-12-08 21:32:14

HumungusFungus
Member
Registered: 2022-12-08
Posts: 15

Re: [SOLVED]Arch-chroot from arch iso on USB boot, luksdev encrypted drive

seth wrote:

yes, I also have another mkinitcpio.conf

What do you mean by "other mkinitcpio.conf"? There's only one mkinitcpio.conf - /etc/mkinitcpio.conf
Any other file w/ the same basename is irrelevant.
So which one is it, which one did you post and if it was the wrong one, please post the correct one.

well this is from the live environment, on root@archiso. when I arch-chroot into /mnt, and ls to see the contents, I see all the directories you'd expect (bin, boot, etc, dev, home, proc and more) and in /etc there an mkinitcpio.conf, but there's also a directory called "@", as well as "@.snapshots" and "@home" (note: @home contains all the files from my original home directory, before this issue, unlike the home directory without the @ which is empty)

anyways, the contents of @ are very similar to the contents of /mnt, containing the same directories (bin, boot, etc and the rest), and inside /@/etc/ is another mkinitcpio.conf, and I'm honestly unsure which one is the correct one.

Did you maybe rebuild the initramfs from the wrong™ mkinitcpio.conf?

Perhaps, I'm not sure which conf mkinitcpio was used to build the initramfs. I'll look into this and try to figure it out and update.

Coming back to

. My drive is encrypted with luksdev,  but when booting up I get an error

mount: /new_root: special device /dev/mapper/luksdev does not exist.

I'm not sure what causes this error...

Booting up what? The installed system? The install iso?

the installed system, the iso boots up fine.

When booting the install iso and

V1del wrote:

mount /dev/nvme0n1p2 to /mnt and /dev/nvme0n1p1 to /mnt/boot

, what's the output of "lsblk -f"?

http://0x0.st/odLV.txt

Offline

#15 2022-12-09 00:39:35

HumungusFungus
Member
Registered: 2022-12-08
Posts: 15

Re: [SOLVED]Arch-chroot from arch iso on USB boot, luksdev encrypted drive

I fixed it! I added the encrypt hook to the /etc/mkinitcpio.conf in /mnt, (previously only the one in @/etc/ had it) but then after rebuilding the image files using

mkinitcpio -P

and rebooting, the error went away and I was able to log in! however after that I had an error with X server, where the default driver switched from Nvidia to Nouveau for some reason, but the reason for that was I didn't have nvidia-lts as I was using an lts version of the Linux kernel, linux-lts. Simply installing Nvidia-lts with

pacman -S nvidia-lts

fixed that, and my system was saved and back to normal

summary of the problem and solution for people reading from the future with a similar issue:

problem: something happened to your system and you aren't able to log in anymore (in my case I lost my initramfs). You try to arch-chroot from a live environment on a USB, but you get an error /bin/bash not found.

but that's probably because you picked the wrong partition! Check again that you're using the right partition, and not that of the USB!

After that, make sure to mount your partitions, and if you're using a luksdev encrypted drive like me, mount your encrypted drive with

cryptsetup open /dev/yourdevice root
mount /dev/mapper/root

and lastly, don't forget to

pacstrap /mnt base linux linux-firmware 

add linux-lts if you're using an lts kernel.

then you should be able to chroot just fine! However, afterwards if you aren't able to boot into your encrypted main system, check to make sure you have the encrypted hook in your mkinitcpio in /mnt! and don't forget to rebuild your image files with

 mkinitcpio -P 

lastly, if you have any issues starting up the X server, and you use Nvidia, make sure you have the nvidia package (nvidia-lts if you're on lts) with pacman, it'll make sure you aren't using nouveau which can sometimes happen, like in my case.

Offline

Board footer

Powered by FluxBB