Results 1 to 2 of 2

Thread: Automounting a crypted device not working, manually works

  1. #1
    Join Date
    Oct 2017
    Beans
    5

    Automounting a crypted device not working, manually works

    Hi.
    I have this script at /root/cryptoskripta.sh
    #!/bin/bash


    ask_for_password () {
    cryptkey="Unlocking the disk $cryptsource ($crypttarget)\nEnter passphrase: "
    if [ -x /bin/plymouth ] && plymouth --ping; then
    cryptkeyscript="plymouth ask-for-password --prompt"
    cryptkey=$(printf "$cryptkey")
    else
    cryptkeyscript="/lib/cryptsetup/askpass"
    fi
    $cryptkeyscript "$cryptkey"
    }


    device=$(echo $1 | cut -d: -f1)
    filepath=$(echo $1 | cut -d: -f2)


    # Ask for password if device doesn't exist
    if [ ! -b $device ]; then
    ask_for_password
    exit
    fi


    mkdir /tmp/auto_unlocker
    mount $device /tmp/auto_unlocker


    # Again ask for password if device exist but file doesn't exist
    if [ ! -e /tmp/auto_unlocker$filepath ]; then
    ask_for_password
    else
    cat /tmp/auto_unlocker$filepath
    fi


    umount /tmp/auto_unlocker

    foud it there: https://askubuntu.com/questions/5948...rypt-partition

    But the problem is that the mount isn't done automatically at boot.

    if i do systemctl start systemd-cryptsetup@chome.service
    it will give me an error arguing that the file /filu does not exist:
    a paste: https://pastebin.ubuntu.com/p/hrD8hhFzVq/

    runing the command
    cryptdisks_start chome
    works anyhow.

    So i can manually mount the device but not automatically on boot.

    this is my /etc/crypttab:
    chome UUID=763ccc90-something/dev/disk/by-uuid/e32fd99e-something1:/filu luks,keyscript=/root/cryptoskripta.sh
    (replaced something there)

    Any hint??

  2. #2
    Join Date
    Oct 2007
    Beans
    1,832

    Re: Automounting a crypted device not working, manually works

    Could you just add it to an autostart file? What WM/DE are you using? Or you could autostart it from cron with something like:

    @reboot /path/to/shell.script
    right in your crontab file

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •