LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 11-26-2018, 02:53 PM   #1
phalange
Member
 
Registered: May 2018
Distribution: Slackware, FreeBSD, Debian
Posts: 355

Rep: Reputation: 184Reputation: 184
GRUB with encrypted drive asks for password twice


I set up a new desktop with Slackware - encrypted drive, un-encrypted /boot/efi partition, using grub2 as bootloader. I've found several threads online about dealing with entering the luks password twice, but mostly distros using initramfs and systemd.

Anyone solve this on Slackware?

Entering luks PW once (as with ELILO) would be my desired outcome.
 
Old 11-29-2018, 10:59 AM   #2
Tonus
Senior Member
 
Registered: Jan 2007
Location: Paris, France
Distribution: Slackware-15.0
Posts: 1,405
Blog Entries: 3

Rep: Reputation: 514Reputation: 514Reputation: 514Reputation: 514Reputation: 514Reputation: 514
GRUB with encrypted drive asks for password twice

Did you read the README_CRYPT.TXT file ?
What tutorial have you follow?
 
Old 12-01-2018, 07:07 PM   #3
phalange
Member
 
Registered: May 2018
Distribution: Slackware, FreeBSD, Debian
Posts: 355

Original Poster
Rep: Reputation: 184Reputation: 184
Quote:
Originally Posted by Tonus View Post
Did you read the README_CRYPT.TXT file ?
Thanks for reminding me about that doc. I hadn't consulted it since it doesn't mention Grub, but the initrd section helped solved this issue.

By creating a luks key with the password to my root drive on a USB stick, and inserting
Code:
-K UUID=[uuid of partition 1 on usb stick]:/path/to/lukskey
to my mkinitrd list, I was able to eliminate the second password request.

If anyone else tries this, I'll note that using the LABEL= did not work for me, but UUID= did (typo maybe, who knows).

It also appears that Grub needs only
Code:
GRUB_CRYPTODISK_ENABLE=y
and no additional modules in GRUB_CMDLINE_LINUX.

My next test will be to see about encrypting the /boot partition (sda1) and storing the key there.
 
Old 01-15-2019, 11:56 AM   #4
Geremia
Member
 
Registered: Apr 2011
Distribution: slackware64-current
Posts: 503

Rep: Reputation: 45
Quote:
Originally Posted by phalange View Post
Code:
-K UUID=[uuid of partition 1 on usb stick]:/path/to/lukskey
Ah, so one can only use the first partition of the USB stick?

I was having trouble making it locate, via LABEL, the second partition of my USB stick.
 
Old 01-15-2019, 08:40 PM   #5
phalange
Member
 
Registered: May 2018
Distribution: Slackware, FreeBSD, Debian
Posts: 355

Original Poster
Rep: Reputation: 184Reputation: 184
Quote:
Originally Posted by Geremia View Post
Ah, so one can only use the first partition of the USB stick?

I was having trouble making it locate, via LABEL, the second partition of my USB stick.
I don't know, as I didn't test a usb with multiple partitions. I specified "partition 1" so that if someone came across this thread, it would be clear I used the UUID of the partition (e.g. /dev/sdb1) rather than the UUID of the USB device itself (e.g. /dev/sdb).

I didn't get it to work with LABEL at all, although after a few failures I simply switched to using UUID which is my preference in other configs anyway. In other words, I can't definitely say LABEL doesn't work, but it didn't for me.
 
Old 01-16-2019, 11:53 AM   #6
Geremia
Member
 
Registered: Apr 2011
Distribution: slackware64-current
Posts: 503

Rep: Reputation: 45
Quote:
Originally Posted by phalange View Post
I don't know, as I didn't test a usb with multiple partitions. I specified "partition 1" so that if someone came across this thread, it would be clear I used the UUID of the partition (e.g. /dev/sdb1) rather than the UUID of the USB device itself (e.g. /dev/sdb).

I didn't get it to work with LABEL at all, although after a few failures I simply switched to using UUID which is my preference in other configs anyway. In other words, I can't definitely say LABEL doesn't work, but it didn't for me.
Update: As it turns out for me, I can't get it to detect any USB drive, regardless if I use LABEL or UUID, whether the drive is FAT or some other filesystem type. It will detect SATA drives' partitions, though.

There is a "sleep 3" on line 620 of mkinitrd; I'm wondering if my USB drives need more time to get online so they'll be detected.
 
Old 01-16-2019, 09:30 PM   #7
phalange
Member
 
Registered: May 2018
Distribution: Slackware, FreeBSD, Debian
Posts: 355

Original Poster
Rep: Reputation: 184Reputation: 184
Quote:
Originally Posted by Geremia View Post
Update: As it turns out for me, I can't get it to detect any USB drive
Are you generating the initrd using the full output of mkinitrd_command_generator.sh? Remember that the -K [...] options are added to the full output of the generator script.
 
Old 01-17-2019, 11:33 AM   #8
Geremia
Member
 
Registered: Apr 2011
Distribution: slackware64-current
Posts: 503

Rep: Reputation: 45
Quote:
Originally Posted by phalange View Post
Are you generating the initrd using the full output of mkinitrd_command_generator.sh? Remember that the -K [...] options are added to the full output of the generator script.
No, I'm using
Code:
mkinitrd -F /etc/mkinitrd.conf
, where the conf file has LUKSKEY in it.

Last edited by Geremia; 01-17-2019 at 11:35 AM.
 
Old 01-17-2019, 09:36 PM   #9
phalange
Member
 
Registered: May 2018
Distribution: Slackware, FreeBSD, Debian
Posts: 355

Original Poster
Rep: Reputation: 184Reputation: 184
Quote:
Originally Posted by Geremia View Post
No, I'm using
Ok, well Slackware includes a handy script called mkinitrd_command_generator.sh that might help.

chroot into your slackware install and run:

Code:
sh /usr/share/mkinitrd/mkinitrd_command_generator.sh -l /boot/vmlinuz-generic
This will output a customized mkinitrd command that may be quite long. Then retype that command verbatim to your prompt so you can actually execute it. Copy 'everything within the single quotes'

You can then append the -K UUID option to the end of the command.

see here:
https://mirror.math.princeton.edu/pu...ADME_CRYPT.TXT

and
https://docs.slackware.com/talk:slac...eginners_guide

and here is what the mkinitrd manual says about labels:
https://linux.die.net/man/8/mkinitrd
 
Old 01-18-2019, 01:33 PM   #10
Geremia
Member
 
Registered: Apr 2011
Distribution: slackware64-current
Posts: 503

Rep: Reputation: 45
Quote:
Originally Posted by phalange View Post
Code:
sh /usr/share/mkinitrd/mkinitrd_command_generator.sh -l /boot/vmlinuz-generic
This will output a customized mkinitrd command that may be quite long. Then retype that command verbatim to your prompt so you can actually execute it. Copy 'everything within the single quotes'
The "-m" option of my output includes many kernel modules:
Code:
xhci-pci:ohci-pci:ehci-pci:xhci-hcd:uhci-hcd:ehci-hcd:hid:usbhid:i2c-hid:hid_generic:hid-asus:hid-cherry:hid-logitech:hid-logitech-dj:hid-logitech-hidpp:hid-lenovo:hid-microsoft:hid_multitouch:xxhash:zstd_decompress:zstd_compress:btrfs
My mkinitrd.conf's MODULE_LIST was empty. Including those modules worked. thanks

Last edited by Geremia; 01-18-2019 at 05:28 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Slackware64 14.2 with RAID+LUKS+LVM asks me twice decryption password at boot dmslack Slackware 9 07-22-2016 01:39 AM
Squid server asks me to enter username and password twice Bitbot Linux - Newbie 0 01-28-2015 02:44 AM
Infinite Grub Loop: GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB... beeblequix MEPIS 2 11-02-2013 10:56 PM
login asks for password twice before authenticating xfurious_mindx Linux - General 9 09-17-2012 08:54 AM
rpm install: A asks for B, B asks for A mike_bio Linux - Software 6 07-15-2005 04:00 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 04:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration