forked from hcaijin/hcaijin.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathatom.xml
More file actions
2872 lines (2872 loc) · 277 KB
/
Copy pathatom.xml
File metadata and controls
2872 lines (2872 loc) · 277 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="text">Vladimir's Blog</title><subtitle type="html">MemE is a powerful and highly customizable GoHugo theme for personal blogs.</subtitle><updated>2020-07-09T01:44:29+08:00</updated><id>http://blog.wxchat.xyz/</id><link rel="alternate" type="text/html" href="http://blog.wxchat.xyz/"/><link rel="self" type="application/atom+xml" href="http://blog.wxchat.xyz/atom.xml"/><author><name>Vladimir</name><uri>http://blog.wxchat.xyz/</uri><email>hcjonline@gmail.com</email></author><rights>[CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/deed.en)</rights><generator uri="https://gohugo.io/" version="0.73.0">Hugo</generator><entry><title type="text">Nexus6p虚焊导致无限重启之救砖教程</title><link rel="alternate" type="text/html" href="http://blog.wxchat.xyz/posts/bootlooping-nexus6p-fix/"/><id>http://blog.wxchat.xyz/posts/bootlooping-nexus6p-fix/</id><updated>2020-07-06T16:40:23+08:00</updated><published>2020-07-03T14:44:06+00:00</published><author><name>Vladimir</name><uri>http://blog.wxchat.xyz/</uri><email>hcjonline@gmail.com</email></author><rights>[CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/deed.en)</rights><summary type="html">前言 前两天手机在使用过程中,无故死机,重启发现在logo显示画面停留一会儿又重启,后面就一直不断的循环这个过程。 本来以为重新做系统就好了,没想到再还原回去还是一样。我以为就这么变砖了,最后还是因为穷的力量,搜索nexus6p无限重启原因就发现原来这是由于前几天我手机摔过一次,可能导致cpu虚焊部分出了毛病,才导致现在手机无限重启的情况。 没办法,通过这几天各种google,终于找到网络上很多大神都有解决的方案,后面后提供大神帖子链接。
准备工作 备份当前的文件和数据 在手机上启用USB调试和OEM解锁 下载ADB驱动程序,安装到你的PC机里。这里有个问题,要安装低版本的,大于29.0的版本再使用时报了个错误,提示找不到可用的命令,网上解决方法就是下载安装26.0版本的解决了这个问题。 去这里下载符合nexus6p的TWRP,这里我下载了3.3.1版本的 去magisk官网下载最新版本应用包括manage 下载要用到的刷机固件Lineage OS,原厂镜像 Nexus6p 下载我打包的要用到的boot.img 备份 由于已经进入不了系统了,备份需要链接USB进到REF里使用这个方法adb pull sdcard备份自己重要的数据
开始刷系统 这里要提一点,一开始我找到的方法是刷指定原厂镜像,刷写4核boot.img就可以重新进入系统。后面又找到不一定原厂镜像的版本,比如lingage17.1的镜像也可以通过大神的方法。 所以,这两种方法都可以解决无限重启进不了系统的问题,我都写在这里,只要看一种方法就好了。
第一种方法:刷原厂镜像 先说一下刷原厂镜像7.1.2版本号n2g48c,参考文档,英文原档</summary><content type="html"><h1 id="前言">前言</h1>
<blockquote>
<p>前两天手机在使用过程中,无故死机,重启发现在logo显示画面停留一会儿又重启,后面就一直不断的循环这个过程。
本来以为重新做系统就好了,没想到再还原回去还是一样。我以为就这么变砖了,最后还是因为穷的力量,搜索nexus6p无限重启原因就发现原来这是由于前几天我手机摔过一次,可能导致cpu虚焊部分出了毛病,才导致现在手机无限重启的情况。
没办法,通过这几天各种google,终于找到网络上很多大神都有解决的方案,后面后提供大神帖子链接。</p>
</blockquote>
<h1 id="准备工作">准备工作</h1>
<ul>
<li>备份当前的文件和数据</li>
<li>在手机上启用USB调试和OEM解锁</li>
<li>下载<a href="https://developer.android.com/studio/releases/platform-tools.html">ADB驱动程序</a>,安装到你的PC机里。这里有个问题,要安装低版本的,大于29.0的版本再使用时报了个错误,提示找不到可用的命令,网上解决方法就是下载安装26.0版本的解决了这个问题。</li>
<li>去这里<a href="https://twrp.me/Devices/">下载</a>符合nexus6p的TWRP,这里我下载了3.3.1版本的</li>
<li>去magisk官网下载最新版本应用包括manage</li>
<li>下载要用到的刷机固件<a href="https://androidfilehost.com/?w=files&amp;flid=302684">Lineage OS</a>,<a href="https://developers.google.com/android/ota#angler">原厂镜像 Nexus6p</a></li>
<li>下载我打包的要用到的boot.img</li>
</ul>
<h1 id="备份">备份</h1>
<blockquote>
<p>由于已经进入不了系统了,备份需要链接USB进到REF里使用这个方法<code>adb pull sdcard</code>备份自己重要的数据</p>
</blockquote>
<h1 id="开始刷系统">开始刷系统</h1>
<blockquote>
<p>这里要提一点,一开始我找到的方法是刷指定原厂镜像,刷写4核boot.img就可以重新进入系统。后面又找到不一定原厂镜像的版本,比如lingage17.1的镜像也可以通过大神的方法。
所以,这两种方法都可以解决无限重启进不了系统的问题,我都写在这里,只要看一种方法就好了。</p>
</blockquote>
<h2 id="第一种方法刷原厂镜像">第一种方法:刷原厂镜像</h2>
<blockquote>
<p>先说一下刷原厂镜像7.1.2版本号n2g48c,<a href="https://bbs.gfan.com/android-9270440-1-1.html">参考文档</a>,<a href="https://forum.xda-developers.com/nexus-6p/general/guide-fix-nexus-6p-bootloop-death-blod-t3640279">英文原档</a></p>
</blockquote>
<ul>
<li>具体怎么刷参考文档里已经写得很清楚了,主要说一下,如果没有刷过twrp的先刷这个<code>fastboot flash recovery twrp3_1_1_4Cores.img</code></li>
<li>先线刷7.1.2, 具体线刷的操作,即进入TWRP界面,选Advanced再点sideload,滑块确认,等待pc端执行<code>adb sideload angler-ota-n2g48c-b004b71e.zip</code></li>
<li>接下来刷入修改版本的boot:<code>adb flash boot 6p48C.img</code></li>
<li>如果前面你先刷twrp就不用再刷一次了。</li>
<li>最后就是进入twrp卡刷性能包6pEX4_1_2.zip。具体操作:把zip包上传到手机sdcard,在twrp界面选择install指定的zip包安装,一路下一步就可以了。如果需要优化就得自己研究其他选项了。</li>
<li>以上就可以完美开机了。</li>
</ul>
<h2 id="第二种方法刷第三方镜像lineage-171">第二种方法:刷第三方镜像lineage 17.1</h2>
<blockquote>
<p>理论上刷其他所有的镜像都可以使用这个方法重进系统。<a href="https://forum.xda-developers.com/nexus-6p/general/bootloop-death-blod-workaround-zip-t3819515">参考文档</a></p>
</blockquote>
<ul>
<li>下载重要的改写cpu核心的软件<a href="https://androidfilehost.com/?w=files&amp;flid=312881">N5x-6P_BLOD_Workaround_Injector_Addon-AK3-signed</a></li>
<li>USB链接手机,使用命令<code>adb reboot bootloader</code>重启</li>
<li>进入原先系统已经刷过twrp的可以直接进入twrp线刷lineage 17.1<code>adb sideload lineage-17.1-20200308-UNOFFICIAL-angler.zip</code> <a href="https://forum.xda-developers.com/nexus-6p/orig-development/rom-lineageos-17-0-nexus-6p-angler-t4012099">参考文档</a></li>
<li>刷写twrp <code>fastboot flash recovery twrp-3.3.1-0-fbe-4core-angler.img</code></li>
<li>然后进入REC模式,上传zip包到sdcard,线刷Addon-AK3.signed.zip这个包<code>adb sideload N5X-6P_BLOD_Workaround_Injector_Addon-AK3-signed.zip</code></li>
<li>最后重启,等待一会儿就可以进入系统了。</li>
</ul>
<h3 id="解决指纹功能bug问题">解决指纹功能bug问题</h3>
<blockquote>
<p>就上一篇文章,我再刷PixelExperience时已经提到过,使用magisk安装补丁的方法重新刷boot就好了。<a href="https://topjohnwu.github.io/Magisk/install.html">参考文档</a></p>
</blockquote>
<ul>
<li>上传boot-17.img到手机<code>adb push boot-17.img sdcard/</code></li>
<li>在手机里安装最新版本的magisk manager</li>
<li>打开magisk点击安装-&gt;安装-&gt;选择要安装的boot-17.img</li>
<li>magisk manager 将生成新的文件magisk_patched.img到sdcard/Download/</li>
<li>下载这个补丁到PC机<code>adb pull /sdcard/Download/magisk_patche.img</code></li>
<li>最后重启进入bootloader刷写这个补丁<code>fastboot flash boot magisk_patched.img</code></li>
<li>以上完成就可以重进系统使用指纹的功能了。</li>
</ul>
<h1 id="总结">总结</h1>
<blockquote>
<p>其实这两个方法最主要是线刷的zip包不同,第二种方法里的AK3包实现了任何系统修改cpu4核心的方法。</p>
</blockquote>
<h1 id="下载">下载</h1>
<blockquote>
<p>我打包了一下所有要用到的软件(不包括原厂镜像包,这些都可以去官网下载),防止原链接失效。<a href="https://drive.google.com/file/d/1Bd4nASTMve23qh28x3BR3OJWJp2NZJyI/view?usp=sharing">备份包</a></p>
</blockquote></content><category scheme="http://blog.wxchat.xyz/tags/bootloop/" term="bootloop" label="bootloop"/><category scheme="http://blog.wxchat.xyz/tags/nexus6p/" term="nexus6p" label="nexus6p"/><category scheme="http://blog.wxchat.xyz/tags/android/" term="android" label="android"/><category scheme="http://blog.wxchat.xyz/tags/magisk/" term="magisk" label="magisk"/></entry><entry><title type="text">Nexus6p Root提权以及刷机攻略</title><link rel="alternate" type="text/html" href="http://blog.wxchat.xyz/posts/root-nexus6p-use-twrp-magisk/"/><id>http://blog.wxchat.xyz/posts/root-nexus6p-use-twrp-magisk/</id><updated>2020-07-06T16:40:23+08:00</updated><published>2020-03-25T18:00:20+00:00</published><author><name>Vladimir</name><uri>http://blog.wxchat.xyz/</uri><email>hcjonline@gmail.com</email></author><rights>[CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/deed.en)</rights><summary type="html">Android 10.0也出来一段时间了,想着给自己的手机刷一下。所以就有了这个攻略,记录一下过程。
准备工作 确保设备电池电量超过50% 备份当前的文件和数据 在手机上启用USB调试和OEM解锁 下载ADB驱动程序,安装到你的PC机里 去这里下载符合nexus6p的TWRP,这里我下载了3.3.1版本的 去magisk官网下载最新版本应用包括manage 下载刷机的固件PixelExperience 10 使用ADB和Fastboot解锁Bootloader 打开终端运行如下命令重启手机到fastboot模式,参考
adb reboot bootloader fastboot flashing unlock 完成以后,就成功解锁了Bootloader,再次检查以启用“开发人员选项”,然后转到“开发人员选项”并启用USB调试模式OEM解锁。有时,他们在启动后会自行禁用。
安装TWRP 还是一样先进到启动模式,把TWRP镜像刷进recovery,如下
adb reboot bootloader fastboot flash recovery twrp-3.</summary><content type="html"><blockquote>
<p>Android 10.0也出来一段时间了,想着给自己的手机刷一下。所以就有了这个攻略,记录一下过程。</p>
</blockquote>
<h1 id="准备工作">准备工作</h1>
<ul>
<li>确保设备电池电量超过50%</li>
<li>备份当前的文件和数据</li>
<li>在手机上启用USB调试和OEM解锁</li>
<li>下载ADB驱动程序,安装到你的PC机里</li>
<li>去这里<a href="https://twrp.me/Devices/">下载</a>符合nexus6p的TWRP,这里我下载了3.3.1版本的</li>
<li>去magisk官网下载最新版本应用包括manage</li>
<li>下载刷机的固件<a href="https://download.pixelexperience.org/angler">PixelExperience 10</a></li>
</ul>
<h1 id="使用adb和fastboot解锁bootloader">使用ADB和Fastboot解锁Bootloader</h1>
<p>打开终端运行如下命令重启手机到fastboot模式,<a href="https://developers.google.com/android/images">参考</a></p>
<pre><code>adb reboot bootloader
fastboot flashing unlock
</code></pre><p>完成以后,就成功解锁了Bootloader,再次检查以启用“开发人员选项”,然后转到“开发人员选项”并启用USB调试模式OEM解锁。有时,他们在启动后会自行禁用。</p>
<h1 id="安装twrp">安装TWRP</h1>
<p>还是一样先进到启动模式,把TWRP镜像刷进recovery,如下</p>
<pre><code>adb reboot bootloader
fastboot flash recovery twrp-3.3.1-0-angler.img
</code></pre><blockquote>
<p>完成上面两个准备刷机的步骤基本上就不用担心手机变砖了,下面开始刷机</p>
</blockquote>
<h1 id="刷pixelexperience-10-到nexus6p">刷PixelExperience 10 到Nexus6p</h1>
<p>首先确保Nexus6p没有刷过其他第三方Rom,如果刷过,要先通过官方Rom还原到指定<a href="https://developers.google.com/android/images#angler">版本</a>
这里我们需要下载8.1.0 (OPM7.181205.001, Dec 2018)版本,解压进入文件夹执行shell就可以还原了。当然首先还得USB链接成功。</p>
<h2 id="刷入pixel-10固件">刷入Pixel 10固件</h2>
<p>确保nexus6p是最新版本8.1.0以后,我们就可以通过TWRP刷入Pixel这个最新的固件了</p>
<p>重启手机,进入手机端的TWRP界面,点选Advanced选项,然后在手机界面里点选ADB sideload选项,然后滑动下面的滑块确认选择,等待电脑端执行adb sideload 刷机包名.zip命令</p>
<p>这里有一点要注意,下载固件的时候要把版本10的两个文件都下载了,因为最新的那版本指纹,锁屏功能有问题。</p>
<pre><code>unzip -x PixelExperience_angler-10.0-20191231-1607-OFFICIAL.zip -d piexl2019
unzip -x PixelExperience_angler-10.0-20200101-0925-OFFICIAL.zip -d piexl2020
cp piexl2019/boot.img piexl2020
cd piexl2020
zip -r -v -o pixel20200101.zip .
</code></pre><p>完成以上,生成我们要刷入的pixel20200101.zip这个固件包了,可以进入TWRP界面三清数据以后线刷就OK了
这里的三清指的是擦除system &amp; data &amp; cache 这三个分区,还有格式化data分区
最后执行以下,重启就能进入新系统了</p>
<pre><code>adb sideload pixel20200101.zip
</code></pre><p>到这里,如果不需要Root手机的话就不用看下面的了</p>
<h1 id="root提权">Root提权</h1>
<p><a href="https://www.youtube.com/watch?v=3pxOeiIBrHI&amp;t=582s">参考</a>
首先进到新系统(别忘了还是要先开启开发者选项)安装magisk manager这个app,把上一步解压出来的boot.img复制到手机里</p>
<pre><code>adb push boot.img /sdcard/
</code></pre><p>操作magisk manager安装magisk的补丁,生成magisk_patched.img
把补丁下载回PC</p>
<pre><code>adb pull /sdcard/Download/magisk_patched.img .
</code></pre><p>重启手机进入快速启动模式,把补丁刷入boot</p>
<pre><code>fastboot flash boot magisk_patched.img
</code></pre><p>最后重启手机,进入magisk manager检查root权限。</p>
<h1 id="参考">参考</h1>
<ul>
<li><a href="https://forum.xda-developers.com/nexus-6p/development/rom-pixel-experience-t3970525"> PixelExperience for Google Nexus 6P 【angler】</a></li>
<li><a href="https://forum.xda-developers.com/nexus-6p/orig-development/rom-lineageos-17-0-nexus-6p-angler-t4012099">【ROM】【UNOFFICIAL】LineageOS 17.1 for Nexus 6P (angler)</a></li>
<li><a href="https://mikey2008.github.io/2019/12/31/%E3%80%90%E6%95%99%E7%A8%8B%E3%80%91%E4%B8%80%E5%8A%A05%E5%88%B7LineageOS%E5%85%A8%E8%BF%87%E7%A8%8B/">【教程】一加5刷LineageOS全过程</a></li>
</ul></content><category scheme="http://blog.wxchat.xyz/tags/android/" term="android" label="android"/><category scheme="http://blog.wxchat.xyz/tags/nexus6p/" term="nexus6p" label="nexus6p"/><category scheme="http://blog.wxchat.xyz/tags/twrp/" term="twrp" label="twrp"/><category scheme="http://blog.wxchat.xyz/tags/magisk/" term="magisk" label="magisk"/></entry><entry><title type="text">树莓派安装配置软路由</title><link rel="alternate" type="text/html" href="http://blog.wxchat.xyz/posts/openwrt-raspberry/"/><id>http://blog.wxchat.xyz/posts/openwrt-raspberry/</id><updated>2020-07-06T16:40:23+08:00</updated><published>2019-07-17T15:43:15+00:00</published><author><name>Vladimir</name><uri>http://blog.wxchat.xyz/</uri><email>hcjonline@gmail.com</email></author><rights>[CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/deed.en)</rights><summary type="html">准备 Raspberry Pi 2 Model B Rev 1.1 SD卡闪盘(4G+) 主机我用的是ArchLinux,内核4.19.52-1-lts 主路由器一个TPlink USB网卡 一条网线 刷openwrt固件 下载解压 去官网下载对应的安装固件
wget http://downloads.openwrt.org/releases/18.06.4/targets/brcm2708/bcm2709/openwrt-18.06.4-brcm2708-bcm2709-rpi-2-ext4-factory.img.gz gzip -d openwrt-18.06.4-brcm2708-bcm2709-rpi-2-ext4-factory.img.gz 烧写SD卡 sudo fdisk -l #列出闪盘设备名 /dev/mmcblk0 sudo dd if=openwrt-18.06.4-brcm2708-bcm2709-rpi-2-ext4-factory.img of=/dev/mmcblk0 链接树莓派 配置主机IP(192.</summary><content type="html"><h1 id="准备">准备</h1>
<ul>
<li>Raspberry Pi 2 Model B Rev 1.1</li>
<li>SD卡闪盘(4G+)</li>
<li>主机我用的是ArchLinux,内核4.19.52-1-lts</li>
<li>主路由器一个TPlink</li>
<li>USB网卡</li>
<li>一条网线</li>
</ul>
<h1 id="刷openwrt固件">刷openwrt固件</h1>
<h2 id="下载解压">下载解压</h2>
<p>去<a href="https://www.openwrt.org">官网</a>下载对应的安装固件</p>
<pre><code>wget http://downloads.openwrt.org/releases/18.06.4/targets/brcm2708/bcm2709/openwrt-18.06.4-brcm2708-bcm2709-rpi-2-ext4-factory.img.gz
gzip -d openwrt-18.06.4-brcm2708-bcm2709-rpi-2-ext4-factory.img.gz
</code></pre><h2 id="烧写sd卡">烧写SD卡</h2>
<pre><code>sudo fdisk -l #列出闪盘设备名 /dev/mmcblk0
sudo dd if=openwrt-18.06.4-brcm2708-bcm2709-rpi-2-ext4-factory.img of=/dev/mmcblk0
</code></pre><h2 id="链接树莓派">链接树莓派</h2>
<p>配置主机IP(192.168.1.1) 网线直接连接树莓派接口 浏览器打开192.168.1.1 配置密码和ssh登陆以后,在终端里登陆<code>ssh root@192.168.1.1</code></p>
<p>修改lan口配置如下:</p>
<pre><code>cat /etc/config/network
config interface 'lan'
option type 'bridge'
option ifname 'eth0'
option proto 'static'
option netmask '255.255.255.0'
option ip6assign '60'
option ipaddr '192.168.10.109'
option gateway '192.168.10.1'
option broadcast '255.255.255.0'
option dns '114.114.114.114'
</code></pre><p>重启路由,用网线连接主路由器就可以链接外网了。</p>
<h2 id="安装软件">安装软件</h2>
<p>安装支持网卡的模块</p>
<pre><code>opkg update
opkg install kmod-rtl8192cu
</code></pre><h3 id="修改无线网络配置">修改无线网络配置</h3>
<pre><code>cat /etc/config/wireless
config wifi-iface 'default_radio0'
option device 'radio0'
option network 'lan'
option mode 'ap'
option encryption 'none'
option ssid 'CMCCFREE'
</code></pre><h3 id="修改路由网络配置">修改路由网络配置</h3>
<pre><code>
cat /etc/config/network
config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config globals 'globals'
option ula_prefix 'fd3c:ca1e:c593::/48'
config interface 'lan'
option proto 'static'
option netmask '255.255.255.0'
option ipaddr '192.168.10.1'
option ip6assign '64'
config interface 'wan'
option ifname 'eth0'
option proto 'dhcp'
option dns '127.0.0.1' #### 连接该 OpenWrt 路由器的所有设备发出的 DNS 请求都会由该路由器的 dnsmasq 来响应(当然,前提是设备没有手动去修改默认的 DNS 服务器 IP,而使用路由器默认提供的 DNS 服务器 IP)。
option peerdns '0' #### 忽略通告的DNS服务器地址
</code></pre><h3 id="修改dhcp配置如下">修改DHCP配置如下</h3>
<pre><code>root@OpenWrt:~# cat /etc/config/dhcp
config dnsmasq
option domainneeded '1'
option localise_queries '1'
option rebind_protection '1'
option rebind_localhost '1'
option domain 'lan'
option expandhosts '1'
option authoritative '1'
option readethers '1'
option leasefile '/tmp/dhcp.leases'
option nonwildcard '1'
option localservice '1'
option logqueries '1'
option noresolv '1'
option local '/lan/'
option allservers '1'
list server '114.114.114.114' #### 配置DNS转发 注意,此为路由器默认查询的 DNS 服务器,你可以根据你的实际情况选择一个较快的 DNS 服务器
config dhcp 'lan'
option interface 'lan'
option dhcpv6 'server'
option ra 'server'
option ra_management '1'
config dhcp 'wan'
option interface 'wan'
option ignore '1'
</code></pre><h3 id="提交修改并重启">提交修改并重启</h3>
<pre><code>uci commit /etc/config/wireless
uci commit /etc/config/network
uci commit /etc/config/dhcp
## 重启路由也是一样的或者执行以下命令重启服务
/etc/init.d/dnsmasq restart
/etc/ini.d/network restart
ifup wan &amp;&amp; wifi
</code></pre><h1 id="安装ss">安装SS</h1>
<h2 id="安装-shadowsocks-libev-相关的包">安装 shadowsocks-libev 相关的包</h2>
<pre><code>opkg update
opkg install shadowsocks-libev-config shadowsocks-libev-ss-local shadowsocks-libev-ss-redir shadowsocks-libev-ss-rules shadowsocks-libev-ss-tunnel luci-app-shadowsocks-libev
</code></pre><h2 id="基础配置">基础配置</h2>
<p>进入openwrt web配置界面,选择 Service-&gt;shadowsocks-libev</p>
<p>点击 Remote Servers, 里面已经默认配置一个服务器 sss0,修改地址,端口,密码,加密方式,最重要的,将disabled的勾去掉,点击 save&amp;apply 按钮。</p>
<p>再点击 Local Instances, 点击 ss-local.cfgXXXXX (XXX为随机数字)条目对应的Disabled 按钮,将其变成 Enabled,点击 Save &amp; Apply。配置保存生效以后, ss-local.cfgXXXX 条目的Running 状态由no变为yes。这时,路由器上已经运行一个SOCKS5服务器,端口1080。设置电脑浏览器的代理服务器为路由器地址,端口1080,尝试访问谷歌,如果成功则说明ss客户端在openwrt上工作一切正常。</p>
<p>接着要测试iptables+ss-redir自动转发代理(透明代理)的功能,在Local Instances中,将ss-redir.hi 设为Enabled。再点击 Redir Rules, Disabled勾去掉,点击Destination Settings,dst default 由bypass改为 forward。点击Save&amp;Apply 使配置生效。将电脑浏览器的代理设置取消,访问谷歌,如果成功,则说明无条件透明代理设置成功。所有数据包都由路由器转发到ss服务器了。</p>
<h2 id="3-进阶配置">3. 进阶配置</h2>
<p>上面最后配置的透明代理将全部流量都转发到远端SS服务器,显然太浪费流量,而且国内的网站去国外转一圈效率也很低。因此我们需要在路由器上识别国内国外流量,区别对待。</p>
<p>1.首先将 Destination Settings中的dst forward 设为 bypass。</p>
<ol start="2">
<li>将opkg列表更新由http 改为https, http存在更新不全的情况,可能是GFW搞鬼</li>
</ol>
<pre><code>opkg install libustream-mbedtls (如果提示找不到,opkg update 多运行几次)
sed -i s/http:/https:/g /etc/opkg/distfeeds.conf
opkg update
</code></pre><ol start="3">
<li>安装各种依赖包</li>
</ol>
<pre><code>opkg remove dnsmasq
opkg install dnsmasq-full
opkg install coreutils-base64 curl ca-certificates ca-bundle
</code></pre><h1 id="问题总结">问题总结</h1>
<h2 id="dnsmasq服务不启动">dnsmasq服务不启动</h2>
<p>最早手动添加域名到 /etc/dnsmasq.d/下的配置文件中,经过测试,发现无法解析该域名,经过排查,可能是配置文件编码格式的问题,导致了dnsmasq服务无法启动</p>
<h2 id="主机路由地址">主机路由地址</h2>
<p>排查问题我们在主机上用<code>nslookup</code></p>
<pre><code>graz@graz ~ % nslookup twitter.com
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
Name: twitter.com
Address: 104.244.42.65
Name: twitter.com
Address: 104.244.42.1
</code></pre><p>如上,看server项,是上上级的路由地址,这就绕过了树莓派的路由直接走上级路由查询。</p>
<p>然后,我们再看一下<code>cat /etc/resolv.conf</code>
可以看到有多个路由地址,包括<code>192.168.10.1</code>,<code>192.168.1.1</code></p>
<p>以上,主机路由地址获取到了上上级的路由,也不知道怎么回事,(有知道的可以邮件通知我一下,谢谢大家),只能先手动修改一下主机路由如下:</p>
<pre><code>cat /etc/resolv.conf
nameserver 192.168.10.1 ## 这里是树莓派路由器的路由地址,一开始获取的还有上上级的路由地址如:192.168.1.1 。要把这个删掉
</code></pre><h1 id="最后">最后</h1>
<p>最后,查看日志或者安装tcpdump抓取5353端口看是否正常配置</p>
<pre><code>opkg update
opkg install tcpdump
tcpdump -vv -i lo port 5353
</code></pre><h1 id="参考">参考</h1>
<ul>
<li><a href="http://blog.kompaz.win/2017/03/24/OpenWRT%20Shadowsocks+GFWList%20%E6%B5%81%E9%87%8F%E8%87%AA%E5%8A%A8%E5%88%86%E6%B5%81/">OpenWRT Shadowsocks+GFWList 流量自动分流</a></li>
<li><a href="https://medium.com/@cnnbysy/openwrt-18-06-1-%E9%85%8D%E7%BD%AE%E7%A7%91%E5%AD%A6%E4%B8%8A%E7%BD%91-30e231958c38">openwrt 18.06.1 配置科学上网</a></li>
<li><a href="https://swsmile.info/2019/01/30/%E3%80%90Network%E3%80%91Shadowsocks%20-Shadowsocks-OpenWRT-dnsmasq-full-ipset-gfwList-%E5%AE%9E%E7%8E%B0%E8%B7%AF%E7%94%B1%E5%99%A8%EF%BC%88%E5%B0%8F%E7%B1%B3%E8%B7%AF%E7%94%B1%E5%99%A8mini%EF%BC%89%E8%87%AA%E5%8A%A8%E7%BF%BB%E5%A2%99/">Shadowsocks + OpenWRT + dnsmasq-full + ipset + gfwList 实现路由器</a></li>
<li><a href="https://blog.ch3n2k.com/posts/xin-de-ji-yu-openwrt-lu-you-qi-de-bu-wan-quan-zi-dong-fan-qiang-fang-an.html">新的基于OpenWrt路由器的(不完全)自动翻墙方案</a></li>
</ul></content><category scheme="http://blog.wxchat.xyz/tags/openwrt/" term="openwrt" label="openwrt"/><category scheme="http://blog.wxchat.xyz/tags/raspberry/" term="raspberry" label="raspberry"/></entry><entry><title type="text">用OPENWRT路由器抓包网络流量笔记</title><link rel="alternate" type="text/html" href="http://blog.wxchat.xyz/posts/openwrt-wireshark-setting/"/><id>http://blog.wxchat.xyz/posts/openwrt-wireshark-setting/</id><updated>2020-07-06T16:40:23+08:00</updated><published>2018-06-13T19:50:11+00:00</published><author><name>Vladimir</name><uri>http://blog.wxchat.xyz/</uri><email>hcjonline@gmail.com</email></author><rights>[CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/deed.en)</rights><summary type="html">前言 openwrt是一款基于linux的路由器系统,可以安装很多相关的工具包,完成像linux系统服务器可以完成的工作,比如今天我们要讲的路由器的网络数据包抓包。
环境 安装了openwrt的路由器,ip地址:192.168.10.1 要抓包流量的Android手机,ip地址:192.68.10.235 工作台笔记本,ip地址:192.168.10.234 安装与配置 以下介绍两种方法都可以实现路由器数据包抓取的功能
简单的说明 根据openwrt文档,所有的局域网的数据最后都是通过br-lan虚拟网卡来做转发,所以对此网卡进行监控即可 此命令本质是远程在路由器上执行网络监控命令,输入文本到本机的wireshark里面 使用wireshark作为可视化工具来查看
捕获与tcpdump的通信 Tcpdump可以安装在OpenWrt路由器上。因此,这种方法消除了让远程Wireshark或类似听众实时分析流量的需要。
ssh登陆到openwrt(默认端口:22),更新并安装tcpdump
opkg update opkg install tcpdump 执行以下命令在接口(-i)上侦听并将捕获的信息存储到文件(-w),并在执行此操作时(-v)进行冗长操作。
tcpdump -i any -v -w pcap.</summary><content type="html"><h1 id="前言">前言</h1>
<p>openwrt是一款基于linux的路由器系统,可以安装很多相关的工具包,完成像linux系统服务器可以完成的工作,比如今天我们要讲的路由器的网络数据包抓包。</p>
<h1 id="环境">环境</h1>
<ul>
<li>安装了openwrt的路由器,ip地址:192.168.10.1</li>
<li>要抓包流量的Android手机,ip地址:192.68.10.235</li>
<li>工作台笔记本,ip地址:192.168.10.234</li>
</ul>
<h1 id="安装与配置">安装与配置</h1>
<blockquote>
<p>以下介绍两种方法都可以实现路由器数据包抓取的功能</p>
</blockquote>
<p><em><strong>简单的说明
根据openwrt文档,所有的局域网的数据最后都是通过br-lan虚拟网卡来做转发,所以对此网卡进行监控即可
此命令本质是远程在路由器上执行网络监控命令,输入文本到本机的wireshark里面
使用wireshark作为可视化工具来查看</strong></em></p>
<h2 id="捕获与tcpdump的通信">捕获与tcpdump的通信</h2>
<blockquote>
<p>Tcpdump可以安装在OpenWrt路由器上。因此,这种方法消除了让远程Wireshark或类似听众实时分析流量的需要。</p>
</blockquote>
<p>ssh登陆到openwrt(默认端口:22),更新并安装tcpdump</p>
<pre><code>opkg update
opkg install tcpdump
</code></pre><p>执行以下命令在接口(-i)上侦听并将捕获的信息存储到文件(-w),并在执行此操作时(-v)进行冗长操作。</p>
<pre><code>tcpdump -i any -v -w pcap.cap
</code></pre><p>生成的pcap.cap文件,我们可以传回工作台,用wireshark打开做进一步的分析</p>
<blockquote>
<p>以下是一些使用tcpdump的例子:</p>
</blockquote>
<ul>
<li><a href="https://www.rationallyparanoid.com/articles/tcpdump.html">https://www.rationallyparanoid.com/articles/tcpdump.html</a></li>
</ul>
<h3 id="制作一键命令脚本">制作一键命令脚本</h3>
<p>命令格式如下:</p>
<pre><code>ssh -p ssh端口 -o StrictHostKeyChecking=no ssh用户名@ssh地址 'tcpdump -s 0 -U -n -w - -i br-lan not port ssh端口' | wireshark -k -i -
</code></pre><p>由于我环境配置了不用密码登陆的方式所以我们可以直接写成如下:</p>
<pre><code>ssh openwrt 'tcpdump -s 0 -U -n -w - -i br-lan not port 22' | wireshark -k -i -
ssh -p 22 -o StrictHostKeyChecking=no root@192.168.10.1 'tcpdump -s 0 -U -n -w - -i br-lan not port 22' | wireshark -k -i -
</code></pre><blockquote>
<p>前面讲述了基本的原理和操作手段,但是缺点是每次都需要输入长串命令行和密码,可以利用linux的一些小操作技巧,简化此过程,做成一个命令工具,方便随时调用。
基本原理:</p>
</blockquote>
<ul>
<li>使用 sshpass 工具来做密码输入</li>
<li>使用 alias 别名来做成命令语句</li>
</ul>
<p>在工作台安装sshpass,执行以下脚本:</p>
<pre><code>sudo pacman -S sshpass
sshpass -p 'password' ssh -p 22 -o StrictHostKeyChecking=no root@192.168.10.1 'tcpdump -s 0 -U -n -w - -i br-lan not port 22' | wireshark-gtk -k -i -
</code></pre><p>把执行语句写到<code>.bash_rc</code>就可以一条命令执行抓包分析了</p>
<pre><code>alias tsharkbyopenwrt=&quot;sshpass -p 'password' ssh -p 22 -o StrictHostKeyChecking=no root@192.168.10.1 'tcpdump -s 0 -U -n -w - -i br-lan not port 22' | wireshark-gtk -k -i -&quot;
</code></pre><h3 id="完善脚本">完善脚本</h3>
<p>通过命名管道来导回数据</p>
<pre><code>mkfifo /tmp/fifo
sshpass -p 'passwrod' ssh openwrt 'tcpdump -s 0 -U -n -w - -i br-lan not port 22' &gt; /tmp/fifo &amp; wireshark-gtk -k -i /tmp/fifo
</code></pre><p><em>这里我配置了<code>.ssh/config</code>,所以可以直接使用<code>ssh openwrt</code>命令代替前面指定端口与用户名的方式。</em></p>
<blockquote>
<p>我们还有一个方法可以不用安装sshpass,直接使用密钥的方式来登陆路由器抓包,以上就可以写为:</p>
</blockquote>
<pre><code>ssh-copy-id openwrt
ssh openwrt 'tcpdump -s 0 -U -n -w - -i br-lan not port 22' &gt; /tmp/fifo &amp; wireshark-gtk -k -i /tmp/fifo
</code></pre><h2 id="使用远程wireshark侦听器进行分析">使用远程Wireshark侦听器进行分析</h2>
<p>ssh登陆到openwrt(默认端口:22),更新并安装iptables-mod-tee</p>
<pre><code>opkg update
opkg install iptables-mod-tee
</code></pre><p>运行以下iptables命令以“在输出接口(-o)上将源IP(-s)的每个数据包的副本转发到网关IP( - 网关)”</p>
<pre><code>iptables -A POSTROUTING -t mangle -o br-lan ! -s 192.168.10.235 -j TEE --gateway 192.168.10.234
</code></pre><p>运行以下iptables命令以“在接口(-i)上将目的IP(-d)的每个数据包的副本转发到网关IP( - 网关)”</p>
<pre><code>iptables -A PREROUTING -t mangle -i br-lan ! -d 192.168.10.235 -j TEE --gateway 192.168.10.234
</code></pre><p>在Wireshark上开始捕获流量并应用下面的过滤器:</p>
<pre><code>(ip.src == 192.168.9.121) || (ip.dst == 192.168.9.121)
</code></pre><p>关于iptable规则一些有用的资源:</p>
<ul>
<li><a href="https://wiki.openwrt.org/doc/howto/netfilter">https://wiki.openwrt.org/doc/howto/netfilter</a></li>
<li><a href="http://www.faqs.org/docs/iptables/index.html">http://www.faqs.org/docs/iptables/index.html</a></li>
<li><a href="http://ipset.netfilter.org/iptables-extensions.man.html#lbDW">http://ipset.netfilter.org/iptables-extensions.man.html#lbDW</a></li>
</ul>
<h2 id="安装使用cloudshark">安装使用CloudShark</h2>
<p>CloudShark是一个独立的,与LEDE无关的云分析平台。它依靠cshark插件远程发送数据包进行分析。请检查您的内部规则,是否允许将网络流量发送到云平台。</p>
<pre><code>opkg update
opkg install cshark luci-app-cshark
</code></pre><p>请查看<a href="https://support.cloudshark.org/openwrt/openwrt-cloudshark.html">Cloud Shark文档</a>以获取更多信息。</p>
<h1 id="问题处理">问题处理</h1>
<p>在工作台使用wireshark-gtk的时候报错:</p>
<pre><code>Couldn't run /usr/bin/dumpcap in child process: Permission denied
</code></pre><p>这是由于dumpcap这个的权限问题。</p>
<pre><code>ll /usr/bin/dumpcap :(
-rwxr-xr-- 1 root wireshark 102K May 23 06:39 /usr/bin/dumpcap
</code></pre><p>只要把当前用户加入到wireshark用户组里,重启就ok了(暂时不明为什么一定要重启,反正我是重启以后才正常使用的)。</p>
<pre><code>sudo usermod -aG wireshark $LOGNAME
sudo setcap cap_net_raw,cap_net_admin+eip /usr/bin/dumpcap
</code></pre><p><em>setcat对应使用getcap查看当前的方法权限</em></p>
<h1 id="参考">参考</h1>
<ul>
<li><a href="http://www.ayomaonline.com/security/analyzing-network-traffic-with-openwrt/">ANALYZING NETWORK TRAFFIC WITH OPENWRT</a></li>
<li><a href="https://openwrt.org/docs/guide-user/firewall/capture-filter-inspect-packets">How to capture, filter and inspect packets</a></li>
<li><a href="http://www.ayomaonline.com/security/getting-started-with-openwrt-linuxfying-routers/">GETTING STARTED WITH OPENWRT – LINUXFYING ROUTERS</a></li>
</ul></content><category scheme="http://blog.wxchat.xyz/tags/openwrt/" term="openwrt" label="openwrt"/><category scheme="http://blog.wxchat.xyz/tags/wireshark/" term="wireshark" label="wireshark"/><category scheme="http://blog.wxchat.xyz/tags/cloudshark/" term="cloudshark" label="cloudshark"/></entry><entry><title type="text">UEFI+GPT安装Archlinux与Win10双系统教程</title><link rel="alternate" type="text/html" href="http://blog.wxchat.xyz/posts/archlinux-uefi-bootloader/"/><id>http://blog.wxchat.xyz/posts/archlinux-uefi-bootloader/</id><updated>2020-07-06T16:40:23+08:00</updated><published>2018-06-10T00:42:24+00:00</published><author><name>Vladimir</name><uri>http://blog.wxchat.xyz/</uri><email>hcjonline@gmail.com</email></author><rights>[CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/deed.en)</rights><summary type="html">前言 最近新入手一台Thinkpad,使用UEFI+GPT预安装好了Win10操作系统,准备开始安装Archlinux。
如果你准备在一块新硬盘上安装双系统,那么应该先安装windows。 如果你安装的是Win10,那么它应该默认就是按UEFI+GPT方式安装的,可以按Win+X键打开磁盘管理,如果是UEFI安装的,那么应该有一个EFI分区,可能是250M。 其它还有Windows的恢复分区和基本数据分区。不用管恢复分区,如果现在磁盘上没有剩余空间,可以右键点击基本数据分区,点击压缩卷,给Arch的安装腾出空间。用右键点击磁盘,查看属性,可以知道自己是否采用了GPT分区方式。
在安装之前,请在电源计划中关掉Windows的快速启动,并在BIOS中关掉Secure Boot,可以很容易搜到对应自己电脑的具体方法。 如果上面有哪一条没有满足,请只看一看我遇到的问题,具体安装请再参考其它教程
安装 安装之前 准备一个大于4G的U盘 安装镜像,可以从Arch Linux的官方网站下载 制作U盘启动盘 这里我只介绍linux系统下使用dd的方式,windows下面的方法可以看一下这个安装教程
插入U盘,查看U盘设备名,不需求挂载
lsblk sudo dd if=archlinux-2018.06.01-x86_64.iso of=/dev/sdb 这样,就制作好了U盘启动了,把U盘插入要安装的机子,配置BIOS通过U盘启动,就可以进入光盘引导的临时系统。
选择镜像源 Arch Linux是通过网络进行安装的,为了以更快的速度下载软件包,建议先配置镜像源。配置镜像源的方法是编辑/etc/pacman.d/mirrorlist这个文件,将想用的镜像源的放到第一个非井号开头的行即可。如下可将中科大镜像源作为首选镜像源。
# /etc/pacman.d/mirrorlist # This is the USTC mirror Server = http://mirrors.</summary><content type="html"><h1 id="前言">前言</h1>
<blockquote>
<p>最近新入手一台Thinkpad,使用UEFI+GPT预安装好了Win10操作系统,准备开始安装Archlinux。</p>
</blockquote>
<p>如果你准备在一块新硬盘上安装双系统,那么应该先安装windows。
如果你安装的是Win10,那么它应该默认就是按UEFI+GPT方式安装的,可以按Win+X键打开磁盘管理,如果是UEFI安装的,那么应该有一个EFI分区,可能是250M。
其它还有Windows的恢复分区和基本数据分区。不用管恢复分区,如果现在磁盘上没有剩余空间,可以右键点击基本数据分区,点击压缩卷,给Arch的安装腾出空间。用右键点击磁盘,查看属性,可以知道自己是否采用了GPT分区方式。</p>
<p>在安装之前,请在电源计划中关掉Windows的快速启动,并在BIOS中关掉Secure Boot,可以很容易搜到对应自己电脑的具体方法。
如果上面有哪一条没有满足,请只看一看我遇到的问题,具体安装请再参考其它教程</p>
<h1 id="安装">安装</h1>
<h2 id="安装之前">安装之前</h2>
<ul>
<li>准备一个大于4G的U盘</li>
<li>安装镜像,可以从Arch Linux的<a href="www.archlinux.org">官方网站</a>下载</li>
</ul>
<h2 id="制作u盘启动盘">制作U盘启动盘</h2>
<p>这里我只介绍linux系统下使用<code>dd</code>的方式,windows下面的方法可以看一下这个<a href="https://github.com/mytbk/Linux_Notes/blob/master/install/install-archlinux.md">安装教程</a></p>
<p>插入U盘,查看U盘设备名,不需求挂载</p>
<pre><code>lsblk
sudo dd if=archlinux-2018.06.01-x86_64.iso of=/dev/sdb
</code></pre><p>这样,就制作好了U盘启动了,把U盘插入要安装的机子,配置BIOS通过U盘启动,就可以进入光盘引导的临时系统。</p>
<h2 id="选择镜像源">选择镜像源</h2>
<p>Arch Linux是通过网络进行安装的,为了以更快的速度下载软件包,建议先配置镜像源。配置镜像源的方法是编辑/etc/pacman.d/mirrorlist这个文件,将想用的镜像源的放到第一个非井号开头的行即可。如下可将中科大镜像源作为首选镜像源。</p>
<pre><code># /etc/pacman.d/mirrorlist
# This is the USTC mirror
Server = http://mirrors.ustc.edu.cn/archlinux/$repo/os/$arch
# and other mirrors
## Score: 4.6, China
Server = http://mirrors.163.com/archlinux/$repo/os/$arch
#
</code></pre><p>配置完成后可以执行pacman -Syy试一下,可以看一下pacman从镜像站下载文件的速度。</p>
<h2 id="分区">分区</h2>
<blockquote>
<p>我们前面提过已经默认有安装的Win10系统,使用<code>fdisk</code>可以看到已经有一个EFI分区为250M大小。因此不要单独为Linux分出EFI分区,因为要双系统启动的话应该把Win10的EFI分区挂载到/boot上。</p>
</blockquote>
<p>以下是我的硬盘分区情况,因为我还有一块硬盘用来挂载/home,所以我只要创建根分区和swap分区</p>
<pre><code>Device Start End Sectors Size Type
/dev/nvme0n1p1 2048 534527 532480 260M EFI System
/dev/nvme0n1p2 534528 567295 32768 16M Microsoft reserved
/dev/nvme0n1p3 567296 254337023 253769728 121G Microsoft basic data
/dev/nvme0n1p4 254337024 485023743 230686720 110G Linux filesystem
/dev/nvme0n1p5 498069504 500117503 2048000 1000M Windows recovery environment
/dev/nvme0n1p6 485023744 497606655 12582912 6G Linux swap
</code></pre><h2 id="格式化">格式化</h2>
<pre><code>mkfs.ext4 /dev/nvme0n1p4
mkswap /dev/nvme0n1p6
swapon /dev/nvme0n1p6
</code></pre><h2 id="挂载分区">挂载分区</h2>
<p>首先,一定是先挂载/分区,再挂载其它分区。因为要使用双系统启动,所以即使没有分/boot分区,还是应该把windows的EFI分区挂载到/上。</p>
<pre><code>mount /dev/nvme0n1p4 /mnt/
mkdir -p /mnt/boot
mount /dev/nvme0n1p1 /mnt/boot
</code></pre><h2 id="基本软件安装">基本软件安装</h2>
<p>安装Arch Linux的软件很简单,执行下面这条命令就行了:</p>
<pre><code>pacstrap /mnt base base-devel
</code></pre><h1 id="配置系统">配置系统</h1>
<h2 id="创建fstab">创建fstab</h2>
<p>生成一个fstab文件(使用-U或-L分别由UUID或标签定义):</p>
<pre><code>genfstab -U /mnt &gt;&gt; /mnt/etc/fstab
</code></pre><h2 id="切换新系统">切换新系统</h2>
<p>现在我们执行<code>arch-chroot /mnt</code>,这样就以chroot的方式进入了新的系统。</p>
<h2 id="配置时间">配置时间</h2>
<pre><code>ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
hwclock --systohc
</code></pre><h2 id="配置本地化">配置本地化</h2>
<p>在/etc/locale.gen中取消注释en_US.UTF-8 UTF-8和其他所需的本地化,并使用<code>local-gen</code>更新本地语言编码</p>
<h2 id="设置主机名">设置主机名</h2>
<pre><code>echo 'hcaijin.com' &gt; /etc/hostname
</code></pre><h2 id="设置root密码">设置root密码</h2>
<pre><code>passwd
</code></pre><h2 id="设置启动">设置启动</h2>
<p>按照上面的步骤,efi分区应该被挂载到了/boot目录下。这时,我们使用<code>bootctl install</code>命令,安装bootloader,然后用<code>cp /usr/share/systemd/bootctl/arch.conf /boot/loader/entries/</code>把示例文件复制过来,只要修改它的options部分就可以了。
以我的/boot分区为例,用<code>blkid -s PARTUUID -o value /dev/nvme0n1p1</code>就可以生成所需要的PARTUUID,最后加上rw就行了。</p>
<p>格式大概为:</p>
<pre><code>title Arch Linux
linux /vmlinuz-linux
initrd /initramfs-linux.img
options root=UUID=6278bd34-44cd-41b9-9bdd-239d9ce4020a rw
</code></pre><p>意思是创建一个标题为Arch Linux的启动项,它用bootloader所在分区(/dev/sda1)根目录下的vmlinuz-linux作为Linux内核,initramfs-linux.img作为initramfs镜像(可以认为是一个临时rootfs镜像),并且用root=/dev/sda2 ro作为内核参数。</p>
<p>再编辑/boot/loader/loader.conf.</p>
<pre><code>timeout 3
default arch
</code></pre><p>意思是默认用arch.conf的配置启动,等待3秒没有键盘操作即使用默认配置启动。</p>
<h2 id="新系统的网络">新系统的网络</h2>
<p>启动盘中默认配置好了有关网络的软件,但新的系统中却没有。
如果你只是使用单一且固定的有线网络,使用<code>systemctl enable dhcpcd@interface.service</code>就可以了(interface是你的网络接口名,可以使用ip link查看,类似enp3s0)。
如果要使用无线网络,那么就要使用<code>pacman -S iw wpa_supplicant dialog</code>命令安装这些软件包。如果失败,可能要安装固件。</p>
<p>至此,新系统的配置就完成了。</p>
<p>使用exit命令退出chroot环境,umount -R /mnt卸载挂载的分区,然后使用reboot重启一下就好了。</p>
<h1 id="最后">最后</h1>
<p>可能会启动失败,解决方法是进入BIOS里的设置把UEFI作为唯一的启动方式。然后保存退出,就可以看到有三个启动项(分别是Arch Linux, Windows Manage, Default),选择你要进入的系统就可以了。</p></content><category scheme="http://blog.wxchat.xyz/tags/archlinux/" term="archlinux" label="archlinux"/><category scheme="http://blog.wxchat.xyz/tags/windows/" term="windows" label="windows"/><category scheme="http://blog.wxchat.xyz/tags/uefi/" term="uefi" label="uefi"/></entry><entry><title type="text">Chromium OS源码编译、U盘安装及使用笔记</title><link rel="alternate" type="text/html" href="http://blog.wxchat.xyz/posts/chromium-os-install/"/><id>http://blog.wxchat.xyz/posts/chromium-os-install/</id><updated>2020-07-06T16:40:23+08:00</updated><published>2018-06-02T23:41:10+00:00</published><author><name>Vladimir</name><uri>http://blog.wxchat.xyz/</uri><email>hcjonline@gmail.com</email></author><rights>[CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/deed.en)</rights><summary type="html">根据官方文档 https://www.chromium.org/chromium-os/quick-start-guide 只有Ubuntu Trusty版本的安装方式写了个ArchLinux的安装方法
安装依赖 Arch Linux 4.16.12-1-ARCH x86_64 GNU/Linux 有sudo权限的用户 基本依赖 确保有如下包就好了,没有就用pacman -S 安装就是:
sudo pacman -S git-core gitk git-gui subversion curl lvm2 thin-provisioning-tools python-pkg-resources python-virtualenv python-oauth2client 安装depot_tools 用git克隆下来就好了,但要注意python的版本,后面会说.</summary><content type="html"><blockquote>
<p>根据官方文档 <a href="https://www.chromium.org/chromium-os/quick-start-guide">https://www.chromium.org/chromium-os/quick-start-guide</a> 只有Ubuntu Trusty版本的安装方式写了个ArchLinux的安装方法</p>
</blockquote>
<h1 id="安装依赖">安装依赖</h1>
<ul>
<li>Arch Linux 4.16.12-1-ARCH</li>
<li>x86_64 GNU/Linux</li>
<li>有sudo权限的用户</li>
</ul>
<h2 id="基本依赖">基本依赖</h2>
<p>确保有如下包就好了,没有就用<code>pacman -S</code> 安装就是:</p>
<pre><code>sudo pacman -S git-core gitk git-gui subversion curl lvm2 thin-provisioning-tools python-pkg-resources python-virtualenv python-oauth2client
</code></pre><h2 id="安装depot_tools">安装depot_tools</h2>
<p>用git克隆下来就好了,但要注意python的版本,后面会说.</p>
<pre><code>cd ~/Source/
git clone https://chromium.googlesource.com/chromium/tools/depot_tools
</code></pre><p>确保deport_tools目录在PATH变量里</p>
<h2 id="sudoers配置">sudoers配置</h2>
<p>要设置Chrome操作系统构建环境,应该关闭sudo的tty_tickets选项,因为它与cros_sdk不兼容。执行如下操作:</p>
<pre><code>cd /tmp
cat &gt; ./sudo_editor &lt;&lt;EOF
#!/bin/sh
echo Defaults \!tty_tickets &gt; \$1 # Entering your password in one shell affects all shells
echo Defaults timestamp_timeout=180 &gt;&gt; \$1 # Time between re-requesting your password, in minutes
EOF
chmod +x ./sudo_editor
sudo EDITOR=./sudo_editor visudo -f /etc/sudoers.d/relax_requirements
</code></pre><h1 id="获取源码">获取源码</h1>
<p>创建一个目录来保存源文件“${SOURCE_REPO}”。</p>
<pre><code>export SOURCE_REPO=&quot;~/Source/chromiumos&quot;
mkdir ${SOURCE_REPO}
cd ${SOURCE_REPO}
virtualenv -p /usr/bin/python2 venv #这里我们要把python环境切换为2.7,才能使用下面的repo
repo init -u https://chromium.googlesource.com/chromiumos/manifest.git
# Optional: Make any changes to .repo/local_manifests/local_manifest.xml before syncing
repo sync
</code></pre><h1 id="创建chromiumos">创建chromiumos</h1>
<h2 id="构建包">构建包</h2>
<pre><code>export BOARD=amd64-generic
cros_sdk -- ./build_packages --board=${BOARD}
</code></pre><h2 id="构建镜像">构建镜像</h2>
<pre><code>cros_sdk -- ./build_image --board=${BOARD}
</code></pre><h2 id="烧入usb">烧入USB</h2>
<p>键入 <code>sudo fdisk -l</code> 查看插入U盘所在区域,然后执行如下操作烧录编译的系统到U盘</p>
<pre><code>cros_sdk -- cros flash usb:///dev/sdd ~/chromiumos/src/build/images/amd-generic/latest/chromiumos_test_image.bin
</code></pre><h2 id="修改分区">修改分区</h2>
<p>如果要使用自定义大小容量的分区构建镜像,请考虑在 build_library/legacy_disk_layout.json 中添加新的磁盘布局或使用 adjust_part。请参阅下面的帮助,</p>
<pre><code>adjust_part ='STATE:1G' ---- 将1GB添加到状态分区
adjust_part ='ROOT-A:-1G' ---- 从主rootfs分区中删除1GB
adjust_part ='STATE:= 1G' --- 设置状态分区为1GB
</code></pre><p>这里键入 <code>cros_sdk -- ./build_image --board=${BOARD} --noenable_rootfs_verification test --adjust_part='STATE:+10G'</code>,这样我们的Chromium OS用户空间便增加10G,如果使用默认设置你会发现用户空间容量不足(约140MB)</p>
<h1 id="最后">最后</h1>
<p>修改要安装到目标机器的bios启动项为U盘启动,插入U盘,启动。</p>
<p>进入系统,按Ctrl + Alt + Back(F2)。在提示符下输入chronos并使用以下命令进行安装。</p>
<pre><code>/usr/sbin/chromeos-install
</code></pre></content><category scheme="http://blog.wxchat.xyz/tags/chromiumos/" term="ChromiumOS" label="ChromiumOS"/><category scheme="http://blog.wxchat.xyz/tags/archlinux/" term="archlinux" label="archlinux"/></entry><entry><title type="text">Arch Linux 内核更新 修复无线模块rtl8821ce编译失败的问题</title><link rel="alternate" type="text/html" href="http://blog.wxchat.xyz/posts/kernel-upgrade-fix-rtl8821ce/"/><id>http://blog.wxchat.xyz/posts/kernel-upgrade-fix-rtl8821ce/</id><updated>2020-07-06T16:40:23+08:00</updated><published>2018-05-19T01:36:07+00:00</published><author><name>Vladimir</name><uri>http://blog.wxchat.xyz/</uri><email>hcjonline@gmail.com</email></author><rights>[CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/deed.en)</rights><summary type="html">最近更新系统,内核从4.15 更新到了 4.16.9发现原来的无线模块编译不通过,找不到头文件stdarg.h
查看无线驱动信息 通过ip l可以看到只有有线网卡
1: lo: &lt;LOOPBACK,UP,LOWER_UP&gt; mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: enp3s0: &lt;BROADCAST,MULTICAST&gt; mtu 1500 qdisc fq_codel state DOWN mode DEFAULT group default qlen 1000 link/ether 8c:16:45:3f:68:0d brd ff:ff:ff:ff:ff:ff 查看无线网卡驱动,找到相应的驱动去下载就好了</summary><content type="html"><blockquote>
<p>最近更新系统,内核从4.15 更新到了 4.16.9发现原来的无线模块编译不通过,找不到头文件stdarg.h</p>
</blockquote>
<h1 id="查看无线驱动信息">查看无线驱动信息</h1>
<p>通过<code>ip l</code>可以看到只有有线网卡</p>
<pre><code>
1: lo: &lt;LOOPBACK,UP,LOWER_UP&gt; mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp3s0: &lt;BROADCAST,MULTICAST&gt; mtu 1500 qdisc fq_codel state DOWN mode DEFAULT group default qlen 1000
link/ether 8c:16:45:3f:68:0d brd ff:ff:ff:ff:ff:ff
</code></pre><p>查看无线网卡驱动,找到相应的驱动去下载就好了</p>
<pre><code>lspci | grep -i 'newwork'
Network controller: Realtek Semiconductor Co., Ltd. RTL8821CE 802.11ac PCIe Wireless Network Adapter
</code></pre><h1 id="下载无线驱动源码">下载无线驱动源码</h1>
<pre><code>git clone https://github.com/endlessm/linux
</code></pre><p>由于这个项目特别的大,这里只需要下载drivers/net/wireless/rtl8821ce</p>
<h1 id="编译">编译</h1>
<h2 id="修改makefile">修改Makefile</h2>
<p>这里需要修改Makefile中TopDIR变量的值为当前路径,否则会提示错误退出</p>
<pre><code>cd drivers/net/wireless/rtl8821ce
sed -i 's/export TopDIR ?=/export TopDIR ?= $(shell pwd)/g' Makefile
</code></pre><h2 id="执行make">执行<code>make</code></h2>
<p>在最新的内核版本(4.16.9-1-ARCH)下编译失败,提示如下:</p>
<pre><code>graz@graz ~/Source/driver_net_wireless/rtl8821ce % make
/usr/bin/make ARCH=x86_64 CROSS_COMPILE= -C /lib/modules/4.16.9-1-ARCH/build M=/home/graz/Source/driver_net_wireless/rtl8821ce modules
make[1]: Entering directory '/usr/lib/modules/4.16.9-1-ARCH/build'
CC [M] /home/graz/Source/driver_net_wireless/rtl8821ce/core/rtw_cmd.o
In file included from ./include/linux/list.h:9,
from ./include/linux/module.h:9,
from /home/graz/Source/driver_net_wireless/rtl8821ce/include/basic_types.h:81,
from /home/graz/Source/driver_net_wireless/rtl8821ce/include/drv_types.h:31,
from /home/graz/Source/driver_net_wireless/rtl8821ce/core/rtw_cmd.c:22:
./include/linux/kernel.h:6:10: fatal error: stdarg.h: No such file or directory
#include &lt;stdarg.h&gt;
^~~~~~~~~~
compilation terminated.
</code></pre><p>通过<code>locate stdarg.h</code>找到头文件 &ldquo;/usr/lib/gcc/x86_64-pc-linux-gnu/8.1.0/include/stdarg.h&rdquo;</p>
<pre><code>ln -s /usr/lib/gcc/x86_64-pc-linux-gnu/8.1.0/include/stdarg.h include/
</code></pre><p>软链接创建好后,就可以执行<code>make</code>编译成功</p>
<h2 id="安装">安装</h2>
<pre><code>sudo make install
modprobe 8821ce
</code></pre><p>最后,没有报错的话,通过<code>ip l</code> 就可以找到这个无线网卡了</p>
<pre><code>1: lo: &lt;LOOPBACK,UP,LOWER_UP&gt; mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp3s0: &lt;BROADCAST,MULTICAST&gt; mtu 1500 qdisc fq_codel state DOWN mode DEFAULT group default qlen 1000
link/ether 8c:16:45:3f:68:0d brd ff:ff:ff:ff:ff:ff
3: wlp5s0: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000
link/ether 70:c9:4e:d8:6d:01 brd ff:ff:ff:ff:ff:ff
</code></pre></content><category scheme="http://blog.wxchat.xyz/tags/rtl8821ce/" term="rtl8821ce" label="rtl8821ce"/><category scheme="http://blog.wxchat.xyz/tags/linux/" term="linux" label="linux"/></entry><entry><title type="text">博客系统从ghost 迁移hexo 安装与配置</title><link rel="alternate" type="text/html" href="http://blog.wxchat.xyz/posts/hexo-install/"/><id>http://blog.wxchat.xyz/posts/hexo-install/</id><updated>2020-07-06T16:40:23+08:00</updated><published>2018-05-06T16:33:21+00:00</published><author><name>Vladimir</name><uri>http://blog.wxchat.xyz/</uri><email>hcjonline@gmail.com</email></author><rights>[CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/deed.en)</rights><summary type="html">备份Ghost 后台export,导出后是一个JSON,包含所有文章以及一些元数据:修改日期、Tags 等等
图片等资源,可以到 assets 文件夹下,打包下载
cd /data/www/ghost tar -zcvf images.tag assets/content 安装hexo 安装依赖 pacman -S npm 安装 npm install hexo-cli -g cd /data/www/ hexo init hcaijin.com cd hcaijin.com hexo install hexo server 迁移 导入Ghost数据 ## 安装数据转换插件 npm install hexo-migrator-ghost --save ## 导入数据 hexo migrate ghost ghost-export.</summary><content type="html"><h1 id="备份ghost">备份Ghost</h1>
<p>后台export,导出后是一个JSON,包含所有文章以及一些元数据:修改日期、Tags 等等</p>
<p>图片等资源,可以到 assets 文件夹下,打包下载</p>
<pre><code>cd /data/www/ghost
tar -zcvf images.tag assets/content
</code></pre><h1 id="安装hexo">安装hexo</h1>
<h2 id="安装依赖">安装依赖</h2>
<pre><code>pacman -S npm
</code></pre><h2 id="安装">安装</h2>
<pre><code>npm install hexo-cli -g
cd /data/www/
hexo init hcaijin.com
cd hcaijin.com
hexo install
hexo server
</code></pre><h1 id="迁移">迁移</h1>
<h2 id="导入ghost数据">导入Ghost数据</h2>
<pre><code>## 安装数据转换插件
npm install hexo-migrator-ghost --save
## 导入数据
hexo migrate ghost ghost-export.json
</code></pre><h2 id="导入图片">导入图片</h2>
<pre><code>cp images.tag /data/www/hcaijin.com/source/
cd /data/www/hcaijin.com/source/
tar -zxvf images.tag
</code></pre><h1 id="最后做一些必要的配置">最后,做一些必要的配置</h1>
<h2 id="基本配置">基本配置</h2>
<ul>
<li><a href="https://hexo.io/zh-cn/docs/configuration.html">Hexo 配置</a></li>
<li><a href="http://theme-next.iissnan.com/getting-started.html">NexT 配置</a></li>
<li><a href="http://theme-next.iissnan.com/theme-settings.html">NexT 高级配置</a></li>
</ul>
<h2 id="安装其他插件">安装其他插件</h2>
<pre><code>npm install hexo-generator-searchdb --save
npm install hexo-generator-sitemap --save
npm install hexo-generator-feed --save
npm install hexo-pwa --save
npm install hexo-all-minifier --save
</code></pre></content><category scheme="http://blog.wxchat.xyz/tags/hexo/" term="hexo" label="hexo"/><category scheme="http://blog.wxchat.xyz/tags/ghost/" term="ghost" label="ghost"/></entry><entry><title type="text">ghost 更新记录</title><link rel="alternate" type="text/html" href="http://blog.wxchat.xyz/posts/ghost-upgrade/"/><id>http://blog.wxchat.xyz/posts/ghost-upgrade/</id><updated>2020-07-06T16:40:23+08:00</updated><published>2017-05-06T12:33:21+00:00</published><author><name>Vladimir</name><uri>http://blog.wxchat.xyz/</uri><email>hcjonline@gmail.com</email></author><rights>[CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/deed.en)</rights><summary type="html">好久没有更新ghost 0.6.0,今天更新的时候发现最新版本,0.11.11 版本 更新安装的时候报错。
查看error日志,是依赖的npm和node版本问题。解决方法就是要么升级npm,node,要么降级ghost到npm,node支持的版本。
升级npm,node在这里就不说了,网上有很多的方法,我用的是搬瓦工家的最便宜vps,使用的npm,node不好升级,估计还得升级linux内核,我就不打算使用这个方法了。
降级ghost到npm,node支持的版本。 我们到Ghost各版本历史去找一下历史版本,我尝试了几个版本,最后确定0.8.0这个版本是可以正常使用的。
这样我们就可以开始升级ghost了。升级ghost不需要停了当前的服务,但是,升级更新都要做好备份。
备份 登陆并进入https://$HOSTNAME/ghost/debug这个页面导出备份。
最好能登陆到服务器进入ghost安装的目录备份一下根目录下的content,这一步要先暂停服务。
cd /data/www/ghost tar -zcvf ghost-content.tag content 备份好以后,我们就可以删除与升级相关的目录了文件。
rm -rf core/ node_modules/ index.</summary><content type="html"><p>好久没有更新ghost 0.6.0,今天更新的时候发现最新版本,0.11.11 版本 更新安装的时候报错。</p>
<p>查看error日志,是依赖的npm和node版本问题。解决方法就是要么升级npm,node,要么降级ghost到npm,node支持的版本。</p>
<ul>
<li>
<p>升级npm,node在这里就不说了,网上有很多的方法,我用的是搬瓦工家的最便宜vps,使用的npm,node不好升级,估计还得升级linux内核,我就不打算使用这个方法了。</p>
</li>
<li>
<p>降级ghost到npm,node支持的版本。
我们到<a href="https://github.com/TryGhost/Ghost/releases">Ghost各版本历史</a>去找一下历史版本,我尝试了几个版本,最后确定0.8.0这个版本是可以正常使用的。</p>
</li>
</ul>
<blockquote>
<p>这样我们就可以开始升级ghost了。升级ghost不需要停了当前的服务,但是,升级更新都要做好备份。</p>
</blockquote>
<h3 id="备份">备份</h3>
<p>登陆并进入https://$HOSTNAME/ghost/debug这个页面导出备份。</p>
<p>最好能登陆到服务器进入ghost安装的目录备份一下根目录下的content,这一步要先暂停服务。</p>
<pre><code>cd /data/www/ghost
tar -zcvf ghost-content.tag content
</code></pre><blockquote>
<p>备份好以后,我们就可以删除与升级相关的目录了文件。</p>
</blockquote>
<pre><code>rm -rf core/ node_modules/ index.js *.json
</code></pre><h3 id="下载最新版本">下载最新版本</h3>
<pre><code>curl -LOk https://github.com/TryGhost/Ghost/releases/download/0.8.0/Ghost-0.8.0.zip
</code></pre><p>然后解压到/data/www/ghost</p>
<pre><code>cd ~
unzip -uo Ghost-0.8.0.zip -d /data/www/ghost
</code></pre><h3 id="安装并重启">安装并重启</h3>
<pre><code>npm cache clear &amp;&amp; npm install --production
</code></pre><p>没有报错的话就是安装成功了。</p>
<p>重启ghost</p>
<pre><code>NODE_ENV=production pm2 start index.js --name &quot;ghost&quot;
</code></pre></content><category scheme="http://blog.wxchat.xyz/tags/ghost/" term="ghost" label="ghost"/></entry><entry><title type="text">Linux 系统Chrome,Firefox程序无用使用Fcitx的问题解决方法</title><link rel="alternate" type="text/html" href="http://blog.wxchat.xyz/posts/linux-%E7%B3%BB%E7%BB%9Fchrome-firefox%E7%A8%8B%E5%BA%8F%E6%97%A0%E7%94%A8%E4%BD%BF%E7%94%A8fcitx%E7%9A%84%E9%97%AE%E9%A2%98%E8%A7%A3%E5%86%B3%E6%96%B9%E6%B3%95/"/><id>http://blog.wxchat.xyz/posts/linux-%E7%B3%BB%E7%BB%9Fchrome-firefox%E7%A8%8B%E5%BA%8F%E6%97%A0%E7%94%A8%E4%BD%BF%E7%94%A8fcitx%E7%9A%84%E9%97%AE%E9%A2%98%E8%A7%A3%E5%86%B3%E6%96%B9%E6%B3%95/</id><updated>2020-07-06T16:40:23+08:00</updated><published>2016-12-25T05:04:29+00:00</published><author><name>Vladimir</name><uri>http://blog.wxchat.xyz/</uri><email>hcjonline@gmail.com</email></author><rights>[CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/deed.en)</rights><summary type="html">起因 使用的gentoo有半年没有更新系统了,原来用的好好的输入法,更新完以后,在其他的程序都可以正常使用fcitx。但是,在chrome,firefox(后来知道应该是GTK,QT相关的程序用了最新版导致的问题)就是用不了,网上也有很多人提问,也没有一个有效的解决方法。
环境 Linux hcj-arch 4.4.39-1-lts #1 SMP Thu Dec 15 21:10:18 CET 2016 x86_64 GNU/Linu fcitx version: 4.2.9.1 Google Chrome 55.0.2883.87 Mozilla Firefox 50.1.0 检查 首先保证环境变量有设置,当然,如果其他程序都可以使用,那这个应该是没有问题的
export GTK_IM_MODULE=fcitx export QT_IM_MODULE=fcitx export XMODIFIERS=@im=fcitx 主要的问题就是我们要用命令 fcitx-diagnose 查看fcitx的相关模块是不是有安装。(更无脑的方式就是把这个命令里显示为红色的信息都看一遍,把相关的模块安装上就ok了)</summary><content type="html"><h3 id="起因">起因</h3>
<p>使用的gentoo有半年没有更新系统了,原来用的好好的输入法,更新完以后,在其他的程序都可以正常使用fcitx。但是,在chrome,firefox(后来知道应该是GTK,QT相关的程序用了最新版导致的问题)就是用不了,网上也有很多人提问,也没有一个有效的解决方法。</p>
<h3 id="环境">环境</h3>
<ul>
<li>Linux hcj-arch 4.4.39-1-lts #1 SMP Thu Dec 15 21:10:18 CET 2016 x86_64 GNU/Linu</li>
<li>fcitx version: 4.2.9.1</li>
<li>Google Chrome 55.0.2883.87</li>
<li>Mozilla Firefox 50.1.0</li>
</ul>
<h3 id="检查">检查</h3>
<p>首先保证环境变量有设置,当然,如果其他程序都可以使用,那这个应该是没有问题的</p>
<pre><code>export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS=@im=fcitx
</code></pre><p>主要的问题就是我们要用命令 <code>fcitx-diagnose</code> 查看fcitx的相关模块是不是有安装。(更无脑的方式就是把这个命令里显示为红色的信息都看一遍,把相关的模块安装上就ok了)</p>
<p>那么,我们可以看到:
<img src="http://blog.wxchat.xyz/content/images/2017/01/Screenshot_2016-12-27_10-51-56.png" alt=""></p>
<p><img src="http://blog.wxchat.xyz/content/images/2017/01/Screenshot_2016-12-27_10-52-09.png" alt=""></p>
<p>== 如上图所示,缺少gtk2,gtk3相关的模块支持,导致的Chrome,Firefox等gtk软件无法使用输入法的情况 ==</p>
<h3 id="解决">解决</h3>
<p>我们先看一下fcitx构建时用到的USE标记,以下
<img src="http://blog.wxchat.xyz/content/images/2017/01/Screenshot_2017-01-09_11-06-32.png" alt="">
可以看到,我自己设置的是默认不安装gtk支持的,所以我们要加上,有以下两种方法:</p>
<ul>
<li>可以直接在/etc/portage/make.conf USE标记上加上gtk的支持</li>
<li>直接定义USE标记,加上gtk的支持</li>
</ul>
<pre><code> USE=&quot;X autostart cairo dbus enchant introspection nls pango qt4 table xml -debug gtk2 gtk3 -lua -opencc -static-libs {-test}&quot; sudo emerge fcitx
</code></pre><blockquote>
<p>最后,重新编译安装过fcitx以后,再看一下<code>fcitx-diagnose</code>,只要没有红色相关字体的警告信息,就说明已经可以正常使用了。把浏览器重启一下,如果还不行,得重启一下系统。</p>
</blockquote></content><category scheme="http://blog.wxchat.xyz/tags/linux/" term="linux" label="linux"/><category scheme="http://blog.wxchat.xyz/tags/chrome/" term="chrome" label="chrome"/><category scheme="http://blog.wxchat.xyz/tags/firefox/" term="firefox" label="firefox"/><category scheme="http://blog.wxchat.xyz/tags/fcitx/" term="fcitx" label="fcitx"/></entry><entry><title type="text">Linux挂载Mac系统下的dmg文件</title><link rel="alternate" type="text/html" href="http://blog.wxchat.xyz/posts/linux%E6%8C%82%E8%BD%BDmac%E7%B3%BB%E7%BB%9F%E4%B8%8B%E7%9A%84dmg%E6%96%87%E4%BB%B6/"/><id>http://blog.wxchat.xyz/posts/linux%E6%8C%82%E8%BD%BDmac%E7%B3%BB%E7%BB%9F%E4%B8%8B%E7%9A%84dmg%E6%96%87%E4%BB%B6/</id><updated>2020-07-06T16:40:23+08:00</updated><published>2016-05-27T05:06:32+00:00</published><author><name>Vladimir</name><uri>http://blog.wxchat.xyz/</uri><email>hcjonline@gmail.com</email></author><rights>[CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/deed.en)</rights><summary type="html">最近想在virtualbox下安装Mac系统,了解到Mac的安装镜像文件是dmg格式的,并下载到了 Install OS X Yosemite 10.10.1.dmg 安装包。
解压缩 本来以为Mac的安装与其他系统的类似,只要把镜像包在虚拟机中做为cd启动就可以了,然而并没什么用 - -
这不,想到把dmg格式的包转化为iso的格式再在虚拟机中启动,这就有了这篇文章的问题了。
google到这个工具acetoneiso可以直接把dmg格式的转为iso
但是,我想是不是可以用更简单的方法来操作。 现在的dmg一般都使用(zlib 或者 bzip2压缩算法)压缩过
需要使用dmg2img把dmg文件转为img
$ dmg2img Install\ OS\ X\ Yosemite\ 10.10.1.dmg yosemite.img 提示如,就表示成功了: Archive successfully decompressed as yosemite.</summary><content type="html"><blockquote>
<p>最近想在virtualbox下安装Mac系统,了解到Mac的安装镜像文件是dmg格式的,并下载到了 Install OS X Yosemite 10.10.1.dmg 安装包。</p>
</blockquote>
<h2 id="解压缩">解压缩</h2>
<p>本来以为Mac的安装与其他系统的类似,只要把镜像包在虚拟机中做为cd启动就可以了,然而并没什么用 - -</p>
<p>这不,想到把dmg格式的包转化为iso的格式再在虚拟机中启动,这就有了这篇文章的问题了。</p>
<p>google到这个工具acetoneiso可以直接把dmg格式的转为iso</p>
<p>但是,我想是不是可以用更简单的方法来操作。
现在的dmg一般都使用(zlib 或者 bzip2压缩算法)压缩过</p>
<p>需要使用dmg2img把dmg文件转为img</p>
<pre><code>$ dmg2img Install\ OS\ X\ Yosemite\ 10.10.1.dmg yosemite.img
</code></pre><p>提示如,就表示成功了:
Archive successfully decompressed as yosemite.img</p>
<h2 id="检查模块">检查模块</h2>
<p>在挂载之前我们要先确保hfsplus模块启用:</p>
<pre><code>lsmod | grep hfs
</code></pre><p>如果没有输出,就表示模块未启用,使用如下命令启用:</p>
<pre><code>modprobe hfsplus
</code></pre><h2 id="挂载">挂载</h2>
<p>启用成功后,就可以用mount挂载img,这里我挂载失败,提示存在坏道,在<a href="http://www.linuxquestions.org/questions/linux-software-2/how-to-mount-dos-img-file-4175430554/">这里</a>才找到了解决的方法。</p>
<pre><code>mount -t hfsplus -o loop my.img /mnt/hfs
mount: wrong fs type, bad option, bad superblock on /dev/loop0,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
</code></pre><h3 id="问题处理">问题处理</h3>
<p>查询系统日志在最下面提示如下信息:</p>
<pre><code>dmesg | tail
[2015609.436682] hfsplus: unable to find HFS+ superblock
</code></pre><p>解决方案:</p>
<p>1.先用fdisk查询img扇区
<img src="http://blog.wxchat.xyz/content/images/2016/05/--_2016-05-27_17-42-21.png" alt="">
可以看到它有两个设备*.img1,*.img2</p>
<p>2.把img的文件挂载出来就得找到开始挂载的起始扇区,所以要设置一下offset的值,
这里<code>offset=1259643×512</code>,运行以下:</p>
<pre><code>sudo mount -t hfsplus -v -o loop,offset=644937216 yosemite.img /mnt/hfs
</code></pre><p>以上,就可以把镜像挂载到了目录/mnt/hfs下。</p></content><category scheme="http://blog.wxchat.xyz/tags/linux/" term="linux" label="linux"/><category scheme="http://blog.wxchat.xyz/tags/mount/" term="mount" label="mount"/><category scheme="http://blog.wxchat.xyz/tags/mac/" term="mac" label="mac"/><category scheme="http://blog.wxchat.xyz/tags/virtualbox/" term="virtualbox" label="virtualbox"/></entry><entry><title type="text">idea tomcat 启动web应用异常处理</title><link rel="alternate" type="text/html" href="http://blog.wxchat.xyz/posts/idea-tomcat-%E5%90%AF%E5%8A%A8web%E5%BA%94%E7%94%A8%E5%BC%82%E5%B8%B8%E5%A4%84%E7%90%86/"/><id>http://blog.wxchat.xyz/posts/idea-tomcat-%E5%90%AF%E5%8A%A8web%E5%BA%94%E7%94%A8%E5%BC%82%E5%B8%B8%E5%A4%84%E7%90%86/</id><updated>2020-07-06T16:40:23+08:00</updated><published>2016-05-11T05:28:04+00:00</published><author><name>Vladimir</name><uri>http://blog.wxchat.xyz/</uri><email>hcjonline@gmail.com</email></author><rights>[CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/deed.en)</rights><summary type="html">2016-05-11 16:36:25.799 [RMI TCP Connection(4)-127.0.0.1] ERROR org.springframework.web.context.ContextLoader - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'shiroFilter' defined in file [/home/hcj/Work/data/ecerp-saas/Sources/ecerp/out/artifacts/ecerp_web_war_exploded/WEB-INF/classes/spring/applicationContext.xml]: Cannot resolve reference to bean 'securityManager' while setting bean property 'securityManager'; nested exception is org.</summary><content type="html"><pre><code>2016-05-11 16:36:25.799 [RMI TCP Connection(4)-127.0.0.1] ERROR org.springframework.web.context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'shiroFilter' defined in file [/home/hcj/Work/data/ecerp-saas/Sources/ecerp/out/artifacts/ecerp_web_war_exploded/WEB-INF/classes/spring/applicationContext.xml]: Cannot resolve reference to bean 'securityManager' while setting bean property 'securityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityManager' defined in file [/home/hcj/Work/data/ecerp-saas/Sources/ecerp/out/artifacts/ecerp_web_war_exploded/WEB-INF/classes/spring/applicationContext.xml]: Cannot resolve reference to bean 'shiroSubjectFactory' while setting bean property 'subjectFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'shiroSubjectFactory': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private gy.erp.service.admin.SecurityMonitor gy.erp.shiro.ShiroSubjectFactory.securityMonitor; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityMonitor' defined in class path resource [spring-domain.xml]: Cannot resolve reference to bean 'sessionService' while setting bean property 'sessionService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionService': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalArgumentException: Invalid registry store file /data/erp.guanyisoft.com/tomcat/ecerp-web.properties, cause: Failed to create directory /data/erp.guanyisoft.com/tomcat!
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:329) ~[spring-beans-3.2.0.RELEASE.jar:3.2.0.RELEASE]
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:107) ~[spring-beans-3.2.0.RELEASE.jar:3.2.0.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1391) ~[spring-beans-3.2.0.RELEASE.jar:3.2.0.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1132) ~[spring-beans-3.2.0.RELEASE.jar:3.2.0.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:522) ~[spring-beans-3.2.0.RELEASE.jar:3.2.0.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461) ~[spring-beans-3.2.0.RELEASE.jar:3.2.0.RELEASE]
at org.
</code></pre><p>java报错总要看异常信息,以上主要关键的地方列在这里:</p>
<pre><code>;nested exception is java.lang.IllegalArgumentException: Invalid registry store file /data/erp.guanyisoft.com/tomcat/ecerp-web.properties, cause: Failed to create directory /data/erp.guanyisoft.com/tomcat!
</code></pre><p>idea tomcat 在启动web应用的时候会生成一个注册dubbo服务的文件,需要指定生成路径,以前项目都是默认生成在out文件里的吧,最近,不知道什么变动,需要手工在项目配置文件application.properties 指定一下:</p>
<pre><code>dubbo.registry.file = /home/hcj/Work/data/ecerp-web.properties
</code></pre></content><category scheme="http://blog.wxchat.xyz/tags/java/" term="java" label="java"/><category scheme="http://blog.wxchat.xyz/tags/tomcat/" term="tomcat" label="tomcat"/><category scheme="http://blog.wxchat.xyz/tags/idea/" term="idea" label="idea"/></entry><entry><title type="text">Linux 声卡驱动问题</title><link rel="alternate" type="text/html" href="http://blog.wxchat.xyz/posts/linux-%E5%A3%B0%E5%8D%A1%E9%A9%B1%E5%8A%A8%E9%97%AE%E9%A2%98/"/><id>http://blog.wxchat.xyz/posts/linux-%E5%A3%B0%E5%8D%A1%E9%A9%B1%E5%8A%A8%E9%97%AE%E9%A2%98/</id><updated>2020-07-06T16:40:23+08:00</updated><published>2016-03-21T01:54:57+00:00</published><author><name>Vladimir</name><uri>http://blog.wxchat.xyz/</uri><email>hcjonline@gmail.com</email></author><rights>[CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/deed.en)</rights><summary type="html">最近转Gentoo,一切安装就绪了,但是想使用youtube观看视频的时候,竟没有声音,估计又得折腾一下了。
(Advanced Linux Sound Architecture,ALSA)是Linux中提供声音设备驱动的内核组件,用来代替原来的开放声音系统(Open Sound System,OSSv3)。
系统环境:Linux hcj.com 4.1.15-gentoo-r1 组件:alsa 前提:内核已经配置支持 硬件设备显示 lspci | grep -i audio 安装 euse -E alsa emerge --ask --changed-use --deep @world emerge --ask alsa-utils 启动声音服务 /etc/init.</summary><content type="html"><blockquote>
<p>最近转Gentoo,一切安装就绪了,但是想使用youtube观看视频的时候,竟没有声音,估计又得折腾一下了。</p>
</blockquote>
<p>(Advanced Linux Sound Architecture,ALSA)是Linux中提供声音设备驱动的内核组件,用来代替原来的开放声音系统(Open Sound System,OSSv3)。</p>
<ul>
<li>系统环境:Linux hcj.com 4.1.15-gentoo-r1</li>
<li>组件:alsa</li>
<li>前提:内核已经配置支持</li>
</ul>
<h3 id="硬件设备显示">硬件设备显示</h3>
<pre><code>lspci | grep -i audio
</code></pre><p><img src="http://blog.wxchat.xyz/content/images/2016/03/--_2016-03-21_22-46-22.png" alt=""></p>
<h3 id="安装">安装</h3>
<pre><code>euse -E alsa
emerge --ask --changed-use --deep @world
emerge --ask alsa-utils
</code></pre><h3 id="启动声音服务">启动声音服务</h3>
<pre><code>/etc/init.d/alsasound start
rc-update add alsasound boot ###声音服务设置boot级别
</code></pre><h3 id="列出设备名">列出设备名</h3>
<pre><code>cat /sys/class/sound/card*/id
</code></pre><p><img src="http://blog.wxchat.xyz/content/images/2016/03/--_2016-03-22_07-16-34.png" alt=""></p>
<h3 id="配置默认设备">配置默认设备</h3>
<pre><code>vi ~/.asoundrc
</code></pre><p><img src="http://blog.wxchat.xyz/content/images/2016/03/--_2016-03-22_07-17-59.png" alt=""></p>
<p>最后,别忘了重启一下。</p>
<p><a href="https://wiki.archlinux.org/index.php/Advanced_Linux_Sound_Architecture">参考链接1</a></p>
<p><a href="https://wiki.gentoo.org/wiki/ALSA">参考链接2</a></p></content><category scheme="http://blog.wxchat.xyz/tags/linux/" term="linux" label="linux"/><category scheme="http://blog.wxchat.xyz/tags/alsamixer/" term="alsamixer" label="alsamixer"/></entry><entry><title type="text">Gentoo安装RTL8723BE无线网卡驱动</title><link rel="alternate" type="text/html" href="http://blog.wxchat.xyz/posts/gentoo%E5%AE%89%E8%A3%85rtl8723be%E6%97%A0%E7%BA%BF%E7%BD%91%E5%8D%A1%E9%A9%B1%E5%8A%A8/"/><id>http://blog.wxchat.xyz/posts/gentoo%E5%AE%89%E8%A3%85rtl8723be%E6%97%A0%E7%BA%BF%E7%BD%91%E5%8D%A1%E9%A9%B1%E5%8A%A8/</id><updated>2020-07-06T16:40:23+08:00</updated><published>2016-03-17T07:40:43+00:00</published><author><name>Vladimir</name><uri>http://blog.wxchat.xyz/</uri><email>hcjonline@gmail.com</email></author><rights>[CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/deed.en)</rights><summary type="html">新配了个ThinkPad E55c 安装Gentoo时无线网卡没能正确识别。网上查了一下是3.15内核版本之前还没有包含这个驱动,需要手动安装一下。但是我想说我安装的内核版本是4.1,而且也安装了linux-firmware固件,可是怎么就没有这个驱动呢 - - 暂时先不深究。
内核版本:Kernel: x86_64 Linux 4.1.15-gentoo-r1 网卡型号:RTL8723BE 确认网卡型号 lspci -k | grep Network 下载源码 git clone https://github.com/lwfinger/rtlwifi_new.git cd rtlwifi_new/ make &amp;&amp; make install 手动加载模块 modprobe rtl8723be ## 手动加载rtl8723be模块 modinfo rtl8723be ## 查看模块详情 模块加载成功,使用lspci -k看一下,如果显示的是如下图说明无线网卡驱动安装成功: 最后ip addr show 可以看到对应的网卡设备了 自启动加载模块 cat /etc/conf.</summary><content type="html"><blockquote>
<p>新配了个ThinkPad E55c 安装Gentoo时无线网卡没能正确识别。网上查了一下是3.15内核版本之前还没有包含这个驱动,需要手动安装一下。但是我想说我安装的内核版本是4.1,而且也安装了linux-firmware固件,可是怎么就没有这个驱动呢 - - 暂时先不深究。</p>
</blockquote>
<ul>
<li>内核版本:Kernel: x86_64 Linux 4.1.15-gentoo-r1</li>
<li>网卡型号:RTL8723BE</li>
</ul>
<h3 id="确认网卡型号">确认网卡型号</h3>
<pre><code>lspci -k | grep Network
</code></pre><p><img src="http://blog.wxchat.xyz/content/images/2016/03/--_2016-03-18_04-16-28.png" alt=""></p>
<h3 id="下载源码">下载源码</h3>
<pre><code>git clone https://github.com/lwfinger/rtlwifi_new.git
cd rtlwifi_new/
make &amp;&amp; make install
</code></pre><h3 id="手动加载模块">手动加载模块</h3>
<pre><code>modprobe rtl8723be ## 手动加载rtl8723be模块
modinfo rtl8723be ## 查看模块详情
</code></pre><p>模块加载成功,使用<code>lspci -k</code>看一下,如果显示的是如下图说明无线网卡驱动安装成功:
<img src="http://blog.wxchat.xyz/content/images/2016/03/--_2016-03-18_04-17-37.png" alt="">
最后<code>ip addr show </code>可以看到对应的网卡设备了
<img src="http://blog.wxchat.xyz/content/images/2016/03/--_2016-03-18_04-30-58.png" alt=""></p>
<h3 id="自启动加载模块">自启动加载模块</h3>
<pre><code>cat /etc/conf.d/modules
modules=&quot;rtl8723be&quot;
</code></pre><p><a href="https://wiki.archlinux.org/index.php/Wireless_network_configuration">引用</a></p></content><category scheme="http://blog.wxchat.xyz/tags/linux/" term="linux" label="linux"/><category scheme="http://blog.wxchat.xyz/tags/gentoo/" term="Gentoo" label="Gentoo"/><category scheme="http://blog.wxchat.xyz/tags/rtl8723be/" term="rtl8723be" label="rtl8723be"/></entry><entry><title type="text">git常规使用</title><link rel="alternate" type="text/html" href="http://blog.wxchat.xyz/posts/git%E5%B8%B8%E8%A7%84%E4%BD%BF%E7%94%A8/"/><id>http://blog.wxchat.xyz/posts/git%E5%B8%B8%E8%A7%84%E4%BD%BF%E7%94%A8/</id><updated>2020-07-06T16:40:23+08:00</updated><published>2016-03-15T02:21:09+00:00</published><author><name>Vladimir</name><uri>http://blog.wxchat.xyz/</uri><email>hcjonline@gmail.com</email></author><rights>[CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/deed.en)</rights><summary type="html">远程仓库有master和dev分支 克隆代码 git clone &lt;git url&gt; 查看所有分支 git branch --all 默认有了dev和master分支,所以会看到如下三个分支
master[本地主分支] origin/master[远程主分支] origin/dev[远程开发分支] ==新克隆下来的代码默认master和origin/master是关联的,也就是他们的代码保持同步,但是origin/dev分支在本地没有任何的关联,所以我们无法在那里开发==
创建本地关联origin/dev的分支 git checkout dev origin/dev 创建本地分支dev,并且和远程origin/dev分支关联,本地dev分支的初始代码和远程的dev分支代码一样
切换到dev分支进行开发 git checkout dev # 这个是切换到dev分支,然后就是常规的开发 假设远程仓库只有mater分支 克隆代码 git clone &lt;git url&gt; 查看所有分支 git branch --all 默认只有master分支,所以会看到如下两个分支</summary><content type="html"><h3 id="远程仓库有master和dev分支">远程仓库有master和dev分支</h3>
<h4 id="克隆代码">克隆代码</h4>
<pre><code>git clone &lt;git url&gt;
</code></pre><h4 id="查看所有分支">查看所有分支</h4>
<pre><code>git branch --all
</code></pre><blockquote>
<p>默认有了dev和master分支,所以会看到如下三个分支</p>
</blockquote>
<ul>
<li>master[本地主分支]</li>
<li>origin/master[远程主分支]</li>
<li>origin/dev[远程开发分支]</li>
</ul>
<p>==新克隆下来的代码默认master和origin/master是关联的,也就是他们的代码保持同步,但是origin/dev分支在本地没有任何的关联,所以我们无法在那里开发==</p>
<h4 id="创建本地关联origindev的分支">创建本地关联origin/dev的分支</h4>
<pre><code>git checkout dev origin/dev
</code></pre><p>创建本地分支dev,并且和远程origin/dev分支关联,本地dev分支的初始代码和远程的dev分支代码一样</p>
<h4 id="切换到dev分支进行开发">切换到dev分支进行开发</h4>
<pre><code>git checkout dev # 这个是切换到dev分支,然后就是常规的开发
</code></pre><h3 id="假设远程仓库只有mater分支">假设远程仓库只有mater分支</h3>
<h4 id="克隆代码-1">克隆代码</h4>
<pre><code>git clone &lt;git url&gt;
</code></pre><h4 id="查看所有分支-1">查看所有分支</h4>
<pre><code>git branch --all
</code></pre><blockquote>
<p>默认只有master分支,所以会看到如下两个分支</p>
</blockquote>
<ul>
<li>master[本地主分支]</li>
<li>origin/master[远程主分支]</li>
</ul>
<p>==新克隆下来的代码默认master和origin/master是关联的,也就是他们的代码保持同步==</p>
<h4 id="创建本地新的dev分支">创建本地新的dev分支</h4>
<pre><code>git branch dev # 创建本地分支
git branch # 查看分支
</code></pre><p>这时会看到master和dev,而且master上会有一个星号
这个时候dev是一个本地分支,远程仓库不知道它的存在
本地分支可以不同步到远程仓库,我们可以在dev开发,然后merge到master,使用master同步代码,当然也可以同步</p>
<h4 id="发布dev分支">发布dev分支</h4>
<p>发布dev分支指的是同步dev分支的代码到远程服务器</p>
<pre><code>git push origin dev:dev # 这样远程仓库也有一个dev分支了
</code></pre><h4 id="在dev分支开发代码">在dev分支开发代码</h4>
<pre><code>git checkout dev # 切换到dev分支进行开发
</code></pre><blockquote>
<p>开发代码之后,我们有两个选择</p>
</blockquote>
<ul>
<li>第一个:如果功能开发完成了,可以合并主分支</li>
</ul>
<pre><code>git checkout master # 切换到主分支
git merge dev # 把dev分支的更改和master合并
git push # 提交主分支代码远程
git checkout dev # 切换到dev远程分支
git push # 提交dev分支到远程
</code></pre><ul>
<li>第二个:如果功能没有完成,可以直接推送</li>
</ul>
<pre><code>git push # 提交到dev远程分支
</code></pre><p>== 注意:在分支切换之前最好先commit全部的改变,除非你真的知道自己在做什么 ==</p>
<h4 id="删除分支">删除分支</h4>
<pre><code>git push origin :dev # 删除远程dev分支,危险命令哦
</code></pre><blockquote>
<p>下面两条是删除本地分支</p>
</blockquote>
<pre><code>git checkout master # 切换到master分支
git branch -d dev # 删除本地dev分支
</code></pre><h4 id="progitpdf">progit.pdf</h4>
<p>书籍格式和语言:中文、英文、PDF、ePub
下载地址:http://git-scm.com/book</p>
<p><a href="https://www.zhihu.com/question/21995370/answer/19975870">转载</a></p></content><category scheme="http://blog.wxchat.xyz/tags/git/" term="git" label="git"/></entry><entry><title type="text">ss-redir 的 iptables 配置(透明代理)</title><link rel="alternate" type="text/html" href="http://blog.wxchat.xyz/posts/ss-redir-%E7%9A%84-iptables-%E9%85%8D%E7%BD%AE-%E9%80%8F%E6%98%8E%E4%BB%A3%E7%90%86/"/><id>http://blog.wxchat.xyz/posts/ss-redir-%E7%9A%84-iptables-%E9%85%8D%E7%BD%AE-%E9%80%8F%E6%98%8E%E4%BB%A3%E7%90%86/</id><updated>2020-07-06T16:40:23+08:00</updated><published>2016-03-09T08:22:01+00:00</published><author><name>Vladimir</name><uri>http://blog.wxchat.xyz/</uri><email>hcjonline@gmail.com</email></author><rights>[CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/deed.en)</rights><summary type="html">透明代理指对客户端透明,客户端不需要进行任何设置就使用了网管设置的代理规则 创建
/etc/ss-redir.json 本地监听 1080 运行ss-redir -v -c /etc/ss-redir.json NAT表配置脚本 基本配置
iptables -t nat -N SHADOWSOCKS # 在 nat 表中创建新链 iptables -t nat -A SHADOWSOCKS -p tcp --dport 23596 -j RETURN # 23596 是 ss 代理服务器的端口,即远程 shadowsocks 服务器提供服务的端口,如果你有多个 ip 可用,但端口一致,就设置这个 iptables -t nat -A SHADOWSOCKS -d 123.</summary><content type="html"><blockquote>
<p>透明代理指对客户端透明,客户端不需要进行任何设置就使用了网管设置的代理规则
创建</p>
</blockquote>
<pre><code>/etc/ss-redir.json 本地监听 1080 运行ss-redir -v -c /etc/ss-redir.json
</code></pre><h3 id="nat表配置脚本">NAT表配置脚本</h3>
<p>基本配置</p>
<pre><code>iptables -t nat -N SHADOWSOCKS
# 在 nat 表中创建新链
iptables -t nat -A SHADOWSOCKS -p tcp --dport 23596 -j RETURN
# 23596 是 ss 代理服务器的端口,即远程 shadowsocks 服务器提供服务的端口,如果你有多个 ip 可用,但端口一致,就设置这个
iptables -t nat -A SHADOWSOCKS -d 123.456.789.111 -j RETURN
# 123.456.789.111 是 ss 代理服务器的 ip, 如果你只有一个 ss服务器的 ip,却能选择不同端口,就设置此条
iptables -t nat -A SHADOWSOCKS -d 0.0.0.0/8 -j RETURN
iptables -t nat -A SHADOWSOCKS -d 10.0.0.0/8 -j RETURN
iptables -t nat -A SHADOWSOCKS -d 127.0.0.0/8 -j RETURN
iptables -t nat -A SHADOWSOCKS -d 169.254.0.0/16 -j RETURN
iptables -t nat -A SHADOWSOCKS -d 172.16.0.0/12 -j RETURN
iptables -t nat -A SHADOWSOCKS -d 192.168.0.0/16 -j RETURN
iptables -t nat -A SHADOWSOCKS -d 224.0.0.0/4 -j RETURN
iptables -t nat -A SHADOWSOCKS -d 240.0.0.0/4 -j RETURN
iptables -t nat -A SHADOWSOCKS -p tcp -j REDIRECT --to-ports 1080
# 1080 是 ss-redir 的监听端口,ss-local 和 ss-redir 的监听端口不同,配置文件不同
</code></pre><p>最后是应用上面的规则,将OUTPUT出去的tcp流量全部经过SOCKS链</p>
<pre><code>
#如果是在openwrt上实现透明代理的话,使用下面被注释了的规则
iptables -t nat -I PREROUTING -p tcp -j SHADOWSOCKS
# 在 PREROUTING 链前插入 SHADOWSOCKS 链,使其生效
在个人电脑上使用以下配置
iptables -t nat -A OUTPUT -p tcp -j SHADOWSOCKS
</code></pre><h3 id="如果要过滤国内流量可以">如果要过滤国内流量可以</h3>
<p>列表太长了就不列出来了!</p>
<h3 id="清除自定义规则">清除自定义规则</h3>
<p>清空整个链 iptables -F 链名,比如:</p>
<pre><code>iptables -t nat -F SHADOWSOCKS
</code></pre><p>删除指定的用户自定义链 iptables -X 链名 比如:</p>
<pre><code>iptables -t nat -X SHADOWSOCKS
</code></pre><p>从所选链中删除规则 iptables -D 链名 规则详情 比如:</p>
<pre><code>iptables -t nat -D SHADOWSOCKS -d 223.223.192.0/255.255.240.0 -j RETURN
</code></pre><h3 id="解决dns污染的问题">解决DNS污染的问题</h3>
<pre><code>$ sudo pacman -S archlinuxcn/dnsmasq-china-list-git
$ sudo dnsmasq-update-china-list 114
####脚本如下:
#!/bin/bash
case &quot;$1&quot; in
114)
DNS=114.114.114.114
;;
ali)
DNS=223.5.5.5
;;
cnnic)
DNS=1.2.4.8
;;
baidu)
DNS=180.76.76.76
;;
google)
DNS=8.8.8.8
;;
*)
DNS=$1
esac
sed -i &quot;s|^\(server.*\)/[^/]*$|\1/$DNS|&quot; /etc/dnsmasq.d/accelerated-domains.china.conf
</code></pre></content><category scheme="http://blog.wxchat.xyz/tags/iptables/" term="iptables" label="iptables"/><category scheme="http://blog.wxchat.xyz/tags/shadowsocks/" term="shadowsocks" label="shadowsocks"/></entry><entry><title type="text">Linux系统挂载NTFS移动硬盘</title><link rel="alternate" type="text/html" href="http://blog.wxchat.xyz/posts/linux%E7%B3%BB%E7%BB%9F%E6%8C%82%E8%BD%BDntfs%E7%A7%BB%E5%8A%A8%E7%A1%AC%E7%9B%98/"/><id>http://blog.wxchat.xyz/posts/linux%E7%B3%BB%E7%BB%9F%E6%8C%82%E8%BD%BDntfs%E7%A7%BB%E5%8A%A8%E7%A1%AC%E7%9B%98/</id><updated>2020-07-06T16:40:23+08:00</updated><published>2016-03-08T02:19:36+00:00</published><author><name>Vladimir</name><uri>http://blog.wxchat.xyz/</uri><email>hcjonline@gmail.com</email></author><rights>[CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/deed.en)</rights><summary type="html">工作中,同事之间拷贝数据的时候,由于我用的linux系统无法识别同事的NTFS移动硬盘,这才网上查了一下,原来还得安装一个软件,以下是转载的文章,记录一下。
有时候做大数据量迁移时,为了快速迁移大数据,有可能在Linux服务器上临时挂载NTFS格式的移动硬盘, 一般情况下,Linux是识别不了NTFS格式移动硬盘的(需要重编译Linux核心才能,加挂NTFS分区),这时候为了能让Linux服务器能够识别NTFS的移动硬盘,就必须安装ntfs-3g(Third Generation Read/Write NTFS Driver)的包。
NTFS-3G介绍 NTFS-3G是一个开源项目,NTFS-3G是为Linux, Android, Mac OS X, FreeBSD, NetBSD, OpenSolaris, QNX, Haiku,和其他操作系统提供的一个稳定的,功能齐全,读写NTFS的驱动程序的。它提供了安全处理Windows XP,Windows Server 2003,Windows 2000,Windows Vista,Windows Server 2008和Windows 7操作系统下的NTFS文件系统。
NTFS-3g是一个开源软件,它支持在Linux下面读写NTFS格式的分区。它非常的快速,同时也很安全。它支持Windows 2000、XP、2003和Vista,并且支持所有的符合POSIX标准的磁盘操作。 ntfs-3g的目的是为了持续的发展,各硬件平台和操作系统的用户需要可靠的互通与支持ntfs的驱动,ntfs-3g可以提供可信任的、功能丰富的高性能解决方案。经过了12年多的发展,ntfs-3g已经逐渐稳定;</summary><content type="html"><blockquote>
<p>工作中,同事之间拷贝数据的时候,由于我用的linux系统无法识别同事的NTFS移动硬盘,这才网上查了一下,原来还得安装一个软件,以下是<a href="http://www.cnblogs.com/kerrycode/archive/2013/04/01/2993701.html">转载</a>的文章,记录一下。</p>
</blockquote>
<hr>
<p>有时候做大数据量迁移时,为了快速迁移大数据,有可能在Linux服务器上临时挂载NTFS格式的移动硬盘, 一般情况下,Linux是识别不了NTFS格式移动硬盘的(需要重编译Linux核心才能,加挂NTFS分区),这时候为了能让Linux服务器能够识别NTFS的移动硬盘,就必须安装ntfs-3g(Third Generation Read/Write NTFS Driver)的包。</p>
<hr>
<p>NTFS-3G介绍
NTFS-3G是一个开源项目,NTFS-3G是为Linux, Android, Mac OS X, FreeBSD, NetBSD, OpenSolaris, QNX, Haiku,和其他操作系统提供的一个稳定的,功能齐全,读写NTFS的驱动程序的。它提供了安全处理Windows XP,Windows Server 2003,Windows 2000,Windows Vista,Windows Server 2008和Windows 7操作系统下的NTFS文件系统。</p>
<p>NTFS-3g是一个开源软件,它支持在Linux下面读写NTFS格式的分区。它非常的快速,同时也很安全。它支持Windows 2000、XP、2003和Vista,并且支持所有的符合POSIX标准的磁盘操作。 ntfs-3g的目的是为了持续的发展,各硬件平台和操作系统的用户需要可靠的互通与支持ntfs的驱动,ntfs-3g可以提供可信任的、功能丰富的高性能解决方案。经过了12年多的发展,ntfs-3g已经逐渐稳定;</p>
<blockquote>
<p>资料介绍</p>
</blockquote>
<ul>
<li>官方网址:http://www.tuxera.com/,</li>
<li>文档手册:http://www.tuxera.com/community/ntfs-3g-manual/</li>
<li>下载地址:http://www.tuxera.com/community/ntfs-3g-download/</li>
</ul>
<h3 id="安装">安装</h3>
<h4 id="解压安装ntfs-3g">解压安装NTFS-3G。</h4>
<pre><code class="language- " data-lang=" ">tar -xvzf ntfs-3g_ntfsprogs-2012.1.15.tgz
cd ntfs-3g_ntfsprogs-2012.1.15
./configure
make
make install
</code></pre><p><em>如果没有报错,提示安装成功,下面就可以用ntfs-3g来实现对NTFS分区的读写了</em></p>
<h3 id="配置">配置</h3>
<h4 id="配置挂载ntfs格式的移动硬盘">配置挂载NTFS格式的移动硬盘</h4>
<h5 id="首先得到ntfs分区的信息">首先得到NTFS分区的信息</h5>
<pre><code>$ sudo fdisk -l | grep NTFS
/dev/sdc1 * 1 244 1955776+ 7 HPFS/NTFS
</code></pre><h5 id="设置挂载点用如下命令实现挂载">设置挂载点,用如下命令实现挂载</h5>
<pre><code>mount -t ntfs-3g &lt;NTFS Partition&gt; &lt;Mount Point&gt;
</code></pre><blockquote>
<p>例如得到的NTFS分区信息为/dev/sdc1,挂载点设置在/mnt/usb下:</p>
</blockquote>
<pre><code>$ mount -t ntfs-3g /dev/sdc1 /mnt/usb
########## 或者直接用 #######
$ ntfs-3g ntfs-3g /dev/sdc1 /mnt/usb
</code></pre><h4 id="如果想实现开机自动挂载可以在etcfstab里面添加如下格式语句">如果想实现开机自动挂载,可以在/etc/fstab里面添加如下格式语句</h4>
<pre><code>&lt;NTFS Partition&gt; &lt;Mount Point&gt; ntfs-3g silent,umask=0,locale=zh_CN.utf8 0 0
</code></pre><p>==这样可以实现NTFS分区里中文文件名的显示。 ==</p>
<p> </p>