ramblings.narrabilis.com - scripts, configs, fixes http://ramblings.narrabilis.com/ en Linux System Troubleshooting http://ramblings.narrabilis.com/talks/lisa2019 <span>Linux System Troubleshooting</span> <div class="w3-section field field--name-body field--type-text-with-summary field--label-hidden w3-bar-item field__item"><p lang="en" xml:lang="en" xml:lang="en">Slides from LISA 2019 Linux systems troubleshooting <a dir="ltr" href="https://www.usenix.org/conference/lisa19/presentation/uphill">#<strong>LISA2019</strong></a></p> <p><a href="https://www.slideshare.net/ThomasHowardUphill/linux-system-troubleshooting">https://www.slideshare.net/ThomasHowardUphill/linux-system-troubleshooting</a></p></div> <span><span lang="" about="/user/3" typeof="schema:Person" property="schema:name" datatype="">thomas</span></span> <span>Wed, 2019.11.13 - 14:01</span> <section class="w3-row field field--name-comment-node-story field--type-comment field--label-inline comment-wrapper"> <h2 class="w3-opacity w3-hover-opacity-off w3-margin-left title comment-form__title">Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=378&amp;2=comment_node_story&amp;3=comment_node_story" token="5A9PzSdjA45Chpml4XmyJ-A77iWlMOkfzpjlJvrfsNQ"></drupal-render-placeholder> </section> Wed, 13 Nov 2019 22:01:09 +0000 thomas 378 at http://ramblings.narrabilis.com http://ramblings.narrabilis.com/talks/lisa2019#comments Process (ps) display shortcuts in bash http://ramblings.narrabilis.com/bash/ps <span>Process (ps) display shortcuts in bash</span> <div class="w3-section field field--name-body field--type-text-with-summary field--label-hidden w3-bar-item field__item"><p>I gave a talk on processes and made some simple shortcuts to show processes matching patterns.</p> <h2>psg</h2> <p>ps - grep, grep the process listing for something and show the parent pid, sort by pid.</p> <pre> <div class="geshifilter"><pre class="bash geshifilter-bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> psg<span style="color: #7a0874; font-weight: bold;">(</span><span style="color: #7a0874; font-weight: bold;">)</span> <span style="color: #7a0874; font-weight: bold;">{</span> <span style="color: #007800;">thing</span>=<span style="color: #007800;">$1</span> <span style="color: #007800;">sort</span>=<span style="color: #007800;">$2</span> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">[</span> <span style="color: #660033;">-z</span> <span style="color: #007800;">$2</span> <span style="color: #7a0874; font-weight: bold;">]</span>; <span style="color: #000000; font-weight: bold;">then</span> <span style="color: #007800;">sort</span>=<span style="color: #ff0000;">'pid'</span> <span style="color: #000000; font-weight: bold;">fi</span> <span style="color: #c20cb9; font-weight: bold;">ps</span> <span style="color: #660033;">-eo</span> <span style="color: #ff0000;">'pid ppid stat cmd'</span> <span style="color: #660033;">--sort</span> <span style="color: #007800;">$sort</span><span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'NR==1 {print}; /$thing/ &amp;&amp; !/awk "NR==1/ {print}'</span> <span style="color: #7a0874; font-weight: bold;">}</span></pre></div></pre> <h2>psgi</h2> <p>ps - grep case insensitive.</p> <pre> <div class="geshifilter"><pre class="bash geshifilter-bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> psgi <span style="color: #7a0874; font-weight: bold;">(</span><span style="color: #7a0874; font-weight: bold;">)</span> <span style="color: #7a0874; font-weight: bold;">{</span> <span style="color: #007800;">thing</span>=<span style="color: #007800;">$1</span>; <span style="color: #007800;">sort</span>=<span style="color: #007800;">$2</span>; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">[</span> <span style="color: #660033;">-z</span> <span style="color: #007800;">$2</span> <span style="color: #7a0874; font-weight: bold;">]</span>; <span style="color: #000000; font-weight: bold;">then</span> <span style="color: #007800;">sort</span>=<span style="color: #ff0000;">'pid'</span>; <span style="color: #000000; font-weight: bold;">fi</span>; <span style="color: #c20cb9; font-weight: bold;">ps</span> <span style="color: #660033;">-eo</span> <span style="color: #ff0000;">'pid ppid stat cmd'</span> <span style="color: #660033;">--sort</span> <span style="color: #007800;">$sort</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">"BEGIN{IGNORECASE = 1}; NR==1 {print}; /<span style="color: #007800;">$thing</span>/ &amp;&amp; "</span><span style="color: #ff0000;">'!/awk "NR==1/ {print}'</span> <span style="color: #7a0874; font-weight: bold;">}</span></pre></div></pre> <h2>psk</h2> <p>ps - kernel, show the kernel processes</p> <pre> <div class="geshifilter"><pre class="bash geshifilter-bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> psk<span style="color: #7a0874; font-weight: bold;">(</span><span style="color: #7a0874; font-weight: bold;">)</span> <span style="color: #7a0874; font-weight: bold;">{</span> <span style="color: #c20cb9; font-weight: bold;">ps</span> <span style="color: #660033;">-eo</span> <span style="color: #ff0000;">'pid ppid stat cmd'</span> <span style="color: #660033;">--sort</span> pid <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'NR==1 {print}; $2==2 {print}'</span> <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">less</span> <span style="color: #7a0874; font-weight: bold;">}</span></pre></div></pre> <h2>pss</h2> <p>ps - sorted by pid (or any other sort field)</p> <pre> <div class="geshifilter"><pre class="bash geshifilter-bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> pss<span style="color: #7a0874; font-weight: bold;">(</span><span style="color: #7a0874; font-weight: bold;">)</span> <span style="color: #7a0874; font-weight: bold;">{</span> <span style="color: #007800;">sort</span>=<span style="color: #007800;">$1</span> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">[</span> <span style="color: #660033;">-z</span> <span style="color: #007800;">$1</span> <span style="color: #7a0874; font-weight: bold;">]</span>; <span style="color: #000000; font-weight: bold;">then</span> <span style="color: #007800;">sort</span>=<span style="color: #ff0000;">'pid'</span> <span style="color: #000000; font-weight: bold;">fi</span> <span style="color: #c20cb9; font-weight: bold;">ps</span> <span style="color: #660033;">-eo</span> <span style="color: #ff0000;">'pid ppid stat cmd'</span> <span style="color: #660033;">--sort</span> <span style="color: #007800;">$sort</span> <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">less</span> <span style="color: #7a0874; font-weight: bold;">}</span></pre></div></pre> <h2>psz</h2> <p>ps - look for Zombie processes</p> <pre> <div class="geshifilter"><pre class="bash geshifilter-bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> psz<span style="color: #7a0874; font-weight: bold;">(</span><span style="color: #7a0874; font-weight: bold;">)</span> <span style="color: #7a0874; font-weight: bold;">{</span> <span style="color: #007800;">sort</span>=<span style="color: #007800;">$1</span> <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">[</span> <span style="color: #660033;">-z</span> <span style="color: #007800;">$1</span> <span style="color: #7a0874; font-weight: bold;">]</span>; <span style="color: #000000; font-weight: bold;">then</span> <span style="color: #007800;">sort</span>=<span style="color: #ff0000;">'pid'</span> <span style="color: #000000; font-weight: bold;">fi</span> <span style="color: #c20cb9; font-weight: bold;">ps</span> <span style="color: #660033;">-eo</span> <span style="color: #ff0000;">'pid ppid stat cmd'</span> <span style="color: #660033;">--sort</span> <span style="color: #007800;">$sort</span><span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'NR==1 {print}; $3=="Z" {print}'</span> <span style="color: #7a0874; font-weight: bold;">}</span></pre></div></pre> <p>Of these, I use psg a lot. I use awk to print the first header line and then any matches.</p></div> <span><span lang="" about="/user/3" typeof="schema:Person" property="schema:name" datatype="">thomas</span></span> <span>Mon, 2019.11.11 - 13:05</span> <section class="w3-row field field--name-comment-node-story field--type-comment field--label-inline comment-wrapper"> <h2 class="w3-opacity w3-hover-opacity-off w3-margin-left title comment-form__title">Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=377&amp;2=comment_node_story&amp;3=comment_node_story" token="15bOG3okEQUN0Kn-Ik25krKe9bIGQXcyos_sLYaRqTw"></drupal-render-placeholder> </section> Mon, 11 Nov 2019 21:05:57 +0000 thomas 377 at http://ramblings.narrabilis.com http://ramblings.narrabilis.com/bash/ps#comments Grub2 Dual Boot EFI Secure Boot Linux / Windows http://ramblings.narrabilis.com/linux/efi/dualboot <span>Grub2 Dual Boot EFI Secure Boot Linux / Windows</span> <div class="w3-section field field--name-body field--type-text-with-summary field--label-hidden w3-bar-item field__item"><p>I just got a new laptop with Secure Boot and was having trouble getting Windows and Fedora installed in a dual boot configuration.  I read a few posts on how to do it by changing the bios to Legacy mode but that didn't seem like much fun.  Fedora 30 installed to secure with no problem, so I knew it was possible.</p> <p>I started by paritioning the disk with a GPT partition table and the following partitions: </p> <table><tr><td>p1</td> <td>/boot</td> <td>ext4</td> </tr><tr><td>p2</td> <td>/boot/efi</td> <td>vfat</td> </tr><tr><td>p3</td> <td>lvm</td> </tr><tr><td>p4</td> <td>Microsoft basic data</td> </tr></table><p>Initially I didn't partition p4 at all, and got the windows installer to create that partition later. </p> <p> I installed Fedora 30 from USB with secure boot and EFI enabled. My Lenovo laptop features a <a href="https://support.lenovo.com/us/en/solutions/ht062552">Novo button</a> that has to be used to access the boot menu. Everything worked but I had no boot menu. I entered the bios boot menu and booted the Windows USB. After installing Windows I could only switch between Windows and Fedora by pressing the Novo button. This is inconvenient on my laptop as the Novo button is recessed and requires a pin to press.</p> <p> To install Grub2 in the EFI with a boot menu, I booted from the Fedora installation media and then mounted /boot and /boot/efi overtop of the live filesystem:<br /><br /><code><br /> # mount /dev/nvme0n1p1 /boot<br /> # mount /dev/nvme0n1p2 /boot/efi<br /></code><br /> I then installed the <tt>grub2-efi-x64-modules</tt> rpm and the <tt>efibootmgr</tt> rpm.</p> <p> After installing the rpms, I ran <tt>grub2-mkconfig</tt> to generate a new grub.cfg<br /><br /><code><br /> # grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg<br /></code><br /> As noted on the <a href="https://fedoraproject.org/wiki/GRUB_2%23Updating_GRUB_2_configuration_on_UEFI_systems">Fedora Project Wiki</a> I did not run grub2-install, I used efibootmgr to create an entry for grub.<br /><code><br /> # efibootmgr -c -L GRUB2 -d /dev/nvme0n1 -p 2 -l "\EFI\fedora\grubx64.efi"<br /></code><br /> I was then able to verify the entry with efibootmgr -v:<br /><code><br /> BootCurrent: 0003<br /> Timeout: 0 seconds<br /> BootOrder: 0005,0003,0000,0001,0006,0004,0002,2001,2002,2003<br /> Boot0000* GRUB2 HD(2,GPT,2a3dbf30-521f-44aa-8f89-2dc2a4cd022d,0xef000,0xee800)/File(\EFI\fedora\grubx64.efi)<br /> Boot0001* Linux HD(2,GPT,2a3dbf30-521f-44aa-8f89-2dc2a4cd022d,0xef000,0xee800)/File(\EFI\fedora\shimx64.efi)<br /> Boot0002* Fedora HD(2,GPT,2a3dbf30-521f-44aa-8f89-2dc2a4cd022d,0xef000,0xee800)/File(\EFI\fedora\shim.efi)RC<br /> Boot0003* Fedora HD(2,GPT,2a3dbf30-521f-44aa-8f89-2dc2a4cd022d,0xef000,0xee800)/File(\EFI\fedora\shimx64.efi)<br /> Boot0004* Linpus lite HD(2,GPT,2a3dbf30-521f-44aa-8f89-2dc2a4cd022d,0xef000,0xee800)/File(\EFI\Boot\grubx64.efi)RC<br /> Boot0006* Windows Boot Manager HD(2,GPT,2a3dbf30-521f-44aa-8f89-2dc2a4cd022d,0xef000,0xee800)/File(\EFI\Microsoft\Boot\bootmgfw.efi)WINDOWS.........x...B.C.D.O.B.J.E.C.T.=.{.9.d.e.a.8.6.2.c.-.5.c.d.d.-.4.e.7.0.-.a.c.c.1.-.f.3.2.b.3.4.4.d.4.7.9.5.}...a................<br /> Boot2001* EFI USB Device RC<br /> Boot2002* EFI DVD/CDROM RC<br /> Boot2003* EFI Network RC<br /></code><br /> Once you are satisfied with your boot options, you can delete entries with "-B -b xxxx" where xxxx is the number you wish to delete.<br /><code><br /> # efibootmgr -B -b 0005<br /></code><br /> On the first reboot you will need to install the keys for grub into the MUK, this is outlined on <a href="https://www.aioboot.com/en/secure-boot/">this page</a>. In my case I had to use the "hash" option and then import the keys for the \EFI\fedora\grubx64.efi and \EFI\BOOT\BOOTX64.efi. Once the keys are imported, grub should fire right up.</p> <p> Now when I reboot, Grub2 is displayed before Fedora Boots, I can also select Windows from the Grub2 menu.</p> <p> This stack exchange link was also helpful in figuring this out: https://superuser.com/questions/376470/how-to-reinstall-grub2-efi</p> </div> <span><span lang="" about="/user/3" typeof="schema:Person" property="schema:name" datatype="">thomas</span></span> <span>Thu, 2019.09.12 - 21:35</span> <section class="w3-row field field--name-comment-node-story field--type-comment field--label-inline comment-wrapper"> <h2 class="w3-opacity w3-hover-opacity-off w3-margin-left title comment-form__title">Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=375&amp;2=comment_node_story&amp;3=comment_node_story" token="UcV9JrzPHMEvzuuSyMwwDtTtnD7dNYKnOclQ5lIvLVU"></drupal-render-placeholder> </section> Fri, 13 Sep 2019 04:35:32 +0000 thomas 375 at http://ramblings.narrabilis.com http://ramblings.narrabilis.com/linux/efi/dualboot#comments Virtualbox Headless Command Line Hacks http://ramblings.narrabilis.com/node/374 <span>Virtualbox Headless Command Line Hacks</span> <div class="w3-section field field--name-body field--type-text-with-summary field--label-hidden w3-bar-item field__item"><p>For reasons I'm running vagrant with VirtualBox inside a docker container.  Most of the time this goes great and no problems, but when it fails it's difficult to see what's happening on the machine.  I've tried and failed to get VNC going on the vm running inside the container. I should note that my problem is with Windows VMs, with Linux VMs it's never a problem to get console. My workaround for Windows is to use screenshots and send keystrokes to the vm via vboxmanage.</p> <p>First step is to get the uuid or name of the vm</p> <h2>List vms</h2> <p><div class="geshifilter"><pre class="bash geshifilter-bash" style="font-family:monospace;">$ vboxmanage list vms <span style="color: #ff0000;">&quot;foo&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>34bcbbef-ffff-4d2d-<span style="color: #000000;">8546</span>-031d7b597332<span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #ff0000;">&quot;bar&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>06e5696c-ffff-4c44-908e-e38aac1152fd<span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #ff0000;">&quot;rhel76&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>312f38c2-ffff-4e46-af79-6c951eeef63d<span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #ff0000;">&quot;win2012&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>4230645c-ffff-4c38-a933-a78787521ea6<span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #ff0000;">&quot;win2019&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>92d7e563-ffff-444d-afd4-242a9e24d219<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div><br /> You can use either the name or the uuid to then <tt>controlvm</tt>:</p> <h2>Screenshot</h2> <p><div class="geshifilter"><pre class="bash geshifilter-bash" style="font-family:monospace;"><span style="color: #666666;">$ </span>vboxmanage controlvm win2019 screenshotpng win2019.png</pre></div><br /> You can then view that PNG to see what's on the screen right now. Next, you can send keyboard input to the VM using keyboardputscancode</p> <h2>Control-Alt-Delete on the VM</h2> <p><div class="geshifilter"><pre class="bash geshifilter-bash" style="font-family:monospace;"><span style="color: #666666;">$ </span>vboxmanage controlvm foo keyboardputscancode 1D <span style="color: #000000;">38</span> <span style="color: #000000;">53</span> D3 B8 9D</pre></div><br /> Using this <a href="https://www.win.tue.nl/~aeb/linux/kbd/scancodes.html">scancodes page</a> to figure out what keystrokes you wish to type on the VM. The above corresponds to Keypress Ctrl, Keypress Alt, Keypress Del, Release Del, Release Alt, Release Ctl. You can use printf to print the Release codes, the release codes are the Keypress codes + 0x80, so for 1d:<br /> <div class="geshifilter"><pre class="bash geshifilter-bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">'%#X\n'</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$((0x80+0x1d)</span>)&quot;</span> 0X9D</pre></div><br /> Using the same trick we can fake a Windows Logo key press and release with "E0 5B E0 DB", so to do a "Run Command" with the Windows Logo Key:<br /><code language="bash"><br /> $ vboxmanage controlvm foo keyboardputscancode E0 5B 13 E0 DB 93<br /> $ vboxmanage controlvm foo keyboardputstring "CMD"<br /> $ vboxmanage controlvm foo keyboardputscancode 1C 9C<br /></code><br /> This types a Windows Key + R, then releases both. I then type "CMD" and then 1C 9C is an Enter. You can also cheat above using a Ctl-J in the string, if you type CMD then Ctrl-V Ctl-J, you'll get a literal carriage return in your keyboardputstring which will be sent to the remote host. </p> <p> Using this method you can "view" the screen on your vm and "type" without having a real console.</p> <p> It's worth noting that VRDP should work here, but I've had no success getting that working remotely. I only have SSH access to the vsphere host running docker/vagrant. VRDP will not work without the EXTPACK installed in virtualbox as well, you need to install the EXTPACK before trying VRDP.</p> </div> <span><span lang="" about="/user/3" typeof="schema:Person" property="schema:name" datatype="">thomas</span></span> <span>Wed, 2019.08.14 - 10:05</span> <section class="w3-row field field--name-comment-node-story field--type-comment field--label-inline comment-wrapper"> <h2 class="w3-opacity w3-hover-opacity-off w3-margin-left title comment-form__title">Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=374&amp;2=comment_node_story&amp;3=comment_node_story" token="zFW_fTD0x4a5ztv1JuX2fqui3c751tDHtmRueW99Gqc"></drupal-render-placeholder> </section> Wed, 14 Aug 2019 17:05:14 +0000 thomas 374 at http://ramblings.narrabilis.com http://ramblings.narrabilis.com/node/374#comments Nokogiri install on MacOSX http://ramblings.narrabilis.com/node/373 <span>Nokogiri install on MacOSX</span> <div class="w3-section field field--name-body field--type-text-with-summary field--label-hidden w3-bar-item field__item"><p>Getting nokogiri to install was failing for me. I'm using bundler and needed nokogiri. Gem is trying to compile it and failing on libxml2.</p> <p>At first I tried using the libxml from brew, that that didn't work, so specified where to find XCode's version of libxml in my bundle config.</p> <p>~/.bundle/config<br /> <span class="geshifilter"><code class="bash geshifilter-bash">BUNDLE_BUILD__NOKOGIRI: <span style="color: #ff0000;">&quot;--use-system-libraries=true --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/libxml2&quot;</span></code></span></p> <p>You might need to tweak the MacOSX10.14.sdk part, that's for Mojave, I've been using this line for a while, and just updated from 10.12-&gt;10.13-&gt;10.14.</p> <p>I also like to install the gems in my home directory, so I add the following to my bundle config:<br /> <span class="geshifilter"><code class="bash geshifilter-bash">BUNDLE_PATH: <span style="color: #ff0000;">&quot;/Users/thomas/.gem&quot;</span></code></span></p> </div> <span><span lang="" about="/user/3" typeof="schema:Person" property="schema:name" datatype="">thomas</span></span> <span>Fri, 2019.07.12 - 08:06</span> <section class="w3-row field field--name-comment-node-story field--type-comment field--label-inline comment-wrapper"> <h2 class="w3-opacity w3-hover-opacity-off w3-margin-left title comment-form__title">Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=373&amp;2=comment_node_story&amp;3=comment_node_story" token="kj4o0dOXTnez17nqPsedv7pS7TJzSCEh2ditXCAnPbs"></drupal-render-placeholder> </section> Fri, 12 Jul 2019 15:06:48 +0000 thomas 373 at http://ramblings.narrabilis.com http://ramblings.narrabilis.com/node/373#comments HTML email with plain mailer plugin on Jenkins http://ramblings.narrabilis.com/node/372 <span>HTML email with plain mailer plugin on Jenkins</span> <div class="w3-section field field--name-body field--type-text-with-summary field--label-hidden w3-bar-item field__item"><p>We build our Jenkins from a docker container, setting up that with code requires setting up the plugin from groovy. I didn't want to figure out how to translate our config for the plain mailer plugin to the email-ext plugin. I started using the plain mailer plugin but decided I'd like to send the email in HTML format. Once again, Jenkins docs were terrible, but reading the code, it looked like mimetype was supported.</p> <p>I came up with the following code to send an HTML email from the Jenkinsfile</p> <p><div class="geshifilter"><pre class="java geshifilter-java" style="font-family:monospace;"> mail to<span style="color: #339933;">:</span> env.<span style="color: #006633;">REQUESTOR</span>, subject<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;Pipeline: ${currentBuild.fullDisplayName} ${currentBuild.result}&quot;</span>, mimeType<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;text/html&quot;</span>, body<span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #0000ff;">&quot; &lt;html&gt; &lt;body&gt; &lt;h1&gt;Pipeline: ${currentBuild.fullDisplayName}&lt;/h1&gt; &lt;h2&gt;&lt;a href=&quot;</span>$<span style="color: #009900;">&#123;</span>env.<span style="color: #006633;">RUN_DISPLAY_URL</span><span style="color: #009900;">&#125;</span><span style="color: #0000ff;">&quot;&gt;Build ${currentBuild.id} Results&lt;/a&gt;&lt;/h2&gt; &lt;h2&gt;&lt;a href=&quot;</span>$<span style="color: #009900;">&#123;</span>env.<span style="color: #006633;">JOB_DISPLAY_URL</span><span style="color: #009900;">&#125;</span><span style="color: #0000ff;">&quot;&gt;${currentBuild.projectName}&lt;/a&gt;&lt;/h2&gt; &lt;/body&gt; &lt;/html&gt; &quot;</span><span style="color: #0000ff;">&quot;&quot;</span></pre></div></p> <p>This results in an email that is correctly displayed by Outlook and Gmail.</p> <p>Just in case someone wants to see the config for the plain mailer...<br /> <div class="geshifilter"><pre class="java geshifilter-java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">hudson.tasks.Mailer</span> &nbsp; def m <span style="color: #339933;">=</span> Mailer.<span style="color: #006633;">descriptor</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> &nbsp; m.<span style="color: #006633;">setSmtpHost</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;smtp.example.com&quot;</span><span style="color: #009900;">&#41;</span> m.<span style="color: #006633;">setReplyToAddress</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;jenkins@example.com&quot;</span><span style="color: #009900;">&#41;</span> m.<span style="color: #006633;">save</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span></pre></div></p> </div> <span><span lang="" about="/user/3" typeof="schema:Person" property="schema:name" datatype="">thomas</span></span> <span>Thu, 2019.07.11 - 14:07</span> <section class="w3-row field field--name-comment-node-story field--type-comment field--label-inline comment-wrapper"> <h2 class="w3-opacity w3-hover-opacity-off w3-margin-left title comment-form__title">Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=372&amp;2=comment_node_story&amp;3=comment_node_story" token="UwdbjhDWsiply6szbCTiqFNYyNDEAv4FIXsDhrsmh1M"></drupal-render-placeholder> </section> Thu, 11 Jul 2019 21:07:24 +0000 thomas 372 at http://ramblings.narrabilis.com http://ramblings.narrabilis.com/node/372#comments git sparse checkout within Jenkinsfile http://ramblings.narrabilis.com/node/371 <span>git sparse checkout within Jenkinsfile</span> <div class="w3-section field field--name-body field--type-text-with-summary field--label-hidden w3-bar-item field__item"><p>I needed to checkout some code from another repository into my project, but I only wanted a specific directory within the other repository.</p> <p>As usual with Jenkins, the docs are lacking, but reading the source for a bit I came up with the following:</p> <p><div class="geshifilter"><pre class="java geshifilter-java" style="font-family:monospace;">dir<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'otherrepo'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> checkout<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span>$class<span style="color: #339933;">:</span> <span style="color: #0000ff;">'GitSCM'</span>, branches<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#91;</span>name<span style="color: #339933;">:</span> <span style="color: #0000ff;">'*/master'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span>, doGenerateSubmoduleConfigurations<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">false</span>, extensions<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span> <span style="color: #009900;">&#91;</span> $class<span style="color: #339933;">:</span> <span style="color: #0000ff;">'SparseCheckoutPaths'</span>, sparseCheckoutPaths<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span> <span style="color: #009900;">&#91;</span> $class<span style="color: #339933;">:</span> <span style="color: #0000ff;">'SparseCheckoutPath'</span>, path<span style="color: #339933;">:</span> <span style="color: #0000ff;">'goodthing/'</span> <span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#93;</span>, submoduleCfg<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span>, userRemoteConfigs<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#91;</span>credentialsId<span style="color: #339933;">:</span> <span style="color: #0000ff;">'ACTIVE_DIRECTORY'</span>, url<span style="color: #339933;">:</span> <span style="color: #0000ff;">'https://github.com/uphillian/otherrepo.git'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#125;</span></pre></div></p> <p>According to the code, you should also be able to remove paths with `!` in the path, but I had trouble with this. I believe if the badpath is nested under the good path, it doesn't work.</p> <p><div class="geshifilter"><pre class="java geshifilter-java" style="font-family:monospace;">dir<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'otherrepo'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> checkout<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span>$class<span style="color: #339933;">:</span> <span style="color: #0000ff;">'GitSCM'</span>, branches<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#91;</span>name<span style="color: #339933;">:</span> <span style="color: #0000ff;">'*/master'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span>, doGenerateSubmoduleConfigurations<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">false</span>, extensions<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span> <span style="color: #009900;">&#91;</span> $class<span style="color: #339933;">:</span> <span style="color: #0000ff;">'SparseCheckoutPaths'</span>, sparseCheckoutPaths<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span> <span style="color: #009900;">&#91;</span> $class<span style="color: #339933;">:</span> <span style="color: #0000ff;">'SparseCheckoutPath'</span>, path<span style="color: #339933;">:</span> <span style="color: #0000ff;">'!goodthing/badthing/*'</span>, path<span style="color: #339933;">:</span> <span style="color: #0000ff;">'scripts/'</span> <span style="color: #009900;">&#93;</span>, <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#93;</span>, submoduleCfg<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span>, userRemoteConfigs<span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#91;</span>credentialsId<span style="color: #339933;">:</span> <span style="color: #0000ff;">'ACTIVE_DIRECTORY'</span>, url<span style="color: #339933;">:</span> <span style="color: #0000ff;">'https://github.com/uphillian/otherrepo.git'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#125;</span></pre></div></p> <p>Doing this I only get the goodthing directory in the otherrepo directory in the workspace.</p> </div> <span><span lang="" about="/user/3" typeof="schema:Person" property="schema:name" datatype="">thomas</span></span> <span>Thu, 2019.07.11 - 13:40</span> <section class="w3-row field field--name-comment-node-story field--type-comment field--label-inline comment-wrapper"> <h2 class="w3-opacity w3-hover-opacity-off w3-margin-left title comment-form__title">Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=371&amp;2=comment_node_story&amp;3=comment_node_story" token="n1KzpjvUsPkUWznlQGz8MTwXccTxHbgnpPzkFWqbotc"></drupal-render-placeholder> </section> Thu, 11 Jul 2019 20:40:53 +0000 thomas 371 at http://ramblings.narrabilis.com http://ramblings.narrabilis.com/node/371#comments Linux System Troubleshooting http://ramblings.narrabilis.com/talks/lisa2018 <span>Linux System Troubleshooting</span> <div class="w3-section field field--name-body field--type-text-with-summary field--label-hidden w3-bar-item field__item"><p>Talk I gave at <a href="https://www.usenix.org/conference/lisa18">#LISA2018</a>. I've given this talk as a half day tutorial, at LISA2018 I gave it in 90minutes. The bulk of the talk is laying a solid foundation on how Linux works. <a href="https://goo.gl/qc8rHw">Slides</a></p> </div> <span><span lang="" about="/user/3" typeof="schema:Person" property="schema:name" datatype="">thomas</span></span> <span>Wed, 2018.11.07 - 10:43</span> <section class="w3-row field field--name-comment-node-story field--type-comment field--label-inline comment-wrapper"> <h2 class="w3-opacity w3-hover-opacity-off w3-margin-left title comment-form__title">Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=369&amp;2=comment_node_story&amp;3=comment_node_story" token="YvF-aVDeKPmp3nHNkr-thgDrcC8qHYor-wR2wJyeJdQ"></drupal-render-placeholder> </section> Wed, 07 Nov 2018 18:43:02 +0000 thomas 369 at http://ramblings.narrabilis.com http://ramblings.narrabilis.com/talks/lisa2018#comments MD-BT01 on iOS 11.3 iPad http://ramblings.narrabilis.com/node/367 <span>MD-BT01 on iOS 11.3 iPad</span> <div class="w3-section field field--name-body field--type-text-with-summary field--label-hidden w3-bar-item field__item"><p>My iPad got updated to 11.3 and I lost the ability to use my usb-midi interface reliably. I had an M-Audio Uno which worked great on 10.3.3. On 11.3 it keeps stopping and a dialog is displayed stating that the "accessory is unsupported".</p> <p>I think this is related to the M-Audio using more than 100mA. My lightning adapter couldn't inject voltage, so I looked at getting a Bluetooth MIDI adapter.</p> <p>I ordered an <a href="https://www.amazon.com/Yamaha-Wireless-MD-BT01-5-PIN-Adapter/dp/B01CFOHF6U">MD-BT01</a> and of course the iPad could not see the adapter. I was able to see the device on my Android Phone and other Bluetooth devices. I found that you can install the MD-BT01 utility from the App Store, you have to search for MD-BT01, then select Filters and change from iPad only to iPhone only. </p> <p>After installing that, you can see the adapter but still not use it. I had to install "Yamaha Synth Book" (you also need to filter for iPhone only to install this) and follow the instructions on <a href="https://www.yamahasynth.com/resources/bluetooth-wireless-midi-adaptors">yamaha's website</a></p> <p>After that the adapter works. I haven't received any disconnect messages from the piano after that.</p> </div> <span><span lang="" about="/user/3" typeof="schema:Person" property="schema:name" datatype="">thomas</span></span> <span>Thu, 2018.04.19 - 11:59</span> <section class="w3-row field field--name-comment-node-story field--type-comment field--label-inline comment-wrapper"> <h2 class="w3-opacity w3-hover-opacity-off w3-margin-left title comment-form__title">Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=367&amp;2=comment_node_story&amp;3=comment_node_story" token="O5MpvakqBSlzp20blI_A7w726YPcwHcKUM_Iqwnw8yo"></drupal-render-placeholder> </section> Thu, 19 Apr 2018 18:59:57 +0000 thomas 367 at http://ramblings.narrabilis.com http://ramblings.narrabilis.com/node/367#comments Hiera 5 data_hash backend http://ramblings.narrabilis.com/puppet/http_data_hash <span>Hiera 5 data_hash backend</span> <div class="w3-section field field--name-body field--type-text-with-summary field--label-hidden w3-bar-item field__item"><p>I made a data_hash backend for hiera that uses the puppet certificate certname to connect to a remote http service and retrieve hieradata for a node. The http backend is up to you, in my implementation I also verified the certificate was signed by the Puppet CA. </p> <p>This backend uses data_hash, so that it only looks up hiera once per catalog compilation. If it finds hieradata for a node, it updates the hiera cache.</p> <p>The github repo is located here <a href="https://github.com/uphillian/http_data_hash">https://github.com/uphillian/http_data_hash</a></p> </div> <span><span lang="" about="/user/3" typeof="schema:Person" property="schema:name" datatype="">thomas</span></span> <span>Wed, 2017.11.08 - 10:24</span> <section class="w3-row field field--name-comment-node-story field--type-comment field--label-inline comment-wrapper"> <h2 class="w3-opacity w3-hover-opacity-off w3-margin-left title comment-form__title">Add new comment</h2> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=366&amp;2=comment_node_story&amp;3=comment_node_story" token="AW050BVbTLuL7YZt7SKFary0gdtscZ1k2xRcdLSRcqI"></drupal-render-placeholder> </section> Wed, 08 Nov 2017 18:24:29 +0000 thomas 366 at http://ramblings.narrabilis.com http://ramblings.narrabilis.com/puppet/http_data_hash#comments