Skip to content

Instantly share code, notes, and snippets.

@goffinet
Last active October 19, 2022 10:21
Show Gist options
  • Save goffinet/f515fb4c87f510d74165780cec78d62c to your computer and use it in GitHub Desktop.
Save goffinet/f515fb4c87f510d74165780cec78d62c to your computer and use it in GitHub Desktop.
Ubuntu/Kali serial console enabled by grub /etc/default/grub, "grub-mkconfig -o /boot/grub/grub.cfg
#!/bin/bash
# Works with Kali latest releases
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
cat << EOF > /etc/default/grub
# grub-mkconfig -o /boot/grub/grub.cfg
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="console=tty1 console=ttyS0,115200"
GRUB_CMDLINE_LINUX="initrd=/install/initrd.gz net.ifnames=0 biosdevname=0"
GRUB_TERMINAL="console serial"
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"
EOF
grub-mkconfig -o /boot/grub/grub.cfg
#!/bin/bash
# Works with Kali latest releases
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
cat << EOF > /etc/default/grub
# grub-mkconfig -o /boot/grub/grub.cfg
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="console=tty1 console=ttyS0,115200"
GRUB_CMDLINE_LINUX="initrd=/install/initrd.gz net.ifnames=0 biosdevname=0"
GRUB_TERMINAL="console serial"
GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"
EOF
grub-mkconfig -o /boot/grub/grub.cfg
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment