Results 1 to 2 of 2

Thread: Need help with LUKS encryption RPi3

  1. #1
    Join Date

    Need help with LUKS encryption RPi3

    I'm newbie here and need some community help.
    Iam following the article here: problem occurs during the step "Backup and Restore"
    Now insert the SD card and validate the device ID. In our case, the device is /dev/sdc2 but yours might be different so adjust as necessary on your system. We mount the device and make a backup of the filesystem
    In my case Kali 2018.2 on WMware player determines sdcard as mmcblk0 with 2 partitions:
    /dev/mmcblk0p1 bootable
    /dev/mmcblk0p2 partition with file system

    mount /dev/mmcblk0p2 /mnt/chroot/
    rsync -avh /mnt/chroot/* /mnt/backup/
    umount /mnt/chroot

    After a successful backuping /mnt/chroot/*

    echo -e "d\n2\nw" | fdisk /dev/mmcblk0

    fdisk swears at \ n2 \ as an unknown attribute

    According to the help menu, I did not understand what this attributes means

    Command (m for help): m
    Command action
    a toggle a bootable flag
    b edit bsd disklabel
    c toggle the dos compatibility flag
    d delete a partition
    l list known partition types
    m print this menu
    n add a new partition
    o create a new empty DOS partition table
    p print the partition table
    q quit without saving changes
    s create a new empty Sun disklabel
    t change a partition's system id
    u change display / entry units
    v verify the partition table
    w write table to disk and exit
    x extra functionality (experts only)

    echo -e "d\n2\nw" | fdisk /dev/mmcblk0
    it means:
    1. fdisk / dev / mmcblk0
    2. d - delete a partition
    3. n2 - add a new partition? 2 is the 2nd section?
    4. n - add a new partition? w - write table to disk and exit

    Next command the same
    echo -e "n\np\n2\n\n\nw" | fdisk

    Please help how should these commands look in my case?
    Last edited by vik1ngsec; 4 Weeks Ago at 13:27.

  2. #2
    Join Date
    \n is actually "newline" aka "hit enter"

    what it's actually saying to do for the script is:

    echo -e (expand) "d" (delete) (press enter) "2" (the second partition) (press enter) "w" (write the changes) | (pipe the changes to...) fdisk

    then the next line

    echo -e (expand) "n" (new) (press enter) "p" (partition) (press enter) "2" (partition number should be 2) (press enter) (press enter) (press enter) "w" (write the changes) | (pipe the changes to...) fdisk

    The only time i've seen fdisk respond like that is if i've actually forgotten to type the -e (expand)

    Doing it manually, which is what we're avoiding by doing the echo, it's simply, fdisk /dev/mmcblk0 - delete the second partition, then create a new partition, numbered 2, and accept the options it gives you for the start and ending points, then write, then continue on.

Similar Threads

  1. Create new partition, adding USB persistence with LUKS encryption
    By etii in forum Kali Linux TroubleShooting
    Replies: 0
    Last Post: 2018-01-15, 01:37
  2. Luks on Rpi3 without ssh
    By rigosantana3 in forum ARM Archive
    Replies: 0
    Last Post: 2017-05-21, 18:48
  3. USB Persistence with LUKS Encryption not working
    By askhenry in forum Installing Archive
    Replies: 2
    Last Post: 2016-11-12, 11:39
  4. luks encryption on...
    By Unknown0 in forum Installing Archive
    Replies: 0
    Last Post: 2016-03-19, 22:43
  5. USB Persistence with LUKS Encryption - Not so persistant
    By hightech316 in forum General Archive
    Replies: 0
    Last Post: 2015-10-19, 16:17

Tags for this Thread

Posting Permissions

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