View files within fog image

Recently I moved from Win 8.1 to W10. Unfortunately I forgot to save my office product key…..Happily I had an fog image of this machine.
Question, can one restore the files inside this container without using fog? (which restores it back to the original device)
YES you can.
First decompress the “fog” file and write it to a file in raw file:

# apt-get install partclone pigz
# cat d1p2.img | pigz -d -c | partclone.ntfs -C -r -s -O foo.img –restore_raw_file

  • d1p2.img = the original image
  • pigz = to decompress the image
  • partclone.ntfs = to restore the image to a ntfs partition type

Partclone v0.2.73 http://partclone.org
Starting to restore image (-) to device (foo.img)
Calculating bitmap… Please wait… done!
File system: NTFS
Device size: 109.2 GB = 26655231 Blocks
Space in use: 48.6 GB = 11859567 Blocks
Free Space: 60.6 GB = 14795664 Blocks
Block size: 4096 Byte
Elapsed: 00:00:04, Remaining: 00:09:40, Completed: 0.68%, 4.99GB/min,
current block: 90541, total block: 26655231, Complete: 0.34%
….
Complete 100%

Then mount foo.img with OSFmount
N
ext use the productkey viewer from Nirsoft to open the SOFTWARE registry hive.
(Note: The Nirsoft tool needs to be started with Admin rights)

Debian Jessie upgrade breaks Thunderbird connection to courier-imap-ssl

After upgrading of my e-mailbox running courier-imap-ssl, I discovered that connecting with Thunderbird just failed.

In /var/log/syslog:

imapd-ssl: couriertls: accept: error:14094417:SSL routines:SSL3_READ_BYTES:sslv3 alert illegal parameter

In Thunderbird, pressing CTRL+SHIFT+J shows the Thunderbird error console. It showed me information that something was wrong with some DH-parameter.

Following: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=787579, I generated a new keyfile using:

# export DH_BITS=2048 && mkdhparams

After generating a new “/etc/courier/dhparams.pem” and restarting courier-ssl by executing: /etc/init.d/courier-imap-ssl restart, I still could not connect with Thunderbird…

Then I discovered that in: /etc/courier/imapd-ssl, the parameter TLS_DHPARAMS could be set. I suspected that the pem-file for some reason could not be found by courier-imap-ssl. A bit strange of course, because it had never been a problem, until now.

So I added:

TLS_DHPARAMS=/etc/courier/dhparams.pem

After restarting courier-imap-ssl once again I discovered that this addition indeed solved my problem.

For future convenience I changed the BITS value in /usr/sbin/mkdhparams

from
BITS=768
to
BITS=2048

automatic security upgrade

Its purpose is to keep the computer current with the latest security (and other) updates automatically. If you plan to use it, you should have some means to monitor your systems, such as installing the apt-listchanges package and configuring it to send you emails about updates. And there is always /var/log/dpkg.log, or the files in /var/log/unattended-upgrades

To install these packages, run the following command as root:

apt-get install unattended-upgrades apt-listchanges

To activate unattended-upgrades, you need to ensure that the apt configuration stub /etc/apt/apt.conf.d/50auto-upgrades contains at least the following lines: 

APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";

This file can be created manually or by running the following command as root:

dpkg-reconfigure -plow unattended-upgrades

source: https://wiki.debian.org/UnattendedUpgrades

messed up locales

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_CTYPE = “UTF-8”,
LANG = “en_US.UTF-8”
are supported and installed on your system.

Solution:

sudo dpkg-reconfigure locales

Choose: en_US.UTF-8
Then put:

LC_ALL=en_US.UTF-8

in /etc/environment

Log off and log on again

Check and repair mysql database tables with myisamchk (and mysqlcheck)

Useful after systemcrash:

When Mysql is not running:

 myisamchk –silent –force –fast –update-state /var/lib/mysql/bugs/*.MYI

myisamchk –safe-recover –force –sort_buffer_size=2G –key_buffer_size=2G /var/lib/mysql/*/*.MYI

-s, –silent option: Prints only errors. You can use two -s to make myisamchk very silent.
-f, –force option: Restart myisamchk automatically with repair option -r, if there are any errors in the table.
-F, –fast option: Check only tables that haven’t been closed properly.
-U –update-state option: Marks tables as crashed, when it finds any error.

When Mysql is running (which is kind of slow)

mysqlcheck –repair –all-databases

 

 

 

3ware Raid Controller Switch of autoverify

To switch of the autoverify feature on a 3ware controller which can be a real performance killer do the following:

From the console, enter the 3ware cli and first check the current status

tw_cli /c0/u0 show autoverify

/c0/u0 Auto Verify Policy = on

As you can see the autoverify feature is on Auto Verify Policy = on. If your raid controller is also c0 and you unit is u0 you may use the following command. Please check this first with the command:

tw_cli /c0 show

Do not just copy and paste. If c0 doesn’t work try a higher number it depends on which pci slot your controller is in.

tw_cli /c0/u0 set autoverify=off

Setting Auto-Verify Policy on /c0/u0 to [off] … Done.

Check the autoverify settings:

tw_cli /c0/u0 show autoverify

/c0/u0 Auto Verify Policy = off

That’s it no more autoverify. Please make sure to check you raid status regularly to detect problems.

Windows bootloader damaged?

Using dualboot after the re-install of Debian Microsoft Vista could not be loaded anymore. It left me with a black screen stating that: c:\Windows\system32\winloader could not be found.

– For this I used a vista 64 installcd. (use x86 version if applicable) booted into recovery-mode which did not help me very much. At least it gave me terminal, which was all I needed. After reading through Microsoft technet I found a possible solution for this:
– From the prompt I entered the following command to check the BCD-file:
C:\Windows\System32\bcdedit /store c:BootBCD /enum
(It found my Vista install on C:)

It showed that something had corrupted the BCD-file setting some parameters to “unknown”
After entering these commands it worked again:

c:\Windows\System32\bcdedit /store c:BootBCD /set {bootmgr} device boot
The operation completed successfully.

c:\Windows\System32\bcdedit /store c:BootBCD /set {default} device boot
The operation completed successfully.

c:\windows\system32\bcdedit /store c:BootBCD /set {default} osdevice boot
The operation completed successfully.

Check with:
C:Windows\System32\bcdedit /store c:BootBCD /enum

Reboot!

source: http://technet.microsoft.com/en-us/library/cc709667%28v=ws.10%29.aspx

Debian booting from GPT disk using grub2

Booting debian Linux on GPT disk
I tried to boot from newly installed 6 TB raidvolume. It showed me the grub2 prompt.
No big deal. I used some grub-commands to boot into the system and executed update-grub. Still after a reboot even a grub-rescue prompt appeared.
After booting into the system using grub-commands I ran: grub-install, which showed me this error:

/usr/sbin/grub-setup: warn: This GPT partition label has no BIOS Boot Partition; embedding won’t be possible!.
/usr/sbin/grub-setup: warn: Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blocklists are UNRELIABLE and their use is discouraged..
/usr/sbin/grub-setup: error: if you really want blocklists, use –force.

Using parted I created a small partition (100 MB) at the end of the raid-volume, in my case partition 3. After this I executed in parted the command: set 3 bios_grub on. This enables the partition as a BIOS Boot partition.

Finally grub-install reported no errors. After rebooting the grub boot menu appeared again.

Howto install Tweepy for python3.2 using debian Wheezy

Setuptools itself doesn’t work on Python 3.X. But you can use Distribute, a fork and a drop in replacement for setuptools in python3

curl -O http://python-distribute.org/distribute_setup.py
sudo python3.2 distribute_setup.py
sudo python3.2 setup.py install

First I used tweepy from: https://code.google.com/p/tweepy/downloads/detail?name=tweepy-1.4-py3.tar.gz

Continue reading