Recent Questions - Unix & Linux Stack Exchange most recent 30 from njg61ql.cn 2020-03-06T23:32:53Z http://njg61ql.cn/feeds http://creativecommons.org/licenses/by-sa/4.0/rdf http://njg61ql.cn/q/571598 1 How does exactly pipelining work with 2>&1? Paulina http://njg61ql.cn/users/399034 2020-03-06T23:28:50Z 2020-03-06T23:28:50Z <p>I've just started learning unix so the question might seem really newbie but would appreciate the answer, as I've been trying to work it out on my own for an hour already with google's help, with no success however.</p> <pre><code>cat /etc/shadow 2&gt;&amp;1 | wc -l </code></pre> <p>What would be the effect of this command? My guess is:<BR> 1. The command will print <strong>the line count</strong> of ?etc/shadow? if there is a standard error, it will be redirected to standard output and the error's lines will be counted.<BR> 2. The command will print <strong>the files</strong> of ?etc/shadow? if there is a standard error, it will be redirected to standard output and the error's lines will be counted.</p> <p>Thank you in advance!</p> http://njg61ql.cn/q/571597 0 GPG Key Gen Fails - no such file or directory Mark http://njg61ql.cn/users/52389 2020-03-06T23:02:44Z 2020-03-06T23:02:44Z <p>I believe I've read and tried all the suggestions, starting with <a href="http://njg61ql.cn/q/318385/52389">this post</a> about the exact same issue.</p> <p>Ubuntu 18.04.4 LTS (GNU/Linux 4.15.0-88-generic x86_64), headless</p> <p><code>gpg --version</code></p> <pre><code>gpg (GnuPG) 2.2.4 libgcrypt 1.8.1 Home: /home/mark/.gnupg Supported algorithms: Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH, CAMELLIA128, CAMELLIA192, CAMELLIA256 Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224 Compression: Uncompressed, ZIP, ZLIB, BZIP2 </code></pre> <p>I've killed gpg-agent and restarted the server multiple times.</p> <p><code>gpgconf --kill gpg-agent</code></p> <p><code>ps aux | grep gpg-agent</code></p> <pre><code>mark 1637 0.0 0.0 14428 1052 pts/0 S+ 13:55 0:00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn gpg-agent </code></pre> <p>The .gnupg directory permissions:</p> <p><code>drwx------ 3 mark mark 4.0K Mar 6 14:01 .gnupg</code></p> <p>I've deleted ~/.gnupg multiple times, rebooting each time for good measure:</p> <p><code>ls -la ~/.gnupg</code></p> <pre><code>total 12K drwx------ 3 mark mark 4.0K Mar 6 14:00 . drwxr-xr-x 17 mark mark 4.0K Mar 6 14:01 .. drwx------ 2 mark mark 4.0K Mar 6 14:00 private-keys-v1.d </code></pre> <p>I've repeated the following several times with the same result:</p> <p><a href="http://i.stack.imgur.com/843jt.png" rel="nofollow noreferrer"><img src="http://i.stack.imgur.com/843jt.png" alt="Trying to generate gpg key"></a></p> <p><code>ls -la ~/.gnupg</code></p> <pre><code>total 16K drwx------ 3 mark mark 4.0K Mar 6 14:01 . drwxr-xr-x 17 mark mark 4.0K Mar 6 14:04 .. drwx------ 2 mark mark 4.0K Mar 6 14:00 private-keys-v1.d -rw------- 1 mark mark 32 Mar 6 14:01 pubring.kbx </code></pre> <p>I changed <code>pubring.kbx</code> to 700 and ran again, same result (grasping at straws)</p> <p><code>ps aux | grep gpg-agent</code></p> <pre><code> mark 1751 0.0 0.0 93316 3348 ? SLs 14:02 0:00 /usr/bin/gpg-agent --supervised mark 1758 0.0 0.0 14428 1084 pts/0 S+ 14:06 0:00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn gpg-agent </code></pre> <p>I also ran with <code>strace</code> but not sure how to decipher that output. Last line is <code>+++ exited with 2 +++</code></p> <pre><code>strace -o /tmp/foo gpg --full-generate-key </code></pre> <p>I'm at a loss here.</p> http://njg61ql.cn/q/571592 0 SSH not working after reboot O S http://njg61ql.cn/users/399025 2020-03-06T22:10:39Z 2020-03-06T23:23:42Z <p>I was looking on Google for a way to reboot my Debain server, I found the following <a href="http://www.configserverfirewall.com/debian-linux/debian-restart-command/" rel="nofollow noreferrer">source</a> and I typed:</p> <p><code>systemctl reboot</code> </p> <p>After doing this, I can't SSH anymore to my Debian server. How can I enable SSH again?</p> <p>When I try to SSH I get the following:</p> <p><code>ssh: connect to host example.com port 22: Connection timed out</code></p> <p><strong>-edit-</strong></p> <p>Fortunatly via Hetzner's console I can still access the server, I'm clueless however how to turn on SSH. I tried doing <code>sudo systemctl restart ssh</code> it doesn't seem to work and I still get the connection timed out.</p> <p><strong>-edit-</strong></p> <p>I believe <code>systemctl reboot</code> disabled networking on my server, and I can't seem to get it up with <code>sudo /etc/init.d/networking start</code>. The <code>journalctl -xe</code> shows: <a href="http://i.stack.imgur.com/0lVHB.jpg" rel="nofollow noreferrer"><img src="http://i.stack.imgur.com/0lVHB.jpg" alt="enter image description here"></a></p> <p>My apologies for the image, Hetzner's console isn't allowing me to copy text from their console.</p> <p>When I do: <code>cat /etc/network/interfaces</code> I only see:</p> <p><a href="http://i.stack.imgur.com/Rrf5E.png" rel="nofollow noreferrer"><img src="http://i.stack.imgur.com/Rrf5E.png" alt="enter image description here"></a></p> <p>When I type <code>ip link show</code> the output is as following:</p> <p><a href="http://i.stack.imgur.com/oR1Xv.png" rel="nofollow noreferrer"><img src="http://i.stack.imgur.com/oR1Xv.png" alt="enter image description here"></a></p> http://njg61ql.cn/q/571590 0 Changing EAPOL version on nmcli hotspot momotaro http://njg61ql.cn/users/398999 2020-03-06T22:00:12Z 2020-03-06T22:00:12Z <p>I've setup a hotspot with nmcli on a Raspberry Pi running Buster by:</p> <ol> <li><p>installing network-manager:</p> <p><code>sudo apt-get install network-manager</code></p></li> <li><p>Setting up a hotspot profile:</p> <p><code>sudo nmcli c add type wifi ifname wlan0 con-name hotspot ssid ssidname 802-11-wireless.mode ap ipv4.method shared 802-11-wireless.band bg 802-11-wireless.channel 11 wifi-sec.key-mgmt wpa-psk wifi-sec.psk password</code></p></li> <li><p>Disabling dhcpcd (don't have that command handy)</p></li> <li><p>Starting the hotspot.</p> <p><code>sudo nmcli c up hotspot</code></p></li> </ol> <p>The problem is that the hotspot defaults to using eapol version 3 (802.1x-2010) which is not supported yet by some hardware that I'm trying to connect to the Pi's network so it will never finish the handshake.</p> <p>Is there some configuration in NetworkManager or nmcli command I can use to define the eapol version to use? I searched through the nmcli 802-11 fields to no avail.</p> <p>I know I can use hostapd + dnsmasq + bridge but this is (hopefully) simpler.</p> <p>Thanks in advance!</p> http://njg61ql.cn/q/571587 0 Intuitive way to flatten a nested list [closed] Ciasto piekarz http://njg61ql.cn/users/103184 2020-03-06T21:39:16Z 2020-03-06T21:39:16Z <p>I have list like <code>[[1,2,[3]],’a’]</code> trying to convert to <code>[1,2,3,’a’]</code>.</p> <p>Can it be done without recursive function ?</p> http://njg61ql.cn/q/571586 0 Append a column to a file based on line number Johnny http://njg61ql.cn/users/398827 2020-03-06T21:36:25Z 2020-03-06T22:10:18Z <p>I have a list of numbers which i would like to add to the end of another file as the final column:</p> <pre><code>1:.196 5:.964 6:.172 </code></pre> <p>The numbers in front (1,5 and 6) indicate at which line the numbers have to be appended in the target file, so that the first line ends with <code>.196</code>, the fifth with <code>.964</code> and so on. The usual <code>paste file1 file2</code> does not take the line numbers into account and simply adds <code>1:.196</code> at the end of the first line and <code>.964</code> at the end of the second instead of the fifth. Any ideas how to do it the right way?</p> <p>Expected would be something like this:</p> <pre><code>Lorem Ipsum 1238 Dolor Sit 4559.196 Lorem Ipsum 4589 Sit elitr 1234 Lorem Ipsum 3215 Dolor Sit 5678 Lorem Ipsum 7825 Dolor Sit 9101 Lorem Ipsum 1865 Dolor Sit 1234.964 </code></pre> http://njg61ql.cn/q/571585 0 how to remove multiple columns in the csv if the row is having same values using awk command Kalpana Pinninty http://njg61ql.cn/users/397847 2020-03-06T21:35:27Z 2020-03-06T23:07:50Z <p>I have output like this </p> <pre><code>4567,4567 5436,5436 1234,5678 </code></pre> <p>Expected output:</p> <pre><code>1234,5678 </code></pre> <p>Tried below command but it is deleting the column not the row</p> <pre><code>awk -F, 'NF==2{NF-=1}NF&lt;1{sub(/",.*/,"\"")}1' OFS=, </code></pre> <p>Thanks for your help and suggestions</p> http://njg61ql.cn/q/571583 0 SSH with remote private and public keys Lincoln Anders http://njg61ql.cn/users/399019 2020-03-06T21:33:48Z 2020-03-06T21:33:48Z <p>I erroneously changed the SSH config on my remote server. I have backups of the <strong>public and private keys and the fingerprint for the remote server</strong>. When I try to SSH with my normal setup, I get an error <code>Permission denied (publickey)</code>. Is there a way for me to SSH into the remote server with only the public and private keys that are on that server? I could login just fine over SSH (without prompting me for a password, using keys) before editing the config.</p> <p>I think I set <code>LoginWithPassword No</code> and the <code>PublicKeyAuthentication Yes</code>. Am I SOL?</p> <p>I've tried (with the <code>priv.key</code> as the private text of the remote key and <code>priv.key.pub</code> as the remote public key):</p> <ul> <li><p><code>ssh-copy-id user@host</code></p></li> <li><p><code>ssh-copy-id -i priv.key user@host</code></p></li> <li><p><code>ssh-copy-id -i priv.key.pub user@host</code></p></li> <li><p><code>ssh -i priv.key user@host</code></p></li> <li><p><code>ssh -i priv.key.pub user@host</code></p></li> </ul> http://njg61ql.cn/q/571581 1 How to remove cron task that deletes PHP sessions bsmither http://njg61ql.cn/users/399017 2020-03-06T21:27:35Z 2020-03-06T21:37:09Z <p>It seems Linux Mint 19.3 Tricia Cinnamon wants to clear out PHP session files every half-hour.</p> <p>How do I:</p> <ul> <li>Remove this task from the scheduler's awareness, and</li> <li>Not have to reboot the computer to do so.</li> </ul> <p>I found the crontab file at <code>/etc/cron.d/php</code>.</p> <p>I edited the file by making the relevant line a comment. I expected that now that there is no information in this crontab file that would establish when it should trigger the task, not even the scheduler(?) would keep aware of it.</p> <pre class="lang-bsh prettyprint-override"><code># 09,39 * * * * root [ -x /usr/lib/php/sessionclean ] &amp;&amp; if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi </code></pre> <p>The cron process(?) noticed the new file timestamp and reloaded the file (as seen in the syslog).</p> <p>But the scheduler is still logging in syslog.</p> <pre><code>Mar 6 01:09:07 BrownBunny systemd[1]: Starting Clean php session files... Mar 6 01:09:08 BrownBunny systemd[1]: Started Clean php session files. </code></pre> <p>(which I do not know where to look for those phrases).</p> <p>I tried the command: </p> <pre><code>sudo service cron reload </code></pre> <p>The PHP session files were still cleaned up.</p> <p>I can move the php crontab file out of <code>cron.d</code>. Considering the above, would this even work?</p> <p>Notes: I am cross-posting this question <a href="http://forums.linuxmint.com/viewtopic.php?f=90&amp;t=313704" rel="nofollow noreferrer">from LinuxMint Forums</a>: </p> <p>Note: This question is copied over from Ask Ubuntu because they consider it not really applicable to Ubuntu.</p> http://njg61ql.cn/q/571580 0 How do I setup a UBI8 container to compile PDF documents via sphinx? flickerfly http://njg61ql.cn/users/17808 2020-03-06T21:05:52Z 2020-03-06T21:05:52Z <p>I see that there is a debian based image that can do this here (<a href="http://hub.docker.com/r/sphinxdoc/sphinx-latexpdf" rel="nofollow noreferrer">http://hub.docker.com/r/sphinxdoc/sphinx-latexpdf</a>), but I need to base my solution on Red Hat UBI 8 container image. What packages do I need to install in order for this to function on that platform? (I will be on a RHEL subscribed machine when building.)</p> <p>I expect to mount a volume with my documentation in Restructured Text format and want the container to provide HTML and PDF output via Sphinx the same way that the linked sphinxdoc/sphinx-latexpdf document does.</p> http://njg61ql.cn/q/571579 0 How to get directory structure and inodes from files recovered through debugfs sap http://njg61ql.cn/users/399012 2020-03-06T20:45:11Z 2020-03-06T20:45:11Z <p>Somehow system update at hosting VPS site deleted my cpanel.</p> <p>I tried to recover files on Centos using debugfs. Command used 1. debugfs /dev/ploop40383p1 2. lsdel - gave me the nodes that were deleted. 3. Now the saved it in a big file which is almost 20GB. dd if=/dev/mapper/wks01-root of=recovered.file.001 bs=4096 count=1 skip=7235938</p> <h1>file recovered.file.001</h1> <p>Now dir and files has been recovered to - recovered.file.001.</p> <p>My question- Is there a way to get Directory/Files inodes from this recovered file or any other way I can get files back. Please help</p> http://njg61ql.cn/q/571578 0 Usb wifi adapter problem mohamed http://njg61ql.cn/users/293933 2020-03-06T20:37:16Z 2020-03-06T20:37:16Z <p>I have a usb wifi adapter (edimax / EW-7612UAn V2) with its driver installed on my parrot system and my computer's pci is not compatible with parrot .The problem is parrot says both adapters are disabled when i use normal wifi and when I use airmon-ng the usb wifi adapter works well and the computer's pci of course doesn't work.</p> http://njg61ql.cn/q/571561 0 How can I merge 2 files line by line with same record in awk/shell? Tiger http://njg61ql.cn/users/370424 2020-03-06T19:03:46Z 2020-03-06T23:17:53Z <p>I am new in awk and shell, wondering how can I merge 2 files with the line that have the same record using shell/awk? file1 and file2 may have different order for the Name. I only want to merge the lines that has the same record. please help.</p> <pre><code>file1.txt Mary 68 Tom 50 Jason 45 Lu 66 file2.txt Jason 37 Tom 26 Mary 74 Tina 80 mergefile.txt Marry 68 74 Tom 50 26 Jason 45 37 </code></pre> <p>I have a try of awk, but it takes some times to running the script. Wondering if there could be a more faster and simple implement.</p> <pre><code>cat file1.txt | while read line do score1=$( echo $line | awk '{print $2}'); name1=$( echo $line | awk '{print $1}'); cat file2.txt | while read l do score2=$( echo $l | awk '{print $2}'); name2=$( echo $l | awk '{print $1}'); if [[ $name1 == $name2 ]] then echo "$name1 $score1 $score2" &gt;&gt; mergefile break fi done done </code></pre> http://njg61ql.cn/q/571498 0 Unpack Node.js to a custom folder and perform paths setup CodeGust http://njg61ql.cn/users/309760 2020-03-06T13:00:15Z 2020-03-06T21:30:39Z <p>I want to unpack <a href="http://nodejs.org/dist/v12.16.1/node-v12.16.1-linux-x64.tar.xz" rel="nofollow noreferrer">Node.js (Linux Binaries (x64))</a> to a custom folder and use it for a few projects. </p> <p>The difficulties appear when I start using console. I can't use <code>npm</code> at all and I've got no idea how to install global modules in this case. </p> <p>For instance, I install <code>gulp -g</code> and even specify the installation path for it, but when I wish to use <code>gulp</code>, it doesn't work.</p> <p>So, again, I do not use package managers and <code>/usr/lib</code> folders, the whole node.js package in one, single folder. How to use it that way if possible at all?</p> <p>There may be a few more Node.js versions there and it would be greate to have a way of setting up the <code>/paths/variables</code> for the selected <code>/folder/version</code> of Node.js.</p> http://njg61ql.cn/q/571489 2 vim - how to ... yank util phrase Kes http://njg61ql.cn/users/46470 2020-03-06T12:12:31Z 2020-03-06T22:05:38Z <p>I'm using the latest version of vim 8.2.148 on the latest version of arch linux 5.5.6-arch1-1.</p> <p>If I want to copy from the cursor until a letter further on in the sentence, I can do that, for example in this sentence, if my cursor was at the start of the sentence and I wanted to yank until the c of copy I would give the command <code>yuc</code>, which would copy "If I want to".</p> <p>Another equally valid example would be to yank from the start of the string to the start of the second instance of "screenshots" in this string: </p> <pre><code>/home/user/linux_config/script_yad/screenshots/change_screenshots_directory.sh </code></pre> <p>However if my cursor was at the start of this sentence and I wanted to yank up until and including the second instance of sentence, how would I do that? </p> <p>I think such a command might look structurally something like <code>yt2"sentence"</code> though this command does not work.</p> <p>Obviously using the letter s to yank will not be satisfactory.</p> <p>I wish to achieve this without using visual mode.</p> <p>Does this need a plugin, and if so which one?</p> <p>Can this be done without a plugin and how?</p> http://njg61ql.cn/q/571478 1 aws session manager to instances without public IP or EIP adagio http://njg61ql.cn/users/384097 2020-03-06T10:35:20Z 2020-03-06T20:23:33Z <p>I am trying to set up session manager to connect to my instances, and I am facing an issue with instances that do not have public IP or EIP.</p> <p>What I have done is created a role and attach the <strong>AmazonSSMManagedInstanceCore</strong> Policy.</p> <p>When I launch an instance (Amazon 2 or Ubuntu) with public IP or EIP everything is ok, as soon as I attach the role it works.</p> <p>But when I do not have Public IP or EIP I am not able to connect.</p> <p>Any idea? Am I missing something?</p> http://njg61ql.cn/q/571419 0 nginx on Fedora 30 setup Ahmed C http://njg61ql.cn/users/398864 2020-03-06T00:25:22Z 2020-03-06T20:44:14Z <p>I am installing nginx on Fedora 30 following a tutorial (I don't know the rules whether I can or not publish a tutorial link here).</p> <p>The tutorial mentions that I should access to this IP address <code>192.168.0.3</code> in order to show the test page, but for me it shows nothing.</p> <p>These are the steps done (If you need any clarification or details don't hesitate).</p> <pre><code>[root@localhost sites-available]# mkdir /var/www/wisdompetmed.local/ root@localhost sites-available]# echo "Site coming soon" &gt; /var/www/wisdompetmed.local/index.html </code></pre> <p>Thanks in advance</p> http://njg61ql.cn/q/571293 32 Is scp unsafe? Should it be replaced with sftp? Fabien Haddadi http://njg61ql.cn/users/219899 2020-03-05T12:30:49Z 2020-03-06T23:05:24Z <p>I have over 20 years experience in Un*x, and I have been using <code>scp</code> for immemorial times. <code>scp</code>is over SSH, therefore I consider it as secure as the latter. Now, in my company, where I recently took up a job, the Security Officer says that <code>scp</code> should not be used, because it is unsafe and obsolete. <code>sftp</code> should be favoured over it (yet over SSH too...)</p> <p>I don't immediately agree with this, based on the infrastructure underneath scp, and based on how popular and trusted <code>scp</code> is in the professional community, and among my other colleagues from my ex-companies. I don't want to change my mind just because some CSO said it. </p> <ul> <li>This said, is there here a subject?</li> <li>Is <code>scp</code> suddenly the blacksheep?</li> <li>Is is just a mere security expert debates in higher spheres?</li> <li>Or is <code>scp</code> just good to use?</li> </ul> http://njg61ql.cn/q/571191 0 Getting Redhat Yum mirrors issues on some of my network subnet and not on the others nixmind http://njg61ql.cn/users/147393 2020-03-04T23:42:42Z 2020-03-06T21:35:12Z <p>I'm using RHVH to manage my infrastructure VMs.</p> <p>I've two bare metal servers in two different network subnets with same release version of RHVH.</p> <p>I use an automated script to deploy VMs on both, and provision a docker repository file there on VMs.</p> <p>The issue I'm facing is when I'm trying to query <code>container-selinux</code> package. It works on VMs from one of my bare metal servers, and not from the other.</p> <p>first sever's VM:</p> <pre><code>[root@cpu-node0 ~]# /bin/repoquery --show-duplicates --plugins --disablerepo '' --enablerepo '' --qf '%{name}|%{epoch}|%{version}|%{release}|%{arch}|%{repoid}' container-selinux container-selinux|2|2.107|1.el7_6|noarch|extras container-selinux|2|2.107|3.el7|noarch|extras [root@cpu-node0 ~]# </code></pre> <p>Second server's VM :</p> <pre><code>[root@cpu-node0 ~]# /bin/repoquery --show-duplicates --plugins --disablerepo '' --enablerepo '' --qf '%{name}|%{epoch}|%{version}|%{release}|%{arch}|%{repoid}' container-selinux Could not match packages: failure: repodata/repomd.xml from docker-engine: [Errno 256] No more mirrors to try. http://yum.dockerproject.org/repo/main/centos/7/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found [root@cpu-node0 ~]# </code></pre> <p>The yum repo configuration on both VMs running on each bare metal server:</p> <pre><code>[root@cpu-node0 ~]# ll /etc/yum.repos.d/ total 44 -rw-r--r--. 1 root root 1664 5 sept. 13:05 CentOS-Base.repo -rw-r--r--. 1 root root 1309 5 sept. 13:05 CentOS-CR.repo -rw-r--r--. 1 root root 649 5 sept. 13:05 CentOS-Debuginfo.repo -rw-r--r--. 1 root root 314 5 sept. 13:05 CentOS-fasttrack.repo -rw-r--r--. 1 root root 630 5 sept. 13:05 CentOS-Media.repo -rw-r--r--. 1 root root 1331 5 sept. 13:05 CentOS-Sources.repo -rw-r--r--. 1 root root 6639 5 sept. 13:05 CentOS-Vault.repo -rw-r--r--. 1 root root 369 2 mars 23:31 docker.repo -rw-r--r--. 1 root root 1050 17 sept. 23:25 epel.repo -rw-r--r--. 1 root root 1149 17 sept. 23:25 epel-testing.repo [root@cpu-node0 ~]# </code></pre> <p>docker.repo file content on both VMs :</p> <pre><code>[root@cpu-node0 ~]# cat /etc/yum.repos.d/docker.repo [docker-ce] name=Docker-CE Repository baseurl=http://download.docker.com/linux/centos/7/$basearch/stable enabled=1 gpgcheck=1 keepcache=1 gpgkey=http://download.docker.com/linux/centos/gpg [docker-engine] name=Docker-Engine Repository baseurl=http://yum.dockerproject.org/repo/main/centos/7 enabled=1 gpgcheck=1 keepcache=1 gpgkey=http://yum.dockerproject.org/gpg [root@cpu-node0 ~]# </code></pre> <p>Repo list on the first VM :</p> <pre><code>[root@cpu-node0 ~]# yum repolist id du dépôt nom du dépôt statut base/7/x86_64 CentOS-7 - Base 10 097 docker-ce/x86_64 Docker-CE Repository 68 !docker-engine Docker-Engine Repository 110 epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 13 199 extras/7/x86_64 CentOS-7 - Extras 323 updates/7/x86_64 CentOS-7 - Updates 1 478 repolist: 25 275 [root@cpu-node0 ~]# </code></pre> <p>Yum repo list on the second VM:</p> <pre><code>[root@cpu-node0 ~]# yum repolist http://yum.dockerproject.org/repo/main/centos/7/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found Essai d'un autre miroir. To address this issue please refer to the below wiki article http://wiki.centos.org/yum-errors If above article doesn't help to resolve this issue please use http://bugs.centos.org/. docker-ce/x86_64/primary_db | 40 kB 00:00:05 http://yum.dockerproject.org/repo/main/centos/7/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not Found Essai d'un autre miroir. id du dépôt nom du dépôt statut base/7/x86_64 CentOS-7 - Base 10 097 docker-ce/x86_64 Docker-CE Repository 68 docker-engine Docker-Engine Repository 0 epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 13 199 extras/7/x86_64 CentOS-7 - Extras 323 updates/7/x86_64 CentOS-7 - Updates 1 478 repolist: 25 165 [root@cpu-node0 ~]# </code></pre> <p>I also get the message below when trying to curl the repository URL :</p> <pre><code>[root@cpu-node0 ~]#curl http://yum.dockerproject.org/repo/main/centos/7/repodata/repomd.xml &lt;!doctype html&gt; &lt;html lang="en"&gt; &lt;head&gt;&lt;/head&gt; &lt;body&gt; &lt;h1&gt;Notice: Shutting down dockerproject.org APT and YUM repos 2020-03-31&lt;/h1&gt; &lt;p&gt;Docker will be shutting down the deprecated APT and YUM repositories hosted at "dockerproject.org" and "dockerproject.com" on the 31st of March 2020.&lt;/p&gt; &lt;p&gt;We noticed that this project is referencing one of these repositories, and recommend updating to use the "download.docker.com" repository to prevent disruption.&lt;/p&gt; &lt;p&gt;More info: http://www.docker.com/blog/changes-dockerproject-org-apt-yum-repositories/ &lt;/p&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Looks like docker does not want anyone to use this repo anymore. Probably they started issuing the error from today I guess.</p> <p>Of course the two VMs do not have <code>subscription-manager</code> package installed, neither subscription attached, they don't need actually in our context, but why is there a mirror issue on one VM and not on the other, whose OS and system configuration is the same on both, except that they are locate in two different networks?</p> http://njg61ql.cn/q/555964 0 PulseAudio: Mic input and application audio are getting mixed together SpecialBomb http://njg61ql.cn/users/146386 2019-12-06T20:07:43Z 2020-03-06T22:56:31Z <p>To be brief, I did a fresh install of Debian Buster today. What's odd, when I use software that may be recording, such as Discord, I can see that all of the audio on my desktop gets mixed in with my microphone input. I have no idea why this is happening or how I can fix it, as I don't know much about Pulse or ALSA. The only input and output devices I have are my laptops audio card, which is listed as "Built-In Audio Analog Stereo" in pavucontrol.</p> <p>I am willing to share any logs that may be useful.</p> http://njg61ql.cn/q/552839 1 CentOS 8 - Clustered File System James Shewey http://njg61ql.cn/users/104565 2019-11-18T22:18:41Z 2020-03-06T20:06:04Z <p>In my environment, I have a need for a shared disk between two application servers such that changes on Server A are immediately available on Server B. Historically, I have solved this issue by sharing a GFS2 volume by using multipathed disks stored on our enterprise filer and attached using our virtualization solution.</p> <p>This configuration requires fencing of the GFS2 nodes in the cluster and so I have used pacemaker to handle the fencing for GFS2 in the event that a node dies or becomes unhealthy to prevent full corruption of the file system by configuring <a href="http://en.wikipedia.org/wiki/STONITH" rel="nofollow noreferrer">stonith</a> to use <a href="http://linux-ha.org/wiki/SBD_Fencing" rel="nofollow noreferrer">SBD fencing</a> previously.</p> <p>While gfs2-utils and fence-agents-sbd is available for CentOS, the pcs command is not available as of CentOS 8.0 and it appears that it may <a href="http://bugs.centos.org/view.php?id=16469" rel="nofollow noreferrer">never be available</a> in the main repos. This is problematic as pcs was integral in configuring this in CentOS 7.</p> <p>This leaves me wondering</p> <ul> <li>What can I do as an alternate for fencing the volume without having to compile the applicaiton from source (ongoing security updates &amp; bug fixes is a requirement)</li> <li>If nothing, what can I use to provide a distributed &amp; redundant storage solution in CentOS 8? An NFS server would be out of the question as a failure to the file server would take both application servers offline.</li> </ul> http://njg61ql.cn/q/496940 4 How is the C library able to access environment variables? James Browning http://njg61ql.cn/users/333595 2019-01-26T22:47:30Z 2020-03-06T20:49:54Z <p>How do functions like getenv(3) access the environment when my program doesn't have any references to the environment?</p> http://njg61ql.cn/q/462934 2 Script dies when parent process is terminated Ghigo http://njg61ql.cn/users/305793 2018-08-16T10:12:37Z 2020-03-06T21:01:33Z <p>I have a .NET Core service running on a Debian 9, let's call it MyService. At some point this service is running a bash script <code>update.sh</code> using <code>Process.Start()</code> with <code>ShellExecute=true</code>.</p> <p>This script basically runs <code>apt-get update; apt-get upgrade</code>.</p> <p>During package upgrade, MyService process is terminated: update script is terminated as well and <code>apt-get upgrade</code> is killed as well, leaving inconsistent packages that must be fixed manually.</p> <p>What I want is that <code>update.sh</code> is NOT terminated when MyService is terminated.</p> <p>I tried splitting <code>update.sh</code> in 2 parts, the first running the second in different ways; I tried starting <code>update2.sh</code> with <code>setsid</code> and <code>nohup</code> but I always get same result. I tried to execute <code>update2.sh</code> script in a new bash shell with <code>/bin/bash /c "update2.sh"</code>, same result.</p> <p>How do I run a script started from a binary and completely detach from binary process, so I can kill binary while script keeps running?</p> <p>Here's my environment. MyService is a binary running as a service. <code>update.sh</code> is started by MyService.</p> <p><strong>.NET Core code to start shell script, inside MyService binary:</strong></p> <pre><code>var process = new Process(); process.EnableRaisingEvents = true; // to avoid [defunct] sh processes process.StartInfo.FileName = "/opt/myservice/update.sh"; process.StartInfo.Arguments = ""; process.StartInfo.UseShellExecute = true; process.StartInfo.CreateNoWindow = true; process.Start(); process.WaitForExit(10000); if (process.HasExited) { Console.WriteLine("Exit code: " + process.ExitCode); } else { Console.WriteLine("Child process still running after 10 seconds"); } </code></pre> <p><strong>update.sh:</strong></p> <pre><code>nohup /opt/myservice/update2.sh &gt; /opt/myservice/update.log &amp; systemctl stop MyService </code></pre> <p><strong>update2.sh:</strong></p> <pre><code>apt-get update &gt;&gt; /opt/myservice/update.log apt-get -y install --only-upgrade myservice-1.0 &gt;&gt; /opt/myservice/update.log </code></pre> <p><code>update2.sh</code> is never executed because it's terminated when MyService is terminated by <code>update.sh</code>.</p> <p><code>update.sh</code> returns code 143, it seems it has been killed.</p> <pre><code>2018-08-16 14:46:14.5215|Running update script: /opt/myservice/update.sh 2018-08-16 14:46:14.5883|Update script /opt/myservice/update.sh returned: 143 </code></pre> <p><strong>UPDATE</strong></p> <p>I tried following approaches, thanks for suggestions:</p> <ul> <li>setsid</li> <li>disown</li> <li>nohup</li> <li>screen</li> <li>tmux</li> <li>unshare</li> </ul> <p>Every approach has same result, termination of all spawned processes. I suspect this is a .NET Core "feature".</p> <p><strong>UPDATE 2</strong></p> <p>I discovered that <code>systemctl stop MyService</code> by default explicitly kills all spawned processes by a service.</p> <p><a href="http://stackoverflow.com/questions/40898077/systemd-systemctl-stop-aggressively-kills-subprocesses">http://stackoverflow.com/questions/40898077/systemd-systemctl-stop-aggressively-kills-subprocesses</a></p> <p>If I add <code>KillMode=process</code> to service descriptor, update script is not terminated when service is terminated. </p> <p>There is <strong>NO WAY</strong> to escape from PID space for a service started by <code>systemctl</code>. Every technique used, included the one in accepted answer, does not generate a separate process. Every spawned process is always killed by <code>systemctl stop MyService</code> unless <code>KillMode=process</code> is specified.</p> <p>I ended up creating a separate service <code>MyServiceUpdater</code>: this service runs the plain updater script without any forking. Since PID space is different, everything works as expected. That was a long ride.</p> http://njg61ql.cn/q/313256 62 Why write an entire bash script in functions? Doktor J http://njg61ql.cn/users/62503 2016-09-29T18:45:23Z 2020-03-06T22:07:32Z <p>At work, I write bash scripts frequently. My supervisor has suggested that the entire script be broken into functions, similar to the following example:</p> <pre><code>#!/bin/bash # Configure variables declare_variables() { noun=geese count=three } # Announce something i_am_foo() { echo "I am foo" sleep 0.5 echo "hear me roar!" } # Tell a joke walk_into_bar() { echo "So these ${count} ${noun} walk into a bar..." } # Emulate a pendulum clock for a bit do_baz() { for i in {1..6}; do expr $i % 2 &gt;/dev/null &amp;&amp; echo "tick" || echo "tock" sleep 1 done } # Establish run order main() { declare_variables i_am_foo walk_into_bar do_baz } main </code></pre> <p>Is there any reason to do this other than "readability", which I think could be equally well established with a few more comments and some line spacing?</p> <p>Does it make the script run more efficiently (I would actually expect the opposite, if anything), or does it make it easier to modify the code beyond the aforementioned readability potential? Or is it really just a stylistic preference?</p> <p>Please note that although the script doesn't demonstrate it well, the "run order" of the functions in our actual scripts tends to be very linear -- <code>walk_into_bar</code> depends on stuff that <code>i_am_foo</code> has done, and <code>do_baz</code> acts on stuff set up by <code>walk_into_bar</code> -- so being able to arbitrarily swap the run order isn't something we would generally be doing. For example, you wouldn't suddenly want to put <code>declare_variables</code> after <code>walk_into_bar</code>, that would break things.</p> <p>An example of how I would write the above script would be:</p> <pre><code>#!/bin/bash # Configure variables noun=geese count=three # Announce something echo "I am foo" sleep 0.5 echo "hear me roar!" # Tell a joke echo "So these ${count} ${noun} walk into a bar..." # Emulate a pendulum clock for a bit for i in {1..6}; do expr $i % 2 &gt;/dev/null &amp;&amp; echo "tick" || echo "tock" sleep 1 done </code></pre> http://njg61ql.cn/q/305428 2 Uid/Gid privileged LXC container : systemd lxc-start failed on ubuntu 16.04 vijayaragavalu http://njg61ql.cn/users/186285 2016-08-24T09:59:05Z 2020-03-06T23:00:38Z <p>I would like to create &amp; start LXC container for specific UID &amp; GID for below purpose.</p> <p>Login to root user(sudo user) , Do lxc-create of container, then do lxc-start of the container with same root user id. while staring container I need to start all the process inside the container with low privilege(un-priv) user id in which access to the user is restricted to only container and not to host.basically when I say ps -axu , I should be able to see low privilege user id for all the container process.</p> <p>PS : my host which is VM with ubuntu 16.04 LTS is systemd init system and my container(type busybox) will be started with systemd services . for that I have modified busybox template as below Code:</p> <pre><code>lxc.init_cmd=/lib/systemd/systemd </code></pre> <p>and also removed all rcS &amp; inittab related scripts in the busybox default template</p> <p>and for user id map , I have changed as below in my template Code:</p> <pre><code> lxc.id_map=u 0 165536 65536 lxc.id_map=g 0 165536 65536 </code></pre> <p>after that I just followed below steps</p> <p>Container created normally with below commend (and I cross checked config file at /var/lib/lxc/testecho_uid/config to make sure that all my template changes are reflected or not, found ok) Code:</p> <pre><code>sudo lxc-create -n testecho_uid -t busybox_systemd_uid </code></pre> <p>Entered below command to start the container with foreground Code:</p> <pre><code>sudo lxc-start -n testecho_uid -F </code></pre> <p>Error is :</p> <pre><code>vijay@vijay-VirtualBox:~$ sudo lxc-start -n testecho_uid -F lxc-start: cgfsng.c: cgfsng_create: 1072 No such file or directory - Failed to create /sys/fs/cgroup/systemd//lxc/testecho_uid: No such file or directory lxc-start: cgfsng.c: cgfsng_create: 1072 No such file or directory - Failed to create /sys/fs/cgroup/systemd//lxc/testecho_uid-1: No such file or directory newuidmap: uid range [0-65536) -&gt; [165536-231072) not allowed lxc-start: start.c: lxc_spawn: 1161 failed to set up id mapping lxc-start: start.c: __lxc_start: 1353 failed to spawn 'testecho_uid' newuidmap: uid range [0-65536) -&gt; [165536-231072) not allowed lxc-start: conf.c: userns_exec_1: 4315 Error setting up child mappings lxc-start: cgfsng.c: recursive_destroy: 983 Error destroying /sys/fs/cgroup/systemd//lxc/testecho_uid-2 newuidmap: uid range [0-65536) -&gt; [165536-231072) not allowed lxc-start: conf.c: userns_exec_1: 4315 Error setting up child mappings lxc-start: cgfsng.c: recursive_destroy: 983 Error destroying /sys/fs/cgroup/perf_event//lxc/testecho_uid-2 newuidmap: uid range [0-65536) -&gt; [165536-231072) not allowed lxc-start: conf.c: userns_exec_1: 4315 Error setting up child mappings lxc-start: cgfsng.c: recursive_destroy: 983 Error destroying /sys/fs/cgroup/hugetlb//lxc/testecho_uid-2 newuidmap: uid range [0-65536) -&gt; [165536-231072) not allowed lxc-start: conf.c: userns_exec_1: 4315 Error setting up child mappings lxc-start: cgfsng.c: recursive_destroy: 983 Error destroying /sys/fs/cgroup/cpu//lxc/testecho_uid-2 newuidmap: uid range [0-65536) -&gt; [165536-231072) not allowed lxc-start: conf.c: userns_exec_1: 4315 Error setting up child mappings lxc-start: cgfsng.c: recursive_destroy: 983 Error destroying /sys/fs/cgroup/memory//lxc/testecho_uid-2 newuidmap: uid range [0-65536) -&gt; [165536-231072) not allowed lxc-start: conf.c: userns_exec_1: 4315 Error setting up child mappings lxc-start: cgfsng.c: recursive_destroy: 983 Error destroying /sys/fs/cgroup/pids//lxc/testecho_uid-2 newuidmap: uid range [0-65536) -&gt; [165536-231072) not allowed lxc-start: conf.c: userns_exec_1: 4315 Error setting up child mappings lxc-start: cgfsng.c: recursive_destroy: 983 Error destroying /sys/fs/cgroup/blkio//lxc/testecho_uid-2 newuidmap: uid range [0-65536) -&gt; [165536-231072) not allowed lxc-start: conf.c: userns_exec_1: 4315 Error setting up child mappings lxc-start: cgfsng.c: recursive_destroy: 983 Error destroying /sys/fs/cgroup/cpuset//lxc/testecho_uid-2 newuidmap: uid range [0-65536) -&gt; [165536-231072) not allowed lxc-start: conf.c: userns_exec_1: 4315 Error setting up child mappings lxc-start: cgfsng.c: recursive_destroy: 983 Error destroying /sys/fs/cgroup/net_cls//lxc/testecho_uid-2 newuidmap: uid range [0-65536) -&gt; [165536-231072) not allowed lxc-start: conf.c: userns_exec_1: 4315 Error setting up child mappings lxc-start: cgfsng.c: recursive_destroy: 983 Error destroying /sys/fs/cgroup/devices//lxc/testecho_uid-2 newuidmap: uid range [0-65536) -&gt; [165536-231072) not allowed lxc-start: conf.c: userns_exec_1: 4315 Error setting up child mappings lxc-start: cgfsng.c: recursive_destroy: 983 Error destroying /sys/fs/cgroup/freezer//lxc/testecho_uid-2 lxc-start: lxc_start.c: main: 344 The container failed to start. lxc-start: lxc_start.c: main: 348 Additional information can be obtained by setting the --logfile and --logpriority options. </code></pre> <p>Can anyone please tell me whether I am missing anything here.</p> <p>below are my ubuntu 16.04 setup for uid &amp; gid Code:</p> <pre><code>vijay@vijay-VirtualBox:~$ sudo cat /etc/subgid vijay:100000:65536 usrlxc:165536:65536 vijay:165536:65537 </code></pre> <p>Code:</p> <pre><code>vijay@vijay-VirtualBox:~$ sudo cat /etc/subuid vijay:100000:65536 usrlxc:165536:65536 vijay:165536:65537 </code></pre> <hr> <p>if above my question is not clear , please see below one more question similar to same scenario. Is there a way to access(lxc start &amp; attach) unprivileged container from root user or sudo user . That is , I have created , started and attached un-priv container using lxc user(not sudo user/root user) by login into lxc user without any issue. Now I would like to start &amp; attach the lxc user created un-priv container from root user or sudo user. </p> <p>Is that possible? if yes please let me know how to do that?. I checked lxc-ls from sudo/root user and it just listed only the containers created by sudo user and does not display the container created by lxc user. </p> <p>or </p> <p>All the processes/threads of Privilege container can be executed/run for specific UID(eg: lxc user) by root/sudo user while doing lxc-start or by any means? I also tried by giving below lxc user uid &amp; gid in config(ultimately changing busybox template). it gave above comment error. Code: lxc.id_map=u 0 165536 65536 lxc.id_map=g 0 165536 65536 I tried all the possible way , but no luck , please educate me this topic.</p> <p>Below are user detail in my ubuntu desktop lxc user --> "usrlxc" which I have created as part of un-priv container creation experiment. Sudo user --> "vijay" - this is sudo user in my ubuntu 16.04 Virtual box machine. root user --> # which all of you aware Please let me know if any information from my ubuntu setup or lxc config</p> http://njg61ql.cn/q/241820 1 How to change password using script Ann http://njg61ql.cn/users/142328 2015-11-09T10:17:15Z 2020-03-06T21:02:15Z <pre><code>#OUTFILE=out.xml prefix='EDSAD150' password="asdf1234" pass=$(perl -e 'print crypt($ARGV[0], "asdf1234")' $password) for i in {01..02};do usname=$prefix""$i yes $pass | yppasswd $usname done </code></pre> <p>I want to change the password of the users but when I run this script I have to give the server password every time because I am using<code>yppasswd</code> command . But when I used <code>passwd</code> command the NIS files won't change.</p> http://njg61ql.cn/q/189737 0 CentOS 7 VNC users dont share desktop session Mark W http://njg61ql.cn/users/105070 2015-03-12T13:49:26Z 2020-03-06T20:01:20Z <p>I installed VNC server on a CentOS machine. I set up a user, and then enabled the VNC server for them on startup following these steps: <a href="http://www.digitalocean.com/community/tutorials/how-to-install-and-configure-vnc-remote-access-for-the-gnome-desktop-on-centos-7" rel="nofollow">http://www.digitalocean.com/community/tutorials/how-to-install-and-configure-vnc-remote-access-for-the-gnome-desktop-on-centos-7</a>. I can successfully log into the machine over VNC, but it appears that the VNC users are not sharing the same session... as if I log into the physical machine and start up a process, when the VNC connection is made, nothing is active on the desktop at all. What did I do wrong? I need VNC to allow users to log in and remotely debug software which may or may not have been started by someone logged into the physical machine</p> http://njg61ql.cn/q/175868 1 Rhel 7 not booting up Amar C http://njg61ql.cn/users/96001 2014-12-25T10:59:00Z 2020-03-06T22:02:00Z <p>I recently installed rhel 7 on my laptop as dual boot (with windows 8.1) in UEFI mode. After the installation I cannot log into redhat. The gnome desktop starts to load and then it goes to a black screen with an underscore at top left corner. No key works at this stage except the power button.<br> My laptop is dell inspiron 15r 5537, 4th gen i5, 8gb ram amd graphics card.<br> I had this same screen while trying to install rhel (while booting from dvd in uefi). After some reboots the anaconda installer just started. And I installed rhel server with gui.<br> What is the issue? </p> http://njg61ql.cn/q/43601 87 How can I set my default shell to start up tmux Michael Durrant http://njg61ql.cn/users/10043 2012-07-20T14:05:27Z 2020-03-06T23:14:58Z <p>I would like my default bash shell to go straight into tmux instead of my always having to type tmux every time.</p> http://njg61ql.cn/q/2577 126 How can I move files and view the progress (e.g. with a progress bar)? letronje http://njg61ql.cn/users/2088 2010-10-01T06:11:35Z 2020-03-06T20:19:30Z <p>When moving large directories using <code>mv</code>, is there a way to view the progress (%)? The <code>cp</code> command on gentoo had a <code>-g</code> switch that showed the progress.</p>