Hibernate
March 31, 2012 — 17:50

Author: silver  Category: linux  Comments: 0

2015

https://01.org/blogs/rzhang/2015/best-practice-debug-linux-suspend/hibernate-issues

Test:

echo disk > /sys/power/state
grep PM: /var/log/dmesg

Disk Encryption and hibernate

Verify resume device:

/etc/default/grub:
GRUB_CMDLINE_LINUX="resume=/dev/mapper/cryptswap1

update-grub

/etc/initramfs-tools/conf.d/resume:
RESUME=/dev/mapper/cryptswap1

sudo update-initramfs -u -k all

If it’s still not working try testing without encrypted swap (/dev/disk/by-label/swap).

2012

Hibernate under Ubuntu often doesn’t work or stops working after a dist upgrade.

There’s several method’s to hibernate (and suspend): uswsup, tuxonince etc – we won’t be using any of those here.

Steps to fix hibernate

  1. Check logs /var/log/pm-powersave.log (and /var/log/pm-suspend.log)
  2. Check if you have enough swap
  3. Try removing all connected usb devices first before hibernating (my XBOX 360 Wireless receiver stops hibernate from working, see script below)
  4. System is hibernating but not resuming? Check /etc/initramfs-tools/conf.d/resume (and do a update-initramfs -k all -u)
  5. Still not working? sudo apt-get remove hibernate uswsusp (just to be sure)
  6. More info: http://chriseiffel.com/everything-linux/step-by-step-how-to-get-hibernate-working-for-linux-ubuntu-11-04-mint-11/

This script disables all usb controllers using UHCI on hibernate and enables them on resume.

/etc/pm/sleep.d/20_custom-ehci_hcd


Wipe SSD/HDD
March 19, 2012 — 12:27

Author: silver  Category: linux other windows  Comments: 0

Linux:

First check the drive (see if erase operations are supported):

# hdparm -I /dev/X 
# hdparm --user-master u --security-set-pass Password /dev/X
# time hdparm --user-master u --security-erase Password /dev/X

or (if supported):

# time hdparm --user-master u --security-erase-enhanched Passwrd /dev/X

Works also for HDD’s.

More info:
https://ata.wiki.kernel.org/articles/a/t/a/ATA_Secure_Erase_936d.html
https://www.thomas-krenn.com/en/wiki/SSD_Secure_Erase

Alternatively boot into Parted Magic and use GUI.

Windows/DOS:

http://cmrr.ucsd.edu/people/Hughes/SecureErase.shtml

Conky System Monitor
March 17, 2012 — 21:32

Author: silver  Category: linux  Comments: 0

Conky System Monitor

# apt-get install conky

/etc/gnome/conky.sh

#!/bin/sh
(sleep 10 && conky) &
# chmod +x /etc/gnome/conky.sh

Add to System > Preferences > Startup Applications (GNOME):

Name: Conky
Command: /etc/gnome/conky.sh
Comment: Conky System Monitor

/etc/conky/conky.cfg

# Conky, a system monitor, based on torsmo
#
# Any original torsmo code is licensed under the BSD license
#
# All code written since the fork of torsmo is licensed under the GPL
#
# Please see COPYING for details
#
# Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
# Copyright (c) 2005-2010 Brenden Matthews, Philip Kovacs, et. al. (see AUTHORS)
# All rights reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see .
#

#alignment top_right
alignment middle_right
#background yes
background no
border_width 1
cpu_avg_samples 2
default_color white
default_outline_color white
default_shade_color white
draw_borders no
draw_fgraph_borders yes
draw_outline no
draw_shades no
use_xft yes
#xftfont DejaVu Sans Mono:size=12
xftfont DejaVu Sans Mono:size=8
gap_x 5
gap_y 60
minimum_size 5 5
net_avg_samples 2
no_buffers yes
out_to_console no
out_to_stderr no
extra_newline no
own_window yes
own_window_class Conky
#own_window_type desktop
#own_window_type normal
#own_window_type root
own_window_type override
stippled_borders 0
update_interval 1.0
uppercase no
double_buffer yes
use_spacer none
show_graph_scale no
show_graph_range no

TEXT
#${scroll 16 $nodename - $sysname $kernel on $machine | }
${color white}$nodename $sysname $machine
${color white}$kernel
${color grey}Uptime:$color $uptime
$hr
${color grey}Available RAM:${color white} $memmax
${color grey}RAM Usage:$color $mem/$memmax - $memperc% ${membar 3}
${color grey}Swap Usage:$color $swap/$swapmax - $swapperc% ${swapbar 3}
$hr
#${color grey}Frequency (in MHz):$color $freq
#${color grey}Frequency (in GHz):$color $freq_g
#${cpugraph 000000 597DB2}
${color grey}CPU History:  ${color white}${cpugraph 20,0 0000ff 00ff00}
#Core 1: ${freq 1} MHz Temprature: $color ${exec sensors|grep ‘Core0′|awk ‘{print $3}’}
1: ${freq 1} MHz ${cpu cpu1}% ${color lightgrey}${cpubar 3 cpu1}$color
#Core 2: ${freq 2} MHz Temprature: $color ${exec sensors|grep ‘Core1′|awk ‘{print $3}’}
2: ${freq 2} MHz ${cpu cpu2}% ${color lightgrey}${cpubar 3 cpu2}$color
#Core 3: ${freq 3} MHz Temprature: $color ${exec sensors|grep ‘Core2′|awk ‘{print $3}’}
3: ${freq 3} MHz ${cpu cpu3}% ${color lightgrey}${cpubar 3 cpu3}$color
#Core 4: ${freq 4} MHz Temprature: $color ${exec sensors|grep ‘Core3′|awk ‘{print $3}’}
4: ${freq 4} MHz ${cpu cpu4}% ${color lightgrey}${cpubar 3 cpu4}$color
#${color grey}CPU Usage:$color $cpu% ${cpubar 3}
$hr
${color grey}Processes:$color $processes  ${color grey}Running:$color $running_processes
#${color grey}Name              PID   CPU%   MEM%
#${color lightgrey} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}
#${color lightgrey} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}
#${color lightgrey} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}
#${color lightgrey} ${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4}
$alignc${color}(top 5 sorted by CPU usage)
${color grey} NAME              PID    CPU%   MEM%
${color lightgrey} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}
${color lightgrey} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}
${color lightgrey} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}
${color lightgrey} ${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4}
${color lightgrey} ${top name 5} ${top pid 5} ${top cpu 5} ${top mem 5}
$alignc${color}(top 5 sorted by MEM usage)
#${color grey} NAME              PID    CPU%   MEM%
${color lightgrey} ${top_mem name 1} ${top_mem pid 1} ${top_mem cpu 1} ${top_mem mem 1}
${color lightgrey} ${top_mem name 2} ${top_mem pid 2} ${top_mem cpu 2} ${top_mem mem 2}
${color lightgrey} ${top_mem name 3} ${top_mem pid 3} ${top_mem cpu 3} ${top_mem mem 3}
${color lightgrey} ${top_mem name 4} ${top_mem pid 4} ${top_mem cpu 4} ${top_mem mem 4}
${color lightgrey} ${top_mem name 5} ${top_mem pid 5} ${top_mem cpu 5} ${top_mem mem 5}
$hr
${color grey}File systems:
 / $color${fs_free /}/${fs_size /} ${fs_bar 3 /}
 sdb1 $color${fs_free /windows/sdb1}/${fs_size /windows/sdb1} ${fs_bar 3 /windows/sdb1}
 sdg1 $color${fs_free /windows/sdg1}/${fs_size /windows/sdg1} ${fs_bar 3 /windows/sdg1}
$hr
${color grey}Networking:
Down: $color${downspeed eth0} k/s Up: ${upspeed eth0} k/s
${downspeedgraph eth0 10,110 000000 ff0000} ${upspeedgraph eth0 10,110 000000 00ff00}$color
${color grey}Total: ${totaldown eth0} Total: ${totalup eth0}
#${color grey}Logging ${hr 2}$color
#$hr
#${color white}${execi 30 tail -n3 /var/log/messages | fold -w30}$color
Quickly enable/disable screensaver
March 17, 2012 — 14:15

Author: silver  Category: windows  Comments: 0
Windows 7 Backup and TrueCrypt
March 13, 2012 — 21:35

Author: silver  Category: encryption windows  Comments: 0

Can’t use TrueCrypted drive directly in Win7 Backup, but have to use windows share… this means no image backups :(

TrueCrypt doesn’t support Volume Shadow Copy

Alternative: BitLocker or http://en.wikipedia.org/wiki/Comparison_of_disk_encryption_software

Update 25-01-2017:

Unfortunately the same seems to be true for VeraCrypt (and Windows 10). If a volume is mounted in VeraCrypt and you try to create a system image it’s not possible to select where to save the backup (error 0x80070001). The VeraCrypt documentation lists the following limitation:

The Windows Volume Shadow Copy Service is currently supported only for partitions within the key scope of system encryption (e.g. a system partition encrypted by VeraCrypt, or a non- system partition located on a system drive encrypted by VeraCrypt, mounted when the encrypted operating system is running). Note: For other types of volumes, the Volume Shadow Copy Service is not supported because the documentation for the necessary API is not available.

( https://veracrypt.codeplex.com/wikipage?title=Issues%20and%20Limitations )

WordPress without ftp/sftp/ssh
March 13, 2012 — 21:31

Author: silver  Category: web  Comments: 0

wp-config.php

define('FS_METHOD', 'direct');
Enable AHCI on ASUS P5 EPU/SE
March 13, 2012 — 21:27

Author: silver  Category: other windows  Comments: 0

Enable AHCI on a ASUS P5 EPU/SE motherboard

Modified BIOS ROM: http://www.bios-mods.com/forum/Thread-AHCI-enable-on-ASUS-P5K-SE-EPU-and-option-ROM-update

(or crossflash never P5K ROM instead)

Windows XP: http://forums.pcper.com/showthread.php?t=444831

Windows 7: http://www.windows7news.com/2010/05/25/how-to-enable-ahci-in-windows-7/

Fix a broken Symantec SEP install
March 13, 2012 — 21:23

Author: silver  Category: windows  Comments: 0

Fix a broken Symantec Endpoint Protection SBE install

Disable/remove services

Remove teefer driver (firewall):

C:\>pnputil -e
C:\>pnputil -f -d oem<#>.inf

Remove registry entries

Remove files

 

More info: http://www.symantec.com/business/support/index?page=content&id=TECH93532&locale=en_US

eCryptfs
March 12, 2012 — 16:50

Author: silver  Category: encryption linux  Comments: 0

Mount manually:

mount -t ecryptfs /home/username/.Private /home/username/Private

Change user password:

# ecryptfs-rewrap-passphrase /home/.ecryptfs/$USER/.ecryptfs/wrapped-passphrase

Recover without login password (needs mount passphrase):

# sudo ecryptfs-add-passphrase --fnek

[Enter mount passphrase]

Inserted auth tok with sig [9986ad986f986af7] into the user session keyring
Inserted auth tok with sig [76a9f69af69a86fa] into the user session keyring

# sudo mount -t ecryptfs /home/username/.Private /home/username/Private

Enter aes, 16, Enable: plaintext passthrough: no, Enable filename encryption: yes
Enter fnek signature (76a9f69af69a86fa)

(auth tok signatures will match /home/.ecryptfs/username/.ecryptfs/Private.sig)

Restore from backup:

Mount backup image file under /mnt/img (or restore your homedir files some other way)

mkdir/mnt/img
mount backup.img /mnt/img

Prepare ecryptfs backup:

rm /mnt/img/home/username/.Private
sudo ln -s /mnt/img/home/.ecryptfs/username/.Private /mnt/img/home/username/.Private

Then use the following script by “Ian D. Allen” from ubuntuforums.org:
ecryptfs-mount-backup


Mount the backup under /mnt/tmp

sudo su -
mkdir /mnt/tmp
USER=username; ./ecryptfs-mount-backup /mnt/img/home/username /mnt/tmp