So I have two SSDs in my laptop running FedoraKDE, and every time I mount the one used for storage, I have to type the luks password and then my root password. So, looking it up, I found that to not need root to mount the drive I need to add it to fstab.

I added (as was told by the internet since I’m flying by the seat of random stackoverflow help in absence of real knowledge):

UUID=uuid-string-goes-here   /path/to/directory ext4 defaults 0 0

To fstab (and forgot to chown the directory, oops!) and rebooted, aaaaaaand now I get booted into “emergency mode” with root disabled and have no clue what to do.

I think I used the right uuid, it was nvme0p1 (or whatever that drive said the right name was, can’t check now!) In any case, I didn’t use the uuid of the drive my system was running on, for sure.

Boot hangs on

job dev-disk-by\x2duuid- [Something something]

Edit: Still taking any advice on how to actually not have to use root to mount this drive, though my boot issue is solved and it looks like I have some links to peruse already!

  • Lucy :3@feddit.org
    link
    fedilink
    arrow-up
    13
    ·
    3 days ago

    Generally: Disks with Luks have to be opened first before being able to be mounted. After opening, a virtual blockdev is created, with the UUID you put into fstab. As the Luks disk is not unlocked at boot, the virtual blockdev doesn’t exist yet, so systemd hangs for 3 mins or so trying to find/wait for it to mount it

    Usually, it should continue to boot after timeout. If it does not, you need a USB Stick with Linux, boot that, mount the root partition and edit the fstab

    • ArcaneSlime@lemmy.dbzer0.comOP
      link
      fedilink
      arrow-up
      6
      ·
      3 days ago

      Ayyyy why didn’t I think of that?! Thank you!

      Booted off a stick, deleted that line and saved, rebooted and we’re back in action!

      Would there possibly be any chance you could point me to the correct way to do what I’m trying to?

      Basically I’m trying to make it so that when I click the drive to mount it, it still prompts me for the luks pass but not root.

      Idk why it needs root, none of my externals do, you’d think it would require root for unknown externals, not the internal secondary!

  • OneCardboardBox@lemmy.sdf.org
    link
    fedilink
    English
    arrow-up
    9
    ·
    edit-2
    3 days ago

    Looks like you’ve already had some help fixing your system. I’d recommend reading the arch wiki pages on encryption. Even if you’re not running arch, the wiki is a good source of up-to-date information, and contains many practical tips.

    This section about setting up your /etc/crypttab to unlock a non-root filesystem at boot might be useful. Even if you don’t want to unlock at boot, it explains how crypttab works: https://wiki.archlinux.org/title/Dm-crypt/System_configuration#crypttab.

    There’s another useful section if you want to decrypt on demand after boot: https://wiki.archlinux.org/title/Dm-crypt/System_configuration#Mounting_on_demand

    Lastly, if you’re experimenting with fstab entries for a non-root device, consider setting nofail so that if you screw anything up the system still boots. This section is somewhat relevant: https://wiki.archlinux.org/title/Fstab#External_devices

    Basically, you need both a crypttab entry and an fstab entry to open and then mount the device.

    • ArcaneSlime@lemmy.dbzer0.comOP
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      3 days ago

      Oh man thanks! Looks like (without clicking yet) the second and third links are going to be a major help!

      I do indeed want to mount on demand (just not root) not auto-mount, and for SURE could have used this nofail today haha!

      Thanks again!

  • gigachad@sh.itjust.works
    link
    fedilink
    arrow-up
    4
    ·
    edit-2
    1 day ago

    No idea about most of your question, but I think you entered the wrong UUID. nvme0p1 is the name of the partition.

    Use blkid in the Terminal, the output will be something like:

    /dev/sda3: UUID="a7d71686-0a65-4402-b6e6-b58430ef8351" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="0ea90c96-1b56-4c51-b07a-02e09285f291"
    /dev/sr0: BLOCK_SIZE="2048" UUID="2020-10-22-14-30-30-00" LABEL="Ubuntu 20.10 amd64" TYPE="iso9660" PTTYPE="PMBR"
    

    This is how a valid UUID looks like: a7d71686-0a65-4402-b6e6-b58430ef8351

    • ArcaneSlime@lemmy.dbzer0.comOP
      link
      fedilink
      arrow-up
      1
      ·
      2 days ago

      Well tarnation. I thought it had to be the one I used because when I go to mount the first part of that drive in nnn it says no, then when I try to mount that partition it says “yes but oh wait permission denied cause root.”

  • flatbield@beehaw.org
    link
    fedilink
    English
    arrow-up
    3
    ·
    edit-2
    3 days ago

    Generally what you do is to define the key and mapping of the second drive in /etc/crypttab usually referencing a file with the key. The root patrition which typically contains /etc is typically unlocked with a password you supply.

    You can manually map the partions with cryptsetup and then mount them with mount.

    • ArcaneSlime@lemmy.dbzer0.comOP
      link
      fedilink
      arrow-up
      2
      ·
      3 days ago

      Woof ok looks like I have some research to do, thanks! Hopefully I can find a handy youtube tut or stackoverflow on it, because that’s about my level of expertise on “linux stuff I haven’t done at least twice” haha.

      • flatbield@beehaw.org
        link
        fedilink
        English
        arrow-up
        2
        ·
        edit-2
        3 days ago

        You could ask duck.ai too then verify the commands with the man command so you know what they do.

        Edit: Also crypttab and fstab are documented in man too as are cryptsetup, mount, and umount.

        Edit: Good to not fully trust ai.

        • ArcaneSlime@lemmy.dbzer0.comOP
          link
          fedilink
          arrow-up
          1
          ·
          3 days ago

          Hmm AI my old nemesis. Still, perhaps it may be necessary for me and AI to work out our differences momentarily, as I am so far unable to find the answers I seek.

          Seems I’m the only one who wants it not to auto-mount, but rather to simply be able to be mounted not as root and still require the luks pass.

          Plenty of people seem to want to do the exact opposite though, auto mount it and bypass the luks password (which imo almost defeats the purpose, though I get it, still protected at rest and all, but my way it’s still protected until you specifically call upon it!)

          • flatbield@beehaw.org
            link
            fedilink
            English
            arrow-up
            1
            ·
            2 days ago

            That is interesting. You can do that by the command line. Basically run cryptsetup to map the encrypted partition, then run mount. Those commands could also be place in a bash script too. You may need sudo access to run cryptsetup. You will need sudo access for mount unless you configure it as user mountable and not auto mounted in fstab.

            You also want script to umount it and unmap it with cryptsetup when done.

            Graphically, maybe the Disks gnome tool can do.

            • ArcaneSlime@lemmy.dbzer0.comOP
              link
              fedilink
              arrow-up
              1
              ·
              2 days ago

              unless you configure it as user mountable and not auto mounted in fstab.

              Maybe all I have to do is this actually, I need to read that fstab man page. I absolutely did not understand that I could use things like noauto and nofail instead of default until this thread.

    • ArcaneSlime@lemmy.dbzer0.comOP
      link
      fedilink
      arrow-up
      2
      ·
      3 days ago

      I’m back! Thanks for the help! Booted off the usb and deleted my shame from fstab haha.

      Though, I actually specifically don’t want it to auto-mount, as dumb as that sounds. I just want it so that when I click “1.9tb encrypted drive” in dolphin it only asks for the luks pass but not root, currently I have to type the luks pass and then root pass every time.

      Also for nmount in nnn, which can only mount stuff as a normal non-root user.

      Idk why my internal secondary requires root while I can mount a flash drive or encrypted external ssd just fine without it.

      • Peffse@lemmy.world
        link
        fedilink
        arrow-up
        3
        ·
        3 days ago

        so instead of defaults I think you want noauto,nofail

        Then it shouldn’t automatically mount, but at the same time won’t throw you into emergency mode if it fails to detect the drive.

        • ArcaneSlime@lemmy.dbzer0.comOP
          link
          fedilink
          arrow-up
          1
          ·
          2 days ago

          Thanks I might just try that! Worst case scenario “repeat step a” now that I know how to fix my dumbassery! And if that cuts my root pass out of the equation it’ll serve my purposes lol.

    • ArcaneSlime@lemmy.dbzer0.comOP
      link
      fedilink
      arrow-up
      2
      ·
      3 days ago

      Yes, and I could type my drive’s pass, it just would hang up after 45s of not being able to find that drive (or whatever) and fail to boot.

      BUT someone else posted “hey dummy boot off a usb and fix fstab,” and that’s what I did and I’m back to booting!

      (OK I’m the one calling me a dummy lol they were very nice, I just can’t believe I didn’t think to do that in my panic haha)

      Now I just need to figure out how to actually make the drive not require root, but also not auto mount, and still prompt for the luks pass lol.

      Thank you for your help anyway!