Import and rename duplicated volume group

If you like to use a cloned volume with a volume group on it, then normally you will have a problem with the VG UUID and the VG Name. The good answer there is a nice solution for the problem and you can import and rename duplicated volume groups.

To rename and generate a new UUID for the volume group on the volume use the program vgimportclone.

sudo gimportclone -n old /dev/sdb1
WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it!
WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it!
WARNING: Activation disabled. No device-mapper interaction will be attempted.
WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it!
Physical volume "/tmp/snap.cozRdFdC/vgimport0" changed
1 physical volume changed / 0 physical volumes not changed
WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it!
WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it!
WARNING: Activation disabled. No device-mapper interaction will be attempted.
WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it!
Volume group "system" successfully changed
WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it!
WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it!
Volume group "system" successfully renamed to "old"
Reading all physical volumes. This may take a while...
Found volume group "system" using metadata type lvm2

After the successfully rename of the volume group activate it.

sudo vgchange -a y

Now you can use the renamed volume group old normally as other volume groups.

xfs filesystem duplicate UUID

If you clone a volume with xfs filesystem on it and you try to mount this on the same node, than normally you will receive error messages, like wrong fs type, bas superblock,… you have the problem with xfs filesystem duplicate UUID.

In the dmesg you should file a message like:

XFS: Filesystem sdb1 has duplicate UUID - can't mount.

If its a one time mount you can do it with:

sudo mount -o nouuid /dev/sdb1 /mnt

But the better solution is to generate a new uuid for the filesystem, because its clean and you can mount it easy without problems:

sudo xfs_admin -U generate /dev/sdb1
Clearing log and setting UUID
writing all SBs
new UUID = 01fbb4f2-1ers0-4dde-94fc-024efb3cd2a4
after that, you can mount this XFS partition regularly.

Then mount the volume normally with mount:

sudo mount /dev/sdb1 /mnt

sudo with Touch ID on macOS

Apple Touch ID with sudo in macOS

If you like to integrate Touch ID in sudo, you can do this easily in macOS and use the fingerprint.

Integration in sudo

Just edit the /private/etc/pam.d/sudo file and put a line inside.

sudo -e /private/etc/pam.d/sudo

Put the following information inside:

auth       sufficient     pam_tid.so

The file should look like:

# sudo: auth account password session
auth       sufficient     pam_tid.so
auth       sufficient     pam_smartcard.so
auth       required       pam_opendirectory.so
account    required       pam_permit.so
password   required       pam_deny.so
session    required       pam_permit.so

Testing

To test the integration, just echo with sudo.

sudo echo "test"
sudo with Touch ID
sudo with Touch ID

Macbook delete fingerprint information

Apple fingerprint information clear

If you want to return, repair or sell your Apple device. Then you should make sure that all data is deleted. This way the fingerprint information should also be deleted.

Clear Touch Bar information

To delete the fingerprint information, the Apple device must be set to Recorvery mode and open the Terminal.

  1. Restart
  2. Hold down Command-R
  3. Utilities -> Terminal
xartutil –erase-all

You get the question if you are sure, you have to confirm this with “yes” and press Return.

Checking

After rebooting, you can easily check the settings to see if it worked.

no fingerprint

git commit forget Signed-off-by

If you forget to set “Signed-off-by” in the commit. This is now problem, you can still do it afterwards.

To sign-off the last two commits:

git filter-branch --msg-filter "cat - && echo && echo 'Signed-off-by: Your Name '" HEAD~2..HEAD

Then force to push them to the remote repo with the -f option:

git push -f

macOS Sierra – [warn] kq_init: detected broken kqueue; not using.: Undefined error: 0

If you have problems, when you update to macOS Sierra and receive this message:

[warn] kq_init: detected broken kqueue; not using.: Undefined error: 0

Reinstall with brew libevent package:

brew reinstall libevent
==> Reinstalling libevent
==> Downloading https://homebrew.bintray.com/bottles/libevent-2.0.22.sierra.bottle.1.tar.gz
######################################################################## 100,0%
==> Pouring libevent-2.0.22.sierra.bottle.1.tar.gz
🍺  /usr/local/Cellar/libevent/2.0.22: 734 files, 2.0M

Vagrant 1.8.5 – public key problem

If you like to create with kitchen a new Vagrant instance with the Vagrant version 1.8.5 you get the following problem:

           default: Vagrant insecure key detected. Vagrant will automatically replace
           default: this with a newly generated keypair for better security.
           default:
           default: Inserting generated public key within guest...
           default: Removing insecure key from the guest if it's present...
           default: Key inserted! Disconnecting and reconnecting using new SSH key...
           default: Warning: Authentication failure. Retrying...
           default: Warning: Authentication failure. Retrying...
           default: Warning: Authentication failure. Retrying...
           default: Warning: Authentication failure. Retrying...
           default: Warning: Authentication failure. Retrying...
           default: Warning: Authentication failure. Retrying...
           default: Warning: Authentication failure. Retrying...
           default: Warning: Authentication failure. Retrying...

To fix this, you should create this file:

vi .vagrant.d/Vagrantfile

With the content:

Vagrant.configure("2") do |config|
  config.ssh.insert_key = false
end

rsync status with lsof

To see the status from rsync, you can use lsof:

lsof -ad3-999 -c rsync

Output:

COMMAND  PID USER   FD   TYPE             DEVICE SIZE/OFF       NODE NAME
rsync   8097 root    3r   REG             252,17   404832 7559983121 /srv/data/safematix
rsync   8097 root    4u  unix 0xffff8806f4447080      0t0      85225 type=STREAM
rsync   8097 root    5u  unix 0xffff8806f4444ec0      0t0      85226 type=STREAM
rsync   8098 root    3u  unix 0xffff880738502580      0t0      77431 type=STREAM
rsync   8099 root    4u  unix 0xffff880738500b40      0t0      77432 type=STREAM

Linux, BSD, Unix and Security tips