Re: LUKS, "no device found"

2022-01-29 Diskussionsfäden Robert Markula

Am 29.01.22 um 01:45 schrieb Ian Eure:
After wiping the partition table, FAI is able to install without 
errors and I get a bootable system at the end.


For sustained wiping of disks you could use something along these lines:


mdadm --stop /dev/md0
mdadm --zero-superblock --force /dev/sda
sgdisk --zap-all /dev/sda


or use the mighty (and dangerous) "wipe-all"-hook at [1].

But be careful to wipe the correct disk(s)! Automated wiping of disks 
can be pretty catastrophic, especially in multi-disk setups. For local 
servers I personally tend to physically remove all disks that should be 
conserved during FAI installation, just in case.


Robert

[1] https://fai-project.org/download/misc/wipe-all


Re: LUKS, "no device found"

2022-01-28 Diskussionsfäden Ian Eure



Maximilian Stein  writes:

If fai stop with an error, you can go to a second tty  via 
"Alt-F2" and type there any command you like to test.




Exactly, that's what I had in mind.

Bonus: You can of course directly edit the disk config file and 
retry 
(and even actually attempt to write your configuration to disk) 
multiple 
times until it works. So, when you start with a known-working 
configuration (like the example) and gradually change it to your 
desired 
configuration you should find the problematic setting.


Excellent, I had poked around looking for another VT, but I guess 
I missed it.


After wiping the partition table, FAI is able to install without 
errors and I get a bootable system at the end.


Thanks for the help on this, I really appreciate it!

 -- Ian


Re: LUKS, "no device found"

2022-01-26 Diskussionsfäden Maximilian Stein



If fai stop with an error, you can go to a second tty  via "Alt-F2" and type 
there any command you like to test.



Exactly, that's what I had in mind.

Bonus: You can of course directly edit the disk config file and retry 
(and even actually attempt to write your configuration to disk) multiple 
times until it works. So, when you start with a known-working 
configuration (like the example) and gradually change it to your desired 
configuration you should find the problematic setting.


Best
Maximilian




OpenPGP_signature
Description: OpenPGP digital signature


AW: LUKS, "no device found"

2022-01-26 Diskussionsfäden Schulz, Reiner
> Sorry for the dumb question, but where would I add the "-d" flag?

If fai stop with an error, you can go to a second tty  via "Alt-F2" and type 
there any command you like to test.

first check if the fai configspace is mountet

you can do a 
ls -l /var/lib/fai/(config/disk_config/

and a

setup-storage -d

Reiner




Re: LUKS, "no device found"

2022-01-25 Diskussionsfäden Thomas Lange
> On Tue, 25 Jan 2022 16:06:52 -0800, Ian Eure  said:

> Is it trying to tear down the existent (broken) disk structure 
> instead of overwriting it?  Otherwise, I don’t understand what 
If you like to overwrite all old lvm softraid stsructures, you can
use a hook for that.
I use this script  https://fai-project.org/download/misc/wipe-all

> Sorry for the dumb question, but where would I add the "-d" flag? 
> I’m creating a CD image and booting it on the target machine using 
> Ventoy on a USB stick.
You have to edit the fai source code (lib/subroutines) which calls 
setup-storage.
-- 
viele Grüße Thomas


Re: LUKS, "no device found"

2022-01-25 Diskussionsfäden Ian Eure



Maximilian Stein  writes:



   Using config file: 
   /var/lib/fai/config/disk_config/LVM_LUKS_EFI

   Executing: wipefs -af /dev/sda1
   Executing: wipefs -af /dev/sda2
   Executing: vgchange -a y vg1
   Executing: wipefs -af /dev/vg1/root
   Executing: lvremove -f /dev/vg1/root
   Executing: head -c 2047 /dev/urandom | od | tee 
/tmp/fai/crypt_dev_sda3

   Executing: vgchange -a n vg1
   Executing: vgremove vg1
   pvremove  /dev/mapper/crypt_dev_sda3
   (STDERR)   No device found for /dev/mapper/cyrpt_dev_sda3
   Command had non-zero exit code

Are you sure that cryptsetup is installed on your stick/cd/nfs 
installer? The log output does not have any


Yes, it’s installed.  When it’s missing, setup-storage terminates 
before creating any partitions.


Basically no part of this output makes any sense to me.  It’s 
activating a vg here:


   Executing: vgchange -a y vg1

But it either hasn’t (or isn’t logging) the creation of the VG.

Then it deactivates and removes the VG:

   Executing: vgchange -a n vg1
   Executing: vgremove vg1

Then tries to remove the PV.

Is it trying to tear down the existent (broken) disk structure 
instead of overwriting it?  Otherwise, I don’t understand what 
it’s trying to do by removing the PV containing the LVs it’s 
supposed to install onto.



Maybe you could also try to use the "Plain disk + LUKS + LVM2" 
example 
directly (i.e., with a legacy PC bootloader, maybe even in a 
VM). I 
think I once had this running in the past for testing.


I can give that a shot, but I’ll need some kind of EFI solution 
for this.



For debugging setup-storage related issues I found it useful to 
add the 
"-d" option. After an installation has failed, you can just run 
setup-storage manually from the command line or via SSH and 
check the 
contents of its internal lists of the actual and desired config.




Sorry for the dumb question, but where would I add the "-d" flag? 
I’m creating a CD image and booting it on the target machine using 
Ventoy on a USB stick.


 -- Ian


Re: LUKS, "no device found"

2022-01-25 Diskussionsfäden Maximilian Stein




   Using config file: /var/lib/fai/config/disk_config/LVM_LUKS_EFI
   Executing: wipefs -af /dev/sda1
   Executing: wipefs -af /dev/sda2
   Executing: vgchange -a y vg1
   Executing: wipefs -af /dev/vg1/root
   Executing: lvremove -f /dev/vg1/root
   Executing: head -c 2047 /dev/urandom | od | tee 
/tmp/fai/crypt_dev_sda3

   Executing: vgchange -a n vg1
   Executing: vgremove vg1
   pvremove  /dev/mapper/crypt_dev_sda3
   (STDERR)   No device found for /dev/mapper/cyrpt_dev_sda3
   Command had non-zero exit code

Are you sure that cryptsetup is installed on your stick/cd/nfs 
installer? The log output does not have any


Maybe you could also try to use the "Plain disk + LUKS + LVM2" example 
directly (i.e., with a legacy PC bootloader, maybe even in a VM). I 
think I once had this running in the past for testing.


For debugging setup-storage related issues I found it useful to add the 
"-d" option. After an installation has failed, you can just run 
setup-storage manually from the command line or via SSH and check the 
contents of its internal lists of the actual and desired config.


Best
Maximilian



OpenPGP_signature
Description: OpenPGP digital signature


Re: LUKS, "no device found"

2022-01-24 Diskussionsfäden Ian Eure



Juri Grabowski  writes:


Hello,

I was looking to my configuration right now and it looks like 
yours, but with "disk_config end" on the end.
Which version of fai, setup-storage are you using? because of 


   (STDERR)   No device found for /dev/mapper/cyrpt_dev_sda3

 ^^
looks wrong.

Sorry, that’s just a typo.  Since the install failed and I had no 
way to copy logs anywhere, I had to type up what I saw instead of 
pasting from the log.


I’m using the Debian Bullseye FAI packages, which are 5.10.3.

 -- Ian


Re: LUKS, "no device found"

2022-01-24 Diskussionsfäden Thomas Lange
> On Mon, 24 Jan 2022 10:31:19 +0100, Juri Grabowski  said:

> I was looking to my configuration right now and it looks like yours, but 
with "disk_config end" on the end.

"disk_config end" ?

I never used this, but indeed it's in the man page. Something new for
me ;-)

-- 
viele Grüße Thomas


Re: LUKS, "no device found"

2022-01-24 Diskussionsfäden Juri Grabowski
Hello,

I was looking to my configuration right now and it looks like yours, but with 
"disk_config end" on the end.
Which version of fai, setup-storage are you using? because of 

>(STDERR)   No device found for /dev/mapper/cyrpt_dev_sda3
 ^^
looks wrong.

Best Regards,
Juri Grabowski


LUKS, "no device found"

2022-01-22 Diskussionsfäden Ian Eure
I’m running into an issue trying to get FAI to install onto an 
EFI+LUKS+LVM disk setup on a laptop.  I’m using this config, which 
is a combination of the example LVM_EFI config and "Plain disk + 
LUKS + LVM2 example" and "Example using a GPT partition table and 
EFI/ESP partition" from the setup-storage(8) man page.


   #   options>


   # entire disk with LVM, all in one partition

   disk_config disk1 disklabel:gpt fstabkey:uuid align-at:1M

   primary /boot/efi 512M vfat rw
   primary /boot  512M ext2 rw,noatime
   primary - 4G-  --

   disk_config cryptsetup
   luks:"changeme" - disk1.3 - -

   disk_config lvm fstabkey:uuid
   vg vg1  disk1.3
   vg1-root /   3G-  ext4noatime,rw
   vg1-swap swapRAM:100% swapsw


But, when I try to use this config, the install fails with:

   Using config file: 
   /var/lib/fai/config/disk_config/LVM_LUKS_EFI

   Executing: wipefs -af /dev/sda1
   Executing: wipefs -af /dev/sda2
   Executing: vgchange -a y vg1
   Executing: wipefs -af /dev/vg1/root
   Executing: lvremove -f /dev/vg1/root
   Executing: head -c 2047 /dev/urandom | od | tee 
   /tmp/fai/crypt_dev_sda3

   Executing: vgchange -a n vg1
   Executing: vgremove vg1
   pvremove  /dev/mapper/crypt_dev_sda3
   (STDERR)   No device found for /dev/mapper/cyrpt_dev_sda3
   Command had non-zero exit code


A similar config 

I’m not sure what’s wrong.  Possibly "vg vg1  disk1.3" is trying 
to put the LVM volume directly in the primary partition, instead 
of the LUKS container?  But the "Plain disk + LUKS + LVM2 example" 
example does this same thing (with disk1.1), and presumably that’s 
correct.


Any pointers on what I’m doing wrong here?

Thanks,

 -- Ian