You are not logged in.
Hi,
I think I need your help again.
I installed Arch Linux on a new Laptop. I installed the system on the encrypted partition sda2 (dm-crypt). The boot partition is sda1. I stored an additional key for sda2 on a SD card so I don't have to enter the passphrase all the time.
This works very well. But if I don't have the SD card I always have to wait 10 seconds before I can enter the passphrase manually.
First question: Is there a way to interrupt the 10 seconds counter? I already put the key hooks before block. This does not enable me to skip the counter eg. by pressing ESC.
If that is not possible I think I could simply add another entry to the GRUB2 menu for the same OS but just with another GRUB_CMDLINE_LINUX (without the cryptkey=...). I tried to add another entry but I had no luck. I'm always finding information on how a menu entry for another OS (eg. Windows) can be added, but nothing for a secondary entry for the same OS just with different parameters.
I already tried to add an entry by editing /etc/grub.d/40_custom:
menuentry "Arch Linux (without SD card check)" {
set root=(hd0,1)
linux /boot/vmlinuz-linux cryptdevice=/dev/sda2:root
}
Unfortunately this doesn't work (/boot/vmli..... is not found).
Is this the right way to add the desired entry? If yes, how do I specify the partition if I have a separate boot partition as in my case?
Thanks for helping!
Last edited by The Infinity (2014-12-24 01:14:08)
Offline
I think that you should add some more scripting in grub. I.e. try to find a file in "hd1,0" (or its UUID), the sd memory, if not found proceed to menu entry "Arch Linux (without SD card check)".
Then, I'm not the one to give the complete clue, you need to study the grub programming a bit. Maybe some similarity is already wrote in grub.cfg, just to learn from there.
do it good first, it will be faster than do it twice the saint
Offline
Thanks for the answer.
I also think I should do more scripting rather then adding a static entry.
In the file /etc/default/grub there is not much to script. There are only variable definitions.
Do you mean with scripting modifying /etc/grub.d/10_linux? This file is very large and I unclear. But I will check it out.
And thanks for the hint to look in crub.cfg. This might be very useful when proceeding the static menu entry.
Offline
Yup, first you should get the SD memory's partition UUID. Second you may try some search like this
search --no-floppy --fs-uuid --set=root UUID
Then try the command find/search /passfrase_filename. You may try to start the grub shell and experiment these commands.
do it good first, it will be faster than do it twice the saint
Offline
I finally created a secondary GRUB2 menu entry for Arch Linux with different command line options (which do not check if a SD card with password is inserted).
I simply added some variables to /etc/default/grub and exported them manually:
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="Arch"
GRUB_ALT="no SD card check" # name of secondary entry
GRUB_CMDLINE_LINUX_DEFAULT="cryptkey=/dev/sdcard:1048576:2048 cryptdevice=/dev/sda2:root"
GRUB_CMDLINE_LINUX_DEFAULT_ALT="cryptdevice=/dev/sda2:root" # default cmd line for secondary entry, not checking for SD card here
GRUB_CMDLINE_LINUX=""
GRUB_CMDLINE_LINUX_ALT="" # cmd line for secondary entry
export GRUB_ALT \
GRUB_CMDLINE_LINUX_DEFAULT_ALT \
GRUB_CMDLINE_ALT
Then I copied /etc/grub.d/10_linux to /etc/grub.d/11_linux_alt and edited the file that the header looks like:
if [ "x${GRUB_ALT}" = "x" ] ; then
exit 0
fi
prefix="/usr"
exec_prefix="/usr"
datarootdir="/usr/share"
. "${datarootdir}/grub/grub-mkconfig_lib"
export TEXTDOMAIN=grub
export TEXTDOMAINDIR="${datarootdir}/locale"
CLASS="--class gnu-linux --class gnu --class os"
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
OS="Linux (${GRUB_ALT})"
else
OS="${GRUB_DISTRIBUTOR} Linux (${GRUB_ALT})"
CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}"
fi
I also changed all occurances of "GRUB_CMDLINE_LINUX_DEFAULT" and "GRUB_CMDLINE_LINUX" names with "_ALT"-prefixed correspondences.
The problem is solved. If someone knows a way to interrupt the countdown (as described in the initial post) I'm still interested.
Last edited by The Infinity (2014-12-24 01:27:11)
Offline
Well, that's a rather manual option
Knowing a bit more the grub scripting, you may do automated selection.
Sorry I can't help you further, I don't use grub actually
Last edited by TheSaint (2014-12-24 01:39:17)
do it good first, it will be faster than do it twice the saint
Offline
Yes, its also manual. But its still better then adding a static menu entry and I don't want to waste my time with over-engineering the problem.
Offline