Showing posts with label lucid. Show all posts
Showing posts with label lucid. Show all posts

Tuesday, July 27, 2010

Grub_puts not found

Two of our Ubuntu 10.4 Lucid workstations ran into Grub2 errors today. Something must have gone wrong with the grub2 apt scripts while they were updating to the latest kernel. Both of the machines with the problem were created from the same Clonezilla image but a few of the other cloned machines weren't affected.

After running the apt-get dist-upgrade command and rebooting, my users encountered the "fix symbol 'grub_puts' not found" error.

Instructions

Burn the Ubuntu desktop ISO to CDROM or use the System > Administrator > Startup Disk Creator to create a bootable USB stick.

Boot from your live disk.

Open a terminal and get a list of the available partitions.

sudo fdisk -l

You should see results that look something like this:

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000e0719

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          32      248832   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              32        9730    77899777    5  Extended
/dev/sda5              32        9730    77899776   83  Linux

Disk /dev/sdb: 8053 MB, 8053063680 bytes
255 heads, 63 sectors/track, 979 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00009233

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1         255     2048256    b  W95 FAT32
/dev/sdb2             256         979     5815530    b  W95 FAT32

In my example above, you can see the system drive is listed as /dev/sda and the bootable USB is /dev/sdb. You may, like me, have a separate /boot partition because you are running encrypted LVM volumes. In that case you need to pay attention to which is your root volume.

Mount your "root" partition or volume first. Standard Linux partitions are simple.

sudo mount /dev/sda1 /mnt

An encrypted LVM is a little more complicated. The Ubuntu Live CD doesn't have the LVM crypto packages installed so run these commands to get it working.

sudo apt-get install lvm2 cryptsetup

Load the dm-crypt module.

sudo modprobe dm-crypte

Now unlock your encrypted volume. Enter your LUKS passphrase when prompted.

sudo cryptsetup luksOpen /dev/sda2 foo

Load the LVM Kernel module.

sudo modprobe dm-mod

Scan for all of the available volume groups.

sudo vgscan

Active the volume group.

sudo vgchange -a

Now list the logical volumes along with their /dev paths. In the example below, note that my laptop is named "falcon" and yours is most likely something else.

sudo lvscan
  ACTIVE            '/dev/falcon/root' [71.22 GiB] inherit
  ACTIVE            '/dev/falcon/swap_1' [3.07 GiB] inherit

Now mount the root volume to /mnt. Replace falcon to match your own results of the previous command.

sudo mount /dev/falcon/root /mnt

Chroot Prep

Now mount the /dev, /proc, /sys folders for os-prober and grub to work properly in a chrooted jail.

sudo mount --bind /dev /mnt/dev
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys

If you had separate /boot partition because of LVM then mount it now.

sudo mount /dev/sda1 /mnt/boot

Now chroot yourself.

sudo chroot /mnt

Repair Grub2

Run the grub-mkconfig command to generate a new grub2 configuration file. This might be what got corrupted and left in this lurch.

grub-mkconfig -o /boot/grub/grub.cfg

Make sure no errors were generated. Then install grub2 in the hard drive MBR.

grub-install /dev/sda

Again make sure didn't get any errors. If you want a warm and fuzzy test your repair with the recheck option.

grub-install --recheck /dev/sda

Exit out of chroot with an exit or Crt+D command.

Unmount the directories.

sudo umount /mnt/dev
sudo umount /mnt

Now reboot and you should have your system back.

Monday, May 3, 2010

Create Cisco VPN on Ubuntu Karmic/Lucid

It is very easy to setup a Cisco VPN on Ubuntu. I used the following instructions to get my corporate tunnels running. This tutorial assumes you have already acquired a .pcf file from your network IT staff.

Instructions

Install the vpnc package and any required dependencies:
sudo apt-get install vpnc

Open your vpn pcf configuration file with your favorite text editor.
vim corporatenet.pcf

It will looking something like this:
[main]
Description=
Host=vpn.corpnet.com
AuthType=1
GroupName=CorpNet
GroupPwd=enc_GroupPwd=C555E3A4BE82FF0001601A38260A92D93FF5693A482367E117EF8697CBED681C5FDD7F2AE0DEEA4B37DBBB21434189A46D8955F11916040A
EnableISPConnect=0
ISPConnectType=0
ISPConnect=
ISPPhonebook=
ISPCommand=
Username=
SaveUserPassword=0
UserPassword=
enc_UserPassword=
NTDomain=
EnableBackup=0
BackupServer=
EnableMSLogon=1
MSLogonType=0
EnableNat=1
TunnelingMode=0
TcpTunnelingPort=10000
CertStore=0
CertName=
CertPath=
CertSubjectName=
CertSerialHash=00000000000000000000000000000000
SendCertChain=0
PeerTimeout=90
EnableLocalLAN=0

Note the values for Host, GroupName and enc_GroupPwd. You'll need these to create your vpnc configuration file.

sudo vim /etc/vpnc/corpnet.conf

Make your configuration file look like this. Just make sure to change the fictional CorpNet values with your own.

IPSec gateway vpn.corpnet.com
IPSec ID CorpNet
IPSec obfuscated secret C555E3A4BE82FF0001601A38260A92D93FF5693A482367E117EF8697CBED681C5FDD7F2AE0DEEA4B37DBBB21434189A46D8955F11916040A
Xauth username YOURUSERNAME
Xauth password YOURPASSWORD

It's important to note the obfuscated option in the group password. Most of the examples and howtos I've seen on the Net leave this out because they were written several years ago before VPNC supported Cisco encrypted passwords. The older guides required you to de-crypt the Cisco string. This isn't necessary anymore with Karmic and Lucid releases.