1
0
mirror of https://github.com/balkian/balkian.github.com.git synced 2025-02-23 10:15:05 +00:00
balkian.github.com/categories/linux/index.xml

230 lines
18 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Linux on J. Fernando Sánchez</title><link>https://balkian.com/categories/linux/</link><description>Recent content in Linux on J. Fernando Sánchez</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Sat, 01 Jun 2019 00:00:01 +0000</lastBuildDate><atom:link href="https://balkian.com/categories/linux/index.xml" rel="self" type="application/rss+xml"/><item><title>Linux on the Microsoft Surface Go</title><link>https://balkian.com/p/linux-on-the-microsoft-surface-go/</link><pubDate>Sat, 01 Jun 2019 00:00:01 +0000</pubDate><guid>https://balkian.com/p/linux-on-the-microsoft-surface-go/</guid><description>&lt;p>Believe it or not, Surface tablets have pretty good linux support, except for the webcams in newer models.
These are some useful notes to get Ubuntu installed in your surface go, as of Summer 2019.&lt;/p>
&lt;h2 id="installing-the-kernel">Installing the kernel
&lt;/h2>&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-shell" data-lang="shell">&lt;span class="line">&lt;span class="cl">git clone --depth &lt;span class="m">1&lt;/span> https://github.com/jakeday/linux-surface.git ~/linux-surface
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">cp -a ~/linux-surface /media/&amp;lt;your usb&amp;gt;
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-shell" data-lang="shell">&lt;span class="line">&lt;span class="cl">cp -a /media/&amp;lt;your usb&amp;gt;/linux-surface ~/
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">cd&lt;/span> ~/linux-surface/
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sudo sh setup.sh
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;h2 id="booting-ubuntu-first">Booting ubuntu first
&lt;/h2>&lt;p>Switch out of Windows S mode.&lt;/p>
&lt;p>Boot into the &amp;ldquo;Command Prompt&amp;rdquo;.&lt;/p>
&lt;p>From Windows go to &amp;ldquo;change advanced startup options&amp;rdquo; and select &amp;ldquo;restart now&amp;rdquo;.&lt;/p>
&lt;p>When it reboots, choose the &amp;ldquo;Troubleshoot&amp;rdquo; option, then choose the &amp;ldquo;Advanced options&amp;rdquo; option, and finally choose the &amp;ldquo;Command Prompt&amp;rdquo; option.&lt;/p>
&lt;p>After the device reboots, login to the command prompt and then you should see a terminal with X:\windows\system32&amp;gt;&lt;/p>
&lt;p>At the prompt, check your UEFI entries:&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-shell" data-lang="shell">&lt;span class="line">&lt;span class="cl">bcdedit /enum firmware
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>Copy UEFI entry of &amp;ldquo;Windows Boot Manager&amp;rdquo; to create a new entry for Ubuntu: bcdedit /copy {bootmgr} /d &amp;ldquo;Ubuntu&amp;rdquo;&lt;/p>
&lt;p>Copy the printed GUID number including the braces {} using Ctrl+C&lt;/p>
&lt;p>Set file path for the new Ubuntu entry. Replace {guid} with the returned GUID of the previous command (Ctrl+V). bcdedit /set {guid} path \EFI\ubuntu\grubx64.efi&lt;/p>
&lt;p>Set Ubuntu as the first/ entry in the boot sequence. Again replace {guid} with the returned GUID of the copy command.&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-shell" data-lang="shell">&lt;span class="line">&lt;span class="cl">bcdedit /set &lt;span class="o">{&lt;/span>fwbootmgr&lt;span class="o">}&lt;/span> displayorder &lt;span class="o">{&lt;/span>guid&lt;span class="o">}&lt;/span> /addfirst
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>Check your UEFI entries again: bcdedit /enum firmware You should see something like this:&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt"> 1
&lt;/span>&lt;span class="lnt"> 2
&lt;/span>&lt;span class="lnt"> 3
&lt;/span>&lt;span class="lnt"> 4
&lt;/span>&lt;span class="lnt"> 5
&lt;/span>&lt;span class="lnt"> 6
&lt;/span>&lt;span class="lnt"> 7
&lt;/span>&lt;span class="lnt"> 8
&lt;/span>&lt;span class="lnt"> 9
&lt;/span>&lt;span class="lnt">10
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-shell" data-lang="shell">&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">Firmware Boot Manager
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">---------------------
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">identifier &lt;span class="o">{&lt;/span>fwbootmgr&lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">displayorder &lt;span class="o">{&lt;/span>3510232e-f8eb-e811-95ce-9ecab3f9d1c4&lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">{&lt;/span>bootmgr&lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">{&lt;/span>2148799b-f8eb-e811-95ce-9ecab3f9d1c4&lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">{&lt;/span>312e8a67-c2f6-e811-95ce-3c1ab3f9d1de&lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="o">{&lt;/span>312e8a68-c2f6-e811-95ce-3c1ab3f9d1de&lt;span class="o">}&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">timeout &lt;span class="m">0&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>Make sure the GUID you copied is the first one listed in displayorder. Then type exit, turn off the PC and turn it back on. After this my surface go is automatically booting to the grub bootloader which lets me choose between Windows and Ubuntu but defaults to Ubuntu after ten seconds.&lt;/p></description></item><item><title>Linux</title><link>https://balkian.com/linux/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://balkian.com/linux/</guid><description>&lt;img src="https://balkian.com/img/linux.png" alt="Featured image of post Linux" />&lt;h2 id="black-screen-and-lightdm-doesnt-unlock">Black screen and LightDM doesn&amp;rsquo;t unlock
&lt;/h2>&lt;p>Add this to your /etc/lightdm/lightdm.conf file:&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-cfg" data-lang="cfg">&lt;span class="line">&lt;span class="cl">&lt;span class="k">[LightDM]&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="na">logind-check-graphical&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="s">true&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>##Edit previous commands&lt;/p>
&lt;p>&lt;code>fc&lt;/code> is a shell builtin to list and edit previous commands in an editor.
In addition to editing a single line (which you can also do with &lt;code>C-x C-e&lt;/code>), it also allows you to edit and run several lines at the same time.
You use it like this:&lt;/p>
&lt;p>List previous commands&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;span class="lnt">4
&lt;/span>&lt;span class="lnt">5
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-shell" data-lang="shell">&lt;span class="line">&lt;span class="cl">$ &lt;span class="nb">fc&lt;/span> -l
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="m">10259&lt;/span> nvim deploy.sh
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">10260* &lt;span class="nb">cd&lt;/span> ..
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">10261* nvim content/cheatsheet/linux.md
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="m">10262&lt;/span> &lt;span class="nb">cd&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>List commands with date (in zsh)&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;span class="lnt">4
&lt;/span>&lt;span class="lnt">5
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-shell" data-lang="shell">&lt;span class="line">&lt;span class="cl">$ &lt;span class="nb">fc&lt;/span> -ld
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">10260* 19:38 &lt;span class="nb">cd&lt;/span> ..
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">10261* 19:38 nvim content/cheatsheet/linux.md
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="m">10262&lt;/span> 19:40 &lt;span class="nb">cd&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="m">10263&lt;/span> 19:40 &lt;span class="nb">fc&lt;/span> -l
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>You can add the date too:&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;span class="lnt">4
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-shell" data-lang="shell">&lt;span class="line">&lt;span class="cl">$ &lt;span class="nb">fc&lt;/span> -fld
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="m">10262&lt;/span> 1/10/2019 19:40 &lt;span class="nb">cd&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="m">10263&lt;/span> 1/10/2019 19:40 &lt;span class="nb">fc&lt;/span> -l
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="m">10264&lt;/span> 1/10/2019 19:40 &lt;span class="nb">fc&lt;/span> -ld
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>You can edit a range of commands&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-shell" data-lang="shell">&lt;span class="line">&lt;span class="cl">$ &lt;span class="nb">fc&lt;/span> &lt;span class="m">10262&lt;/span> &lt;span class="m">10264&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>The range can be relative to the current position, so the previous command is equivalent to:&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-shell" data-lang="shell">&lt;span class="line">&lt;span class="cl">$ &lt;span class="nb">fc&lt;/span> -3 -1
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>If you save and exit, all commands are executed as a script, and it will be added to your history.&lt;/p>
&lt;p>Source: &lt;a class="link" href="https://shapeshed.com/unix-fc/" target="_blank" rel="noopener"
>https://shapeshed.com/unix-fc/&lt;/a>&lt;/p>
&lt;h2 id="prevent-logoff-from-killing-tmux-sessions">Prevent logoff from killing tmux sessions
&lt;/h2>&lt;p>Lately I&amp;rsquo;ve noticed that logging out of i3, intentionally or when i3 fails, would also kill any tmux or emacs sessions.
This is extremely annoying.&lt;/p>
&lt;p>This is caused by a new default in logind (systemd&amp;rsquo;s login) to kill user process on logoff.
You can revert this setting in your logind.conf (&lt;code>/etc/systemd/logind.conf&lt;/code>):&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-cfg" data-lang="cfg">&lt;span class="line">&lt;span class="cl">&lt;span class="na">KillUserProcesses&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="s">no&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>Or only for a specific process (e.g., tmux):&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-shell" data-lang="shell">&lt;span class="line">&lt;span class="cl">systemd-run --scope --user tmux
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>Source: &lt;a class="link" href="https://unix.stackexchange.com/questions/490267/prevent-logoff-from-killing-tmux-session" target="_blank" rel="noopener"
>https://unix.stackexchange.com/questions/490267/prevent-logoff-from-killing-tmux-session&lt;/a>&lt;/p>
&lt;h2 id="upload-a-temporary-file">Upload a temporary file
&lt;/h2>&lt;p>Sometimes you just need to copy/paste a file from a server, and copying from the terminal can be a hassle.
These two services are command-line &amp;ldquo;pastebins&amp;rdquo; just one curl away:&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;span class="lnt">4
&lt;/span>&lt;span class="lnt">5
&lt;/span>&lt;span class="lnt">6
&lt;/span>&lt;span class="lnt">7
&lt;/span>&lt;span class="lnt">8
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-shell" data-lang="shell">&lt;span class="line">&lt;span class="cl">&amp;lt;command&amp;gt; &lt;span class="p">|&lt;/span> curl -F &lt;span class="s1">&amp;#39;sprunge=&amp;lt;-&amp;#39;&lt;/span> http://sprunge.us
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># OR&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&amp;lt;command&amp;gt; 2&amp;gt;&lt;span class="p">&amp;amp;&lt;/span>&lt;span class="m">1&lt;/span> &lt;span class="p">|&lt;/span> curl -F &lt;span class="s1">&amp;#39;f:1=&amp;lt;-&amp;#39;&lt;/span> ix.io
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># OR&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&amp;lt;command&amp;gt; &lt;span class="p">|&lt;/span> curl -F&lt;span class="s2">&amp;#34;file=@-&amp;#34;&lt;/span> https://ttm.sh
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;h1 id="install-fortinet-sslvpn-support-for-networkmanager">Install Fortinet SSLVPN support for NetworkManager
&lt;/h1>&lt;p>UPM (Universidad Politécnica de Madrid) uses a propriatary VPN solution.
The instructions for GNU/Linux on their website involve downloading a specific client (&lt;code>.tar.gz&lt;/code>) and manually running it.
That works, but it is kind of a hassle.
A much more convenient alternative is installing this NetworkManager plugin:&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-shell" data-lang="shell">&lt;span class="line">&lt;span class="cl">pacman -Sy networkmanager-fortisslvpn
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Or apt get install networkmanager-fortisslvpn &lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>Now you can simply add a new VPN connection in NetworkManager and manage it as you would any other connection.&lt;/p></description></item></channel></rss>