How to change the name an encrypted full-system partition is mapped to












13















My system is fully encrypted with dm-crypt and LVM. I recently moved the encrypted partition from /dev/sda5 to /dev/sda2.



My question is: how can I change the name the encrypted partition is mapped to from sda5_crypt to sda2_crypt?



I can boot the system all right. But the prompt I get at boot time says (sda5_crypt) though the UUID maps to /dev/sda2:



  Volume group "vg" not found
Skipping volume group vg
Unlocking the disk /dev/.../UUID (sda5_crypt)
Enter passphrase:


I tried to live-boot, decrypt sda2, activate vg, chroot to /dev/vg/root and run update-grub2 but to no avail.



Merely editing /etc/crypttab doesn't work either.










share|improve this question























  • Have you recreated the initrd after editing /etc/crypttab?

    – Hauke Laging
    Jun 28 '13 at 12:53











  • I think so: update-initramfs -t -u -k all

    – n.r.
    Jun 28 '13 at 12:59











  • Output of grep -r sda5_crypt /etc?

    – Hauke Laging
    Jun 28 '13 at 13:04











  • Found the issue: I must mount /dev/sda1 as /boot before running update-initramfs.

    – n.r.
    Jun 28 '13 at 13:36













  • Make that an answer instead of a comment and accept it (if that is possible with own answers, I am not sure) so that this question is shown as answered.

    – Hauke Laging
    Jun 28 '13 at 13:48
















13















My system is fully encrypted with dm-crypt and LVM. I recently moved the encrypted partition from /dev/sda5 to /dev/sda2.



My question is: how can I change the name the encrypted partition is mapped to from sda5_crypt to sda2_crypt?



I can boot the system all right. But the prompt I get at boot time says (sda5_crypt) though the UUID maps to /dev/sda2:



  Volume group "vg" not found
Skipping volume group vg
Unlocking the disk /dev/.../UUID (sda5_crypt)
Enter passphrase:


I tried to live-boot, decrypt sda2, activate vg, chroot to /dev/vg/root and run update-grub2 but to no avail.



Merely editing /etc/crypttab doesn't work either.










share|improve this question























  • Have you recreated the initrd after editing /etc/crypttab?

    – Hauke Laging
    Jun 28 '13 at 12:53











  • I think so: update-initramfs -t -u -k all

    – n.r.
    Jun 28 '13 at 12:59











  • Output of grep -r sda5_crypt /etc?

    – Hauke Laging
    Jun 28 '13 at 13:04











  • Found the issue: I must mount /dev/sda1 as /boot before running update-initramfs.

    – n.r.
    Jun 28 '13 at 13:36













  • Make that an answer instead of a comment and accept it (if that is possible with own answers, I am not sure) so that this question is shown as answered.

    – Hauke Laging
    Jun 28 '13 at 13:48














13












13








13


3






My system is fully encrypted with dm-crypt and LVM. I recently moved the encrypted partition from /dev/sda5 to /dev/sda2.



My question is: how can I change the name the encrypted partition is mapped to from sda5_crypt to sda2_crypt?



I can boot the system all right. But the prompt I get at boot time says (sda5_crypt) though the UUID maps to /dev/sda2:



  Volume group "vg" not found
Skipping volume group vg
Unlocking the disk /dev/.../UUID (sda5_crypt)
Enter passphrase:


I tried to live-boot, decrypt sda2, activate vg, chroot to /dev/vg/root and run update-grub2 but to no avail.



Merely editing /etc/crypttab doesn't work either.










share|improve this question














My system is fully encrypted with dm-crypt and LVM. I recently moved the encrypted partition from /dev/sda5 to /dev/sda2.



My question is: how can I change the name the encrypted partition is mapped to from sda5_crypt to sda2_crypt?



I can boot the system all right. But the prompt I get at boot time says (sda5_crypt) though the UUID maps to /dev/sda2:



  Volume group "vg" not found
Skipping volume group vg
Unlocking the disk /dev/.../UUID (sda5_crypt)
Enter passphrase:


I tried to live-boot, decrypt sda2, activate vg, chroot to /dev/vg/root and run update-grub2 but to no avail.



Merely editing /etc/crypttab doesn't work either.







dm-crypt






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jun 28 '13 at 12:34









n.r.n.r.

946824




946824













  • Have you recreated the initrd after editing /etc/crypttab?

    – Hauke Laging
    Jun 28 '13 at 12:53











  • I think so: update-initramfs -t -u -k all

    – n.r.
    Jun 28 '13 at 12:59











  • Output of grep -r sda5_crypt /etc?

    – Hauke Laging
    Jun 28 '13 at 13:04











  • Found the issue: I must mount /dev/sda1 as /boot before running update-initramfs.

    – n.r.
    Jun 28 '13 at 13:36













  • Make that an answer instead of a comment and accept it (if that is possible with own answers, I am not sure) so that this question is shown as answered.

    – Hauke Laging
    Jun 28 '13 at 13:48



















  • Have you recreated the initrd after editing /etc/crypttab?

    – Hauke Laging
    Jun 28 '13 at 12:53











  • I think so: update-initramfs -t -u -k all

    – n.r.
    Jun 28 '13 at 12:59











  • Output of grep -r sda5_crypt /etc?

    – Hauke Laging
    Jun 28 '13 at 13:04











  • Found the issue: I must mount /dev/sda1 as /boot before running update-initramfs.

    – n.r.
    Jun 28 '13 at 13:36













  • Make that an answer instead of a comment and accept it (if that is possible with own answers, I am not sure) so that this question is shown as answered.

    – Hauke Laging
    Jun 28 '13 at 13:48

















Have you recreated the initrd after editing /etc/crypttab?

– Hauke Laging
Jun 28 '13 at 12:53





Have you recreated the initrd after editing /etc/crypttab?

– Hauke Laging
Jun 28 '13 at 12:53













I think so: update-initramfs -t -u -k all

– n.r.
Jun 28 '13 at 12:59





I think so: update-initramfs -t -u -k all

– n.r.
Jun 28 '13 at 12:59













Output of grep -r sda5_crypt /etc?

– Hauke Laging
Jun 28 '13 at 13:04





Output of grep -r sda5_crypt /etc?

– Hauke Laging
Jun 28 '13 at 13:04













Found the issue: I must mount /dev/sda1 as /boot before running update-initramfs.

– n.r.
Jun 28 '13 at 13:36







Found the issue: I must mount /dev/sda1 as /boot before running update-initramfs.

– n.r.
Jun 28 '13 at 13:36















Make that an answer instead of a comment and accept it (if that is possible with own answers, I am not sure) so that this question is shown as answered.

– Hauke Laging
Jun 28 '13 at 13:48





Make that an answer instead of a comment and accept it (if that is possible with own answers, I am not sure) so that this question is shown as answered.

– Hauke Laging
Jun 28 '13 at 13:48










2 Answers
2






active

oldest

votes


















17














"sda5_crypt" crypttab change as per suggestion below:



Replace OLD_NAME with NEW_NAME in /etc/crypttab, and then:



# dmsetup rename OLD_NAME NEW_NAME
# update-initramfs -c -t -k all
# update-grub
# reboot





share|improve this answer





















  • 2





    rescue should not be necessary. just edit the crypttab, update-initramfs, and next time you boot it should be renamed. You can also rename it in the running system using dmsetup rename oldname newname. Note that this does not free the old name, as it may be in use.

    – frostschutz
    Jun 28 '13 at 18:29











  • @frostschutz You have to be able to get at that /etc/crypttab file somehow… Doing the mounting manually from the initramfs shell so that you can boot the normal system is possible, but not easy. A rescue system is the quicker option if you aren't intimately familiar with cryptsetup and LVM commands.

    – Gilles
    Jun 28 '13 at 22:45






  • 1





    @Gilles: sure, but the question stated "I can boot the system all right."

    – frostschutz
    Jun 29 '13 at 11:29











  • You just saved me a big headache @n.r. Thank you

    – deitch
    May 6 '16 at 10:38



















0














I just came across this issue - with the additional complication that I haven't seen the warning of the last update-initramfs. So I renamed the device in crypttab, ran update-initramfs, restarted and had a problem. I solved it as follows, basically the same n.r. but I had to alter the commands slightly:




  1. Boot a Live (K)Ubuntu System from USB

  2. Open the device in Dolphin/? which setups all the needed configuration and asks you your password

  3. Open the console in the root directory of your broken system

  4. Execute the following line by line


sudo -s
# get the name the partition was mounted with, starts with luks
dmsetup ls
# rename the loop device (check with ls /dev/mapper)
dmsetup rename LUKS_NAME NEW_NAME

# prepare chroot
mount --bind /dev dev/
mount --bind /proc proc/
mount --bind /sys sys/
chroot .

# mount devices (I missed this first, you need both)
mount boot
mount /

# ready to update
update-initramfs -u -k all




share








New contributor




y_z is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f81011%2fhow-to-change-the-name-an-encrypted-full-system-partition-is-mapped-to%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    17














    "sda5_crypt" crypttab change as per suggestion below:



    Replace OLD_NAME with NEW_NAME in /etc/crypttab, and then:



    # dmsetup rename OLD_NAME NEW_NAME
    # update-initramfs -c -t -k all
    # update-grub
    # reboot





    share|improve this answer





















    • 2





      rescue should not be necessary. just edit the crypttab, update-initramfs, and next time you boot it should be renamed. You can also rename it in the running system using dmsetup rename oldname newname. Note that this does not free the old name, as it may be in use.

      – frostschutz
      Jun 28 '13 at 18:29











    • @frostschutz You have to be able to get at that /etc/crypttab file somehow… Doing the mounting manually from the initramfs shell so that you can boot the normal system is possible, but not easy. A rescue system is the quicker option if you aren't intimately familiar with cryptsetup and LVM commands.

      – Gilles
      Jun 28 '13 at 22:45






    • 1





      @Gilles: sure, but the question stated "I can boot the system all right."

      – frostschutz
      Jun 29 '13 at 11:29











    • You just saved me a big headache @n.r. Thank you

      – deitch
      May 6 '16 at 10:38
















    17














    "sda5_crypt" crypttab change as per suggestion below:



    Replace OLD_NAME with NEW_NAME in /etc/crypttab, and then:



    # dmsetup rename OLD_NAME NEW_NAME
    # update-initramfs -c -t -k all
    # update-grub
    # reboot





    share|improve this answer





















    • 2





      rescue should not be necessary. just edit the crypttab, update-initramfs, and next time you boot it should be renamed. You can also rename it in the running system using dmsetup rename oldname newname. Note that this does not free the old name, as it may be in use.

      – frostschutz
      Jun 28 '13 at 18:29











    • @frostschutz You have to be able to get at that /etc/crypttab file somehow… Doing the mounting manually from the initramfs shell so that you can boot the normal system is possible, but not easy. A rescue system is the quicker option if you aren't intimately familiar with cryptsetup and LVM commands.

      – Gilles
      Jun 28 '13 at 22:45






    • 1





      @Gilles: sure, but the question stated "I can boot the system all right."

      – frostschutz
      Jun 29 '13 at 11:29











    • You just saved me a big headache @n.r. Thank you

      – deitch
      May 6 '16 at 10:38














    17












    17








    17







    "sda5_crypt" crypttab change as per suggestion below:



    Replace OLD_NAME with NEW_NAME in /etc/crypttab, and then:



    # dmsetup rename OLD_NAME NEW_NAME
    # update-initramfs -c -t -k all
    # update-grub
    # reboot





    share|improve this answer















    "sda5_crypt" crypttab change as per suggestion below:



    Replace OLD_NAME with NEW_NAME in /etc/crypttab, and then:



    # dmsetup rename OLD_NAME NEW_NAME
    # update-initramfs -c -t -k all
    # update-grub
    # reboot






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Dec 26 '13 at 3:33

























    answered Jun 28 '13 at 14:07









    n.r.n.r.

    946824




    946824








    • 2





      rescue should not be necessary. just edit the crypttab, update-initramfs, and next time you boot it should be renamed. You can also rename it in the running system using dmsetup rename oldname newname. Note that this does not free the old name, as it may be in use.

      – frostschutz
      Jun 28 '13 at 18:29











    • @frostschutz You have to be able to get at that /etc/crypttab file somehow… Doing the mounting manually from the initramfs shell so that you can boot the normal system is possible, but not easy. A rescue system is the quicker option if you aren't intimately familiar with cryptsetup and LVM commands.

      – Gilles
      Jun 28 '13 at 22:45






    • 1





      @Gilles: sure, but the question stated "I can boot the system all right."

      – frostschutz
      Jun 29 '13 at 11:29











    • You just saved me a big headache @n.r. Thank you

      – deitch
      May 6 '16 at 10:38














    • 2





      rescue should not be necessary. just edit the crypttab, update-initramfs, and next time you boot it should be renamed. You can also rename it in the running system using dmsetup rename oldname newname. Note that this does not free the old name, as it may be in use.

      – frostschutz
      Jun 28 '13 at 18:29











    • @frostschutz You have to be able to get at that /etc/crypttab file somehow… Doing the mounting manually from the initramfs shell so that you can boot the normal system is possible, but not easy. A rescue system is the quicker option if you aren't intimately familiar with cryptsetup and LVM commands.

      – Gilles
      Jun 28 '13 at 22:45






    • 1





      @Gilles: sure, but the question stated "I can boot the system all right."

      – frostschutz
      Jun 29 '13 at 11:29











    • You just saved me a big headache @n.r. Thank you

      – deitch
      May 6 '16 at 10:38








    2




    2





    rescue should not be necessary. just edit the crypttab, update-initramfs, and next time you boot it should be renamed. You can also rename it in the running system using dmsetup rename oldname newname. Note that this does not free the old name, as it may be in use.

    – frostschutz
    Jun 28 '13 at 18:29





    rescue should not be necessary. just edit the crypttab, update-initramfs, and next time you boot it should be renamed. You can also rename it in the running system using dmsetup rename oldname newname. Note that this does not free the old name, as it may be in use.

    – frostschutz
    Jun 28 '13 at 18:29













    @frostschutz You have to be able to get at that /etc/crypttab file somehow… Doing the mounting manually from the initramfs shell so that you can boot the normal system is possible, but not easy. A rescue system is the quicker option if you aren't intimately familiar with cryptsetup and LVM commands.

    – Gilles
    Jun 28 '13 at 22:45





    @frostschutz You have to be able to get at that /etc/crypttab file somehow… Doing the mounting manually from the initramfs shell so that you can boot the normal system is possible, but not easy. A rescue system is the quicker option if you aren't intimately familiar with cryptsetup and LVM commands.

    – Gilles
    Jun 28 '13 at 22:45




    1




    1





    @Gilles: sure, but the question stated "I can boot the system all right."

    – frostschutz
    Jun 29 '13 at 11:29





    @Gilles: sure, but the question stated "I can boot the system all right."

    – frostschutz
    Jun 29 '13 at 11:29













    You just saved me a big headache @n.r. Thank you

    – deitch
    May 6 '16 at 10:38





    You just saved me a big headache @n.r. Thank you

    – deitch
    May 6 '16 at 10:38













    0














    I just came across this issue - with the additional complication that I haven't seen the warning of the last update-initramfs. So I renamed the device in crypttab, ran update-initramfs, restarted and had a problem. I solved it as follows, basically the same n.r. but I had to alter the commands slightly:




    1. Boot a Live (K)Ubuntu System from USB

    2. Open the device in Dolphin/? which setups all the needed configuration and asks you your password

    3. Open the console in the root directory of your broken system

    4. Execute the following line by line


    sudo -s
    # get the name the partition was mounted with, starts with luks
    dmsetup ls
    # rename the loop device (check with ls /dev/mapper)
    dmsetup rename LUKS_NAME NEW_NAME

    # prepare chroot
    mount --bind /dev dev/
    mount --bind /proc proc/
    mount --bind /sys sys/
    chroot .

    # mount devices (I missed this first, you need both)
    mount boot
    mount /

    # ready to update
    update-initramfs -u -k all




    share








    New contributor




    y_z is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.

























      0














      I just came across this issue - with the additional complication that I haven't seen the warning of the last update-initramfs. So I renamed the device in crypttab, ran update-initramfs, restarted and had a problem. I solved it as follows, basically the same n.r. but I had to alter the commands slightly:




      1. Boot a Live (K)Ubuntu System from USB

      2. Open the device in Dolphin/? which setups all the needed configuration and asks you your password

      3. Open the console in the root directory of your broken system

      4. Execute the following line by line


      sudo -s
      # get the name the partition was mounted with, starts with luks
      dmsetup ls
      # rename the loop device (check with ls /dev/mapper)
      dmsetup rename LUKS_NAME NEW_NAME

      # prepare chroot
      mount --bind /dev dev/
      mount --bind /proc proc/
      mount --bind /sys sys/
      chroot .

      # mount devices (I missed this first, you need both)
      mount boot
      mount /

      # ready to update
      update-initramfs -u -k all




      share








      New contributor




      y_z is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.























        0












        0








        0







        I just came across this issue - with the additional complication that I haven't seen the warning of the last update-initramfs. So I renamed the device in crypttab, ran update-initramfs, restarted and had a problem. I solved it as follows, basically the same n.r. but I had to alter the commands slightly:




        1. Boot a Live (K)Ubuntu System from USB

        2. Open the device in Dolphin/? which setups all the needed configuration and asks you your password

        3. Open the console in the root directory of your broken system

        4. Execute the following line by line


        sudo -s
        # get the name the partition was mounted with, starts with luks
        dmsetup ls
        # rename the loop device (check with ls /dev/mapper)
        dmsetup rename LUKS_NAME NEW_NAME

        # prepare chroot
        mount --bind /dev dev/
        mount --bind /proc proc/
        mount --bind /sys sys/
        chroot .

        # mount devices (I missed this first, you need both)
        mount boot
        mount /

        # ready to update
        update-initramfs -u -k all




        share








        New contributor




        y_z is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.










        I just came across this issue - with the additional complication that I haven't seen the warning of the last update-initramfs. So I renamed the device in crypttab, ran update-initramfs, restarted and had a problem. I solved it as follows, basically the same n.r. but I had to alter the commands slightly:




        1. Boot a Live (K)Ubuntu System from USB

        2. Open the device in Dolphin/? which setups all the needed configuration and asks you your password

        3. Open the console in the root directory of your broken system

        4. Execute the following line by line


        sudo -s
        # get the name the partition was mounted with, starts with luks
        dmsetup ls
        # rename the loop device (check with ls /dev/mapper)
        dmsetup rename LUKS_NAME NEW_NAME

        # prepare chroot
        mount --bind /dev dev/
        mount --bind /proc proc/
        mount --bind /sys sys/
        chroot .

        # mount devices (I missed this first, you need both)
        mount boot
        mount /

        # ready to update
        update-initramfs -u -k all





        share








        New contributor




        y_z is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.








        share


        share






        New contributor




        y_z is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        answered 7 mins ago









        y_zy_z

        1




        1




        New contributor




        y_z is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.





        New contributor





        y_z is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






        y_z is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f81011%2fhow-to-change-the-name-an-encrypted-full-system-partition-is-mapped-to%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            CARDNET

            Boot-repair Failure: Unable to locate package grub-common:i386

            濃尾地震