OSX Camera lost

When camera cant be found anymore in OSX try this

sudo killall VDCAssistant
sudo killall AppleCameraAssistant

Posted in Uncategorized | Leave a comment

OSX not enough diskspace

For some reason timemachine (sometimes) leaves a bunch of local thin snapshots on the disk which causes an error when trying to backup for example iphone to disk (using iTunes). Last time I had about 230G of available disk space (reported by df and About This Mac -> Storage) but iTunes still crapped out with a error message saying that there’s not enough diskspace.

Fix: Open a terminal and run the following command:

tmutil thinlocalsnapshots / 999999999999999 4

Output will look something like this if any local snapshots are removed:

dennis@macscape ~> tmutil thinlocalsnapshots / 999999999999999 4
Thinned local snapshots:
com.apple.TimeMachine.2019-12-05-122627
com.apple.TimeMachine.2019-12-05-111611
com.apple.TimeMachine.2019-12-05-095814
com.apple.TimeMachine.2019-12-05-084121
com.apple.TimeMachine.2019-12-05-073237
com.apple.TimeMachine.2019-12-05-062628
com.apple.TimeMachine.2019-12-05-052302
com.apple.TimeMachine.2019-12-05-042031
com.apple.TimeMachine.2019-12-05-031749
com.apple.TimeMachine.2019-12-05-021517
com.apple.TimeMachine.2019-12-05-011122
com.apple.TimeMachine.2019-12-04-235834
com.apple.TimeMachine.2019-12-04-224844
com.apple.TimeMachine.2019-12-04-214647
com.apple.TimeMachine.2019-12-04-170631
com.apple.TimeMachine.2019-12-04-155048
com.apple.TimeMachine.2019-12-04-142104
com.apple.TimeMachine.2019-12-04-132222

Posted in Uncategorized | Leave a comment

SSH Proxy

Set up the tunnel with this command:

  • ssh -D 8080 -f -C -q -N toor@example.com

Explanation of arguments

  • -D: Tells SSH that we want a SOCKS tunnel on the specified port number (you can choose a number between 1025-65536)
  • -f: Forks the process to the background
  • -C: Compresses the data before sending it
  • -q: Uses quiet mode
  • -N: Tells SSH that no command will be sent once the tunnel is up
Posted in *nix | Leave a comment

New router

new_router

Posted in Uncategorized | Leave a comment

unattended-upgrades

$ sudo dpkg-reconfigure -plow unattended-upgrades

Posted in *nix | Leave a comment

kvm console

 

Direct terminal access via Serial Console

It is possible to access a KVM Guest directly using the Serial Console interface, in which case setting up bridged networking, SSH, and similar is not necessary. Access via the Serial Console provides an alternate way of accessing your servers to compliment or replace the default VNC access.

This is done using the virsh utility which is a shell interface for libvirt.

Define a console device for the Guest

Check whether a console device had been defined:

virsh ttyconsole my_vm

If the output is shown(e.g. /dev/pts/41), it indicates the Guest has a console device already.

Otherwise, define one with virsh edit. Here is an example to be added inside <device></device>. Refer to libvirt XML format for details.

<console type='pty'>
  <target port='0'/>
</console>

Configure a Serial Console in the Guest

First, we need to configure a serial console in the guest, in order that it will accept a connection:

If the version of your guest Ubuntu OS is 15.04 (Vivid) or later, run the following systemctl commands to enable the serial console:

systemctl enable serial-getty@ttyS0.service
systemctl start serial-getty@ttyS0.service

The following configuration method works for (guest) Ubuntu 9.10 (Karmic) until Ubuntu 14.10 (Utopic):

sudo editor /etc/init/ttyS0.conf

Add the configuration:

# ttyS0 - getty
#
# This service maintains a getty on ttyS0 from the point the system is
# started until it is shut down again.

start on stopped rc RUNLEVEL=[2345]
stop on runlevel [!2345]

respawn
exec /sbin/getty -L 115200 ttyS0 xterm

Run the following command to initiate the Serial Console (or restart the VM):

sudo start ttyS0

Here we are using “xterm” as the terminal type, which works well if we are connecting using a gnome-terminal (or xterm) instance. It is likely preferable to set this to match the terminal type which will be used to connect. This can be found using this command in the host/client terminal you will be using to connect:

echo $TERM

For example, if you are running screen it is “screen”, for byobu “screen-bce”, etc.

You can also set the variable temporarily when you are already connected to the console:

export TERM=screen

 

(source https://help.ubuntu.com/community/KVM/Access )

Posted in Uncategorized | Leave a comment

vmbuilder kvm

vmbuilder kvm ubuntu -c vmbuilder.cfg –hostname=guest –ip=193.10.5.x –ssh-user-key=/home/user/user.key –dest=/home/user/kvm/guest –tmpfs=- –part=vmbuilder.partition

$ cat vmbuilder.cfg

[DEFAULT]
tmpfs=-
hostname = stark
ip = 193.10.5.x
gw = 193.10.5.1
dns = 130.242.80.14
part = vmbuilder.partition
user = user
name = user
pass = changeme
tmpfs = suid,dev,size=1G
timezone = Europe/Stockholm
firstboot = /home/user/boot.sh
;firstlogin = /home/user/login.sh
mem = 1024
cpus = 2
bridge = br0
[ubuntu]
mirror = http://se.archive.ubuntu.com/ubuntu/
proxy = http://host.domain.se:3142
suite = precise
flavour = virtual
addpkg = openssh-server, unattended-upgrades, acpid, denyhosts

[kvm]
libvirt = qemu:///system

 

$ cat vmbuilder.partition
root 21000
swap 1000

$ cat /home/user/boot.sh
# This script will run the first time the virtual machine boots
# It is ran as root.

# Expire the user account
passwd -e user

# Regenerate ssh keys
# rm /etc/ssh/ssh_host*key*
# dpkg-reconfigure -fnoninteractive -pcritical openssh-server

$ cat login.sh
# This script is ran the first time a user logs in

echo “This is a domain.se vm template server.”
echo “In order to do it, we’ll need to ask you a few questions,”
echo “starting by setting you keyboard and other console informations.”
# give the opportunity to change the keyboard
# sudo dpkg-reconfigure console-setup

 

Posted in *nix | Leave a comment

ZFS

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:zfs-native/
sudo apt-get update
sudo apt-get install ubuntu-zfs

modprobe zfs

dmesg |grep ZFS

Posted in *nix | Leave a comment

Find new files

How to find new files in current folder this case last 7 days and print it in a nice format

find . -type f -ctime -7 -printf “%Tx %TH:%TM %f\n” | sort

 

Posted in Uncategorized | Leave a comment

Good news

Good news everyone!

Posted in Uncategorized | Tagged | Leave a comment