commandlinekid

Chroot on Arch Linux from LIVE CD to fix other installation

Jun 6th, 2020
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.48 KB | None | 0 0
  1. GETTING CHROOT on arch linux.
  2.  
  3. Mostly use this:
  4. https://forum.artixlinux.org/index.php/topic,103.0.html
  5.  
  6. Text with my updates:
  7.  
  8. #-------------------------------#
  9. # Standard chroot #
  10. #-------------------------------#
  11.  
  12. First, I used an old LiveDVD/CD from 2019. This is 2020. It works just fine.
  13.  
  14. This command manually Identify and Prepare the Installed Partition(s)
  15.  
  16. 1. Open your terminal and start a root session: su
  17.  
  18. 2. List all your partitions: lsblk -f (commandlinekid update: was /sda3)
  19.  
  20. 3. Mount your system partition. The syntax to mount the system partition is: mount /dev/[partition_to_mount] /mnt
  21.  
  22. Example: if the system partition is /dev/sda3, this will be mounted using the following command: mount /dev/sda3 /mnt if a separate partition /dev/sda1 has been used for the GRUB, mount it with the following command: mount /dev/sda1 /mnt/boot
  23.  
  24. 4. Change to the root directory of your mounted partitions: cd /mnt
  25.  
  26. To complete the operation, and to mount completely the file system, it will be necessary to enter a series of commands in the following order:
  27.  
  28. mount -t proc proc /mnt/proc
  29. mount -t sysfs sys /mnt/sys
  30. mount -o bind /dev /mnt/dev
  31. mount -o bind /run /mnt/run
  32. mount -t devpts pts /mnt/dev/pts/
  33.  
  34. cp /etc/resolv.conf /mnt/etc/resolv.conf
  35.  
  36. chroot /mnt
  37.  
  38. DONE and now you are positioned on the chroot-ed file system, where all your command will act.
  39.  
  40. #---------------------------------#
  41. # LUKS Partition chroot #
  42. #---------------------------------#
  43.  
  44. 1) Boot with a liveUSB
  45.  
  46. 2) Open a Terminal session
  47.  
  48. 3) Identify the hd partition: lsblk
  49.  
  50. In this example I suppose that:
  51. /dev/sda1 is the /boot partition
  52. /dev/sda2 is the LUKS encrypted partition
  53.  
  54. NOTE: replace sda1 or sda2 with the partition name that you get with the lsblk command
  55.  
  56. $ su
  57. $ cryptsetup open --type luks /dev/sda2 root # where sda2 is the encrypted device
  58. $ mount /dev/mapper/root /mnt
  59. $ mount /dev/sda1 /mnt/boot # mount here the boot partition
  60. $ mount -t proc proc /mnt/proc
  61. $ mount -t sysfs sys /mnt/sys
  62. $ mount -o bind /dev /mnt/dev
  63. $ mount -o bind /run /mnt/run
  64. $ mount -t devpts pts /mnt/dev/pts
  65.  
  66. $ cp /etc/resolv.conf /mnt/etc/resolv.conf
  67.  
  68. $ chroot /mnt
  69.  
  70. commandlinekid update (chroot DID work, but if not, try arch-chroot)
  71.  
  72. commandlinekid update (if chroot /mnt doesn't work, do this: chroot /mnt /bin/bash)
  73.  
  74. THEN RUN THESE TWO COMMANDS:
  75.  
  76. pacman Syu
  77. mkinitcpio -p linux
  78.  
  79. Then reboot
  80.  
  81. (second command I got from here: https://www.soimort.org/notes/170407/)
Add Comment
Please, Sign In to add comment