the f*ck rants about stuff

debian

Welcome to the mothership…

Some travel longer than the others… everybody ends up here eventually

I came to Debian for the freedom, but stayed for the power and empowering of the user

Debian is the place to be if you want to takle issues at the root and be able to fix things in a straight forward way

Ive been a Debian contributor since 2012. Im on the lookout for more oportunities to help grow this great project

Latest posts related to debian:



  1. How to clone a server using just rsync

    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

    Now the basic server option is cheaper and is enough for me. Plus there were some black friday discounts :)

    So I decided to move the server with all my services to a cheaper option and save 75% of what i was spending with more or less the same features

    Unfortunately, this is not supported by default and theres no one button way to do it. Fortunately, this is very easy to do using linux!

    People fighting over products in black friday fashion

    This is how i did it in 6 easy steps:

    Step 1

    • Reboot booh machines using a live image and have a working ssh server on the target server
    • Mount the server disk on both servers on /mnt

    Step 2

    • rsync -AHXavP --numeric-ids --exclude='/mnt/dev' --exclude='/mnt/proc' --exclude='/mnt/sys' /mnt/ root@ip.dest.server:/mnt/

    Step 3

    • ssh on the target server. Bind /proc /dev /sys to /mnt/ and chroot it
    • grub-install /dev/sdb && update-grub
    • ack ip.orig.server /etc/ and change it where appropiate
    • reboot

    Step 4

    • Change DNS

    Step 5

    • ????

    Step 6

    • Profit!
    Conclusion
    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?
    
  2. Get a nearly fresh debian install without reinstalling

    I was recently asked how to get rid of the old and unused packages without having to reinstall?

    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

    Anyway, heres what i would do:

    # apt-mark showmanual
    # apt-mark auto <packages you dont recognize>
    # apt purge <packages you recognize but dont want anymore>
    # apt autoremove --purge
    
  3. Destructive git behaviour

    fun with git

    I destroyed all the work I had done in a project for the last 2 months

    tl;dr:
    GIT doesnt consider the files in .gitignore important and will happily replace them

    Im pretty careless with my local git commands

    Ive been trained by git to be this careless. Unless i use --force on a command, git will always alert me if im about to do something destructive. Even then, worse case scenario, you can use git reflog to get back in time after a bad merge or something not easily accesible with a normal git flow

    What happened?

    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 .gitignore to avoid git complaining about it

    Then happily worked on in for 2 months

    I was ready to merge it, so I made a final commit and I checked out master

    So far, pretty normal git flow… right?

    But wait, something was wrong. My folder was missing!

    Wait, what?! what happened!

    The folder existed as a syslink on master, so git happily replaced my folder with a now broken syslink

    It seems git doesnt consider files under .gitignore as important

    You can see by yourself and reproduce this behaviour by typing the following commands. It doesnt matter if links doesnt exists:

    [~/tmp]
    $ mkdir gitdestroy/
    
    [~/tmp]
    $ cd gitdestroy/
    
    [~/tmp/gitdestroy]
    $ cat > file1
    hi, im file1
    
    [~/tmp/gitdestroy]
    $ ln -s nofile link
    
    [~/tmp/gitdestroy]
    $ ll
    total 48K
    drwxr-xr-x. 26 alberto alberto  36K Jan 29 15:18 ..
    -rw-r--r--   1 alberto alberto   13 Jan 29 15:19 file1
    lrwxrwxrwx   1 alberto alberto    6 Jan 29 15:19 link -> nofile
    drwxr-xr-x   2 alberto alberto 4.0K Jan 29 15:19 .
    
    [~/tmp/gitdestroy]
    $ git init
    Initialized empty Git repository in /home/alberto/tmp/gitdestroy/.git/
    
    [~/tmp/gitdestroy (master #%)]
    $ git add -A
    
    [~/tmp/gitdestroy (master +)]
    $ git status
    On branch master
    
    No commits yet
    
    Changes to be committed:
      (use "git rm --cached <file>..." to unstage)
    
        new file:   file1
        new file:   link
    
    
    [~/tmp/gitdestroy (master +)]
    $ git commit -m "link on repo"
    [master (root-commit) 5001c61] link on repo
     2 files changed, 2 insertions(+)
     create mode 100644 file1
     create mode 120000 link
    
    [~/tmp/gitdestroy (master)]
    $ git checkout -b branchwithoutlink
    Switched to a new branch 'branchwithoutlink'
    
    [~/tmp/gitdestroy (branchwithoutlink)]
    $ git rm link 
    rm 'link'
    
    [~/tmp/gitdestroy (branchwithoutlink +)]
    $ mkdir link
    
    [~/tmp/gitdestroy (branchwithoutlink +)]
    $ cat >link/file2
    hi im file2
    
    [~/tmp/gitdestroy (branchwithoutlink +%)]
    $ cat > .gitignore
    link
    
    [~/tmp/gitdestroy (branchwithoutlink +%)]
    $ git status
    On branch branchwithoutlink
    Changes to be committed:
      (use "git reset HEAD <file>..." to unstage)
    
        deleted:    link
    
    Untracked files:
      (use "git add <file>..." to include in what will be committed)
    
        .gitignore
    
    
    [~/tmp/gitdestroy (branchwithoutlink +%)]
    $ git add -A
    
    [~/tmp/gitdestroy (branchwithoutlink +)]
    $ git commit -m "replace link with folder"
    
    [branchwithoutlink 2cfb06c] replace link with folder
     2 files changed, 1 insertion(+), 1 deletion(-)
     create mode 100644 .gitignore
     delete mode 120000 link
    
    [~/tmp/gitdestroy (branchwithoutlink)]
    $ ll
    total 60K
    drwxr-xr-x. 26 alberto alberto  36K Jan 29 15:18 ..
    -rw-r--r--   1 alberto alberto   13 Jan 29 15:19 file1
    drwxr-xr-x   2 alberto alberto 4.0K Jan 29 15:21 link
    drwxr-xr-x   4 alberto alberto 4.0K Jan 29 15:22 .
    -rw-r--r--   1 alberto alberto    5 Jan 29 15:22 .gitignore
    drwxr-xr-x   8 alberto alberto 4.0K Jan 29 15:22 .git
    
    [~/tmp/gitdestroy (branchwithoutlink)]
    $ git checkout master
    Switched to branch 'master'                                        <--- NO ERROR???
    
    [~/tmp/gitdestroy (master)]
    $ ll
    total 52K
    drwxr-xr-x. 26 alberto alberto  36K Jan 29 15:18 ..
    -rw-r--r--   1 alberto alberto   13 Jan 29 15:19 file1
    lrwxrwxrwx   1 alberto alberto    6 Jan 29 15:22 link -> nofile    <--- WHAT
    drwxr-xr-x   8 alberto alberto 4.0K Jan 29 15:22 .git
    drwxr-xr-x   3 alberto alberto 4.0K Jan 29 15:22 .
    
    [~/tmp/gitdestroy (master)]
    $ git checkout branchwithoutlink 
    Switched to branch 'branchwithoutlink'
    
    [~/tmp/gitdestroy (branchwithoutlink)]
    $ ll
    total 56K
    drwxr-xr-x. 26 alberto alberto  36K Jan 29 15:18 ..
    -rw-r--r--   1 alberto alberto   13 Jan 29 15:19 file1
    -rw-r--r--   1 alberto alberto    5 Jan 29 15:23 .gitignore
    drwxr-xr-x   8 alberto alberto 4.0K Jan 29 15:23 .git
    drwxr-xr-x   3 alberto alberto 4.0K Jan 29 15:23 .
    

    Aftermath

    I analyzed what git was doing underneath in hopes to gain some insight on how to recover these files. It seems git unlinkat(2) everyfile and finally rmdir(2) the folder

    By contrasts rm(1) just uses unlinkat(2) in every file and folder

    Not sure what difference this makes, but it was quite useless. I tried some EXT undelete tools to try to recover the missing files, but everything was gone

    Actually I was able to undeleted some files i had removed 3 years ago that i didnt need :/

    Future

    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

    Recently theres been some discussion on git about something that could prevent this behaviour. They are introducing the concept of “precious ignored” files

    But for me the damage was done

    This was unexpected behaviour for me. Maybe it was also for you. Be safe out there!

  4. Copy list of packages installed to another debian machine

    In this day and age, reading debian forums, I still see $ dpkg --get-selections as the recommended way to copy the list of packages installed on one machine in order to install the same packages on another machine

    This list misses vital information… such as which of those packages were automatically installed as dependence!!!

    If you dont want to break your new installation so early on, use $ apt-mark showmanual instead for the list of packages. It will show only packages that you manually installed. You should get the rest as dependences

  5. Virus, Qubes-OS and Debian

    computer problems that people attribute to virus doesnt overlap with real problems caused by virus

    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

    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

    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

    Using debian is one way to protect yourself… but they still fall short because it still uses a very old authorization model

    Authorization model in computers is old

    Its no secret that the authorization model in computers is really old

    Qubes-os is a system that tries to mitigates that problem quite sucessfully. Qubes-os 4.0 rc1 has been released recently. Im currently testing it on my mediabox, and will probably use it in my main machine soon

    Holger gave a talk a few weeks ago named “Using qubes os from the pov of a debian developer”. In debconf fashion you can watch it online

  6. Stretch is out

    New version of Debian is out… codename stretch. Thats the name of the stretchy octopus toy from Toy Story 3

    All the code names of debian come from Toy story

    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!

    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

    Also, the first point release is expected in a month. So wait out that long for a smoother transtion of your stable installations

  7. Dealing with mime types

    The mime type is a little text like image/jpeg or application/pdf that is used to identify the content of a file. Its main use is to determine what program can handle each file

    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 .txt 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 text/plain files using its wine-extension-txt.desktop file

    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

    I fixed this weird behaviour a long time ago by using strace |grep home to locate the file that was being used and updating it. In this case

    ~/.local/share/applications/mimeapps.list
    

    It was fast, but I never really understood why it happened on the first place

    This 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!

  8. Look at that nice looking FreedomBox!

    I’m rebuilding my home server and decided to take a look at freedombox project as the base for it

    0.6 version was recently released and I wasnt aware of how advanced the project is already!

    They have a virtualbox image ready for some quick test. It took me longer to download it than to start using it

    Here’s a pic of what it looks like to entice you to try it :)

    freedombox snapshot

    All this is already on debian right now and you can turn any debian sid installation into a freedombox just by installing a package

    The setup generates everything private on the first run, so even the virtualbox image can be used as the final thing

    They use plinth (django) to integrate the applications into the web interface. More info on how to help integrate more debian packages here

    A live demo is going to be streamed this friday and a hackaton is scheduled for this saturday

    Cheers!

    Original post at Laura Arjona’s Blog on 30 October 2015. Thanks for first hosting it!

¡ En Español !