| 28 | |
| 29 | Assuming your target is an MFPL kvm guest, you will want grub to output to a serial console and you will want a login prompt on the serial console. Therefore, you may want to add these lines to your script: |
| 30 | |
| 31 | {{{ |
| 32 | ssh "$target_host" "sed -i 's|^#T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100|T0:23:respawn:/sbin/getty -L ttyS0 115200 vt102|' /mnt/etc/inittab" |
| 33 | ssh "$target_host" "sed -i 's|^1:2345:respawn:/sbin/getty|#1:2345:respawn:/sbin/getty|' /mnt/etc/inittab" |
| 34 | ssh "$target_host" "sed -i 's|^2:23:respawn:/sbin/getty|#2:23:respawn:/sbin/getty|' /mnt/etc/inittab" |
| 35 | ssh "$target_host" "sed -i 's|^3:23:respawn:/sbin/getty|#3:23:respawn:/sbin/getty|' /mnt/etc/inittab" |
| 36 | ssh "$target_host" "sed -i 's|^4:23:respawn:/sbin/getty|#4:23:respawn:/sbin/getty|' /mnt/etc/inittab" |
| 37 | ssh "$target_host" "sed -i 's|^5:23:respawn:/sbin/getty|#5:23:respawn:/sbin/getty|' /mnt/etc/inittab" |
| 38 | ssh "$target_host" "sed -i 's|^6:23:respawn:/sbin/getty|#6:23:respawn:/sbin/getty|' /mnt/etc/inittab" |
| 39 | |
| 40 | ssh "$target_host" 'echo nameserver 209.234.253.239 > /mnt/etc/resolv.conf' |
| 41 | ssh "$target_host" 'echo GRUB_CMDLINE_LINUX=\"console=ttyS0,115200n8\" >> /mnt/etc/default/grub' |
| 42 | ssh "$target_host" 'echo GRUB_TERMINAL=serial >> /mnt/etc/default/grub' |
| 43 | ssh "$target_host" 'echo GRUB_SERIAL_COMMAND=\"serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1\" >> /mnt/etc/default/grub' |
| 44 | |
| 45 | ssh "$target_host" "chroot /mnt update-grub" |
| 46 | }}} |