Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
284 views
in Technique[技术] by (71.8m points)

Steps for automounting Encrypted LVM in debian using preseed configuration file

Issue: Cryptsetup Encryption key creation command halt in the preseed stage.

Command: echo passphrase | cryptsetup luksAddkey encrypted_partition_label_name key_file_path

Example: echo "passphrase" | cryptsetup luksAddkey /dev/sda1 /tmp/file.key

Steps Followed: Included the above command as one of the sequential steps in the shell script and invoking the script as a preseed late_command. Please find the Preseed late_command and all the commands included in the shell script.

Preseed Late Command: d-i preseed/late_command string cp /cdrom/preseed/test.sh /target/root/; in-target chmod +x /root/test.sh; in-target /bin/bash /root/test.sh

Script: enter image description here

Expected behavior: Completely Automated Debian OS installation along with encrypted partition and which will automount() after completing the installation, booting, and for every boot, Passphrase should load automatically using cryptsetup key file.

The same script works in the below scenario.

Install Debian OS using the same preseed configuration file without late_command. Post OS installation system boot will ask for the passphrase. Copy the same test.sh script to any path in the server. Execution of the script is a success and post-execution rebooting the system is not asking for the passphrase which is my expected behavior.

The same behavior I am expecting to work at the preseed stage itself so that the System will not ask for the passphrase after the first reboot itself.

Please suggest the best approach for achieving the above behavior, any changes in the above command or script that will make my job done.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...