pkg

pkg

  • Atualizando pra FreeBSD 13.0

    Já faz anos que deixei de usar FreeBSD como principal systema operacional, inclusive no meu laptop.  Um dos motivos que me levaram a isso na época foi o fato da hibernação não funcionar corretamente (naquela época).  O post que fiz da migração foi esse aqui: Migrando para OpenSuse.  Como mudei pra Suécia pra virar um desenvolvedor de software em Linux, não fazia muito sentido continuar ou tentar voltar ao FreeBSD como sistema principal.

    Mas sempre tentei manter um pé por ali.  FreeBSD é um sistema fantástico pra ser usado.  E com as facilidades de CPUs com múltiplos núcleos e avanço no sistemas de virtualização, ficou fácil ter sempre à mão uma VMzinha com o diabinho rodando.

    Meu eu sempre criava a VM, usava por um tempo, e depois removia.  Simplesmente parei de fazer upgrades.  Só testava algumas features e ficava por isso mesmo.

    Após uma explicação muito boa do sistema de upgrades feita pelo Garga (@rbgarga) no grupo de FreeBSD (FUG-BR) no Telegram (https://t.me/fug_br), eu resolvi experimentar.

    A explicação:

    Existem 3 casos de uso do freebsd-update:


    1. Atualizar de X.Y pra X.Y-p1
    2. Atualizar de X.Y pra X.Y+1
    3. Atualizar de X.Y pra X+1.Y

    No caso 1, apenas correções de segurança, então vc vai rodar freebsd-update fetch install, reboot e já era.

    No caso 2, como vc tá atualizando pra uma nova versão de kernel, dentro da mesma série, vc vai fazer freebsd-update -r X.Y+1 upgrade pra ele baixar tudo o que precisa, aí vai fazer freebsd-update install pra ele instalar o kernel novo, então reboot no kernel novo, confere que tá tudo em ordem e freebsd-update install novamente pra ele atualizar o world, aí vc reinicia ( ou faz um reboot se for possível ) e pronto.

    No caso 3 você tá trocando de major version, do 12 pro 13 por exemplo, então vc repete o processo do caso 2, porém, depois do segundo freebsd-update install vc vai estar em um sistema rodando world e kernel do 13, porém com pacotes ainda do 12.  Então vc atualiza todos os pacotes e depois roda o último freebsd-update install pra ele remover todos os arquivos antigos do 12 que não são mais usados no 13 (equivalente ao make delete-old delete-old-libs).  Se rodar isso antes de reinstalar todos os pacotes, com certeza vai quebrar coisas

    Então segui as direções num upgrade do 12.2-RELEASE pro 13.0-RC1, o caso 3.

    
    root@freebsd:~ # freebsd-update -r 13.0-RC1 upgrade
    src component not installed, skipped
    Looking up update.FreeBSD.org mirrors... 3 mirrors found.
    Fetching metadata signature for 12.2-RELEASE from update4.freebsd.org... done.
    Fetching metadata index... done.
    Inspecting system... done.
    
    The following components of FreeBSD seem to be installed:
    kernel/generic kernel/generic-dbg world/base world/base-dbg world/doc
    world/lib32 world/lib32-dbg
    
    The following components of FreeBSD do not seem to be installed:
    
    Does this look reasonable (y/n)? y
    
    Fetching metadata signature for 13.0-RC1 from update4.freebsd.org... done.
    Fetching metadata index... done.
    Fetching 1 metadata patches. done.
    Applying metadata patches... done.
    Fetching 1 metadata files... done.
    Inspecting system... done.
    Fetching files from 12.2-RELEASE for merging... done.
    Preparing to download files... done.
    Fetching 10251 patches.....10....20....30....40....
    [editado]
    ....10230....10240....10250 done.
    Applying patches...
    Fetching 638 files.......10....20....
    [editado]
    ...620....630.... done.
    Attempting to automatically merge changes in files... done.
     
    The following file will be removed, as it no longer exists in
    FreeBSD 13.0-RC1: /etc/motd
    Does this look reasonable (y/n)? y
    The following files are affected by updates. No changes have
    been downloaded, however, because the files have been modified
    locally:
    /var/db/etcupdate/log
    The following files will be removed as part of updating to
    13.0-RC1-p0:
    /boot/boot1.efifat
    13.0-RC1-p0:
    /boot/boot1.efifat
    /boot/gptboot.efifat
    /boot/kernel/aha.ko
    [...]
    The following files will be added as part of updating to
    13.0-RC1-p0:
    /boot/fonts
    /boot/fonts/10x18.fnt.gz
    /boot/fonts/10x20.fnt.gz
    /boot/fonts/11x22.fnt.gz
    [...]
    The following files will be updated as part of updating to
    13.0-RC1-p0:
    /.cshrc
    /.profile
    /COPYRIGHT
    /bin/[
    /bin/cat
    /bin/chflags
    [...]
    To install the downloaded upgrades, run "/usr/sbin/freebsd-update install".
    root@freebsd:~ # /usr/sbin/freebsd-update install
    src component not installed, skipped
    Installing updates...
    Kernel updates have been installed.  Please reboot and run
    "/usr/sbin/freebsd-update install" again to finish installing updates.
    root@freebsd:~ # reboot
    Mar 10 11:39:50 freebsd reboot[65100]: rebooted by root
    Mar 10 11:39:50 freebsd syslogd: exiting on signal 15
    [...]
    root@freebsd:~ # uname -a
    FreeBSD freebsd 13.0-RC1 FreeBSD 13.0-RC1 #0 releng/13.0-n244639-60e8939aa85: Fri Mar  5 05:01:01 UTC 2021     This email address is being protected from spambots. You need JavaScript enabled to view it.:/usr/obj/usr/src/amd64.amd64/sys/GENERIC  amd
    64
    root@freebsd:~ # /usr/sbin/freebsd-update install
    src component not installed, skipped
    Installing updates...
    Scanning //usr/share/certs/blacklisted for certificates...
    Scanning //usr/share/certs/trusted for certificates...
    
    Completing this upgrade requires removing old shared object files.
    Please rebuild all installed 3rd party software (e.g., programs
    
    /bin/[
    /bin/cat
    /bin/chflags
    [...]
    To install the downloaded upgrades, run "/usr/sbin/freebsd-update install".
    root@freebsd:~ # /usr/sbin/freebsd-update install
    src component not installed, skipped
    Installing updates...
    Kernel updates have been installed.  Please reboot and run
    "/usr/sbin/freebsd-update install" again to finish installing updates.
    root@freebsd:~ # reboot
    Mar 10 11:39:50 freebsd reboot[65100]: rebooted by root
    Mar 10 11:39:50 freebsd syslogd: exiting on signal 15
    [...]
    root@freebsd:~ # uname -a
    FreeBSD freebsd 13.0-RC1 FreeBSD 13.0-RC1 #0 releng/13.0-n244639-60e8939aa85: Fri Mar  5 05:01:01 UTC 2021     This email address is being protected from spambots. You need JavaScript enabled to view it.:/usr/obj/usr/src/amd64.amd64/sys/GENERIC  amd
    64
    root@freebsd:~ # /usr/sbin/freebsd-update install
    src component not installed, skipped
    Installing updates...
    Scanning //usr/share/certs/blacklisted for certificates...
    Scanning //usr/share/certs/trusted for certificates...
    
    Completing this upgrade requires removing old shared object files.
    Please rebuild all installed 3rd party software (e.g., programs
    installed from the ports tree) and then run "/usr/sbin/freebsd-update install"
    again to finish installing updates.
    root@freebsd:~ # reboot
    Mar 11 17:25:34 freebsd reboot[43513]: rebooted by root
    Mar 11 17:25:34 freebsd syslogd: exiting on signal 15
    [...]
    root@freebsd:~ # file /usr/local/bin/htop
    /usr/local/bin/htop: ELF 64-bit LSB executable, x86-64, version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 12.0 (1200086), FreeBSD-style, stripped
    
    root@freebsd:/usr/ports/ports-mgmt/pkg # pkg update -f
    Updating FreeBSD repository catalogue...
    Fetching meta.conf: 100%    163 B   0.2kB/s    00:01
    Fetching packagesite.txz: 100%    6 MiB   6.4MB/s    00:01
    pkg: No trusted certificates
    Unable to update repository FreeBSD
    Error updating repositories!
    
    

    E fiquei travado nesse problema de "no trusted certificates" pra atualizar os pacotes.

    Levei um tempo buscando solução, que indicavam pegar os certificados do /usr/src, que eu não instalo mais, mas achei a informação de ouro que corrigiu o problema.  A instalação sobrescreveu a configuração em /etc/pkg/FreeBSD.conf e isso causou o erro.  Bastou trocar o parâmetro "signature_type" para "none" que consegui atualizar os pacotes pra binários do FreeBSD-13.0-RC1.

    
    root@freebsd:~ # cat /etc/pkg/FreeBSD.conf  
    # $FreeBSD$ 
    #   echo "FreeBSD: { enabled: no }" > /usr/local/etc/pkg/repos/FreeBSD.conf
    # 
    
    FreeBSD: { 
      url: "pkg+http://pkg.FreeBSD.org/${ABI}/quarterly", 
      mirror_type: "srv", 
      signature_type: "none", 
      fingerprints: "/usr/share/keys/pkg",
      enabled: yes 
    }
    
    

    Sobre o FreeBSD-13.0?  Não muito a dizer até onde mexi, mas tem novas features interessantes que espero testar mais a fundo.  No momento estou deixando o ambiente preparado pra talvez fazer uma palestra dobre Python no FreeBSD.

We use cookies

We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.