View previous topic :: View next topic |
Author |
Message |
mgnut57 Guru
Joined: 12 Jan 2008 Posts: 308
|
Posted: Thu May 04, 2023 2:17 am Post subject: /etc/crypttab? [SOLVED] |
|
|
I have an entry in /etc/crypttab, but when I connect a drive with a luks encryption, it doesn't automatically open the luks device. I have been able to work around this using a custom udev rule, but I would like to get the crypttab method working.
Note that I am NOT trying to boot the system from the encrypted partition.
My entry in /etc/cryptab:
Code: | ext_backups UUID=5b817c75-c26a-407f-91ab-46410c061f69 /root/Crypt/cryptkey luks |
This is the correct UUID:
Code: | # cryptsetup luksUUID /dev/sdc3
5b817c75-c26a-407f-91ab-46410c061f69 |
My system uses OpenRC, not systemd.
Code: | # emerge --info
Portage 3.0.44 (python 3.10.10-final-0, default/linux/amd64/17.1, gcc-11, glibc-2.36-r7, 5.15.80-gentoogeneric x86_64)
=================================================================
System uname: Linux-5.15.80-gentoogeneric-x86_64-Intel-R-_Celeron-R-_CPU_J1900_@_1.99GHz-with-glibc2.36
KiB Mem: 7852924 total, 2242468 free
KiB Swap: 4194300 total, 4193788 free
Timestamp of repository gentoo: Sat, 25 Mar 2023 23:00:01 +0000
Head commit of repository gentoo: 7fd1d07c881988fa8b630b632efcf54a57b75efa
sh bash 5.1_p16-r2
ld GNU ld (Gentoo 2.38 p4) 2.38
distcc[11144] (dcc_trace_version) distcc 3.4 x86_64-pc-linux-gnu; built Feb 3 2023 19:16:47 [disabled]
ccache version 4.7.4 [disabled]
app-misc/pax-utils: 1.3.5::gentoo
app-shells/bash: 5.1_p16-r2::gentoo
dev-lang/perl: 5.36.0-r2::gentoo
dev-lang/python: 3.8.16::gentoo, 3.9.16_p3::gentoo, 3.10.10_p3::gentoo, 3.11.2_p2::gentoo
dev-lang/rust-bin: 1.66.1-r1::gentoo
dev-util/ccache: 4.7.4::gentoo
dev-util/cmake: 3.25.2::gentoo
dev-util/meson: 1.0.1::gentoo
sys-apps/baselayout: 2.13-r1::gentoo
sys-apps/openrc: 0.45.2-r2::gentoo
sys-apps/sandbox: 2.29::gentoo
sys-devel/autoconf: 2.71-r5::gentoo
sys-devel/automake: 1.16.5::gentoo
sys-devel/binutils: 2.38-r2::gentoo, 2.39-r4::gentoo
sys-devel/binutils-config: 5.4.1::gentoo
sys-devel/gcc: 11.3.1_p20221209::gentoo, 12.2.1_p20230121-r1::gentoo
sys-devel/gcc-config: 2.8::gentoo
sys-devel/libtool: 2.4.7-r1::gentoo
sys-devel/llvm: 15.0.7::gentoo
sys-devel/make: 4.3::gentoo
sys-kernel/linux-headers: 6.1::gentoo (virtual/os-headers)
sys-libs/glibc: 2.36-r7::gentoo
Repositories:
gentoo
location: /usr/portage
sync-type: rsync
sync-uri: rsync://gentoo-portage/gentoo-portage
priority: -1000
volatile: True
sync-rsync-verify-metamanifest: no
sync-rsync-extra-opts:
sync-rsync-verify-max-age: 24
sync-rsync-verify-jobs: 1
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=nocona -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt /var/bind"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe"
DISTDIR="/usr/portage/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LEX="flex"
LINGUAS="en en_GB"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
SHELL="/bin/bash"
USE="X a52 aac acl alsa amd64 amr apm bzip2 cdda cdr clearpasswd cli cups dbus dri dv dvd dvdr dvdread elogind foomaticdb fortran gdbm gif gimpprint gphoto2 gstreamer gtk2 hpcups hvm iconv imap ipod ipv6 jpeg libglvnd libtirpc lm_sensors logrotate mad mbox mjpeg mmx mp3 mpeg multilib ncurses nforce2 nfs nfsidmap nfsv3 nfsv4 nfsv41 nls nptl nptlonly nsplugin objc ogg openmp pam pcre pmu png ppds readline samba seccomp spell split-usr sse sse2 ssl swat test-rust tiff truetype udisks unicode usb v4l2 vcd vim-syntax wmf xattr zlib" ABI_X86="64 32" ADA_TARGET="gnat_2021" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="keyboard mouse" KERNEL="linux" L10N="en-GB en-US" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-4 php8-0" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_10" PYTHON_TARGETS="python3_10" RUBY_TARGETS="ruby27 ruby30" USERLAND="GNU" VIDEO_CARDS="vesa" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset: ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS |
Last edited by mgnut57 on Thu May 04, 2023 4:23 am; edited 2 times in total |
|
Back to top |
|
|
grknight Retired Dev
Joined: 20 Feb 2015 Posts: 1925
|
Posted: Thu May 04, 2023 2:28 am Post subject: Re: /etc/crypttab? |
|
|
mgnut57 wrote: | I have an entry in /etc/crypttab, but when I connect a drive with a luks encryption, it doesn't automatically open the luks device. I have been able to work around this using a custom udev rule, but I would like to get the crypttab method working.
My system uses OpenRC, not systemd. |
OpenRC startup scripts do not consider /etc/crypttab at all.
Other tools, like dracut initramfs, may.
If you want to automatically open this device on system startup, then configure /etc/conf.d/dmcrypt and add dmcrypt to a runlevel. This does assume the device is always accessible.
Perhaps there are other tools that hook into say udisks or udev that can unlock removable devices. |
|
Back to top |
|
|
mgnut57 Guru
Joined: 12 Jan 2008 Posts: 308
|
Posted: Thu May 04, 2023 4:22 am Post subject: |
|
|
Thanks for clarifying that. I'll continue using my udev rule. |
|
Back to top |
|
|
sdauth l33t
Joined: 19 Sep 2018 Posts: 652 Location: Ásgarðr
|
Posted: Thu May 04, 2023 9:17 am Post subject: |
|
|
Code: | target=external_backup
source=UUID="2868dedf-1d15-42e9-9bfc-f63c11935915"
key=/etc/keys/external/keyfile_external_backup
wait=2 |
Then, a simple restart of dmcrypt service to unlock the external drive.
Also, if the laptop doesn't boot with the external hdd attached, then it only waits 2s and skip the target.
Obviously, this requires some manual input. So udev rule might be better indeed.
Another option (using udisks) is udiskie, with a nice little tray icon helper if one doesn't want to manage udev rules manually. Very easy to configure. (similar to dmcrypt), I use that now. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|