How do I upgrade my system to nixos-unstable? - nixos

How do I make sure that all packages I install on my system nixos installation (i.e. packages listed in /etc/nixos/configuration.nix, which I install using sudo nixos-rebuild switch) are using the latest (unstable) version of nixos/nixpkgs?

As explained in the manual's section on upgrading, if you issue the following command as root:
# nix-channel --list
you will most likely see something like the following (if you were following the 16.09 branch for instance):
nixos https://nixos.org/channels/nixos-16.09
By issuing the following command (still as root):
# nix-channel --add https://nixos.org/channels/nixos-unstable nixos
you will remove the 16.09 channel and replace it with nixos-unstable.
Now this is not enough yet. To really update your system, you need one last command:
# nixos-rebuild switch --upgrade
which is going to rebuild your system with your current configuration and updated packages from the channel you switched to.

Run the following commands:
sudo nix-channel --add https://nixos.org/channels/nixos-unstable
sudo nix-channel --add https://nixos.org/channels/nixpkgs-unstable
Note that the sudo is required: if you don't use sudo, it will only affect user-level packages (i.e. things you install using nix-env -i), not system-level packages.

Related

Is there a way to update visual-studio-code-bin which is installed from the arch wiki

visual-studio-code-bin is installed from the arch wiki. The only way I know how to actually update the software is reinstalling it again from the arch wiki which is tedious and inconvenient.
Any help is appreciated
Old post with a lot of split information so for anyone who finds this later, you have 2 choices:
Install the open source version of visual studio code from the official repos.
Install the official Microsoft binary version via the AUR that contains some proprietary code from Microsoft that is not available in the fully open version (e.g. some debugging some languages).
Info on how to do this can be found in the wiki.
It depends on how you installed vscode. If you did sudo pacman -S code, then the solution is to run it again. But if you did yay -S visual-studio-code-bin, then you should run THIS command again.
The best way to use VS Code on Arch is to use the open source version on the community repos. Which you can install by doing
sudo pacman -S code
visual-studio-code-bin is the proprietary binary which can be installed from the Arch User Repository.
If for some reason you want to go for the latter approach, you can either use an AUR helper or manage everything manually.
You can see the Arch Wiki's page on AUR helpers which shows the different options you have: https://wiki.archlinux.org/index.php/AUR_helpers
You can use these helpers to help manage your updates just like you would on pacman.
Here's how you would do things manually: https://wiki.archlinux.org/index.php/Arch_User_Repository#Installing_and_upgrading_packages
Just as a warning, AUR helpers are not supported by Arch Linux and the manual approach, though less user friendly is the recommended way by the Arch Wiki to manage your AUR Packages.
First a short version:
Simply run
sudo pacman -Sy
sudo pacman -S visual-studio-code-bin
The longer explanation:
Getting the right version of vscode
First of all, "code" and "visual-studio-code-bin" are two different packages. "code" is an open-source release and "visual-studio-code-bin" is an Microsoft-branded release. One of the major differences is that "code" doesn't support any Microsoft Extensions like C/C++, to my knowledge. This information can be found in the arch wiki: https://wiki.archlinux.org/title/Visual_Studio_Code#Installation. For more detailed information about the differences I'll refer you to the vscode repository: https://github.com/microsoft/vscode/wiki/Differences-between-the-repository-and-Visual-Studio-Code
By running "sudo pacman -S code" you (unintentionally) uninstall "visual-studio-code-bin" and install "code" because of wired some decency conflict.
So if you want to update/install "visual-studio-code-bin" run:
sudo pacman -S visual-studio-code-bin
This should fix any Problems with no functioning Microsoft-Extensions
Of course if you want to sick to the open-source version you can use
sudo pacman -S code
Fixing your Problem with not updating to the right version
I have to admit this took me ages. I had two machines, one with an freshly installed version of geruda Linux (an arch based distro) and an six moth old version of geruda Linux. Both had vscode installed. At the time of writing this the current version of vscode is 1.59.0-1. Interestingly the my old machine, witch had vscode version 1.58.0-1 installed didn't know that there was an newer version. The newer machine was aware of the the newer version. An simply running pacman -S visual-studio-code-bin didn't change anything. This hinted my to the problem of an not synchronized package database. And forcefully synchronizing the database with
sudo pacman -Sy
did the trick for me. For a more detialed information I would redirect you to the man pages: https://archlinux.org/pacman/pacman.8.html or this thread https://bbs.archlinux.org/viewtopic.php?id=117765. After running this command you only need to install vscode with "sudo pacman -S visual-studio-code-bin" or "sudo pacman -S code" to get the newest version of vscode
As rightly said by #AlexanderHD27 code is open source and vscode is microsoft official version but it is not open source. though code is more like an experimental version of of vscode; however, you can install code directly in archlinux using sudo pacman -S code but for the the vscode you have to clone the repository from github and install in the following way:
git clone visual-studio-code-bin
then cd visual-studio-code-bin and makepkg -si
remember if you don't have git installed you can do that using sudo pacman -S git. As for the update; code is updated during system full update but vscode is not updated. So, you have to cd into the directory again and do git pull the makepkg -si again.
As KamilCuk and Aviad mentioned there is no visual-studio-bin package, since it is a aur package you can use yay (AUR helper) to get a updateable version. For more information about yay see: https://github.com/Jguer/yay.
Install yay
sudo pacman -S --needed base-devel git
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
cd ..
rm -rf yay
Install visual-studio-code-bin with yay
# install
yay -S visual-studio-code-bin
If you installed vscode via pamac manager in manjaro, try this:
pamac update
To update with the cloned AUR directory.
First update pacman database:
pacman-Sy
Then in the AUR directory you can update the AUR to the latest version with:
git pull
Then update dependencies with:
makepkg -s
Finally you install it:
makepkg -i
==> WARNING: A package has already been built, installing existing package...
==> Installing package visual-studio-code-bin with pacman -U...
loading packages...
resolving dependencies...
looking for conflicting packages...
Packages (1) visual-studio-code-bin-1.73.1-1
Total Installed Size: 324.26 MiB
Net Upgrade Size: 29.66 MiB
:: Proceed with installation? [Y/n]

How to stop/disable/hold automatic updates for packages in linux?

I have installed some packages (Docker, Kubeadm, Kubelet, Kubectl) for my Kubernetes cluster on Ubuntu 18.04 LTS.
I don't want these packages to get auto updated because there will be some issue arises between them when the update happens between one another.
I just want to update manually when they are stable.
What is the correct command for stop packages update automatically?
Commands I have used to install them on Ubuntu 18.04
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
sudo apt-get update
sudo apt-get install -y docker-ce=18.06.1~ce~3-0~ubuntu
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
cat << EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF
sudo apt-get update
sudo apt-get install -y kubelet=1.12.7-00 kubeadm=1.12.7-00 kubectl=1.12.7-00
Motivation: You don't want to take any risks over sensitive packages on your linux machine (It happens when your application is in production and customers use it, or some important task running inside, newer version can break changes and accidentally can cause a downtime). In this situation - you want to pin specific versions to your packages and make sure no upgrade happens without explicit action and approval from your side.
Solution: You should disable the unattended-upgrades feature and pin your package into the current version you use (in other words - keep this version).
step 1: disable automatic upgrade (aka unattended-upgrades)
$ sudo vim /etc/apt/apt.conf.d/20auto-upgrades
#edit these lines - which disabling the upgrade feature.
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "0";
step 2: hold and freeze the specific package you want prevent from self upgrading:
sudo apt-mark hold <package-name>
You can use the hold status for a package (or set of packages) to not involve it upgrades. That gives you the more fine-tuned ability to decide on a per-package basis what should, or should not, upgrade. Very helpful during known digressions, bugs, and subtle changes in behaviour.
From the manual page for dpkg and edited / indented:
--get-selections [package-name-pattern...]
Get list of package selections, and write it to stdout. Without a pattern,
non-installed packages (i.e. those which have been previously purged) will
not be shown.
--set-selections
Set package selections using file read from stdin. This file should be in
the format “package state”, where state is one of install, hold, deinstall
or purge. Blank lines and comment lines beginning with ‘#’ are also
permitted.
The available file needs to be up-to-date for this command to be useful,
otherwise unknown packages will be ignored with a warning. See the
--update-avail and --merge-avail commands for more information.
The format is arguably a little weird -- but this is very powerful and helpful. I relied on it a few times during my twenty-five years (!!) with Debian/Ubuntu. I may have a shell script helper somwhere but I may need to dig.
Find of the day :). Ubuntu apt gives you the command to hold the auto update of the package. Thanks to Dirk for giving me the hint.
sudo apt-mark hold docker-ce kubelet kubeadm kubectl
apt doesn't have yum like flags --enable-repo and --disablerepo while performing install or update. A way to manage repos is shown here
But for your case the way you have added the repositories they have been appended to /etc/apt/sources.list therefore you can use sed to comment out the repository lines which you have added to install docker and kubernetes.
Note: you should comment out lines after installation and before performing sudo apt-get update
Example:To disable docker repo:
sed -i 's/^deb.*docker.*/# &/g' /etc/apt/sources.list
Enable the docker repo for manual update:
sed -i '/^# deb .*docker.*/s/^# //' /etc/apt/sources.list

Ansible: ufw is not a legal parameter in an ansible task or handler

Trying to run an ansible installation on ubuntu 14.04
ansible-playbook -i hosts ruby-webapp.yml -t swap,ruby,deploy,mysql,nginx,ufw,import_data
I get
ERROR: ufw is not a legal parameter in an Ansible task or handler
and I can't go forward with the rest of the installation.
ufw was was added as a system module to Ansible 1.6 (see http://docs.ansible.com/ufw_module.html).
You are probably running an older version of Ansible on your control node (i.e., the machine where you are invoking the ansible-playbook command). Check your version with:
ansible --version
Upgrading depends on how you installed Ansible originally, but if you installed it to your system as root using pip, you can probably use:
sudo pip install -U ansible
(The -U means "update")
Edit: Just realized that you might be running Ubuntu 14.04 as your control node so I checked to see what version you get when you install Ansible with apt-get. As of this writing, it installs version 1.5.4, so if that's how you installed it, you definitely have the wrong version. You probably want to uninstall the OS package version and use one of the recommended installation techniques: http://docs.ansible.com/intro_installation.html#running-from-source
Something like:
sudo apt-get remove ansible
sudo easy_install pip
sudo pip install ansible
If you are missing easy_install, you may install it with:
sudo apt-get install python-setuptools

Compiling VIM with breakindent patch

In Ubuntu 12.04 Precise the only way to get breakindent patch working in VIM seems to be compiling VIM itself after patching it. Here's what I've done:
Install pbuilder and create local environment
sudo apt-get install pbuilder debootstrap
sudo pbuilder create --debootstrapopts --variant=buildd
Get the sources
sudo apt-get source vim
Patch them with breakindent patch retrieved from the official repo
cd vim-7.3.429
patch -p1 < vim-breakindent.patch
sudo pbuilder build vim_7.3.429-2ubuntu2.1.dsc
Pbuilder correctly generates deb packages but, after installing them, no breakindent option is available:
:set bri
E518: Unknown option: bri
Where's the mistake?
Thank you
pbuilder is still using the unmodified .dsc, .orig.tar.gz, and .debian.tar.gz to build the package. Applying the patch to your local copy doesn't help.
You should probably add the patch to debian/patches/ and debian/patches/series, bump the local version number in debian/changelog (debchange can help), and re-make the source archive (something like dpkg-buildpackage -S).
Update: it worked following some more steps.
After apt-get source:
cd vim-7.3.429
sudo chmod u=rw,g=r,o=r ../vim-breakindent.patch
sudo cp ../vim-breakindent.patch debian/patches/debian/.
added one new entry in debian/changelog, bumping version from vim_7.3.429-2ubuntu2.1 to vim_7.3.429-2ubuntu2.2
added debian/vim-breakindent.patch at the end of debian/patches/series
generate new source package:
sudo pdebuild
compile the new .dsc:
sudo pbuilder build vim_7.3.429-2ubuntu2.2.dsc
install new debs:
sudo dpkg -i /var/cache/pbuilder/result/*.deb

apt-get for Cygwin?

Is there any apt-get-like program for use with Cygwin?
I already tried cyg-apt but when I try I get this error:
cyg-apt: downloading: http://cygwin.mirrors.pair.com/setup-2.bz2
cyg-apt: downloading: http://cygwin.mirrors.pair.com/setup-2.ini
cyg-apt: bad URL http://cygwin.mirrors.pair.com/setup-2.ini, exiting.
Best I have ever used:
apt-cyg package manager
You can do this using Cygwin’s setup.exe from Windows command line. Example:
cd C:\cygwin64
setup-x86_64 -q -P wget,tar,gawk,bzip2,subversion,vim
For a more convenient installer, you may want to use the
apt-cyg package manager. Its syntax is
similar to apt-get, which is a plus. For this, follow the above steps and then
use Cygwin Bash for the following steps:
wget rawgit.com/transcode-open/apt-cyg/master/apt-cyg
install apt-cyg /bin
Now that apt-cyg is installed. Here are a few examples of installing some
packages:
apt-cyg install nano
apt-cyg install git
apt-cyg install ca-certificates
Update: you can read the more complex answer, which contains more methods and information.
There exists a couple of scripts, which can be used as simple package managers. But as far as I know, none of them allows you to upgrade packages, because it’s not an easy task on Windows since there is not possible to overwrite files in use. So you have to close all Cygwin instances first and then you can use Cygwin’s native setup.exe (which itself does the upgrade via “replace after reboot” method, when files are in use).
apt-cyg
The best one for me. Simply because it’s one of the most recent. It works correctly for both platforms - x86 and x86_64. There exists a lot of forks with some additional features. For example the kou1okada fork is one of improved versions.
Cygwin’s setup.exe
It has also command line mode. Moreover it allows you to upgrade all installed packages at once.
setup.exe-x86_64.exe -q --packages=bash,vim
Example use:
setup.exe-x86_64.exe -q --packages="bash,vim"
You can create an alias for easier use, for example:
alias cyg-get="/cygdrive/d/path/to/cygwin/setup-x86_64.exe -q -P"
Then you can for example install the Vim package with:
cyg-get vim
you can always make a bash alias to setup*.exe files in $home/.bashrc
cygwin 32bit
alias cyg-get="/cygdrive/c/cygwin/setup-x86.exe -q -P"
cygwin 64bit
alias cyg-get="/cygdrive/c/cygwin64/setup-x86_64.exe -q -P"
now you can install packages with
cyg-get <package>
This got it working for me:
curl https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg > \
apt-cyg && install apt-cyg /bin
No. The only officially supported tool for downloading and updating Cygwin packages is the setup.exe file you used for the initial install, although that can be invoked with command line arguments to help the process.
From that same page:
The basic reason for not having a more full-featured package manager is that such a program would need full access to all of Cygwin's POSIX functionality. That is, however, difficult to provide in a Cygwin-free environment, such as exists on first installation. Additionally, Windows does not easily allow overwriting of in-use executables so installing a new version of the Cygwin DLL while a package manager is using the DLL is problematic.
You can use Chocolatey to install cyg-get and then install your packages with it.
For example:
choco install cyg-get
Then:
cyg-get install my-package

Resources