temporary

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
temporary [2024/04/14 08:23] baecytemporary [2024/04/19 17:11] (현재) baecy
줄 2: 줄 2:
 from [[https://unix.stackexchange.com/questions/14345/how-do-i-tell-im-running-in-a-chroot]] \\ from [[https://unix.stackexchange.com/questions/14345/how-do-i-tell-im-running-in-a-chroot]] \\
 <code lang=bash> <code lang=bash>
 +## stat - Display file or file system status.
 +
 +## -c  --format=FORMAT   use the specified FORMAT instead of the default;
 +##                          output a newline after each use of FORMAT
 +
 +## The valid format sequences for files (without --file-system):
 +##  %d   device number in decimal (st_dev)
 +##  %i   inode number
 +
 +## 현재 root의 device, inode가 /sbin/init가 실행한 root와 동일한지 확인
 +## PS1에 적용하면 normal과 chroot간에 다른 PS1 사용 가능
 +
 if [ "$(stat -c %d:%i /)" != "$(stat -c %d:%i /proc/1/root/.)" ]; then if [ "$(stat -c %d:%i /)" != "$(stat -c %d:%i /proc/1/root/.)" ]; then
   echo "We are chrooted!"   echo "We are chrooted!"
줄 7: 줄 19:
   echo "Business as usual"   echo "Business as usual"
 fi</code> fi</code>
 +
 +=== Readline Colored Completion ===
 +[[https://superuser.com/questions/251107/how-to-get-a-colored-tab-completion|Read This]]
 +
 +=== grub PARTUUID ===
 +[[https://unix.stackexchange.com/questions/93767/why-cant-i-specify-my-root-fs-with-a-uuid|Read This]] \\
 +This is a 5 year old thread. But still it is imho not fully answered. There's a little example missing. Here it is:
 +
 +In this example:
 +
 +/dev/sda3 = /
 +/dev/sda2 = swap
 +...using a GPT partition. With MBR (dos partition) the PARTUUID's are shorter but the procedure is the same...
 +
 +get the PARTUUID's with blkid:
 +<code cmdout=2,4 user=root>
 +blkid -s PARTUUID -o value /dev/sda3 # root
 +77fd7830-faa2-4e99-a48b-337ad9eded28
 +blkid -s PARTUUID -o value /dev/sda2 # swap
 +5b63167a-6fd2-4e72-948c-90832372956c</code>
 +/boot/grub/grub.cfg:
 +<code lang=bash>
 +search --no-floppy --part-uuid --set=root 77fd7830-faa2-4e99-a48b-337ad9eded28
 +
 +menuentry "GNU/Linux, KERNEL 4.12.7-lfs-8.1" {
 +  linux /boot/vmlinuz-4.12.7-lfs-8.1 root=PARTUUID=77fd7830-faa2-4e99-a48b-337ad9eded28 net.ifnames=0 ipv6.disable=1 ro rootwait rootfstype=ext4
 +}</code>
 +/etc/fstab/:
 +<code lang=bash>
 +PARTUUID=77fd7830-faa2-4e99-a48b-337ad9eded28 / ext4 noatime,nodiratime,errors=remount-ro 0 1
 +PARTUUID=5b63167a-6fd2-4e72-948c-90832372956c swap swap pri=1 0 0</code>
 +This is known to WORK with lfs8.1 (kernel 4.12.7) But i think it should work with most other kernels too (olders and newers...)
  • temporary.1713082983.txt.gz
  • 마지막으로 수정됨: 2024/04/14 08:23
  • 저자 baecy