Advertisement
Guest User

story: change root full

a guest
May 25th, 2014
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. # Setup CHROOT
  2. # =============
  3. ## copy 7 commands below then paste:
  4. ## Change /dev/sdxY to actual partition value eg. /dev/sda5
  5.  
  6. sudo mount /dev/sdxY /mnt/
  7. sudo mount --bind /dev /mnt/dev
  8. sudo mount --bind /proc /mnt/proc
  9. sudo mount --bind /sys /mnt/sys
  10. sudo mount --bind /dev/pts /mnt/dev/pts
  11. If networking is needed: Open a new terminal and ->
  12. sudo cp /mnt/etc/hosts /mnt/etc/hosts.old
  13. sudo cp /etc/hosts /mnt/etc/hosts
  14. sudo cp /etc/resolv.conf /mnt/etc/resolv.conf
  15. exit
  16. (The exit command at the end closes the new tab/window.)
  17.  
  18. sudo chroot /mnt/ /bin/bash
  19.  
  20. # =============
  21. # Remove CHROOT
  22. # =============
  23. ## Ctrl+d to exit chroot,
  24. ## copy 6 commands below then paste.
  25. to restore the old hosts file if networking were inabled ->
  26. cp /etc/hosts.old /etc/hosts
  27. sudo umount /mnt/dev/pts
  28. sudo umount /mnt/sys
  29. sudo umount /mnt/proc
  30. sudo umount /mnt/dev
  31. sudo umount /mnt
  32.  
  33. *side note :/etc/resolv.conf is nowadays managed by resolvconf, it'll automatically be generated when using NetworkManager and can safely be removed using rm /etc/resolv.conf
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement