alberto - debianhttps://alberto.tf/2019-12-02T15:06:00+01:00How to clone a server using just rsync2019-12-02T15:06:00+01:002019-12-02T15:06:00+01:00Albertotag:alberto.tf,2019-12-02:/how-to-clone-a-server-using-just-rsync.html<p>In the past I needed more space in the server and so i had to upgraded it to a more expensive option, without option of going back</p>
<p>Now the basic server option is cheaper and is enough for me. Plus there were some black friday discounts :)</p>
<p>So I decided to move the server with all my services to a cheaper option and <strong>save 75%</strong> of what i was spending with more or less the same features</p>
<p>Unfortunately, this is not supported by default and theres no one button way to do it. Fortunately, this is very easy to do using <strong>linux</strong>!</p>
<p><a href="/images/blackfriday.jpg"><img alt="People fighting over products in black friday fashion" src="/images/blackfriday.jpg" title="Cheaper server time!!" width="100%"></a></p>
<p>This is how i did it in <strong>6 easy steps</strong>:</p>
<h4>Step 1</h4>
<ul>
<li>Reboot booh machines using a live image and have a working ssh server on the target server</li>
<li>Mount the server disk on both servers on /mnt</li>
</ul>
<h4>Step 2</h4>
<ul>
<li><code>rsync -AHXavP --numeric-ids --exclude='/mnt/dev' --exclude='/mnt/proc' --exclude='/mnt/sys' /mnt/ root@ip.dest.server:/mnt/</code></li>
</ul>
<h4>Step 3</h4>
<ul>
<li>ssh on the target server. Bind /proc /dev /sys to /mnt/ and chroot it</li>
<li><code>grub-install /dev/sdb && update-grub</code></li>
<li><code>ack ip.orig.server /etc/</code> and change it where appropiate</li>
<li><code>reboot</code></li>
</ul>
<h4>Step 4</h4>
<ul>
<li>Change <span class="caps">DNS</span></li>
</ul>
<h4>Step 5</h4>
<ul>
<li>????</li>
</ul>
<h4>Step 6</h4>
<ul>
<li>Profit!</li>
</ul>
<h5>Conclusion</h5>
<div class="highlight"><pre><span></span>A couple of hours to do the whole thing including buying the new server and everything seems to be working as if nothing happened. Copying directly from server to server helped with the downtime too. Aint linux wonderful?
</pre></div><p>In the past I needed more space in the server and so i had to upgraded it to a more expensive option, without option of going back</p>
<p>Now the basic server option is cheaper and is enough for me. Plus there were some black friday discounts :)</p>
<p>So I decided to move the server with all my services to a cheaper option and <strong>save 75%</strong> of what i was spending with more or less the same features</p>
<p>Unfortunately, this is not supported by default and theres no one button way to do it. Fortunately, this is very easy to do using <strong>linux</strong>!</p>
<p><a href="/images/blackfriday.jpg"><img alt="People fighting over products in black friday fashion" src="/images/blackfriday.jpg" title="Cheaper server time!!" width="100%"></a></p>
<p>This is how i did it in <strong>6 easy steps</strong>:</p>
<h4>Step 1</h4>
<ul>
<li>Reboot booh machines using a live image and have a working ssh server on the target server</li>
<li>Mount the server disk on both servers on /mnt</li>
</ul>
<h4>Step 2</h4>
<ul>
<li><code>rsync -AHXavP --numeric-ids --exclude='/mnt/dev' --exclude='/mnt/proc' --exclude='/mnt/sys' /mnt/ root@ip.dest.server:/mnt/</code></li>
</ul>
<h4>Step 3</h4>
<ul>
<li>ssh on the target server. Bind /proc /dev /sys to /mnt/ and chroot it</li>
<li><code>grub-install /dev/sdb && update-grub</code></li>
<li><code>ack ip.orig.server /etc/</code> and change it where appropiate</li>
<li><code>reboot</code></li>
</ul>
<h4>Step 4</h4>
<ul>
<li>Change <span class="caps">DNS</span></li>
</ul>
<h4>Step 5</h4>
<ul>
<li>????</li>
</ul>
<h4>Step 6</h4>
<ul>
<li>Profit!</li>
</ul>
<h5>Conclusion</h5>
<div class="highlight"><pre><span></span>A couple of hours to do the whole thing including buying the new server and everything seems to be working as if nothing happened. Copying directly from server to server helped with the downtime too. Aint linux wonderful?
</pre></div>Get a nearly fresh debian install without reinstalling2019-09-26T12:31:00+02:002019-09-26T12:31:00+02:00Albertotag:alberto.tf,2019-09-26:/get-a-nearly-fresh-debian-install-without-reinstalling.html<p>I was recently asked <strong>how to get rid of the old and unused packages without having to reinstall?</strong></p>
<p>Debian have the mechanisms to deal with this and more. Unfortunately for new people, its not as automated and a little more obscure that i would like</p>
<p>Anyway, heres what i would do:</p>
<div class="highlight"><pre><span></span># apt-mark showmanual
# apt-mark auto <packages you dont recognize>
# apt purge <packages you recognize but dont want anymore>
# apt autoremove --purge
</pre></div><p>I was recently asked <strong>how to get rid of the old and unused packages without having to reinstall?</strong></p>
<p>Debian have the mechanisms to deal with this and more. Unfortunately for new people, its not as automated and a little more obscure that i would like</p>
<p>Anyway, heres what i would do:</p>
<div class="highlight"><pre><span></span># apt-mark showmanual
# apt-mark auto <packages you dont recognize>
# apt purge <packages you recognize but dont want anymore>
# apt autoremove --purge
</pre></div>Destructive git behaviour2019-01-29T17:23:00+01:002019-01-29T17:23:00+01:00Albertotag:alberto.tf,2019-01-29:/destructive-git-behaviour.html<p><a href="/images/funwithgit.png"><img alt="fun with git" src="/images/funwithgit.png" title="Deleting your work forever is fun, right?" width="100%"></a></p>
<p>I <strong>destroyed</strong> all the <strong>work</strong> I had done in a project for the last <strong>2 months</strong></p>
<div class="alert alert-info"><dt>tl;dr:</dt><dd><span class="caps">GIT</span> doesnt consider the files in <i>.gitignore</i> important and will happily replace them</dd></div>
<p>Im pretty careless with my local git commands</p>
<p>Ive been trained by git to be this careless. Unless i use <code>--force</code> on a command, git <strong>will always alert me if im about to do something destructive</strong>. Even then, worse case scenario, you can use <code>git reflog</code> to get back in time after a bad merge or something not easily accesible with a normal git flow</p>
<h4>What happened?</h4>
<p>I had a link to a folder in my master branch. I branched to do some work and decided to replace the link with the actual folder to untangle some other mess and added it to <code>.gitignore</code> to avoid git complaining about it</p>
<p>Then happily worked on in for 2 months</p>
<p>I was ready to merge it, so I made a final commit and I checked out master</p>
<p>So far, pretty normal git flow… right?</p>
<p>But wait, something was wrong. <strong>My folder was missing!</strong></p>
<h4>Wait, what?! what happened!</h4>
<p>The folder existed as a syslink on master, so git <strong>happily replaced my folder with a now broken syslink</strong></p>
<p>It seems git <strong>doesnt consider files under <code>.gitignore</code> as important</strong></p>
<p>You can see by yourself and reproduce this behaviour by typing the following commands. It doesnt matter if links doesnt exists:</p>
<div class="highlight"><pre><span></span><span class="go">[~/tmp]</span>
<span class="gp">$</span> mkdir gitdestroy/
<span class="go">[~/tmp]</span>
<span class="gp">$</span> <span class="nb">cd</span> gitdestroy/
<span class="go">[~/tmp/gitdestroy]</span>
<span class="gp">$</span> cat > file1
<span class="go">hi, im file1</span>
<span class="go">[~/tmp/gitdestroy]</span>
<span class="gp">$</span> ln -s nofile link
<span class="go">[~/tmp/gitdestroy]</span>
<span class="gp">$</span> ll
<span class="go">total 48K</span>
<span class="go">drwxr-xr-x. 26 alberto alberto 36K Jan 29 15:18 ..</span>
<span class="go">-rw-r--r-- 1 alberto alberto 13 Jan 29 15:19 file1</span>
<span class="go">lrwxrwxrwx 1 alberto alberto 6 Jan 29 15:19 link -> nofile</span>
<span class="go">drwxr-xr-x 2 alberto alberto 4.0K Jan 29 15:19 .</span>
<span class="go">[~/tmp/gitdestroy]</span>
<span class="gp">$</span> git init
<span class="go">Initialized empty Git repository in /home/alberto/tmp/gitdestroy/.git/</span>
<span class="go">[~/tmp/gitdestroy (master #%)]</span>
<span class="gp">$</span> git add -A
<span class="go">[~/tmp/gitdestroy (master +)]</span>
<span class="gp">$</span> git status
<span class="go">On branch master</span>
<span class="go">No commits yet</span>
<span class="go">Changes to be committed:</span>
<span class="go"> (use "git rm --cached <file>..." to unstage)</span>
<span class="go"> new file: file1</span>
<span class="go"> new file: link</span>
<span class="go">[~/tmp/gitdestroy (master +)]</span>
<span class="gp">$</span> git commit -m <span class="s2">"link on repo"</span>
<span class="go">[master (root-commit) 5001c61] link on repo</span>
<span class="go"> 2 files changed, 2 insertions(+)</span>
<span class="go"> create mode 100644 file1</span>
<span class="go"> create mode 120000 link</span>
<span class="go">[~/tmp/gitdestroy (master)]</span>
<span class="gp">$</span> git checkout -b branchwithoutlink
<span class="go">Switched to a new branch 'branchwithoutlink'</span>
<span class="go">[~/tmp/gitdestroy (branchwithoutlink)]</span>
<span class="gp">$</span> git rm link
<span class="go">rm 'link'</span>
<span class="go">[~/tmp/gitdestroy (branchwithoutlink +)]</span>
<span class="gp">$</span> mkdir link
<span class="go">[~/tmp/gitdestroy (branchwithoutlink +)]</span>
<span class="gp">$</span> cat >link/file2
<span class="go">hi im file2</span>
<span class="go">[~/tmp/gitdestroy (branchwithoutlink +%)]</span>
<span class="gp">$</span> cat > .gitignore
<span class="go">link</span>
<span class="go">[~/tmp/gitdestroy (branchwithoutlink +%)]</span>
<span class="gp">$</span> git status
<span class="go">On branch branchwithoutlink</span>
<span class="go">Changes to be committed:</span>
<span class="go"> (use "git reset HEAD <file>..." to unstage)</span>
<span class="go"> deleted: link</span>
<span class="go">Untracked files:</span>
<span class="go"> (use "git add <file>..." to include in what will be committed)</span>
<span class="go"> .gitignore</span>
<span class="go">[~/tmp/gitdestroy (branchwithoutlink +%)]</span>
<span class="gp">$</span> git add -A
<span class="go">[~/tmp/gitdestroy (branchwithoutlink +)]</span>
<span class="gp">$</span> git commit -m <span class="s2">"replace link with folder"</span>
<span class="go">[branchwithoutlink 2cfb06c] replace link with folder</span>
<span class="go"> 2 files changed, 1 insertion(+), 1 deletion(-)</span>
<span class="go"> create mode 100644 .gitignore</span>
<span class="go"> delete mode 120000 link</span>
<span class="go">[~/tmp/gitdestroy (branchwithoutlink)]</span>
<span class="gp">$</span> ll
<span class="go">total 60K</span>
<span class="go">drwxr-xr-x. 26 alberto alberto 36K Jan 29 15:18 ..</span>
<span class="go">-rw-r--r-- 1 alberto alberto 13 Jan 29 15:19 file1</span>
<span class="go">drwxr-xr-x 2 alberto alberto 4.0K Jan 29 15:21 link</span>
<span class="go">drwxr-xr-x 4 alberto alberto 4.0K Jan 29 15:22 .</span>
<span class="go">-rw-r--r-- 1 alberto alberto 5 Jan 29 15:22 .gitignore</span>
<span class="go">drwxr-xr-x 8 alberto alberto 4.0K Jan 29 15:22 .git</span>
<span class="go">[~/tmp/gitdestroy (branchwithoutlink)]</span>
<span class="gp">$</span> git checkout master
<span class="hll"><span class="go">Switched to branch 'master' <--- NO ERROR???</span>
</span>
<span class="go">[~/tmp/gitdestroy (master)]</span>
<span class="gp">$</span> ll
<span class="go">total 52K</span>
<span class="go">drwxr-xr-x. 26 alberto alberto 36K Jan 29 15:18 ..</span>
<span class="go">-rw-r--r-- 1 alberto alberto 13 Jan 29 15:19 file1</span>
<span class="hll"><span class="go">lrwxrwxrwx 1 alberto alberto 6 Jan 29 15:22 link -> nofile <--- WHAT</span>
</span><span class="go">drwxr-xr-x 8 alberto alberto 4.0K Jan 29 15:22 .git</span>
<span class="go">drwxr-xr-x 3 alberto alberto 4.0K Jan 29 15:22 .</span>
<span class="go">[~/tmp/gitdestroy (master)]</span>
<span class="gp">$</span> git checkout branchwithoutlink
<span class="go">Switched to branch 'branchwithoutlink'</span>
<span class="go">[~/tmp/gitdestroy (branchwithoutlink)]</span>
<span class="gp">$</span> ll
<span class="go">total 56K</span>
<span class="go">drwxr-xr-x. 26 alberto alberto 36K Jan 29 15:18 ..</span>
<span class="go">-rw-r--r-- 1 alberto alberto 13 Jan 29 15:19 file1</span>
<span class="go">-rw-r--r-- 1 alberto alberto 5 Jan 29 15:23 .gitignore</span>
<span class="go">drwxr-xr-x 8 alberto alberto 4.0K Jan 29 15:23 .git</span>
<span class="go">drwxr-xr-x 3 alberto alberto 4.0K Jan 29 15:23 .</span>
</pre></div>
<h4>Aftermath</h4>
<p>I analyzed what <code>git</code> was doing underneath in hopes to gain some insight on how to recover these files. It seems git <code>unlinkat(2)</code> everyfile and finally <code>rmdir(2)</code> the folder</p>
<p>By contrasts <code>rm(1)</code> just uses <code>unlinkat(2)</code> in every file <strong>and</strong> folder</p>
<p>Not sure what difference this makes, but it was quite useless. I tried some <code>EXT undelete</code> tools to try to recover the missing files, but everything was gone</p>
<p>Actually I was able to undeleted some files i had removed 3 years ago that i didnt need :/</p>
<h4>Future</h4>
<p>This directory was under git as well and remotely hosted. But my last push was 2 months ago. I will be more careful on the future</p>
<p>Recently theres been some discussion on git about something that could prevent <a href="https://public-inbox.org/git/a852c0e9-f278-8e2a-406c-bb6099b2440c@mandelberg.org/">this behaviour</a>. They are introducing the concept of <a href="https://public-inbox.org/git/4C6A1C5B.4030304@workspacewhiz.com/">“precious ignored” files</a></p>
<p>But for me the damage was done</p>
<p>This was <strong>unexpected behaviour</strong> for me. Maybe it was also for you. Be safe out there!</p><p><a href="/images/funwithgit.png"><img alt="fun with git" src="/images/funwithgit.png" title="Deleting your work forever is fun, right?" width="100%"></a></p>
<p>I <strong>destroyed</strong> all the <strong>work</strong> I had done in a project for the last <strong>2 months</strong></p>
<div class="alert alert-info"><dt>tl;dr:</dt><dd><span class="caps">GIT</span> doesnt consider the files in <i>.gitignore</i> important and will happily replace them</dd></div>
<p>Im pretty careless with my local git commands</p>
<p>Ive been trained by git to be this careless. Unless i use <code>--force</code> on a command, git <strong>will always alert me if im about to do something destructive</strong>. Even then, worse case scenario, you can use <code>git reflog</code> to get back in time after a bad merge or something not easily accesible with a normal git flow</p>
<h4>What happened?</h4>
<p>I had a link to a folder in my master branch. I branched to do some work and decided to replace the link with the actual folder to untangle some other mess and added it to <code>.gitignore</code> to avoid git complaining about it</p>
<p>Then happily worked on in for 2 months</p>
<p>I was ready to merge it, so I made a final commit and I checked out master</p>
<p>So far, pretty normal git flow… right?</p>
<p>But wait, something was wrong. <strong>My folder was missing!</strong></p>
<h4>Wait, what?! what happened!</h4>
<p>The folder existed as a syslink on master, so git <strong>happily replaced my folder with a now broken syslink</strong></p>
<p>It seems git <strong>doesnt consider files under <code>.gitignore</code> as important</strong></p>
<p>You can see by yourself and reproduce this behaviour by typing the following commands. It doesnt matter if links doesnt exists:</p>
<div class="highlight"><pre><span></span><span class="go">[~/tmp]</span>
<span class="gp">$</span> mkdir gitdestroy/
<span class="go">[~/tmp]</span>
<span class="gp">$</span> <span class="nb">cd</span> gitdestroy/
<span class="go">[~/tmp/gitdestroy]</span>
<span class="gp">$</span> cat > file1
<span class="go">hi, im file1</span>
<span class="go">[~/tmp/gitdestroy]</span>
<span class="gp">$</span> ln -s nofile link
<span class="go">[~/tmp/gitdestroy]</span>
<span class="gp">$</span> ll
<span class="go">total 48K</span>
<span class="go">drwxr-xr-x. 26 alberto alberto 36K Jan 29 15:18 ..</span>
<span class="go">-rw-r--r-- 1 alberto alberto 13 Jan 29 15:19 file1</span>
<span class="go">lrwxrwxrwx 1 alberto alberto 6 Jan 29 15:19 link -> nofile</span>
<span class="go">drwxr-xr-x 2 alberto alberto 4.0K Jan 29 15:19 .</span>
<span class="go">[~/tmp/gitdestroy]</span>
<span class="gp">$</span> git init
<span class="go">Initialized empty Git repository in /home/alberto/tmp/gitdestroy/.git/</span>
<span class="go">[~/tmp/gitdestroy (master #%)]</span>
<span class="gp">$</span> git add -A
<span class="go">[~/tmp/gitdestroy (master +)]</span>
<span class="gp">$</span> git status
<span class="go">On branch master</span>
<span class="go">No commits yet</span>
<span class="go">Changes to be committed:</span>
<span class="go"> (use "git rm --cached <file>..." to unstage)</span>
<span class="go"> new file: file1</span>
<span class="go"> new file: link</span>
<span class="go">[~/tmp/gitdestroy (master +)]</span>
<span class="gp">$</span> git commit -m <span class="s2">"link on repo"</span>
<span class="go">[master (root-commit) 5001c61] link on repo</span>
<span class="go"> 2 files changed, 2 insertions(+)</span>
<span class="go"> create mode 100644 file1</span>
<span class="go"> create mode 120000 link</span>
<span class="go">[~/tmp/gitdestroy (master)]</span>
<span class="gp">$</span> git checkout -b branchwithoutlink
<span class="go">Switched to a new branch 'branchwithoutlink'</span>
<span class="go">[~/tmp/gitdestroy (branchwithoutlink)]</span>
<span class="gp">$</span> git rm link
<span class="go">rm 'link'</span>
<span class="go">[~/tmp/gitdestroy (branchwithoutlink +)]</span>
<span class="gp">$</span> mkdir link
<span class="go">[~/tmp/gitdestroy (branchwithoutlink +)]</span>
<span class="gp">$</span> cat >link/file2
<span class="go">hi im file2</span>
<span class="go">[~/tmp/gitdestroy (branchwithoutlink +%)]</span>
<span class="gp">$</span> cat > .gitignore
<span class="go">link</span>
<span class="go">[~/tmp/gitdestroy (branchwithoutlink +%)]</span>
<span class="gp">$</span> git status
<span class="go">On branch branchwithoutlink</span>
<span class="go">Changes to be committed:</span>
<span class="go"> (use "git reset HEAD <file>..." to unstage)</span>
<span class="go"> deleted: link</span>
<span class="go">Untracked files:</span>
<span class="go"> (use "git add <file>..." to include in what will be committed)</span>
<span class="go"> .gitignore</span>
<span class="go">[~/tmp/gitdestroy (branchwithoutlink +%)]</span>
<span class="gp">$</span> git add -A
<span class="go">[~/tmp/gitdestroy (branchwithoutlink +)]</span>
<span class="gp">$</span> git commit -m <span class="s2">"replace link with folder"</span>
<span class="go">[branchwithoutlink 2cfb06c] replace link with folder</span>
<span class="go"> 2 files changed, 1 insertion(+), 1 deletion(-)</span>
<span class="go"> create mode 100644 .gitignore</span>
<span class="go"> delete mode 120000 link</span>
<span class="go">[~/tmp/gitdestroy (branchwithoutlink)]</span>
<span class="gp">$</span> ll
<span class="go">total 60K</span>
<span class="go">drwxr-xr-x. 26 alberto alberto 36K Jan 29 15:18 ..</span>
<span class="go">-rw-r--r-- 1 alberto alberto 13 Jan 29 15:19 file1</span>
<span class="go">drwxr-xr-x 2 alberto alberto 4.0K Jan 29 15:21 link</span>
<span class="go">drwxr-xr-x 4 alberto alberto 4.0K Jan 29 15:22 .</span>
<span class="go">-rw-r--r-- 1 alberto alberto 5 Jan 29 15:22 .gitignore</span>
<span class="go">drwxr-xr-x 8 alberto alberto 4.0K Jan 29 15:22 .git</span>
<span class="go">[~/tmp/gitdestroy (branchwithoutlink)]</span>
<span class="gp">$</span> git checkout master
<span class="hll"><span class="go">Switched to branch 'master' <--- NO ERROR???</span>
</span>
<span class="go">[~/tmp/gitdestroy (master)]</span>
<span class="gp">$</span> ll
<span class="go">total 52K</span>
<span class="go">drwxr-xr-x. 26 alberto alberto 36K Jan 29 15:18 ..</span>
<span class="go">-rw-r--r-- 1 alberto alberto 13 Jan 29 15:19 file1</span>
<span class="hll"><span class="go">lrwxrwxrwx 1 alberto alberto 6 Jan 29 15:22 link -> nofile <--- WHAT</span>
</span><span class="go">drwxr-xr-x 8 alberto alberto 4.0K Jan 29 15:22 .git</span>
<span class="go">drwxr-xr-x 3 alberto alberto 4.0K Jan 29 15:22 .</span>
<span class="go">[~/tmp/gitdestroy (master)]</span>
<span class="gp">$</span> git checkout branchwithoutlink
<span class="go">Switched to branch 'branchwithoutlink'</span>
<span class="go">[~/tmp/gitdestroy (branchwithoutlink)]</span>
<span class="gp">$</span> ll
<span class="go">total 56K</span>
<span class="go">drwxr-xr-x. 26 alberto alberto 36K Jan 29 15:18 ..</span>
<span class="go">-rw-r--r-- 1 alberto alberto 13 Jan 29 15:19 file1</span>
<span class="go">-rw-r--r-- 1 alberto alberto 5 Jan 29 15:23 .gitignore</span>
<span class="go">drwxr-xr-x 8 alberto alberto 4.0K Jan 29 15:23 .git</span>
<span class="go">drwxr-xr-x 3 alberto alberto 4.0K Jan 29 15:23 .</span>
</pre></div>
<h4>Aftermath</h4>
<p>I analyzed what <code>git</code> was doing underneath in hopes to gain some insight on how to recover these files. It seems git <code>unlinkat(2)</code> everyfile and finally <code>rmdir(2)</code> the folder</p>
<p>By contrasts <code>rm(1)</code> just uses <code>unlinkat(2)</code> in every file <strong>and</strong> folder</p>
<p>Not sure what difference this makes, but it was quite useless. I tried some <code>EXT undelete</code> tools to try to recover the missing files, but everything was gone</p>
<p>Actually I was able to undeleted some files i had removed 3 years ago that i didnt need :/</p>
<h4>Future</h4>
<p>This directory was under git as well and remotely hosted. But my last push was 2 months ago. I will be more careful on the future</p>
<p>Recently theres been some discussion on git about something that could prevent <a href="https://public-inbox.org/git/a852c0e9-f278-8e2a-406c-bb6099b2440c@mandelberg.org/">this behaviour</a>. They are introducing the concept of <a href="https://public-inbox.org/git/4C6A1C5B.4030304@workspacewhiz.com/">“precious ignored” files</a></p>
<p>But for me the damage was done</p>
<p>This was <strong>unexpected behaviour</strong> for me. Maybe it was also for you. Be safe out there!</p>Copy list of packages installed to another debian machine2018-05-28T21:47:00+02:002018-05-28T21:47:00+02:00Albertotag:alberto.tf,2018-05-28:/copy-list-of-packages-installed-to-another-debian-machine.html<p>In this day and age, reading debian forums, I still see <code>$ dpkg --get-selections</code> as the recommended way to copy the list of packages installed on one machine in order to install the same packages on another machine</p>
<p>This list misses vital information… such as which of those packages were automatically installed as dependence!!!</p>
<p>If you dont want to break your new installation so early on, use <code>$ apt-mark showmanual</code> instead for the list of packages. It will show only packages that you manually installed. You should get the rest as dependences</p><p>In this day and age, reading debian forums, I still see <code>$ dpkg --get-selections</code> as the recommended way to copy the list of packages installed on one machine in order to install the same packages on another machine</p>
<p>This list misses vital information… such as which of those packages were automatically installed as dependence!!!</p>
<p>If you dont want to break your new installation so early on, use <code>$ apt-mark showmanual</code> instead for the list of packages. It will show only packages that you manually installed. You should get the rest as dependences</p>Virus, Qubes-OS and Debian2017-08-28T22:23:00+02:002017-08-28T22:23:00+02:00Albertotag:alberto.tf,2017-08-28:/virus-qubes-os-and-debian.html<p><a href="/images/virus_venn_diagram.png"><img alt="computer problems that people attribute to virus doesnt overlap with real problems caused by virus" src="/images/virus_venn_diagram.png" title="source: xkcd 1180" width="100%"></a></p>
<p>This is the virus venn diagram. Its pretty accurate and many people, including people that gets along with technology, is oblivious to it. Voluntarily installing crap by installing random programs you just googled in your computer hardly counts as a virus</p>
<p>Sometimes they overlap tho. What I call “trawling viruses”. Using some very old exploit that should hardly work on anybody and spamming it, you can still get lots of people that never update. In this case, you dont care about anything, you just try get a quick profit and you dont really care if you slow down the target machine</p>
<p>But by and large, virus try to be as invisible as possible, do their bussiness and go undetected for as long as possible. If they can make an optimization to your system, like patching how they got in, they will</p>
<p>Using debian is one way to protect yourself… but they still fall short because it still uses a very old authorization model</p>
<p><a href="https://alberto.tf/images/authorization.png"><img alt="Authorization model in computers is old" src="https://alberto.tf/images/authorization.png" title="source: xkcd 1200" width="100%"></a></p>
<p>Its no secret that the authorization model in computers is really old</p>
<p><a href="https://www.qubes-os.org/">Qubes-os</a> is a system that tries to mitigates that problem quite sucessfully. Qubes-os 4.0 rc1 <a href="https://www.qubes-os.org/news/2017/07/31/qubes-40-rc1/">has been released recently</a>. Im currently testing it on my mediabox, and will probably use it in my main machine soon</p>
<p>Holger gave a talk a few weeks ago named <a href="https://debconf17.debconf.org/talks/16/">“Using qubes os from the pov of a debian developer”</a>. In debconf fashion you can watch it online</p><p><a href="/images/virus_venn_diagram.png"><img alt="computer problems that people attribute to virus doesnt overlap with real problems caused by virus" src="/images/virus_venn_diagram.png" title="source: xkcd 1180" width="100%"></a></p>
<p>This is the virus venn diagram. Its pretty accurate and many people, including people that gets along with technology, is oblivious to it. Voluntarily installing crap by installing random programs you just googled in your computer hardly counts as a virus</p>
<p>Sometimes they overlap tho. What I call “trawling viruses”. Using some very old exploit that should hardly work on anybody and spamming it, you can still get lots of people that never update. In this case, you dont care about anything, you just try get a quick profit and you dont really care if you slow down the target machine</p>
<p>But by and large, virus try to be as invisible as possible, do their bussiness and go undetected for as long as possible. If they can make an optimization to your system, like patching how they got in, they will</p>
<p>Using debian is one way to protect yourself… but they still fall short because it still uses a very old authorization model</p>
<p><a href="https://alberto.tf/images/authorization.png"><img alt="Authorization model in computers is old" src="https://alberto.tf/images/authorization.png" title="source: xkcd 1200" width="100%"></a></p>
<p>Its no secret that the authorization model in computers is really old</p>
<p><a href="https://www.qubes-os.org/">Qubes-os</a> is a system that tries to mitigates that problem quite sucessfully. Qubes-os 4.0 rc1 <a href="https://www.qubes-os.org/news/2017/07/31/qubes-40-rc1/">has been released recently</a>. Im currently testing it on my mediabox, and will probably use it in my main machine soon</p>
<p>Holger gave a talk a few weeks ago named <a href="https://debconf17.debconf.org/talks/16/">“Using qubes os from the pov of a debian developer”</a>. In debconf fashion you can watch it online</p>Stretch is out2017-06-18T13:17:00+02:002017-06-18T13:17:00+02:00Albertotag:alberto.tf,2017-06-18:/stretch-is-out.html<p><img class="logo" src="/images/Stretch.png"></p>
<p><a href="https://www.debian.org/News/2017/20170617">New version of Debian is out</a>… codename stretch. Thats the name of the stretchy octopus toy from Toy Story 3</p>
<p>All the code names of debian come from Toy story</p>
<p>For normal desktops users of the testing branch, updates come incremmentally and we have been using stretch without problems for a while now, but stable deployments have a new version to jump to when ready!</p>
<p>In my experience, for testing users, its better to stay in stable for a while (at least 2-3 months) before jumping into testing again. Theres a lot of new packages waiting to enter debian and it takes a while to stabilize again. Developers has been asked to spread out their uploads a little so not everything breaks at once</p>
<p>Also, the first point release is expected in a month. So wait out that long for a smoother transtion of your stable installations</p><p><img class="logo" src="/images/Stretch.png"></p>
<p><a href="https://www.debian.org/News/2017/20170617">New version of Debian is out</a>… codename stretch. Thats the name of the stretchy octopus toy from Toy Story 3</p>
<p>All the code names of debian come from Toy story</p>
<p>For normal desktops users of the testing branch, updates come incremmentally and we have been using stretch without problems for a while now, but stable deployments have a new version to jump to when ready!</p>
<p>In my experience, for testing users, its better to stay in stable for a while (at least 2-3 months) before jumping into testing again. Theres a lot of new packages waiting to enter debian and it takes a while to stabilize again. Developers has been asked to spread out their uploads a little so not everything breaks at once</p>
<p>Also, the first point release is expected in a month. So wait out that long for a smoother transtion of your stable installations</p>Dealing with mime types2016-12-10T14:21:00+01:002016-12-10T14:21:00+01:00Albertotag:alberto.tf,2016-12-10:/dealing-with-mime-types.html<p>The mime type is a little text like <code>image/jpeg</code> or <code>application/pdf</code> that is used to identify the content of a file. Its main use is to determine what program can handle each file</p>
<p>Theres been this problem where the default program offered by debian were a very awkward one. Like trying to use the notepad.exe that comes with wine to open <code>.txt</code> files. In linux we dont rely on extensions to determine the content of a file, but still wines registers itself as being able to handle <code>text/plain</code> files using its <code>wine-extension-txt.desktop</code> file</p>
<p>The reason this happens is that in some lightweight desktops (like xfce), it will default to the last program installed (or upgraded!!!) that can handle the file, unless you define a default one yourself</p>
<p>I fixed this weird behaviour a long time ago by using <code>strace |grep home</code> to locate the file that was being used and updating it. In this case</p>
<div class="highlight"><pre><span></span>~/.local/share/applications/mimeapps.list
</pre></div>
<p>It was fast, but I never really understood why it happened on the first place</p>
<p><a href="https://fnord.no/2016/12/09/mime-types-applications/">This</a> post found on planet debian digs a little deeper using a different but longer approach and was used to find the reason behind it. Good catch!</p><p>The mime type is a little text like <code>image/jpeg</code> or <code>application/pdf</code> that is used to identify the content of a file. Its main use is to determine what program can handle each file</p>
<p>Theres been this problem where the default program offered by debian were a very awkward one. Like trying to use the notepad.exe that comes with wine to open <code>.txt</code> files. In linux we dont rely on extensions to determine the content of a file, but still wines registers itself as being able to handle <code>text/plain</code> files using its <code>wine-extension-txt.desktop</code> file</p>
<p>The reason this happens is that in some lightweight desktops (like xfce), it will default to the last program installed (or upgraded!!!) that can handle the file, unless you define a default one yourself</p>
<p>I fixed this weird behaviour a long time ago by using <code>strace |grep home</code> to locate the file that was being used and updating it. In this case</p>
<div class="highlight"><pre><span></span>~/.local/share/applications/mimeapps.list
</pre></div>
<p>It was fast, but I never really understood why it happened on the first place</p>
<p><a href="https://fnord.no/2016/12/09/mime-types-applications/">This</a> post found on planet debian digs a little deeper using a different but longer approach and was used to find the reason behind it. Good catch!</p>Two easy solutions: http-referer and find the source package2016-11-08T14:06:00+01:002016-11-08T14:06:00+01:00Albertotag:None,2016-11-08:-http-referer-and-find-the-source-package.html<h5>How to control http-referer in your browser:</h5>
<div class="highlight"><pre><span></span># apt install xul-ext-refcontrol
</pre></div>
<p>And select the default you want. Either <code>block</code> or <code>use base url</code> if you want to be more discreet ;)</p>
<h5>How to find the source package of a binary package</h5>
<div class="highlight"><pre><span></span>$ apt showsrc <binary-package-name>
</pre></div>
<p>I posted this because the solutions offered in <a href="http://planet.debian.org">planet debian</a> were <a href="https://feeding.cloud.geek.nz/posts/tweaking-referrer-for-privacy-in-firefox/">very</a> <a href="https://sandrotosi.blogspot.com.es/2016/11/debian-source-package-name-from-binary.html">convoluted</a></p><h5>How to control http-referer in your browser:</h5>
<div class="highlight"><pre><span></span># apt install xul-ext-refcontrol
</pre></div>
<p>And select the default you want. Either <code>block</code> or <code>use base url</code> if you want to be more discreet ;)</p>
<h5>How to find the source package of a binary package</h5>
<div class="highlight"><pre><span></span>$ apt showsrc <binary-package-name>
</pre></div>
<p>I posted this because the solutions offered in <a href="http://planet.debian.org">planet debian</a> were <a href="https://feeding.cloud.geek.nz/posts/tweaking-referrer-for-privacy-in-firefox/">very</a> <a href="https://sandrotosi.blogspot.com.es/2016/11/debian-source-package-name-from-binary.html">convoluted</a></p>Look at that nice looking FreedomBox!2016-04-22T13:54:00+02:002016-04-22T13:54:00+02:00Albertotag:alberto.tf,2016-04-22:/look-at-that-nice-looking-freedombox.html<p>I’m rebuilding my home server and decided to take a look at freedombox project as the base for it</p>
<p>0.6 version was recently <a href="http://lists.alioth.debian.org/pipermail/freedombox-discuss/2015-October/006907.html">released</a> and I wasnt aware of how advanced the project is already!</p>
<p>They have a <a href="https://wiki.debian.org/FreedomBox/Hardware/VirtualBox">virtualbox image</a> ready for some quick test. It took me longer to download it than to start using it</p>
<p>Here’s a pic of what it looks like to entice you to try it :)</p>
<p><a href="/images/selection_175.png"><img alt="freedombox snapshot" src="/images/selection_175.png" title="This looks great, does it not?" width="100%"></a></p>
<p>All this is already on debian right now and you can turn any debian sid installation into a freedombox just by installing a <a href="https://wiki.debian.org/FreedomBox/Hardware/Debian">package</a></p>
<p>The setup generates everything private on the first run, so even the virtualbox image can be used as the final thing</p>
<p>They use plinth (django) to integrate the applications into the web interface. More info on how to help integrate more debian packages <a href="https://wiki.debian.org/FreedomBox/Plinth">here</a></p>
<p>A live demo is going to be streamed <a href="http://lists.alioth.debian.org/pipermail/freedombox-discuss/2015-October/006930.html">this friday</a> and a <a href="https://wiki.debian.org/FreedomBox/Hackathon">hackaton</a> is scheduled for <a href="http://www.freedomboxfoundation.org/news/halloweenhackathon/index.en.html">this saturday</a></p>
<p>Cheers!</p>
<p><a href="https://larjona.wordpress.com/2015/10/30/look-at-that-nice-looking-freedombox/">Original post</a> at <a href="https://larjona.wordpress.com/">Laura Arjona’s Blog</a> on 30 October 2015. Thanks for first hosting it!</p><p>I’m rebuilding my home server and decided to take a look at freedombox project as the base for it</p>
<p>0.6 version was recently <a href="http://lists.alioth.debian.org/pipermail/freedombox-discuss/2015-October/006907.html">released</a> and I wasnt aware of how advanced the project is already!</p>
<p>They have a <a href="https://wiki.debian.org/FreedomBox/Hardware/VirtualBox">virtualbox image</a> ready for some quick test. It took me longer to download it than to start using it</p>
<p>Here’s a pic of what it looks like to entice you to try it :)</p>
<p><a href="/images/selection_175.png"><img alt="freedombox snapshot" src="/images/selection_175.png" title="This looks great, does it not?" width="100%"></a></p>
<p>All this is already on debian right now and you can turn any debian sid installation into a freedombox just by installing a <a href="https://wiki.debian.org/FreedomBox/Hardware/Debian">package</a></p>
<p>The setup generates everything private on the first run, so even the virtualbox image can be used as the final thing</p>
<p>They use plinth (django) to integrate the applications into the web interface. More info on how to help integrate more debian packages <a href="https://wiki.debian.org/FreedomBox/Plinth">here</a></p>
<p>A live demo is going to be streamed <a href="http://lists.alioth.debian.org/pipermail/freedombox-discuss/2015-October/006930.html">this friday</a> and a <a href="https://wiki.debian.org/FreedomBox/Hackathon">hackaton</a> is scheduled for <a href="http://www.freedomboxfoundation.org/news/halloweenhackathon/index.en.html">this saturday</a></p>
<p>Cheers!</p>
<p><a href="https://larjona.wordpress.com/2015/10/30/look-at-that-nice-looking-freedombox/">Original post</a> at <a href="https://larjona.wordpress.com/">Laura Arjona’s Blog</a> on 30 October 2015. Thanks for first hosting it!</p>