-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWSL_Kubernetes_Python3_Project__27thSep2021.txt
6234 lines (5073 loc) · 377 KB
/
WSL_Kubernetes_Python3_Project__27thSep2021.txt
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
-----------------------------
Author : Twrcha AD
email : [email protected]
version: v1.5.3
created: 1st Dec 2020
updated: 27th Sep 2021
disply : 1920 x 1080
-----------------------------
@@@ DISCLAIMER: this file is a collection of best practises and know-how gathered from various sources, tested and verified by this document author within the subject linux environment for the best of the author's knowldage during the document dated period. meanwhile there are few un-verified commands/procedures which are highlighted/marked by the auther, however discrepancy still may occurs, due to the fact of no 100% matched environments. @@@
##########################################################################################################
# Welcome to Ubuntu-20.04.2-LTS-Focal-Fossa-WSL-KVM (GNU/Linux v5.4.72-microsoft-standard-WSL2 x86_64) #
# (oe-user@oe-host) (gcc version 8.2.0 (GCC)) #1 SMP Wed Oct 28 23:40:43 UTC 2020 #
# & Ubuntu-20.04-focal-fossa-gnome-desktop Kernel:(GNU/Linux v5.4.0.73_x86_64) #
##########################################################################################################
# (WSL) is Microsoft's version of Linux (KVM) Kernel-based Virtual Machine with user level process emulation.
This will allow the process to run in a different platform & architecture environment.
# (WSL/WSL1) Windows Subsystem for Linux: is a compatibility layer for running Linux binary executables (in ELF64 format) natively on Windows. it translates Linux instructions to Windows
instruction using "Pico Processeson" in Kernel mode, eliminating the need for a Linux Kernel with direct use of the host file system through VolFS, DrvFS and some parts of the hardware
such as the network, which guarantees interoperability. Web servers for example, can be accessed through the same interfaces and IP addresses configured on the host, and shares the same
restrictions on the use of ports that require administrative permissions, or ports already occupied by other applications. Furthermore, there is no emulation/virtualisation involved.
Released on 2nd August 2016 with (Windows10_x64-version-1607 or 1083 or later, while there is No server release of it).
# (LXSS Manager & LxssManagerUser_f7c4a) Services are the services in charge of interacting with the linux subsystem (through the drivers lxss.sys and lxcore.sys), and the way that
Bash.exe launches the Linux processes, as well as handling the Linux system calls and the binary locks during their execution. the LXSS Manager service supports running native ELF
binaries.
it provides the infrastructure necessary for ELF binaries to run on Windows.
# (WSL2) is Microsoft's newly developed open-source Linux Kernel, a complete Linux Kernel with full-ELF64 stack, hence it enables Full Linux System call capabilities. It runs as a
lightweight virtual Machine (VM) over Windows Virtual Machine Platform (WVMP) extension of Windows_x64 Kernel. released in 12th June 2019.
Available on (Windows10_x64_version-1903-Build-18362 & Windows10_ARM64_version-2004-Build-19041 & Windows-Server-2019_x64_version-1709 or higher).
# WSL2 does not replace WSL. It just runs alongside it. This means you can run Linux installs with a combination of different versions. You're able to set either as default as well as
setting a version specifically to each Linux distro you have on your PC.
# developers don't need to change anything in their published distributions. WSL2 settings can be tweaked by the WSL global configuration, contained in an INI file named ".wslconfig" in
the User Profile folder.
# The WSL-Linux-Distro-VM is located under the path below as an ".vhdx" Container-File/Virtual-Disk.
C:\Users\<username>\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgsc\LocalState\ext4.vhdx
C:\Users\<username>\AppData\Local\Packages\46932SUSE.openSUSELeap15.2_022rs5jcyhyac\LocalState\ext4.vhdx
C:\Users\<username>\AppData\Local\Packages\46932SUSE.openSUSE-Leap-15-1_022rs5jcyhyac\LocalState\ext4.vhdx
# The ext4 journaling file system or fourth extended filesystem is a journaling file system for Linux. it is also the default filesystem for Debian, Ubuntu, google & Android.
# the WSL linux distro access the host file system through the "9P protocol" (Plan 9 Filesystem Protocol or Styx). cross-platform filesystem performance issues due to "9P".
# WSL2's memory usage grows and shrinks as you use it. When a process frees memory this is automatically returned to Windows. However, as of right now WSL 2 does not yet release cached
pages in memory back to Windows until the WSL instance is shut down. If you have long running WSL sessions, or access a very large amount of files,
this cache can take up memory on Windows. We are tracking the work to improve this experience on the WSL Github repository issue 4166.
# (fork) In software engineering, a project fork happens when developers take a copy of source code from one software package and start independent development on it, creating a distinct
and separate piece of software.
# Windows 10 filesystem and drives can be accessed and handled within the WSL2 console interface itself. The drive partitions are mounted at launch within the path of /mnt/. For example,
the logical drive "C:\" mount at "/mnt/c".
# WSL2 is currently limited to the CLI. GUI is not natively supported. Although it is possible to run few number of GUI/Xserver applications (like GWSL) with small tweaks.
# (ELF64) Executable and Linkable Format: By design, the ELF format is flexible, extensible, and cross-platform. it supports different endiannesses and address sizes so it does not exclude
any particular (CPU) or instruction set architecture. This has allowed it to be adopted by many different operating systems on many different hardware platforms.
# (WVMP) Windows Virtual Machine Platform: is a (Subset) of Microsoft Hypervisor-V which is a Type1-Hypervisor running on Windows_x64 Kernel level.
# Microsoft Hyper-V Role: is a Type1-Hypervisor with full OS capability, with its subsystems runs in Windows_x64 platform Kernel mode. it coverts the Windows user mode layer to a vitual
management OS. It uses hardware-assisted virtualization. meaning that, virtualization is supported at the CPU level by Intel VT or by AMD-V. It is a built-in feature, that needs to be
turned on in (Windows7_x64_Pro & Enterprise or later & Windows-Server-2008_x64 & 2008-R2 editions or later).
# Linux distribution (distro): an operating system made from a software collection that is based upon the Linux kernel and, often, a package management system. different brands and
versions of Linux OS (RedHat, Fedora, Ubuntu, Kubuntu, OpenSUSE Tumbleweed & leap, Debian, KALI, CentOS, Alpine, etc.). There are over 600 Linux distros and about 500 in active
development.
# Linux licenseing: Free and Open-Source Software (FOSS), which is seen by free & Open source community as one of their "social responsibilities", "duty towards society" and a "social
obligation". pro-sharing norms might spread to influence other producers and projects.
# Free software licenses can be divided into two broad categories: copyleft licenses (like the GPL), which require derivatives of the software to be licensed under the same terms; and
permissive licenses (like the MIT/X11 license), which allow the software to be reused in any project, even closed-source projects (No Source code provided).
# Open Source (GNU GPLv3).
# (GPL) - General Public License part of the "GNU project" Sep 1983 by Richard Matthew Stallman aka(rms) the founder of the Free Software Foundation (FSF).
# (GNU) - "GNU's not Unix!" (a recursive acronym meaning).
# (GCC) - "GNU Compiler Collection" is an optimizing compiler produced by the GNU Project supporting various programming languages, hardware architectures and operating systems.
# (Copyleft) is a GPL license: the practice of granting the right to freely distribute and modify intellectual property with the requirement that the same rights be preserved in
derivative works created from that property. In the form of licenses it can be used to maintain copyright conditions for works ranging from computer software, to documents, art,
scientific discoveries and even certain patents.
# (Permissive) free software license, also known as "Copycenter" or "BSD-like or "BSD-style" license: is a free-software license with only minimal restrictions on how the software can
be used, modified, and redistributed, usually including a warranty disclaimer.
# (Pushover) a free license used with small programs, below 300 lines of code.
# (LGPL) is a 'weak copyleft', allowing licensed works to be used in closed-source works, but requiring improvements to the work itself to be released under a copyleft license.
# (MPL)
# Apache
# free-rider is someone who uses an Open Source software project without contributing to it.
# (LightDM) is the display manager running in Ubuntu up to version 16.04 LTS. While it has been replaced by (GDM) in later Ubuntu releases, LightDM is still used by default in the latest
release of several Ubuntu flavors. LightDM starts the X servers, user sessions and greeter (login screen).
# (bash) born again shell: is the first FOSS Unix/linux shell-interpreter based on POSIX, as (CLI) replacment for the proprietary Unix (bsh). it became the default shell for many
Unix/Linux Distro's such as Solaris, RedHat, Debian, Ubuntu, OpenSUSE.
# (zsh) z-shell is used by Apple MacOS since 2019.
# X Window System (X11, or simply X) is a windowing system (GUI) for bitmap displays, common on Unix-like operating systems.
# Linux/Unix x64 packages are taged as "amd64" because they made the 1st 64bit CPU architecture.
# Ubuntu 20.04 LTS from Microsoft app store includes a built-in Python3.8.x compiler.
# "Sudo" is root previlage for that specific following command.
# (apt) is a commandline package manager and provides commands for searching and managing as well as querying information about packages. It provides the same functionality as the
specialized APT tools, like "apt-get" and "apt-cache".
# .RPM package is Ubuntu supported automatic installation package.
# .tar.gz is a g-zipped tar package also called tarball.
# .zip is a zipped application package.
# *-bin.tar.gz is a binary package without the source code.
# *-src.tar.gz is a binary package along with the source code.
# (AAA) stands for "Authentication - Authorisation - Access" and refers to the user access management principle and the related AAA server with "TACACS+" or "RADIUS" security protocols.
# (TACACS+) "Terminal Access Controller Access Control System" uses (TCP) and all data transmitted are encrypted and it separates the three AAA operation stages for a better security.
# (RADIUS) "Remote Authentication Dial-In User Service": based on the IEEE802.1X standard, it runs in the application layer (7) and uses either (UDP or TCP) while encrypts only the user
password and combines the Authentication and Authorization starges of the AAA. Therefore it is less secured than TACACS+ .
# to verify the dwonloaded package integrity before instalation, you have to download the hash file Sha512 & asc (PGP signature file) which is the package encryption public key.
# Pretty Good Privacy (PGP) an encryption program that provides cryptographic privacy and authentication for data communication. it is used for signing, encrypting, and decrypting texts,
emails, files, directories, and whole disk partitions and to increase the security of e-mail communications.
# TLS-v1.2 or above is requirment to access the internet.
# SSL-v or above is requirment to access the internet.
# from 2016 onward, SHA-2 is the new standard. all SSL/TLS certificates today must be using that signature at a minimum.
# SHA-2: A family of two similar hash functions, with different block sizes, known as SHA-256 and SHA-512. They differ in the word size; SHA-256 uses 32-byte words where SHA-512 uses
64-byte words. There are also truncated versions of each standard, known as SHA-224, SHA-384, SHA-512/224 and SHA-512/256. These were also designed by the NSA.
# SHA "Secure Hash Algorithms" is a family of cryptographic hash functions published by the National Institute of Standards and Technology (NIST). SHA-2 standard is "FIPS PUB 180-2".
# SHA-2 will likely remain in use for at least five years. However, some unexpected attack against the algorithm could be discovered which would prompt an earlier transition.
# SHA-256 claims 128-bit collision resistance, SHA-512 claims 256-bit collision resistance. SHA-512 is generally faster on 64-bit processors, SHA-256 faster on 32-bit processors.
From a non-security perspective, the reasons to choose SHA-256 over the longer digests are more easily apparent: it's smaller, requiring less bandwidth to store and transmit,
less memory and in many cases less processing power to compute. (There are cases where SHA-512 is faster and more efficient).
# SHA-256 is just as secure as SHA-512 when it comes to to "Collisions Attacks" however SHA-512 is much more secure when it comes to "Length Extension Attacks".
# SHA-3: A hash function formerly called Keccak, chosen in 2012 after a public competition among non-NSA designers. It supports the same hash lengths as SHA-2, and its internal structure
differs significantly from the rest of the SHA family. NIST has updated Draft FIPS Publication 202, SHA-3 Standard separate from the Secure Hash Standard (SHS).
# (SysV) or System V: is one of the first and traditional init system managers for the UNIX/Linux operating system. Init is the first process started by the kernel during system boot,
and is a parent process for everything. with new versions it has been replaced by other init systems such as (launchd, Service Management, systemd and Upstart).
# (Upstart) is an event-based replacement for the /sbin/init daemon.
# (systemd) is a current most adopted init system & service manager for Linux distributions systems, and it uses socket and D-Bus activation for starting services providing aggressive
parallelisation capabilities and Keeps track of processes using Linux "cgroups".
# (NuGET) is the package management tool for the .NET and it is similar to PowerShellGet, MSI packages which support several commands and packages to work with PowerShell.
## A repository is a collection of files that has information about various software, their versions and some other details like the checksum.
Each Ubuntu version has its own official set of four repositories:
# Main – Canonical-supported free and open-source software.
# Universe – Community-maintained free and open-source software.
# Restricted – Proprietary drivers for devices.
# Multiverse – Software restricted by copyright or legal issues.
# Ubuntu's Offical online repository's URL "http://archive.ubuntu.com/ubuntu/dists/" .
# Microsoft linux packages repository URL;
deb https://packages.microsoft.com/ubuntu/20.04/prod/ focal main
deb-src https://packages.microsoft.com/ubuntu/20.04/prod/ focal main
# This information is stored in the sources.list file in the directory /etc/apt. If you look at its content, you’ll see that it has the URL of the repositories.
The lines with # at the beginning are ignored.
# the added repositories are located under "/var/lib/apt/lists".
# Now when you run the command sudo apt update, your system uses APT tool to check against the repo and stores the information about the software and their version in a cache.
When you use the command sudo apt install package_name, it uses the information to get that package from the URL where the actual software is stored.
# Ubuntu provides a platform called Launchpad that enables software developers to create their own repositories. An end user i.e. you can add the PPA repository to your sources.
list and when you update your system, your system would know about the availability of this new software and you can install it using the standard sudo apt install command like this.
# PPA stands for Personal Package Archive. The PPA allows application developers and Linux users to create their own repositories to distribute software. With PPA,
you can easily get newer software version or software that are not available via the official Ubuntu repositories.
# There are three places to check when troubleshooting online repositories update issues:
/etc/apt/sources.list file, this include the offical ubuntu online archive & other added non-PPA repositories using apt-add-repository.
/etc/apt/sources.list.d/ folder, (if you have systemd installed) here you will find different .list files with both PPA & non-PPA repositories URL's.
/etc/apt/apt.conf.d/sources.list file,
/var/lib/apt/lists/ folder, holds all the repositories cache (PPA & non-PPA). if you have a problem clear this cahce and remove the bad source from the first two locations above
before running apt update again.
# (pip) or (pip3) - stands for "PyPI, Python-Package-Installer" it is a command used to install Python packages from the Python Package Index (PyPI) online repository. The pip command can
be installed as part of the package manager for your Linux distro.
# (PyPI) - “Python Package Index” and it is the official central library for all the python packages, which means it consists of all the registered and licensed python packages.
# pip is used by Python2.x and earlier versions while pip3 is used by Python3.x , pip is the apt equivalent for python.
# Python3: WARNING: The "easy_install" command is deprecated and will be removed in a future version.
# download and install the free Windows x64 version of Anaconda3 "Anaconda Individual Edition" which covers a wide range of open source libraries/repositories for (Python, C++, C#, Java,
ML, Data science, Analytics, Data Mining, data modeling, etc.) and update through x64 Powershell 7.x (PS).
# install Anaconda3 in your WSL2 -Ubuntu 20.x environment.
# (LTS) stands for Long Term Support,
Ubuntu produces a new Ubuntu Desktop and Ubuntu Server release every six months. That means you'll always have the latest and the best applications in the open source world. Ubuntu is
designed with security in mind. You get free security updates for at least 9 months on the desktop and server.
A new LTS version is released every two years. In previous releases, a Long Term Support (LTS) version had three years support on Ubuntu (Desktop) and five years on Ubuntu Server.
Starting with Ubuntu 12.04 LTS, both versions received five years support. There is no extra fee for the LTS version.
# (LSB) Linux Standard Base: is a joint project by several Linux distributions under the organizational structure of the Linux Foundation to standardize the software system structure,
including the Filesystem Hierarchy Standard used in the Linux kernel. ##
# (.lock) file you mention is used to avoid running more than one instance of any software able to add packages (apt-get, aptitude, synaptic, ...).
This is necessary because the list of installed software is saved in DB file. Having more than one process accessing this DB will lead to corruption into it and break your installed
software DB. Lock files are created by a program when it is necessary to have only one instance of this program running at the same time.
Generally, this is to avoid that local files/DB are accessed concurrently because this may corrupt them.
# (GiB) Gibibytes: is a standard unit used in the field of data processing and transmission and is defined as base 1024 rather than base 1000. ##
# There are different tools that can be used to create a bootable USB device, here are few opensource utilities/commands (dd command & Mkusb toolset) as linux CLI commands, while
there are many GUI utilities with various capabilities and OS/filesystem support. for example (Rufus, UNetbootin, Universal-USB-Installer, Multi-writer, etc.). ##
# The “static-hostname" is the traditional hostname, which can be chosen by the user.
The “pretty-hostname" is a free-form UTF8 host name for presentation to the user. ##
# Note that while DNS allows domain name up to 255 characters, the hostname in Linux is limited to 64 characters only. ##
# The static-hostname is stored in "/etc/hostname" file, while pretty-hostname and icon-name are stored in the "/etc/machine-info" file. ##
# your distro "/etc/apt/sources.list" file containes a list of the standard online repositories and whatever your have added/modified afterward.
# Files and directories whose names begin with a dot "." by default are not displayed in directory listings by the standard command ls.
Therefore, they are traditionally used to store settings, preferences, etc.. Many graphical file browsers ignore the convention of hiding file names beginning with a ".",
so it is not necessarily correct any longer to call these files "hidden".
# there are also two special directory names in this class: the directory named simply "." is an alias for the same directory in which it appears (a self reference),
and the directory named ".." refers to the parent directory of ".".
# get-pip.py Python2 pip:
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. upgrade your Python to at least v3.6. knowing that pip 21.0 has dropped support for Python 2.7 in January 2021.
More details about Python2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
# (SNI) Server Name Indication: extension to TLS as part of HTTPS communication.
# UbuntuDDE Remix 21.04: is a Remix flavor of Ubuntu system with Deepin Desktop Environment (DDE). UbuntuDDE is a linux distribution based on Ubuntu with the most beautiful desktop
environment. Its initial release is UbuntuDDE Remix 20.04 focal based on Ubuntu 20.04 LTS focal and is supported by the UbuntuDDE community.
# (Playonlinux) which is based on "wine" is a free tool which facilitate/run Microsoft Windows based apps and games on linux.
# (Crossover) is similar to Playonlinux but it is proprietary (not free).
# localhost is 127.0.0.1, while 172.16.0.0/12 is the default space (172.16.0.0 - 172.31.255.255) for WSL2.
-------------------------------------------------
Windows10 name resolution DNS/NETBIOS/ARP :
-------------------------------------------------
## WSL2 shares the same hostname with its Windows10 host machine which can cause name resolution issues for both.
## You should NOT try and paste your new hosts file over the top of an existing hosts file – it won’t work. Make sure you rename the original hosts file.
## "C:\Windows\System32\drivers\etc\hosts" Windows hosts file path. once finished editing, fulsh the DNS cache on the host machine "ipconfig /flushdns" to load the new settings.
## "/etc/hosts" hosts file location on WSL.
## make sure to leave one last empty line in the hosts file.
## Note that you cannot use the hosts file for https, only for http, so you’ll need to test your new server without SSL and then switch to https once happy.
## the IP "127.0.0.1" represents "localhost" by default.
## Things that normally go wrong:
Trying to edit the hosts file in C:\Windows\System32\drivers\etc .
Trying to paste over the hosts file in C:\Windows\System32\drivers\etc .
Trying to edit the new hosts file with anything other than Windows Notepad.
Leaving the new hosts file as a text file, without removing the extension.
Forgetting the final empty line in the hosts file.
Expecting to be able to access an encrypted address (https://) with the hosts file.
Performing any of this as a non admin user.
Using a security app that blocks access to the hosts file, e.g. “Webroot”.
## Nodes: When configuring TCP/IP on a client, one of the options that you may see (depending on the installation) is the node type. The node type refers to how the client finds a domain
controller to service its logon requests.
There are four node types in TCP/IP:
------------------------------------
B-node (broadcast node): When a client needs to find a domain controller, it will perform a broadcast. The first domain controller to respond will be handed the job of servicing the
logon request.
P-node (point-to-point node): In this environment, name queries go directly to the WINS server.
M-node (multi-homed node): An m-node environment uses b-node first and then—if necessary—p-node to resolve names.
H-node (hybrid node): An h-node environment uses p-node first and then b-node if the name service is unavailable. ##
## (base) PS C:\Users\ardal> ipconfig /all
Windows IP Configuration
Host Name . . . . . . . . . . . . : PineGap # Windows 10 & WSL Hostname.
Primary Dns Suffix . . . . . . . :
Node Type . . . . . . . . . . . . : Hybrid
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No
DNS Suffix Search List. . . . . . : home
## Ethernet adapter vEthernet (WSL):
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter #3
Physical Address. . . . . . . . . : 00-15-5D-BB-3B-D0
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . : fe80::65d5:e500:a479:4fdf%56(Preferred)
IPv4 Address. . . . . . . . . . . : 172.20.48.1(Preferred) # WSL VM IP.
Subnet Mask . . . . . . . . . . . : 255.255.240.0
Default Gateway . . . . . . . . . :
DHCPv6 IAID . . . . . . . . . . . : 939529565
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-27-D9-90-E3-E4-A4-71-E2-17-CE
DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
fec0:0:0:ffff::2%1
fec0:0:0:ffff::3%1
NetBIOS over Tcpip. . . . . . . . : Enabled
## Wireless LAN adapter Wi-Fi:
Connection-specific DNS Suffix . : home
Description . . . . . . . . . . . : Intel(R) Dual Band Wireless-AC 8260
Physical Address. . . . . . . . . : E4-A4-71-E2-17-CE
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
IPv6 Address. . . . . . . . . . . : 2a00:23c7:ff04:c501:6df7:8a57:6997:8f07(Preferred)
Temporary IPv6 Address. . . . . . : 2a00:23c7:ff04:c501:69b8:f445:6fe1:36e2(Preferred)
Link-local IPv6 Address . . . . . : fe80::6df7:8a57:6997:8f07%11(Preferred)
IPv4 Address. . . . . . . . . . . : 192.168.1.240(Preferred) # Windows Host IP.
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : fe80::ced4:2eff:fed8:6a3e%11
192.168.1.254
DHCPv6 IAID . . . . . . . . . . . : 165979249
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-27-D9-90-E3-E4-A4-71-E2-17-CE
DNS Servers . . . . . . . . . . . : fe80::ced4:2eff:fed8:6a3e%11
192.168.1.254
8.8.8.8
NetBIOS over Tcpip. . . . . . . . : Enabled
Connection-specific DNS Suffix Search List : home
-------------------------------
Linux file types & extensions:
-------------------------------
# *.service # is a systemd service unit.
# *.service.d #
# *.service.requires #
# *.target #
# *.target.wants #
# *.scope #
# *.socket #
# *.sock # seen under Docker units.
# *.device #
# *.timer #
# *.list #
# *.mount #
# *.automount #
# *.conf #
# *.config #
# *.order #
# *.path #
# *.slice #
# *.slice.d #
# *.d #
# *.deb #
# *.run # ".run" files are typically proprietary and encoded binary files. You can't really see what they're doing.
# *.json #
# *.swp # vim file editor swapped/recoverd file.
# *.nupkg # Nuget installation package for Powershell.
# *.beam # Elixir & Erlang/OTP BEAM package.
# *.dev #
# *.deb # debian package.
# *.yaml #
# *.yml #
# *.git # git package.
# *.tar.gz # Z compressed tar package.
# *.jar # zip compressed package.
# *.sh # bash script.
# *.py # Python script.
# *.html #
# *.php #
# *.gif #
# *.bzr #
# *.hg #
# *.svn #
# *.lock #
# *.mlocate #
# *.dpkg-old #
# *.blacklist #
# *.bashrc #
# *.rpm # ".rpm" is the installation package file for distros such as RedHat & OpenSUSE, there are cross-platform support for such packages on Ubuntu.
# *.exe # Microsoft Windows executable file, cross-platform support is available for this type of files through "mono" command.
# *.ini #
# *[blank] # files with no extension.
# .* # file or folder names that starts with ".".
---------------
Type of Units:
---------------
# Daemon # is a subset of a service that always run in memory waiting to service a request.
# Service # a process or multi processes or sub processes that include daemons.
# process # is a Non-Daemon subset that relies on "xinetd" (a daemon) to service and pass the requests to be processed & served.
-----------------------------
Service-Commands & Contents:
-----------------------------
# Description= # a systemd unit option that defines, the unit descriptions with details about the unit.
# after= # a systemd unit option that defines, the unit startup sequence or prioritisation.
# requires= # a systemd unit option that defines, the unit hard dependencies, (the unt will fail to load, if the condition is not met).
# Wants= # a systemd unit option that defines, the unit soft dependencies, (the unit will pacially load, some features/functions may not work properly).
# ExecStart= # defines, what commands to execute/run when starting a service.
# ExecStop= # defines, what commands to execute/run when stopping a service.
# ExecReload= # defines, what commands to execute/run when reloading a service.
# ExecStartPre= # defines, what commands to execute/run before starting a service.
# ExecStartPost= # defines, what commands to execute/run after starting a service.
# ExecStopPre= # defines, what commands to execute/run before stopping a service.
# ExecStopPost= # defines, what commands to execute/run after stopping a service.
# sd_notify= # send a notification.
# busName= # defines the dbus name required to start the unit daemon.
------------------
Type of services:
------------------
# simple # simple single command execution.
# forking # the start process initiates a child/sub process which will become the main process/service.
# oneshot # runs and finishes before the next unit starts the service/process may still considered as "active" even after the command exits, if the "RemainAfterExit" option is set to "yes" (the default is "no").
# dbus # the service will requist a specific name and wont run unless that name is aquired.
# notify # sends a notification via "sd_notify" function, once sent then the next unit is initiated.
----------------------------
Type of download packages :
----------------------------
# *.tar.gz
# *.jar
# *.zip
# *.git
# *.run
# *.rpm
# *.deb
---------------------
Type of installers :
---------------------
aptitude install # package manager.
snap install # package manager.
cargo install # package manager.
flatpak install # package manager.
tasksel install # package manager.
dpkg # an old method of unpacking & installing downloaded application packages.
bash *.sh # or (./*.sh) execute a bash configuration &/or installtion script.
./configure.sh # configure a source code before compilation, used with packages that has YAML/JSON config file. it represents an in-memory POJO of the app's.
./bootstrap.sh # configure a source code before compilation. The pre-start application environment, containing everything required to bootstrap a Dropwizard command.
# Environment - A Dropwizard application's environment.
make # compile a downloaded and extracted source code.
Make install # install the compiled source code.
cmake .. # a similar advance version of make that compiles complex, large & graphical source code packages.
gdebi <*.deb> # a Debian package compiler.
apt-get install <packageName> # Ubuntu / Debian / KALI Linux distro's.
dnf install <packageName> # Fedora Linux.
yum install <packageName> # CentOS & RHEL Linux Distro's.
zypper install <packageName> # OpenSUSE linux.
pacman -S <packageName> # Arch & Manjaro Linux distro's.
## Source code classis and compilation:
# Dropwizard: is basically an opinionated web framework, primarily used for serving as a REST API project. The classes you're asking about are the crux of what makes a Dropwizard
application. The developers have combined all of the libraries they want used in their framework and wired them together so it can easily work off of what they've
bootstrapped for us.##
# Environment: is the Dropwizard Environment container, not your application's personal environment (i.e. local vs. production). It has properties that are core to the Dropwizard
framework such as the jersey web container. the Environment shouldn't used to determine database connection types and credentials; that is what your Configuration .yml file is for.
You'll want to put any environment specific variables in that file and then run your application with a specific .yml file. I personally have an application-local.yml,
application-staging.yml and application-prod.yml and run my application with the appropriate .yml depending on the environment. Dropwizard does some auto configuration of
datasources with specific .yml properties. ##
# Bootstrap: is basically the class that wires up everything being used in the Environment, including your Configuration and Application.
If you have a look at the source files, you'll get a good idea of how these classes are working. ##
# Configure: script is responsible for getting ready to build the software on your specific system. It makes sure all of the dependencies for the rest of the build and install process
are available, and finds out whatever it needs to know to use those dependencies. Unix programs are often written in C, so we’ll usually need a C compiler to build them. In these
cases the configure script will establish that your system does indeed have a C compiler, and find out what it’s called and where to find it.
#####################################
# Online software stores for Ubuntu #
#####################################
software-center # (an obsolete GUI store), is a discontinued high-level graphical front end for the APT/dpkg package management system. It is free software written in Python, PyGTK/PyGObject based on GTK.
sudo apt install gnome-software #
gnome-software # GUI command.
sudo apt install ubuntu-software # The Ubuntu Software & Snap Store. The default software app is the Ubuntu Software, but it is the Snap store under the hood. All apps available in the Snap store are snap packages while the Ubuntu Software can contain both Snaps and apt packages.
sudo apt install snap-store # this is the default store for ubuntu-20.04-Focal-fossa and above.
####################################
# User Access Management (AAA) #
####################################
from bash:
----------
sudo -u user1 bash # switch to the bash-Shell with the user1 user, if not specified root is the default.
sudo -u user1 zsh # switch to the Z-Shell with the user1 user.
sudo -u user1 pwsh # switch to PowerShell with the user1 user.
sudo -u user1 tcsh # C-shell.
sudo -u user1 fish # fish-shell.
sudo passwd root # to change the root password.
sudo adduser user1 # create a new user "user1" which will take you through a profile creation process.
sudo userdel -r user1 # delete/remove a user "user1".
whoami # to check the current user.
su user1 # switch to user1.
id # check the Uid and profile details of the current user.
id root # check the Uid and profile details of a specific user, root in this case.
cat /etc/passwd # get your distro users User-ID (Uid) from the 3rd column of the user raw in this commands output:
------------------------------------------------------------
$ id
uid=1000(user1) gid=1000(user1) groups=1000(user1),4(adm),20(dialout),24(cdrom),25(floppy),27(sudo),29(audio),30(dip),44(video),46(plugdev),117(netdev)
$
$ id root
uid=0(root) gid=0(root) groups=0(root)
$
------------------------------------------------------------
Output; (partial) of the cat command above:
-------------------------------------------
root:x:0:0:root:/root:/bin/bash
twrcha:x:1000:1000:,,,:/home/twrcha:/bin/bash
_flatpak:x:112:120:Flatpak system-wide installation helper,,,:/nonexistent:/usr/sbin/nologin
mysql:x:114:124:MySQL Server,,,:/nonexistent:/bin/false
--------------------------------------------------------
Explaining the above output:
----------------------------
Column 1 – Name
Column 2 – Password – If the user has set a password on this field, then it is indicated with the letter (x).
Column 3 – UID (User ID)
Column 4 – GID (Group ID)
Column 5 – Gecos – Contain general information about the user and can be empty.
Column 6 – Home directory
Column 7 – Shell – The path to the default shell for the user.
## the root Uid=0 while the first 999 Uid's are reserved for the system. therefore user Id's starts from 1000. in old distro versions Uid use to start from 500.
from pwsh:
----------
LxRunOffline set-uid -n <distroName> -v <UID> # set the default autologin user for your distro.
LxRunOffline set-uid -n Ubuntu-20.04 -v 1000 # for example user twrcha UID =1000.
## you can get the UID from /etc/passwd file as explained above, find the user name and check the third column for the uid. ##
## you can also read or set the default Uid in the registery path below, read or set the Uid for the user you want as the default autologin user for your distro:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss{MY-UUID}
Key_Name Type value
DefaultUid Reg_DWORD <Decimal_value>
------------------------------------------------------------##
from bash:
----------
$ sudo passwd root
New password:
Retype new password:
passwd: password updated successfully
$
$ sudo adduser user1
Adding user `user1' ...
Adding new group `user1' (1001) ...
Adding new user `user1' (1000) with group `user1' ...
Creating home directory `/home/user1' ...
Copying files from `/etc/skel' ...
New password:
Retype new password:
passwd: password updated successfully
Changing the user information for user1
Enter the new value, or press ENTER for the default
Full Name []:
Room Number []:
Work Phone []:
Home Phone []:
Other []:
Is the information correct? [Y/n] y
$
----------------------------------------------------------#
#######################################
# Set the default user in your distro #
#######################################
from bash:
----------
$ sudo touch /etc/wsl.conf
$ sudo nano /etc/wsl.conf
[user]
default=username
$
or
from pwsh:
----------
ubuntu2004 config --default-user twrcha # The lxrun.exe command is depreciated and replaced by the 'ubuntu2004.exe' (varies based on your distro's type and version).
####################################
# Export & Import a distro image #
####################################
wsl --export Ubuntu ubuntu.tar # create a tar image of the distro.
wsl --import UbuntuRuby .\UbuntuRuby ubuntu.tar --version 2 # import the distro image then rename it and covert it's version.
wsl -d UbuntuRuby # launch the new distro.
sc stop LxssManager # to stop & start (restart) the LxssManager Windows service whenever required.
sc start LxssManager
Let assume two users, 1st user has installed a distro but 2nd does not.
😇 Good advice:
Use wsl --export in 1st user to make a tar file.
Move that file to 2nd user realm.
Use wsl --import to install it in 2nd user.
😈 Evil advice:
Copy the VHDX file from 1st user. See this Superuser answer for how to find.
Export the registry HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Lxss from 1st user in a REG file.
Copy or move those two files to 2nd user realm.
Double click to import the registry.
Copy the path where you put the VHDX file in 2nd user realm and paste it in the BasePath in Lxss registry key. Make sure to match the distribution name.
As you have said your Linux distribution installed in different drive then you have to only export the Lxss registry from 1st use and import it in 2nd.
###########################################
# Z-shell (zsh) environment & settings #
###########################################
sudo apt install zsh
sudo -u user1 zsh # switch to Z shell with the specified user.
-------------------------------------------------------------------------
This is the Z Shell configuration function for new users,
zsh-newuser-install.
You are seeing this message because you have no zsh startup files
(the files .zshenv, .zprofile, .zshrc, .zlogin in the directory
~). This function can help you with a few settings that should
make your use of the shell easier.
You can:
(q) Quit and do nothing. The function will be run again next time.
(0) Exit, creating the file ~/.zshrc containing just a comment.
That will prevent this function being run again.
(1) Continue to the main menu.
(2) Populate your ~/.zshrc with the configuration recommended
by the system administrator and exit (you will need to edit
the file by hand, if so desired).
--- Type one of the keys in parentheses ---
Aborting.
The function will be run again next time. To prevent this, execute:
touch ~/.zshrc
PineGap%
-------------------------------------------------------------------------
###################################################
# Linux File-System Management & Troubleshooting #
###################################################
## "fsck" (file system check) is a command-line utility that allows you to perform consistency checks and interactive repairs on one or more Linux file systems.
It uses programs specific to the type of the file system it checks. ##
## Make sure you are in Windows Insider Build 20211, September 10, 2020 or later for "--mount" command availability in WSL. ##
## To join Windows Insider program, you’ll need to open Settings app, go to “Update & Security -> Windows Insider Program” section and follow the instructions. ##
## https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewSDK?wa=wsignin1.0 for Windows Insider Preview Downloads. ##
## https://docs.microsoft.com/en-us/windows-insider/flight-hub/ To check the latest and all available builds and SDK releases. ##
## https://www.microsoft.com/en-us/software-download?rfs=1/ to download Windows 7 or 8.1 or 10 iso images. ##
## https://www.microsoft.com/en-us/software-download/windows10/ to download Windows10 iso image. ##
## https://www.microsoft.com/en-gb/windows/get-windows-10?step=Win10Question1/ to buy Windows10 upgrade license for Windows Xp or 7 or MAC or Windows Home to Pro. ##
## Microsoft Windows Insider Preview Build release depend on the channel level (one out of three) you subscribed to (Dev/Pro, Beta or Release Preview/commercial). ##
## Once you swiched your Windows Consumer release to one of the three Insider channel relases you wont be able to switch between the channels without a fresh Windows installation. ##
## Windows Insider Preview Builds releases for the Dev channel first then after some time moves to the Beta then later to Release Preview then eventually to the Consumer release. ##
## Microsoft released Windows10 as a service, which means you’ll not see any new name for Windows OS in future. There will always be Windows 10 as the latest OS from Microsoft. ##
## Microsoft releases two feature updates for Windows 10 every year. One feature update releases in March or April and the other feature update releases in September or October month. ##
## (SDK) Windows Software Development Kit, iso image. ##
## (WDK) Windows Driver Kit, iso image. ##
## (EWDK) Windows Enterprise WDK, iso image. is a standalone self-contained CLI environment for building drivers. It includes Build Tools for Visual-Studio-2017, the SDK, the WDK and
support for ARM64 driver development.##
## (ADK) Windows Assessment and Deployment Kit, iso image. ##
## (HLK) Windows Hardware Lab Kit, iso image. is a test framework used to test hardware devices for Windows10 and all versions of Windows Server starting with Windows Server 2016. ##
## (ICD) Windows Imaging and Configuration Designer, part of the ADK iso image. ##
## (PE) Windows Preinstallation Environment, iso image, this is the WinPE image and tools. ##
## (VHLK) Windows Virtual HLK, VHD image version 2004, 180 days evaluation. ##
## The build number of the SDK and the WDK must match. ##
## Use the HLKsetup.exe tool to install the needed HLK package. ##
## To add Windows PE to your ADK installation, download the Windows PE Addon ISO and run the installer after installing the ADK. This change enables post-RTM updates to tools in the ADK. ##
## (LTSC) Long-Term Servicing Channel: Windows10 Enterprise / Windows Server2019 release. Released every two to three years. These releases get security updates for 10 years and don't
receive feature updates by design. Microsoft has advocated that customers use the LTSC releases sparingly -- for mission-critical applications only -- and not for everyday use
as a way to avoid updates. (Some customers do use them to avoid updates, however.).
## (SAC) Semi-Annual Channel: the regular none-LTSC version of Windows client/server, desktop & core experance.
## Windows Server vNext Long-Term Servicing Channel (LTSC) release that contains both the Desktop Experience and Server Core installation options for Datacenter and Standard editions.
## whats new in Microsoft Windows server vNext ##
# MsQuic – an open source implementation of the IETF QUIC transport protocol powers both HTTP/3 web processing and SMB file transfers.
# SMB now supports AES-256 Encryption.
## Windows Server vNext Long-Term Servicing Channel Preview is available in ISO format in 18 languages, and in VHDX format in English only.
## The following keys allow for unlimited activations ##
# Standard: MFY9F-XBN2F-TYFMP-CCV49-RMYVH
# Datacenter: 2KNJJ-33Y9H-2GXGX-KMQWH-G6H67
## Windows Server vNext Semi-Annual Preview/ Semi-Annual Channel (SAC), The Server Core Datacenter and Standard Editions are available in the 18 supported Server languages in ISO format
and in VHDX format in English only.
## The following keys allow for unlimited activations ##
# Standard: V6N4W-86M3X-J77X3-JF6XW-D9PRV
# Datacenter: B69WH-PRNHK-BXVK3-P9XF7-XD84W
## Keys are valid for preview builds only. After activation for the preview keys is disabled, you may still install and use preview builds for development and testing purposes without
activating.
## The Microsoft symbol server makes Windows debugger symbols publicly available.
## (AKS) Azure Kubernetes Service.
## to access the WSL host Windows filesystem from your distro,
$ cd /mnt/c
$ cd /mnt/c/users/ardal/documents
$ cd /mnt/c/users/ardal/downloads
@@ Current latest Windows SDK package is the Insider Preview Build 20334. @@
@@ current latest available HLK package for Windows10, version 20H2 & the earlier version 2004, is Windows HLK version 2004 build 19041. @@
@@ Cuurent latest Windows 10 Insider Preview Dev channel version 21H1, Build 21359 , released April 14th 2021. @@
@@ Current latest Windows 10 Insider Preview Release Preview channel version 20H2, Build 20334 , released April 14th 2021. @@
@@ Current latest Windows 10 Consumer channel version 20H2, build 19042.928, as of April 21st 2021. @@
@@ Current latest Windows Feature Experience Beta & Release Preview channels Pack 120.2212.3530.0 , released March 25th 2021. @@
--------------------------------------------------------------------------
Edition Windows 10 Pro
Version 20H2
Installed on 23/08/2020
OS build 19042.928
Serial number xxxxxxxx
Experience Windows Feature Experience Pack 120.2212.551.0
--------------------------------------------------------------------------
from pwsh:
----------
wmic diskdrive list brief # list the available disks under Windows.
wsl -l -v
wsl --mount <DiskPath> # mount a disk in WSL.
wsl --mount <DiskPath> --bare
wsl --mount <DiskPath> --partition <PartitionNumber> --type <Filesystem>
wsl --unregister <distroName>
wsl --register <distroName>
----------------------------------------------------------------------------------------------------------
$ wsl -l -v
NAME STATE VERSION
* Ubuntu-20.04 Running 2
openSUSE-Leap-15.2 Stopped 1
docker-desktop-data Stopped 2
docker-desktop Stopped 2
$
$ wmic diskdrive list brief
Caption DeviceID Model Partitions Size
SAMSUNG MZ7TY256HDHP-000L7 \\.\PHYSICALDRIVE0 SAMSUNG MZ7TY256HDHP-000L7 3 256052966400
SanDisk Ultra Fit USB Device \\.\PHYSICALDRIVE1 SanDisk Ultra Fit USB Device 1 124218178560
$
$ wsl lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 256G 0 disk
sdb 8:16 0 256G 0 disk /
$
$ wsl
user1@host1:/mnt/c/Users/winuser1$ blkid
/dev/sda: UUID="3255683f-53a2-4fdf-91cf-b4c1041e2a62" TYPE="ext4"
/dev/sdb: UUID="3255683f-53a2-4fdf-91cf-b4c1041e2a62" TYPE="ext4"
user1@host1:/mnt/c/Users/winuser1$
----------------------------------------------------------------------------------------------------------
from bash:
-----------
lsb_release -a # check your LSB core version & distro release.
hostnamectl # returns the Kernel version, OS/Distro, Architecture, Hostname(Static&Pretty), Icon-name, chassis and IDs.
hostnamectl --static # returns the static-hostname of your system.
hostnamectl --pretty # returns the pretty-hostname of your system.
uname -r # returns the Kernel version, "Generic" means Desktop edition otherwise "Server" for server edition.
uname -a # for more details.
hostname # check the "Static-hostname", the "Pretty-hostname"="ComputerName" in the GUI mode.
cat /etc/hostname # returns static-hostname.
cat /etc/machine-info # returns the pretty-hostname, the "machine-info" file is created after setting the hostname from the GUI.
sudo hostnamectl set-hostname <TheNewHostName> # set the static-hostname.
## to have two different hostnames (static-hostname & Pretty-hostname),set the static hostname after setting the hostname from the GUI,
## two methods to change the deviceName/ComputerName from the GUI.
GUI > Settings > Sharing > ComputerName.
GUI > Settings > About > DeviceName. ##
--------------------------------------------------------
$ hostnamectl
Static hostname: bananagap
Pretty hostname: BananaGap
Icon name: computer-laptop
Chassis: laptop
Machine ID: d34d11fb687d4784be6b02c3db8c15f8
Boot ID: 65bce81f0b0741d68df13d3cc5f177f2
Operating System: Ubuntu 20.04.2 LTS
Kernel: Linux 5.8.0-43-generic
Architecture: x86-64
$
--------------------------------------------------------
df -h # show the filesystem details.
lsblk # list the availble disks/partitions & size.
blkid # list the available disks name & UUID. UUID stands for Universal-Unit-Identification.
fsck # filesystem check and recovery command. once it runs succesfully it will log the results in "/var/log/fsck".
fsck.ext4 -f /dev/sda # -f fix disk filesystem erros. /dev/sda = C: the OS boot partition, while "Ext4" is a linux filesystem and WSL distro vitual disk name "ext4.vhdx".
man fsck # read the fsck manual.
tune2fs -c 1 /dev/sda #
cat /etc/fstab # check below output. File-Systems-Table file is a system configuration file and part of the util-linux package.
dmesg | less # (":q" to quit) is a command that prints the message buffer of the kernel. The output includes messages produced by the device drivers.
sudo apt install tgt # install's the tgt-admin - "tgtadm" command that will create the "/etc/tgt/targets.conf", Linux SCSI Target Configuration File.
cat /etc/tgt/targets.conf # Linux target framework (tgt) aims to simplify various SCSI target driver (iSCSI, Fibre Channel, SRP, etc) creation and maintenance.
--------------------------------------------------------------------------------------#
$ lsblk #
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 256G 0 disk
sdb 8:16 0 256G 0 disk /
--------------------------------------------------------------------------------------#
$ blkid # determine the UUID of the file system.
/dev/sda: UUID="3255683f-53a2-4fdf-91cf-b4c1041e2a62" TYPE="ext4" # equivalent to C: in Windows OS.
/dev/sdb: UUID="3255683f-53a2-4fdf-91cf-b4c1041e2a62" TYPE="ext4" # equivalent to D: in Windows OS.
--------------------------------------------------------------------------------------#
$ cat /etc/fstab # show file content.
LABEL=cloudimg-rootfs / ext4 defaults 0 1 # /dev/sda: LABEL="cloudimg-rootfs" UUID="<UUID>" TYPE="ext4" PARTUUID="<PartUUID>"
--------------------------------------------------------------------------------------#
$ df -h # show the disk filesystem structure & details.
Filesystem Size Used Avail Use% Mounted on
/dev/sdb 251G 6.9G 232G 3% /
tools 238G 222G 16G 94% /init
none 3.1G 0 3.1G 0% /dev
tmpfs 3.1G 0 3.1G 0% /sys/fs/cgroup
none 3.1G 728K 3.1G 1% /run
none 3.1G 0 3.1G 0% /run/lock
none 3.1G 8.0K 3.1G 1% /run/shm
none 3.1G 0 3.1G 0% /run/user
tmpfs 3.1G 0 3.1G 0% /mnt/wsl
C:\ 238G 222G 16G 94% /mnt/c
tmpfs 623M 0 623M 0% /run/user/1000
$
------------------------------------------------------
$ sudo fsck.ext4 -f /dev/sdb
e2fsck 1.45.5 (07-Jan-2020)
/dev/sdb is mounted.
e2fsck: Cannot continue, aborting.
$
$ fsck
fsck from util-linux 2.34
fsck.ext4: Unable to resolve 'LABEL=cloudimg-rootfs'
$
---------------------------------------------Untested troubleshooting steps
fsck -Af -M
sudo mount -o remount,rw /
sudo mount -o rw remount /
sudo umount /dev/sda
sudo mount /dev/sda
sudo fsck -p /dev/sda
sudo systemctl daemon-reload
sudo systemctl mask multipathd.service
----------------------------------------------
#################################################
# HW devices & Network adapters on Ubuntu 20.x #
#################################################
## network manager is the default service that manages network interfaces through the graphical user interface. Therefore, If you want to configure IP addresses via GUI, then the network- manager should be enabled. An Alternative to Ubuntu network manager is systemd-networkd, which is the default backend service in Ubuntu server 18.04. ##
## in linux OS structure, you will find many config files path/location is a simple short mapping/link of the actual file location within the distro's filesystem.
## Immutable flags, also known as immutable bits, are file system attributes that, when enabled, prohibit changes to files or folders (objects), i.e. lock them. Enabled, immutable flags supersede permissions: you cannot modify an object whose immutable flags have been enabled despite having Read & Write permissions on that object. ##
## (mdadm): MDADM command is used to monitor and manage software RAID devices. RAID is nothing but a technique used for Performance management and Reduce data redundancy. RAID: Redundant Array of Independent Disk. ##
## "/etc/resolv.conf" is a link to "/run/resolvconf/resolv.conf" which is automatically generated by WSL. To stop automatic generation of this file,
add the following entry to /etc/wsl.conf and hash the configuration entireis of the "resolv.conf" file:
## connect to Windows port with no listener returns ETIMEDOUT instead of ECONNREFUSED when Windows firewall is enabled. or WSL2, problem with network connection when VPN used (PulseSecure).
or wsl unable to connect to IP resources with Cisco Annyconnect active.
To resolve the name resolution issue due to the above implement the following changes:
sudo rm /etc/resolv.conf # remove the syslink with "run/resolvconf/resolv.conf", knowing that run is a (tmpfs) temp filesystem.
sudo bash -c 'echo "nameserver 8.8.8.8" > /etc/resolv.conf' # set google root DNS server 8.8.8.8 as your default nameserver.
sudo bash -c 'echo "[network]" > /etc/wsl.conf' #
sudo bash -c 'echo "generateResolvConf = false" >> /etc/wsl.conf' # disable "/etc/wsl.conf" from autogenerating/overwriting the "/etc/resolv.conf" file.
sudo chattr +i /etc/resolv.conf # this will change the file attributes on a Linux filesystem after braking the syslink. "+i" means add "immutable" to the current file attribute.
sudo chattr -i /etc/resolv.conf # to remove the immutable attribute, so you can edit the file and save the new setting, then set back the +i.
# close the terminal and restart WSL service "lxssManager" on Windows10 then reopen the distro, issue should be resolved. ##
## ERROR:@@@ Failed to connect to https://changelogs.ubuntu.com/meta-release-lts. Check your Internet connection or proxy settings. @@@ Error comes up at startup:
One of the reasons for this error is DNS name resolution issue. There are two proposed solutions below which might solve the problem,
# Those MOTD messages are generated by scripts in "/etc/update-motd.d". The exact script that generates that specific line is "/etc/update-motd.d/91-release-upgrade", which also runs "/usr/lib/ubuntu-release-upgrader/release-upgrade-motd". This last script will check for new releases and write output into
"/var/lib/ubuntu-release-upgrader/release-upgrade-available". The script will only update the file every 24 hours. So if you wait long enough, the file will go stale and the script will update the file anyway. But, if you want to update it immediately, just
#(1)# removing "/var/lib/ubuntu-release-upgrader/release-upgrade-available" and the next time you login, it will see there's no cache and run the check script automatically.
or
#(2)# remove "/var/lib/ubuntu-release-upgrader/release-upgrade-available",
run "/usr/lib/ubuntu-release-upgrader/release-upgrade-motd" instead of "/etc/update-motd.d/91-release-upgrade".
or
#(3)# remove "/var/lib/ubuntu-release-upgrader/release-upgrade-available"
run "/etc/update-motd.d/91-release-upgrade" and it should start working correctly.
##
## https://www.digitalocean.com/community/tutorials/how-to-use-the-awk-language-to-manipulate-text-in-linux ##
## https://github.com/shayne/go-wsl2-host ##
sudo nano /etc/netplan/01-netcfg.yaml # ubuntu dhcp config file.
## different ways of fetching the WSL distro's ip address:
ip a s eth0 | grep 'inet\b' | awk '{print $2}' | cut -d/ -f1 # read the changing wsl distro's ip for services to be able to reconnect whenever the ip changes.
ip a s eth0 | awk '/inet / {print $2}' | cut -d/ -f1 # the space after inet is crucial.
ip a s eth0 | awk '/inet / {print $2}' |awk -F '[/]+' '{print $1}' #
##
## both ssh.service & xrdp.service are synced with the sysv script below:
sudo nano /lib/systemd/systemd-sysv-install
$ sudo systemctl enable ssh
Synchronizing state of ssh.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable ssh
$
$ sudo systemctl enable xrdp
Synchronizing state of xrdp.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable xrdp
$
##
## to resolve the xrdp access issue to the key.pem file add xrdp to the ssl-cert group:
$ cd /etc/xrdp
$ ls -al
lrwxrwxrwx 1 root root 36 May 23 23:32 cert.pem -> /etc/ssl/certs/ssl-cert-snakeoil.pem
lrwxrwxrwx 1 root root 38 May 23 23:32 key.pem -> /etc/ssl/private/ssl-cert-snakeoil.key
$ sudo adduser xrdp ssl-cert
# Error: xrdp.service: Can't open PID file /run/xrdp/xrdp.pid (yet?) after start: Operation not permitted
$ sudo nano /etc/xrdp/startwm.sh
change #!/bin/sh to #!/bin/bash ##
ip a # to list all network adapters and their mac & ip details.
sudo apt install golang-github-vmware-govmomi-dev # to enable the VMWare "networks" command.
lshw -C network # show only the network adapters and status.
lsusb # show all the HW devices connected to the system USB bus.
lspci # show all the HW devices connected to the system PCIe bus.
tail -f /var/log/messages # for PCMCIA wifi adapters run this command then connect the adapter to be detected.
nmcli dev wifi # list available Wifi hotspots to connect to.
nmcli dev wifi connect [essid_name] password [insert your password] #
sudo cp /lib/firmware/rtlwifi/rtl8822befw.bin /lib/firmware/rtw88/ # copy the RealTek wifi driver to that folder.
sudo mv /lib/firmware/rtw88/rtl8822befw.bin /lib/firmware/rtw88/rtw8822b_fw.bin # rename the driver file to be loaded after restart.
pv # to monitor a running activity like disk format, disk encryption, running script, etc. .
rfkill # show RF devices in the system.
lspci -knn # shows more details.
lspci -knn | grep Net -A3; rfkill list #
sudo nmcli networking off # Turn the network adapter off and then on instead of restarting the system.
sudo nmcli networking on #
iwconfig # display the wireless interfaces on your system and check their status
iw dev # to list wireless interfaces only.
iw dev <interface_name> link # check whether the interface is connected to any wireless device.
sudo iwlist <wifi_adapter> scan | grep -i ESSID # search/scan for available wifi hotspot to connect to.
nano /etc/netplan/01-network-manager-all.yaml # this where you can manually configure your network interfaces.
sudo netplan generate #
sudo netplan apply #
reboot #
############################################
# Install/Upgrade & Manage System Drivers #
############################################
## FFmpeg is a free and open-source collection of tools for handling multimedia files. It contains a set of shared audio and video libraries such as libavcodec, libavformat, and libavutil. With FFmpeg, you can convert between various video and audio formats, set sample rates, capture streaming audio/video, and resize videos. ##
sudo apt install ffmpeg # this will install the FFMPEG Audio & Video codec managaement package which includes the following three libraries: (libavcodec, libavformat, libavutil).
sudo apt install wireless-tools #
sudo apt install ubuntu-drivers-common # enable the "ubuntu-drivers" command.