Mining ZCash on Ubuntu Linux

I didn’t quite believe that mining crypto currencies is viable as an individual, until I saw the news that AMD graphics cards were sold out because they’re good at mining Ethereum. To be convinced I tried to order AMD RX 570 from some online vendors, and they all cancelled my orders and refunded me shortly.

So even if I wanted to mine Ethereum I will have to wait indefinitely for the AMD cards to be re-stocked. At least I can buy some NVidia GTX 1070 cards and mine ZCash instead, before NVidia cards are sold out.

Here’s how to mine ZCash with NVidia cards on Ubuntu.

First, you need a wallet so I can receive payments, if there will be any.  It’s quite easy to install zcash on Arch Linux(because I run Arch on my laptop):

sudo pacman -S zcash
mkdir .zcash
echo "addnode=mainnet.z.cash" >~/.zcash/zcash.conf
echo "rpcuser=<your user>" >>~/.zcash/zcash.conf
echo "rpcpassword=`head -c 32 /dev/urandom | base64`" >>~/.zcash/zcash.conf

For other operating systems, see https://z.cash/download.html

Then you can download the bootstrap data with

zcash-fetch-params

It will download about 800MB, after finished, you can start your wallet with

zcashd

When it’s running, you can use zcash-cli command to create your wallet:

zcash-cli getnewaddress

There will be a long hash started with ‘t’, which is a transparent address, with which you can send and receive zcash. You don’t have to run your wallet and your miner on the same machine, but your miner will use the t address(you will get paid to your wallet).

Now onto your miner machine. You will need to install some dependencies for the miner:

sudo apt-get install nvidia-opencl-dev nvidia-375

System needs to be restarted to load the driver. You can load the driver without restarting too, eg. sudo modprobe nvidia-375. Then you can follow the post below to use the miner:

https://bitcointalk.org/index.php?topic=1707546.0

🙂

关闭 Dell XPS 15 9550 的独立显卡

最近我从 ebay 淘了个二手 Dell XPS 15 笔记本电脑, 2016年的而且配置很高, 但价格相当便宜. 既然好货不便宜, 这电脑是不是有问题? 是的, 卖家承认电脑的 nVidia 独立显卡有故障, 装好驱动程序之后 Windows 就会僵死, 但禁用了它之后一切正常, 当然就不要指望能玩什么像样的游戏了. 不过正好我也不打算在笔记本电脑上玩游戏的, 而且 Dell 对 Linux 的支持算是很好的, 于是我欣然买下.

电脑到手后我装了 Fedora 25, 一切顺利, 送走了 Windows 10. 顺便提及, Fedora 25 已经能检测到 XPS 15 BIOS 有更新可以安装了, 很赞.

启用 nVidia 驱动后果然死锁. 索性把 nVidia 关闭了吧, 还能延长电池的使用时间呢. 首先添加 bumblebee, 参考(在 Fedora 25 上测试通过, 其他 Linux 可能需要不同的设置):

https://fedoraproject.org/wiki/Bumblebee#Installation

安装 bbswitch:

sudo -i
VER=$(uname -r)
dnf install kernel-devel-$VER kernel-headers-$VER bbswitch-dkms

禁止系统自动装载 nVidia 的开源驱动 nouveau:

echo "blacklist nouveau" > /etc/modprobe.d/nouveau.conf

让 bbswitch 自动装载, 并在装载时关闭独立显卡:

echo "bbswitch" > /etc/modules-load.d/bbswitch.conf
echo "options bbswitch load_state=0" > /etc/modprobe.d/bbswitch.conf

重新启动系统之后, 测试一下:

cat /proc/acpi/bbswitch
0000:01:00.0 OFF

OFF 就说明成功了 🙂

擎天柱与大黄蜂

1400x960-bumblebee-optimus-prime5

前些时, 我打算升级一下我的笔记本电脑, 作为给自己的生日礼物, 老婆很给力的批准了. 于是我稍做筛选, 购买了正在促销的 ASUS R501J, i7 处理器 + 15″ 1080P 的屏幕 + 16GB 内存, 我觉得够用了. 只是… 预装的是 Windows 8, 而且有 UEFI + SecureBoot.

微软希望依赖 SB 来阻止我卸载 Windows 安装 Linux, 但很显然他也不得不给自己留个后门, 我只需要照做就是了. 于是轻松关闭 UEFI + SB, 又看到了熟悉的 BIOS, 那安装 Fedora 20 吧. 好笑的是每一种企图剥夺用户自由的”科技”都会美其名曰为了保护用户不受”未授权”的软件的”侵害”, 哈哈哈.

安装 Fedora 20 在 R501J 上就像在茶餐厅点菜一样容易, 键盘上的功能键/屏幕/触板/无线网络/摄像头…都直接可用了, 不过意料之内的是独立显卡似乎被闲置一边了. 原来这就是传说中 Nvidia 的 Optimus(擎天柱) 技术, 平时使用 Intel 的集成显卡达到省电的目的, 而开启 游戏等 3D 应用时就切换到 Nvidia 的 GTX 760M 独立显卡. 硬件厂商是来不及给不到 1% 的 Linux 市场写驱动的, 一贯如此. 但 Linux 用户数目虽少, 却藏龙卧虎, 很快我就找到了 Bumblebee(大黄蜂) 项目, 看名字就知道是来给擎天柱大哥帮忙的.

按照 Bumblebee 上给出的步骤, 我很轻松的安装并测试成功. 下面是对比结果:

先是 Intel 集成显卡:
Selection_323

对比 Nvidia 独立显卡
Selection_324

虽然没有自动切换, 也基本完美了. 改天装个 Dota 2 感受一下.  Dota 2 还玩不成, segmentation fault…

🙂

PS. 貌似集成显卡的 FPS 峰顶在60了, 不过肯定也不会高到哪里去的.