Thursday 10 January 2013

Recovering LUKS encrypted Arch Linux installation on LVM after overwriting MBR when installing Windows Vista or Windows 8 to the same disk

Commented commands are optional.

Boot up with Arch Live CD
# loadkeys uk
# setfont Lat2-Terminus16
# vgscan
vgchange -ay
cryptsetup luksOpen /dev/mapper/[encrypted source] [unencrypted target]
mount /dev/mapper/[unencrypted target] /mnt
mount /dev/mapper/[lvm boot device] /mnt/boot
arch-chroot /mnt /bin/bash
grub-install --target=i386-pc --recheck /dev/sdX
exit
umount /mnt/boot
umount /mnt
reboot

Boot back in to Arch without Live CD and as root
## It may be sufficient to execute the following commands in the previous chroot environment.
# cp /boot/grub/grub.cfg /boot/grub/grub.cfg.old
grub-mkconfig -o /boot/grub/grub.cfg
reboot
Requires GRUB2 OS-Prober to detect Windows installation(s).

Enjoy!

References
https://wiki.archlinux.org/index.php/Beginners'_Guide
https://wiki.archlinux.org/index.php/LVM
https://wiki.archlinux.org/index.php/Dm-crypt_with_LUKS
https://wiki.archlinux.org/index.php/GRUB2

Sunday 18 November 2012

Allow Gigabyte GA-EP45-DS4 to boot up with AHCI enabled

If your computer is failing to boot and hangs during AHCI enumeration with a possible code 23 in the top right corner, and it only happens when (1 or more) SATA HDD are connected that have a MBR (Master Boot Record), this may fix it for you, as it did for me:
  • Turn off computer.
  • Disconnect (not-really-)faulty HDD.
  • Turn on computer.
  • In BIOS, disable AHCI:
    • BIOS > Integrated Peripherals > SATA AHCI Mode = Disabled
  • Save changes and turn off computer.
  • Reconnect (not-really-)faulty HDD.
  • Turn on computer.
  • Boot in to operating system of your choice. e.g. Linux
  • Open (not-really-)faulty HDD in a hex editor. e.g. hexcurse /dev/sda
  • Set the 3 bytes starting at offset 0x1C3 to FE FF FF, save and quit.
    • You may wish to make a note of the original values you're replacing in case you need to undo.
  • If using Arch Linux, add ahci to mkinitcpio.conf modules list and rebuild kernel image
  • Reboot, in bios enable AHCI again, save and reboot
There is an error in the BIOS/AHCI controller ROM that has been reported to Gigabyte, but whether they've released BIOS updates for all affected motherboards is a mystery. For example, there's a "beta" bios update for my motherboard, but without a changelog I'm hesitant to install it.

References:
http://forum.giga-byte.co.uk/index.php?topic=8585.0
https://wiki.archlinux.org/index.php/AHCI
http://forums.tweaktown.com/gigabyte/42356-removing-ahci-option-rom.html
http://forums.tweaktown.com/gigabyte/28441-gigabyte-latest-beta-bios-2.html

Thursday 8 November 2012

Startup script for DD-WRT to get date from NTP server.

May or may not work:


while [ "`date +%Y`" == "1970" ]; do
 ntpclient uk.pool.ntp.org && \
 sleep 3 && \
 stopservice process_monitor && \
 sleep 3 && \
 startservice process_monitor;
 echo "done" >> "/tmp/ntp.example.txt" && \
 sleep 120;
done;
echo "end" >> "/tmp/ntp.example.txt"


Reference:

Monday 26 March 2012

Kippo SSH Honeypot on Ubuntu 11.04

Rough install guide:

sudo apt-get update && sudo apt-get dist-upgrade && sudo apt-get autoremove && sudo apt-get autoclean
sudo apt-get install subversion python-twisted-conch
sudo useradd -r -s /bin/false --uid 497 kippo
svn checkout http://kippo.googlecode.com/svn/trunk/ ./kippo
sudo mv kippo/ /opt/
cd /opt/kippo/
cp kippo.cfg.dist kippo.cfg
sudo chown -R kippo:kippo /opt/kippo

Upstart job:

/etc/init/kippo.conf
start on started networking

pre-start script
  iptables -N SSH_FAKE || iptables -F SSH_FAKE
  iptables -A INPUT -p tcp --dport 2222 -m state --state NEW -j SSH_FAKE
  iptables -A SSH_FAKE -m recent --name ssh_attempt --rcheck --seconds 60 --hitcount 3 -j DROP
  iptables -A SSH_FAKE -m recent --name ssh_attempt --set
end script

script
  exec start-stop-daemon -S -c kippo -d /opt/kippo -x /usr/bin/twistd -- -ny kippo.tac -l log/kippo.log
end script

post-stop script
  iptables -D INPUT -p tcp --dport 2222 -m state --state NEW -j SSH_FAKE || true
  iptables -F SSH_FAKE && iptables -X SSH_FAKE || true
end script

Monday 20 July 2009

(17:44:15) dk: boot some livecd that has ext4 support
(17:44:20) dk: extract tarball from smgl cd
(17:44:24) dk: after formatting
(17:44:29) dk: cast the things you need 
(17:44:33) dk: get a bootlaoder installed
(17:44:35) dk: reboot
(17:44:36) dk: basically
(17:44:40) kit: i've got ubuntu up on another disk at the moment so can prepare the disk i'm gonna install smgl to
(17:44:40) opi: pray
(17:44:47) dk: I didn't need much praying
(17:44:50) dk: it worked for the most part
(17:45:03) dk: I forgot to install a kernel so I had to boot back into the livecd to do that
(17:45:06) dk: heh
(17:45:23) dk: and then, since I'm running 64-bit, I had to set up a chroot within a chroot to do a 32-bit build of grub
(17:46:27) kit: well, i'll give it a shot
(17:51:52) kit: why couldn't you do a 64 bit build of grub ?
(17:52:15) dk: because it doesn't
(17:52:26) ara: you need a multilib system
(17:52:37) ara: or a chroot
(17:53:01) kit: ah ok. thanks for the tip, lol
(17:53:29) ara: dunno if there's any multilib support in sourcemage
(17:53:45) dk: not reall
(17:53:47) dk: y
nano /var/lib/sorcery/codex/test/crypto/openssl/BUILD
add OPTS="" after ./config $OPTS

Thursday 2 July 2009

Gmail removes lab feature for placing labels at the right of your email

As someone who has around 30 labels I find this very dissapointing.