Skip to content

Instantly share code, notes, and snippets.

@unixfox
Last active May 3, 2025 08:57
Show Gist options
  • Save unixfox/58bdb24f6412579eeb1e26516eaf18c6 to your computer and use it in GitHub Desktop.
Save unixfox/58bdb24f6412579eeb1e26516eaf18c6 to your computer and use it in GitHub Desktop.

Revisions

  1. unixfox revised this gist Nov 3, 2024. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,7 @@
    Use this better tutorial: https://gist.github.com/karolba/a3f1c5f8d50c67f5a19e6c8f38e53e12

    ---------

    1. Reboot into the rescue image
    2. Then execute these commands:
    ```
  2. unixfox revised this gist Jul 2, 2022. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,10 @@
    1. Reboot into the rescue image
    2. Then execute these commands:
    ```
    cd /dev/shm
    mkdir alpine
    cd alpine
    wget https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/x86_64/alpine-minirootfs-3.13.1-x86_64.tar.gz
    wget https://dl-cdn.alpinelinux.org/alpine/v3.16/releases/x86_64/alpine-minirootfs-3.16.0-x86_64.tar.gz
    tar xzvf alpine*
    mount -t proc /proc proc/
    mount -t sysfs /sys sys/
    @@ -15,7 +16,7 @@ apk add alpine-conf nano
    3. `nano /sbin/setup-disk`
    4. Set return 1 to return 0 for is_efi
    5. `nano /sbin/setup-alpine`
    6. add `-s 0 -k virt` after `$PREFIX/sbin/setup-disk`
    6. add `-s 0 -k virt` after `setup-disk`
    7. `setup-alpine`
    8. Then:
    ```
  3. unixfox revised this gist Feb 15, 2021. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -42,6 +42,7 @@ rc-update add mdev sysinit
    rc-update add killprocs shutdown
    rc-update add hwdrivers sysinit
    rc-update add crond
    rc-update add local
    ```
    10. Add your key in /mnt/root/.ssh/authorized_keys
    11. `umount /mnt`
  4. unixfox revised this gist Feb 4, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -22,7 +22,7 @@ apk add alpine-conf nano
    exit
    mount /dev/vda2 /mnt
    chroot /mnt /bin/ash
    cd /etc/boot/grub
    cd /boot/grub
    nano grub.cfg
    ```
    9. Add `console=ttyS0` for line `linux /boot/vmlinuz-virt`
  5. unixfox revised this gist Feb 4, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -21,7 +21,7 @@ apk add alpine-conf nano
    ```
    exit
    mount /dev/vda2 /mnt
    chroot /mnt
    chroot /mnt /bin/ash
    cd /etc/boot/grub
    nano grub.cfg
    ```
  6. unixfox revised this gist Feb 4, 2021. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -24,6 +24,10 @@ mount /dev/vda2 /mnt
    chroot /mnt
    cd /etc/boot/grub
    nano grub.cfg
    ```
    9. Add `console=ttyS0` for line `linux /boot/vmlinuz-virt`
    10. Then execute this commands for having a proper boot:
    ```
    rc-update add modules boot
    rc-update add hostname boot
    rc-update add dmesg sysinit
    @@ -39,7 +43,6 @@ rc-update add killprocs shutdown
    rc-update add hwdrivers sysinit
    rc-update add crond
    ```
    9. Add `console=ttyS0` for line `linux /boot/vmlinuz-virt`
    10. Add your key in /mnt/root/.ssh/authorized_keys
    11. `umount /mnt`
    12. Reboot
  7. unixfox revised this gist Feb 3, 2021. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -37,6 +37,7 @@ rc-update add mount-ro shutdown
    rc-update add mdev sysinit
    rc-update add killprocs shutdown
    rc-update add hwdrivers sysinit
    rc-update add crond
    ```
    9. Add `console=ttyS0` for line `linux /boot/vmlinuz-virt`
    10. Add your key in /mnt/root/.ssh/authorized_keys
  8. unixfox revised this gist Feb 3, 2021. 1 changed file with 15 additions and 3 deletions.
    18 changes: 15 additions & 3 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -21,8 +21,22 @@ apk add alpine-conf nano
    ```
    exit
    mount /dev/vda2 /mnt
    cd /mnt/boot/grub
    chroot /mnt
    cd /etc/boot/grub
    nano grub.cfg
    rc-update add modules boot
    rc-update add hostname boot
    rc-update add dmesg sysinit
    rc-update add devfs sysinit
    rc-update add acpid boot
    rc-update add bootmisc boot
    rc-update add hwclock boot
    rc-update add sysctl boot
    rc-update add syslog boot
    rc-update add mount-ro shutdown
    rc-update add mdev sysinit
    rc-update add killprocs shutdown
    rc-update add hwdrivers sysinit
    ```
    9. Add `console=ttyS0` for line `linux /boot/vmlinuz-virt`
    10. Add your key in /mnt/root/.ssh/authorized_keys
    @@ -39,6 +53,4 @@ GRUB_SERIAL_COMMAND="serial --unit=0 --word=8 --parity=no --speed 38400 --stop=1
    3. `grub-mkconfig -o /boot/grub/grub.cfg`
    4. Add `ttyS0::respawn:/sbin/getty -L ttyS0 38400 vt100` to `/etc/inittab`

    For IPv6: `rc-update add modules`

    Source: https://riedstra.dev/2019/09/alpine-gcp
  9. unixfox revised this gist Feb 3, 2021. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -39,4 +39,6 @@ GRUB_SERIAL_COMMAND="serial --unit=0 --word=8 --parity=no --speed 38400 --stop=1
    3. `grub-mkconfig -o /boot/grub/grub.cfg`
    4. Add `ttyS0::respawn:/sbin/getty -L ttyS0 38400 vt100` to `/etc/inittab`

    For IPv6: `rc-update add modules`

    Source: https://riedstra.dev/2019/09/alpine-gcp
  10. unixfox created this gist Feb 3, 2021.
    42 changes: 42 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,42 @@
    1. Reboot into the rescue image
    2. Then execute these commands:
    ```
    mkdir alpine
    cd alpine
    wget https://dl-cdn.alpinelinux.org/alpine/v3.13/releases/x86_64/alpine-minirootfs-3.13.1-x86_64.tar.gz
    tar xzvf alpine*
    mount -t proc /proc proc/
    mount -t sysfs /sys sys/
    mount --rbind /dev dev/
    cp /etc/resolv.conf etc/resolv.conf
    chroot . ash -l
    apk add alpine-conf nano
    ```
    3. `nano /sbin/setup-disk`
    4. Set return 1 to return 0 for is_efi
    5. `nano /sbin/setup-alpine`
    6. add `-s 0 -k virt` after `$PREFIX/sbin/setup-disk`
    7. `setup-alpine`
    8. Then:
    ```
    exit
    mount /dev/vda2 /mnt
    cd /mnt/boot/grub
    nano grub.cfg
    ```
    9. Add `console=ttyS0` for line `linux /boot/vmlinuz-virt`
    10. Add your key in /mnt/root/.ssh/authorized_keys
    11. `umount /mnt`
    12. Reboot

    Extra for correct serial:
    1. Add this in `/etc/default/grub`:
    ```
    GRUB_TERMINAL="serial console"
    GRUB_SERIAL_COMMAND="serial --unit=0 --word=8 --parity=no --speed 38400 --stop=1"
    ```
    2. Add `console=ttyS0,38400n8d` to `GRUB_CMDLINE_LINUX_DEFAULT`
    3. `grub-mkconfig -o /boot/grub/grub.cfg`
    4. Add `ttyS0::respawn:/sbin/getty -L ttyS0 38400 vt100` to `/etc/inittab`

    Source: https://riedstra.dev/2019/09/alpine-gcp