2014年11月17日月曜日

When zpool create command fails

When try to create pool on whole disk but a partition, zpool command automatically creates partition.
But sometimes the command fails and emits the following error message.
the kernel failed to rescan the partition table: 16
cannot label 'sdc': try using parted(8) and then provide a specific slice: -1

As described in ArchWiki, that is because udev fails to create the device file within 1 second.

The ArchWiki proposes to slow down the disk by parallel read.
I found another way which is much stable.


strace command traps syscalls and dump the parameters of syscalls to stderr.
cstream command lets you limit throughput.
So limit the stderr by cstream slows down the zpool.
strace zpool create /dev/sda /dev/sdb tank |& cstream -b 64 -t 2048

If the command is too slow, then increase the throughput to 8K or 16K.

2014年10月24日金曜日

SoftEther VPN on Gentoo

SoftEther VPN is an opensource VPN client/server software, which supports multiple vpn protocols like their own protocol, L2TP/IPsec, OpenVPN, and MS-SSTP. Its client and server software runs on multiple platform including Window, Linux and BSD. Simply saying it's awesome.

Maybe because the software is originally developed on Windows, some part of its behavior is not unix-style.
  • logs are saved in the same directory as the binary locates
  • config file is saved in the same directory as the binary locates

And no ebuild in the gentoo portage exists. That's why I make my portage overlay.
It is available at my github repository.

The ebuild includes several patches that I think not appropriate to merged in mainline.
  1. pid file and log file are saved in /var/run and /var/log/softeher respectively.
  2. disable override /proc/sys/kernel/threads-max setting
  3. activate all features including X.509 authentication that are disabled on original source

How to use my overlay: 

  • emerge layman
  • enable the line of "overlay_defs" in /etc/layman/layman.cfg
  • wget https://raw.githubusercontent.com/yTakatsukasa/misc/master/layman/yutetsu.xml -O /etc/layman/overlays/yutetsu.xml
  • layman -a yutetsu

How to install softether-vpn

After my overlay is enabled,
# emerge softether-vpn
# rc-update add vpnserver
# /etc/init.d/vpnserver start
Then configure the vpnserver. I recommend to use Server Management program on windows to configure the server.

2014年9月25日木曜日

Changing the permission of /dev/nvidia* on Gentoo Linux

To use CUDA on Gentoo, just emerge nvvidia-cuda-sdk is sufficient.
After installing the driver and sdk, /dev/nvidia* will be found.

These device files has 660 permission and belong to video group.
So if users are a member of video group, no problem.

If you want to use the device file from other groups, you have to change the permission.
Here is what I did.


1) edit /etc/modprobe.d/nvidia.conf
  change the line starts with "options nvidia NVreg_DeviceFileMode=", from NVreg_DeviceFileMode=432 to NVreg_DeviceFileMode=0666

2) chmod +x /opt/bin/nvidia-modprobe

3) reboot

Then you will find /dev/nvidia* have permissioin 666.