Search This Blog

Saturday 29 December 2012

Ubuntu fix - an epic

Much as in the "for the want of a nail the battle was lost", with its escalating list of consequences emanating from a minor incident, I decided earlier this week to resolve an issue I'd been experiencing with my Ubuntu server. It turned into a major undertaking.

The issue made itself apparent on (infrequent) reboots, where disk checks would typically advise that the home folder had errors and mount was difficult.

Unlike Windows (not something I thought I would find myself saying), disk checks - fsck - cannot be run when drives are mounted.

That means booting from USB or disk.

My server was not built with an optical drive - I didn't think I'd need one. As it turns out, when my son's Dell finally gave up the ghost, I salvaged its DVD writer and that is now in the caddy.

Problem 1 : There are two SATA data connections on my motherboard. Both of these are taken by existing HDDs. So I cannot connect the DVD drive.

Potential solution 1 : Run from USB. So I downloaded the image (on my Mac) and then followed the instructions to make a bootable USB stick - http://www.ubuntu.com/download/help/create-a-usb-stick-on-ubuntu

Put the USB in, booted. Didn't work.

Potential solution 2 : Copy the image (as downloaded) onto the USB, copy THAT on to the Ubuntu machine and use Start up Disk Creator. Also didn't work.

Potential (and actual) solution 3 : Attach an external disk drive to Ubuntu machine and use that. Using the image I'd already downloaded, I made a boot disk of Ubuntu 12.10 (machine is currently running 12.04). Boot up, hitting F11 to get to boot menu. Choose the optical drive to boot from.

This takes me into the Ubuntu start up disk. Boy is it slow.

Intention at this stage is still to run fsck and avoid the need for a reinstall. So through the drives I go, running fsck on them.

But that doesn't fix the errors. I get new and interesting messages. I search for solutions. I struggle....

Problem 2 : Can't fix the errors

Potential solution 4 : Reinstall.

There are, of course, numerous options when reinstalling. My data is backed up, so easiest is a clean reinstall.

That means a bit of disk partitioning first, as I want to have a separate swap partition and one for /home (concept being that in future I just update the system files). I also have to select a boot installer. I misunderstand this and choose the overall drive, NOT the part where the files reside.

So of course once the install has happened (which takes a LONG time), when I attempt to boot I get error messages from GRUB : Error 15 file not found

Well that shouldn't be too difficult to fix, should it? All I need to do is reboot, get into the GRUB menu and choose the right option.

Nope. This is Grub 2. It doesn't use ESC to skip out to menu. It uses Shift. Except it doesn't. I try both shift buttons, holding them down, pressing repeatedly. No joy.

Fair enough, I'll boot again using install disk, drop to Terminal and make the necessary edits.

So now I wait another eternity for disk boot to start. Then, due to the horrible Unity interface, Terminal is not immediately present as an option. So now the delight of Dashboard and its responsiveness of a glacier.

Into Terminal I go, and then start trying to take on board the logic I can see in numerous posts about Grub 2 and this error, all of which say something slightly different. None work for me.

Potential (and actual) solution 5 : reinstall again, but this time get the boot installer properly specified

Problem 3 : It boots - hooray! But.... it's STILL as slow as hell. This suggests the problems with speed were not related to the optical drive being external, but possibly due to 12.10 itself (and I have seen some posts to that effect)

Potential (and actual) solution 6 : install an earlier version.

I had an earlier disk of 11.04, so decided to start from this point and then update online.

This time, at least, I was aware of the options regarding bootloader. However, despite my best efforts, the installer seemed really keen to install on my 1TB internal drive, which is purely data, rather than my 120GB drive.

Aha, I'll get round that by physically disconnecting those drives and then adding them after and changing mount points if necessary.

We now actually reach a solution! (well, partial). The install worked, boot was speedy and all worked.

Next step - lots of updates, and a system upgrade to 11.10.

End of the story? Nowhere near.

Firstly, I needed to re-attach the drives and mount them. This meant editing my fstab also. Fortunately I'd backed up my old fstab, so could base on this.

The 1TB drive mounted and worked fine with fstab. My "other" 120GB drive (which houses videos), wants to be the same as my "home" and filesystem 120GB drive. I've not yet solved this issue.

There was then the matter of ensuring aspects of my previous install that worked well for me were also in place on my fresh install. And that I removed unnecessary items.

Unnecessary was pretty straightforward as this could all be done via Synaptic. Amongst others I removed Evolution and Thunderbird - I'm running the server for firewall management and for data storage, so much of the superfluous can go.

(Incidentally, I also discovered that "Installed (Residual Config)" applications can all be removed in Synaptic! Didn't realise this before)

As for adding apps, this meant:

  • Bleachbit
  • Calibre
  • GTKOrphan
  • StartUp-manager
  • Locale
  • Gparted

Next step, run Localepurge to clear unnecessary files, then Bleachbit and GTKOrphan to clear other files no longer needed.

See also http://ubuntuforums.org/showthread.php?t=1560872 and http://ubuntuforums.org/showthread.php?t=140920&highlight=deborphan

Then, as I'd saved my previous bash_history, copy this over to my new install so I can refer back to useful previous info.

I'd stated previously that I use the server for firewall management. Fortunately, I'd copied my three sets of iptables rules, so was able to restore them.

Which left backup usage. Connecting via Samba from my Mac was my previous method of access.

Samba is not installed at outset on Ubuntu, so had to install it. But there is Samba4 and Samba.

This may have caused me the problems I next experienced:

Problem 4 : Samba sharing not working

Samba installed and then smb.conf amended. Now, I hadn't made notes of how I'd done this before (nor, sadly, had I copied the config), but I can't remember it being as involved as this.

Essentially, any attempt at starting, restarting or stopping smbd was just not working ("restart: Unknown instance:")

Potential solution (and actual) 7 : completely remove Samba (all / any versions) and then reinstall.

This time I avoided the Samba 4 complications, and now

sudo restart smbd

and

sudo restart nmbd worked

Problem 5 : Back to the Mac, CTRL-K and choose server name. "The server cannot be found"

Potential (and actual) solution 8 : The Mac is looking for a static IP address. I have not yet assigned a static IP to the server. This I now do.

Problem 6 : The Mac is looking for a static IP address that now exists, but still no joy with Samba.

Potential solution 9 : Let's try and see if ssh works instead!

Problem 7 : ssh not installed by default

Potential (and actual) solution 10 : install ssh, and then $ sudo service ssh start.

Problem 8 : Host key verification fails!

Potential (and actual) solution 11 : http://stackoverflow.com/questions/4161548/how-to-establish-ssh-key-pair-when-host-key-verification-failed - ssh-keygen -R hostname

This deletes the offending key from the known_hosts

It works! I am connected on the network. So why not Samba?

Potential (and actual) solution 12 : Reference to https://help.ubuntu.com/12.04/serverguide/samba-fileserver.html finally got Samba working for me - and an rsync worked perfectly for me.

TODO:

  1. Issues with mounting the two 120GB drives
  2. Purchase and install a SATA PCI card to allow use of the optical drive
  3. Map the Ubuntu drives on Mac - http://osxdaily.com/2010/09/20/map-a-network-drive-on-a-mac/
  4. Amend smb.conf to remove duplication of home directories


LESSONS LEARNED:

  1. Backup MANY more of the config files
  2. Keep a full list (regularly updated) of the installed applications
  3. Keep a more recent set of install discs


Thursday 27 December 2012

Time Machine to the rescue

I'd bought my MacBook Pro less than 10 months ago, but had noticed that performance was incredibly slow. Waking the machine could easily involve applications being sluggish for a good 20 minutes or so, Chrome was forever giving me "Kill page" messages, and if I did take the option to reboot, I could be looking at least half an hour.

I'd read various articles which had not provided the answer, and had been initially reluctant to upgrade memory (as I had with my previous Mac) as it seemed much more inaccessible.

However, on re-checking this option, it looked less onerous, and that memory modules were reached merely by unscrewing the base of the machine. So that I did, armed with two 8GB RAM modules to replace my measly 2GB variants.

One minor issue - the module needs to be pushed in then angled down into its final position. The first module is a bit fiddly in this regard, and in the process I partially broke one of the spongy retainers.

Anyway, machine reassembled, time to boot.

And boot just hung and hung. I left it at 40 minutes and thought this was going to never happen.

So into Recovery mode, with Time Machine attached, and attempt a TM restore. About two hours later, it was complete.

Some adjustments were required - Mail had to be re-synced with the data files, and Super Duper needed an amend (as did Google Drive), but since then the difference has been marked. How much of this is down to the memory, and how much down to a reinstalled system, I don't know!

Monday 11 June 2012

Transmitting Sky signal via RF2

Other TVs in the house were getting a very noisy picture, whether due to too strong a signal or too weak I'm not sure.

It also turns out that accessing the setup menu has changed now. It's Services, then 0 0 1 and select.

I changed to the default (Ch68 and powered on). Still not a great picture on other TVs, but better than it was

Friday 3 February 2012

Guidance on how to check for Power PC applications

Apps > Utilities > System Information

Choose applications from menu, then sort by kind

New Macbook Pro - and implications

I'd previously made some updates to my MBP bought in 2007 - new hard drive, extra RAM, replacement fan (necessary due to the hideous noise it was making). But it was beginning to feel its age.

Combine this with eldest son's PC having what appears to be motherboard problems (http://www.tech-forums.net/pc/f77/dell-desktop-wont-power-up-blinking-orange-light-power-supply-162691/), and his incessant demands for a replacement, I thought laterally - here's an opportunity for me to get a new Mac, give my old one on, and avoid the sunk cost of £300 or more if I bought him a laptop or netbook now.

So that's exactly what I did. This is what I ordered - http://www.amazon.co.uk/Apple-MacBook-Laptop-Quad-Core-Graphics/dp/B006009L5Y/ref=pd_cp_computers_0 - ordered on Friday, arrived Monday - very good!

This Mac comes with Lion installed, which is new to me, particularly the trackpad directions - the exact opposite to my older Snow Leopard Mac.

I set up Migration Assistant via ethernet connection, and a mere 20 odd hours later everything had transferred.

Things I need(ed) to address:

1. IP addresses. I use static IPs and control via iptables on my Ubuntu server
2. Remove Power PC applications
3. Set up DNS servers (initially no access to internet via Ethernet as these weren't set!)
4. Check mappings to server drives
5. Set up Time Machine
6. Set up Crash Plan

I also took the opportunity to port forward Webmin on the server via my router so I can access remotely.

Still to do:

1. Data transfer from Dell PC to my old Mac for son's data
2. Check iTunes Applescripts work OK

Tuesday 3 January 2012

Encrypted zip files in Mac OS

Enter the command below in the format specified.

zip -e myzipfile.zip file1.txt file2.txt

You will be prompted to type in a password, this is the password used to protect the zip file.

To do this action on a folder

zip -e myzipfile.zip /users//desktop/myfolder/* 


You can also specify where to place the zipfile using the same syntax as you would to specify where the files are. 


zip -e /users//Desktop/myzipfile.zip /users//Documents/file1.txt /users//Desktop/file2.txt