How do I update core to 8.4?
Make a database backup.
Make a Drupal code source backup.
I had to know which drush I use:

$ drush version
Drush Version   :  8.1.9


which isn't good for me.
I had to find out whether it is a local or a global installation

$ locate drush
/usr/local/bin/drush
$ dpkg -l | grep drush
rc  drush    5.10.0-2ubuntu1


it looks like the ubuntu package was removed before
and it wasn't installed by pear:

$ pear list

Installed packages, channel pear.php.net:
=========================================
Package          Version State
Archive_Tar      1.4.0   stable
Console_Getopt   1.4.1   stable
HTTP_Request2    2.2.1   stable
Net_URL2         2.2.0   stable
PEAR             1.10.1  stable
PEAR_Manpages    1.10.0  stable
PHP_CodeSniffer  2.5.1   stable
Structures_Graph 1.1.1   stable
XML_Util         1.3.0   stable



So, it can be only a global phar installation.


I chose the WRONG WAY of the installation in the beginning which resulted a lot of more issues (I don't list them here) and finally a drush installation which I wasn't able to update my drupal
Just for the record here is the wrong way: I decided I install drush by composer and if the global version confuses its functionality I will remove the old one from the file system manually
I ran this command from the root directory of my drupal project
$ composer require drush/drush
This installed a lot of other packages and updated my drush from 8.1.9 to 8.1.12. Everything looked good at this point.
$ drush version



Drush Version   :  8.1.12


$ drush up drupal
resulted


Unable to load class \Drush\VersionControl\Backup.


I removed the drush 8.1.12 and installed the drush 9.x version.
I wasn't able to update my drupal site, so I removed the local drush package and its dependencies.


the WORKING WAY
remove the composer version if that exists and install drush globally by phar



# Download latest stable release using the code below or browse to github.com/drush-ops/drush/releases.
wget https://github.com/drush-ops/drush/releases/download/8.1.16/drush.phar

# Test your install.
php drush.phar core-status

# Rename to `drush` instead of `php drush.phar`. Destination can be anywhere on $PATH. 
chmod +x drush.phar
sudo mv drush.phar /usr/local/bin/drush



I updated my drupal from 8.3.4 to 8.3.5
$ drush up drupal
I got the package name of the drupal 8.4 by this command
$ drush dl drupal-8 --select



 [0]  :  Cancel                                               
 [1]  :  8.4.x-dev  -  2017-Jul-22  -  Development            
 [2]  :  8.3.5      -  2017-Jul-05  -  Supported, Recommended 
 [3]  :  8.3.4      -  2017-Jun-21  -  Security


I chosed 0


I updated my drupal from 8.3.5 to 8.4
$ drush pm-update drupal-8.4.x-dev



Update information last refreshed: Mon, 06/26/2017 - 18:31
 Name    Installed Version  Proposed version  Message                     
 Drupal  8.3.5              8.4.x-dev         Specified version available

Do you really want to continue? (y/n): y


At the end I got 3 errors, but the update was successful.
Unfortunately the drupal 8.4.x-dev version didn't fix any of my issues.