<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>tuxette-chix</title>
    <description>a girly blog about linux and free software</description>
    <link>https://tuxette.nathalievialaneix.eu/</link>
    <atom:link href="https://tuxette.nathalievialaneix.eu/zfeed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Tue, 12 Nov 2024 19:18:50 +0100</pubDate>
    <lastBuildDate>Tue, 12 Nov 2024 19:18:50 +0100</lastBuildDate>
    <generator>Jekyll v4.2.2</generator>
    
      <item>
        <title>Not enough space on boot partition</title>
        <description>&lt;p&gt;When your ubuntu distribution is installed using the LVM partition system, you can run into an issue while performing updates and upgrades of the distribution because, at some points, the &lt;code&gt;/boot&lt;/code&gt; partition becomes too small. This results in messages of this type:&lt;/p&gt;
&lt;pre&gt;
Not enough free disk space 

The upgrade has aborted. The upgrade needs a total of 617 M free 
space on disk &apos;/boot&apos;. Please free at least an additional 282 M of 
disk space on &apos;/boot&apos;. 
&lt;/pre&gt;

&lt;p&gt;When this happens,&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;check the content of your &lt;code&gt;/boot&lt;/code&gt; partition (with &lt;code&gt;ls /boot&lt;/code&gt;) and remove all unused kernels. This can be performed with
    &lt;pre&gt;
sudo apt autoremove --purge
    &lt;/pre&gt;
    or, if you have old kernels and images, this sometimes require that you remove them one by one by removing the &lt;code&gt;linux-headers-...&lt;/code&gt; and &lt;code&gt;linux-images-...&lt;/code&gt; packages along with the remaining files in &lt;code&gt;/boot&lt;/code&gt;;
  &lt;/li&gt;
  &lt;li&gt;if this is still not enough, edit (as sudo) the file &lt;code&gt;/etc/initramfs-tools/initramfs.conf&lt;/code&gt; and change the line
    &lt;pre&gt;
COMPRESS=lz4
    &lt;/pre&gt;
    to
    &lt;pre&gt;
COMPRESS=xz
    &lt;/pre&gt;
    and run
    &lt;pre&gt;
sudo update-initramfs -u -k all
sudo apt autoremove --purge
    &lt;/pre&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This should be enough to solve the problem.&lt;/p&gt;
</description>
        <pubDate>Tue, 25 Jul 2023 11:26:00 +0200</pubDate>
        <link>https://tuxette.nathalievialaneix.eu/2023/07/not_enough_space_on_boot.html</link>
        <guid isPermaLink="true">https://tuxette.nathalievialaneix.eu/2023/07/not_enough_space_on_boot.html</guid>
        
        <category>22.04</category>
        
        <category>ubuntu</category>
        
        <category>upgrade</category>
        
        
        <category>xubuntu</category>
        
      </item>
    
      <item>
        <title>nextcloud was extremely slow (and how I solved it)</title>
        <description>&lt;p&gt;Nextcloud was extremely slow since a couple of months: all tentative to synchronize tasks or even keepass2 file on android failed, updating the task list in nextcloud took more than 10 minutes and connexion to the web interface also took several minutes. I tested a few things to improve performance and ended up finding the origin of the problem and fixing it.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#caching&quot;&gt;Configuring caching&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#swap&quot;&gt;Increasing swap size&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#cron&quot;&gt;Setting properly CRON for maintenance tasks&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;&lt;a name=&quot;caching&quot;&gt;&lt;/a&gt;Configuring caching&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Reference&lt;/em&gt;: &lt;a href=&quot;https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/caching_configuration.html&quot;&gt;Nextcloud documentation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;One of the main source of performance improvement for nextcloud is supposed to be a proper configuration of caching with &lt;a href=&quot;https://redis.io&quot; target=&quot;_blank&quot;&gt;redis&lt;/a&gt;. It can be installed using:&lt;/p&gt;
&lt;pre&gt;
sudo apt install redis-server php-redis
&lt;/pre&gt;
&lt;p&gt;and the installation is properly made (and server started) if the following command line&lt;/p&gt;
&lt;pre&gt;
ps ax | grep redis
&lt;/pre&gt;
&lt;p&gt;returns something like:&lt;/p&gt;
&lt;pre&gt;
1920663 ?        Ssl    0:00 /usr/bin/redis-server 127.0.0.1:6376
&lt;/pre&gt;
&lt;p&gt;(the port is usually 6379 instead of 6376).&lt;/p&gt;
&lt;p&gt;Then, nextcloud has to be configured to use redis for caching. I used the following setting, entered into the `config/config.php` file of the nextcloud installation directory:&lt;/p&gt;
&lt;pre&gt;
&apos;memcache.local&apos; =&amp;gt; &apos;\OC\Memcache\APCu&apos;,
&apos;memcache.distributed&apos; =&amp;gt; &apos;\OC\Memcache\Redis&apos;,
&apos;redis&apos; =&amp;gt; [
  &apos;host&apos; =&amp;gt; &apos;/run/redis/redis-server.sock&apos;,
  &apos;port&apos; =&amp;gt; &apos;0&apos;,
],
&apos;memcache.locking&apos; =&amp;gt; &apos;\OC\Memcache\Redis&apos;,
&lt;/pre&gt;
&lt;p&gt;which uses redis through a socket. The socket itself is configured by editing the file `/etc/redis/redis.conf` and by checking the unix socket path:&lt;/p&gt;
&lt;pre&gt;
unixsocket /run/redis/redis-server.sock
&lt;/pre&gt;
&lt;p&gt;Finally, make sure that redis is in the group `www-data` and restart redis and apache2 to ensure the proper use of the updated settings:&lt;/p&gt;
&lt;pre&gt;
sudo usermod -a -G redis www-data
sudo systemctl restart apache2
sudo systemctl restart redis-server
&lt;/pre&gt;

&lt;h2&gt;&lt;a name=&quot;swap&quot;&gt;&lt;/a&gt;Increasing swap size&lt;/h2&gt;

&lt;p&gt;Another problem that I encountered was the fact that my memory was almost entirely used and that the swap was full (use `top`, `htop` of `free -h` to check your memory usage). After having killed some of the processes that were running for a while, I freed swap in order to setup a larger swap file:&lt;/p&gt;
&lt;pre&gt;
swapoff -a
&lt;/pre&gt;
&lt;p&gt;I doubled the swap size to 1Mb by creating a swap file with the following command line:&lt;/p&gt;
&lt;pre&gt;
sudo dd if=/dev/zero of=/media/swapfile.img bs=1024 count=1M
&lt;/pre&gt;
&lt;p&gt;on which I put proper permissions and that I registered as a swapfile:&lt;/p&gt;
&lt;pre&gt;
chmod 600 /media/swapfile.img
mkswap /media/swapfile.img
&lt;/pre&gt;
&lt;p&gt;To make the change persisting even after reboot, I also edited the file &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/fstab&lt;/code&gt; to comment out the previous line corresponding to the former swap (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/dev/sda3&lt;/code&gt; in my case) and to replace it by the following line:&amp;lt;/p&amp;gt;&lt;/p&gt;
&lt;pre&gt;
/media/swapfile.img swap swap sw 0 0
&lt;/pre&gt;

&lt;h2&gt;&lt;a name=&quot;cron&quot;&gt;&lt;/a&gt;Setting properly CRON for maintenance tasks&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Reference&lt;/em&gt;: &lt;a href=&quot;https://docs.nextcloud.com/server/21/admin_manual/configuration_server/background_jobs_configuration.html&quot;&gt;Nextcloud help page on background jobs&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;However, none of these two previous fixes solved my main issue. I also noticed that nextcloud was slow for my user but not for some other user (for instance, I have a user dedicated to administration of the app that was not having the same type of issue). I then found out [this conversation](https://github.com/nextcloud/server/issues/6203) and saw that the exact same problem was occuring with me: logged on the web interface, in &quot;Personal settings/Security&quot;, I had thousands of reported opened sessions).&lt;/p&gt;

&lt;p&gt;As the admin user, I thus went to &quot;Administration settings/Administration/Basic settings&quot; and set background jobs to be run through CRON (last option) instead of AJAX. In parallel, on the server, I first run the maintenance task once through the command line, from within the nextcloud installation directory:&lt;/p&gt;
&lt;pre&gt;
sudo -u www-data php -f cron.php
&lt;/pre&gt;
&lt;p&gt;This task took a long time to run (approximately 15 minutes I would say) but ended up with no error and the old sessions from my user account were revoked. The connexion to this account from my smartphone, thunderbird and the web interface became normal again. Most of the opened sessions have been generated by &lt;a href=&quot;https://f-droid.org/fr/packages/at.bitfire.davdroid/&quot; target=&quot;_blank&quot;&gt;DAVx5&lt;/a&gt; so I&apos;ll keep an eye on it in the future.&lt;/p&gt;
&lt;p&gt;To finish, I also set up an automatic task to run the CRON script regularly. Advised frequency is 5 minutes but since the previous run took more than this time, I set a frequency time of 60 minutes, which should be enough for my personal instance:&lt;/p&gt;
&lt;pre&gt;
crontab -u www-data -e
&lt;/pre&gt;
&lt;p&gt;and adding the line&lt;/p&gt;
&lt;pre&gt;
*/60  *  *  *  * php -f /var/www/nextcloud/cron.php
&lt;/pre&gt;
&lt;p&gt;properly sets the CRON job.&lt;/p&gt;
</description>
        <pubDate>Fri, 30 Dec 2022 08:36:00 +0100</pubDate>
        <link>https://tuxette.nathalievialaneix.eu/2022/12/nextcloud-was-extremely-slow</link>
        <guid isPermaLink="true">https://tuxette.nathalievialaneix.eu/2022/12/nextcloud-was-extremely-slow</guid>
        
        <category>22.04</category>
        
        <category>ubuntu</category>
        
        <category>server</category>
        
        <category>nextcloud</category>
        
        <category>redis</category>
        
        
        <category>Ubuntu serveur</category>
        
      </item>
    
      <item>
        <title>grub-efi-amd64-signed kept back during upgrade</title>
        <description>&lt;p&gt;A recent upgrade of my package versions on Xubuntu 22.04 LTS led to the following error:&lt;/p&gt;
&lt;pre&gt;
The following packages have been kept back: grub-efi-amd64-signed
&lt;/pre&gt;
&lt;p&gt;where, indeed, the package `grub-efi-amd64-signed` could not be updated. The reason is that the list of dependencies related to this package has changed. The following command line fixes the upgrade:&lt;/p&gt;
&lt;pre&gt;
sudo apt install --only-upgrade grub-efi-amd64-bin
&lt;/pre&gt;
</description>
        <pubDate>Fri, 30 Dec 2022 08:26:00 +0100</pubDate>
        <link>https://tuxette.nathalievialaneix.eu/2022/12/grub-package-kept-back</link>
        <guid isPermaLink="true">https://tuxette.nathalievialaneix.eu/2022/12/grub-package-kept-back</guid>
        
        <category>22.04</category>
        
        <category>ubuntu</category>
        
        <category>package</category>
        
        <category>grub</category>
        
        
        <category>Xubuntu</category>
        
      </item>
    
      <item>
        <title>Getting rid of firefox based on snap on Ubuntu 22.04</title>
        <description>&lt;p&gt;Since Ubuntu 22.04, &lt;a href=&quot;https://www.mozilla.org/en-US/firefox/new/&quot; target=&quot;_blank&quot;&gt;firefox&lt;/a&gt; is based on snap, with various side effects, including inability to download files in &lt;a href=&quot;http://tuxette.clementine.wf/2016/01/english-using-fuse-ssh-to-mountunmount-a-remote-directory/&quot;&gt;fuse.fs&lt;/a&gt; mounted partitions. This post explains how to install firefox from mozilla repository instead.&lt;/p&gt;
&lt;p&gt;Special thanks to &lt;span style=&quot;color: #cc99ff;&quot;&gt;&lt;strong&gt;Stéphanie&lt;/strong&gt;&lt;/span&gt; who had a problem with her mounted partitions and pointed the issue to me so that I could fix it for her!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Important warning!&lt;/strong&gt; Before you start, be sure to have saved your user profile (it is especially important if firefox stores for you your passwords or other login information). This can be done:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;either by activating your &lt;a href=&quot;https://www.mozilla.org/en-US/firefox/sync/&quot; target=&quot;_blank&quot;&gt;firefox sync account&lt;/a&gt;. In this case, activating the same sync account on any brand new firefox will automatically activate your formally saved passwords and downloaded plugins;&lt;/li&gt;
  &lt;li&gt;or directly save the snap user profile (included in &lt;code&gt;~/snap/firefox/common/.mozilla/firefox&lt;/code&gt;). After firefox has been reinstalled, it can be copied into &lt;code&gt;~/.mozilla/firefox/&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Special thanks to &amp;gt;&lt;strong&gt;Pierre&lt;/strong&gt; who had to experience the loss of his data and pointed that issue to me.&lt;/p&gt;

&lt;p&gt;Finally, to install the mozilla repository based version of firefox, first remove firefox based on snap:&lt;/p&gt;
&lt;pre&gt;
sudo snap remove firefox
&lt;/pre&gt;
&lt;p&gt;and add mozilla PPA in you source list:&lt;/p&gt;
&lt;pre&gt;
sudo add-apt-repository ppa:mozillateam/ppa
&lt;/pre&gt;
&lt;p&gt;Then, as sudo, create a file &lt;code&gt;/etc/apt/preferences.d/mozilla-firefox&lt;/code&gt; where you put the following lines:&lt;/p&gt;
&lt;pre&gt;
Package: *
Pin: release o=LP-PPA-mozillateam
Pin-Priority: 1001

Package: firefox*
Pin: release o=Ubuntu
Pin-Priority: -1
&lt;/pre&gt;

&lt;p&gt;To finish,&lt;/p&gt;
&lt;pre&gt;
sudo apt update
sudo apt upgrade
sudo apt install firefox
&lt;/pre&gt;
&lt;p&gt;should be enough to properly install firefox (and as an extra surprise, install a better version of thunderbird, compatible with more plugins, including the &lt;a href=&quot;https://addons.thunderbird.net/fr/thunderbird/addon/tbsync/&quot; target=&quot;_blank&quot;&gt;TbSync&lt;/a&gt; plugin that is the only one to handle Active Directory synchronization and is not functional in Ubuntu official release of thunderbird).&lt;/p&gt;
</description>
        <pubDate>Tue, 25 Oct 2022 09:26:00 +0200</pubDate>
        <link>https://tuxette.nathalievialaneix.eu/2022/10/getting_rid_of_snap_firefox.html</link>
        <guid isPermaLink="true">https://tuxette.nathalievialaneix.eu/2022/10/getting_rid_of_snap_firefox.html</guid>
        
        <category>22.04</category>
        
        <category>ubuntu</category>
        
        <category>firefox</category>
        
        <category>snap</category>
        
        
        <category>asterics</category>
        
      </item>
    
      <item>
        <title>Encrypting some files in git repositories with git-crypt</title>
        <description>&lt;p&gt;This post describes how to encrypt some files (containing secrets) in git repositories in a transparent way. The chosen solution encrypts files before they are pushed to the remote and decrypts it at pull locally (so you have to make sure that your secrets are well protected on your local computer).&lt;/p&gt;

&lt;p&gt;Different tools exist to perform this task, including &lt;a href=&quot;https://github.com/StackExchange/blackbox&quot; target=&quot;_blank&quot;&gt;BlackBox&lt;/a&gt;, &lt;a href=&quot;https://github.com/mozilla/sops&quot; target=&quot;_blank&quot;&gt;SOPS&lt;/a&gt;, &lt;a href=&quot;https://github.com/elasticdog/transcrypt&quot; target=&quot;_blank&quot;&gt;transcrypt&lt;/a&gt;, &lt;a href=&quot;https://git-secret.io/&quot; target=&quot;_blank&quot;&gt;git-secret&lt;/a&gt;. I chose &lt;a href=&quot;https://github.com/AGWA/git-crypt&quot; target=&quot;_blank&quot;&gt;git-crypt&lt;/a&gt; because it is available through a Ubuntu package, is really fully transparent, is well referenced, cited, and used, is regularly maintained, and can work over GnuPG.&lt;/p&gt;

&lt;h1&gt;First step: as a maintainer, initialize your git-crypt repository&lt;/h1&gt;

&lt;p&gt;git-crypt is easily installed with &lt;code&gt;apt&lt;/code&gt; (install gnupg if you do not have it installed already):&lt;/p&gt;
&lt;pre&gt;
sudo apt install gnupg git-crypt
&lt;/pre&gt;

&lt;p&gt;Locally, initialize your git repository as usual and add the git-crypt initialization afterwards:&lt;/p&gt;
&lt;pre&gt;
git init
git-crypt init
&lt;/pre&gt;
&lt;p&gt;Then, create a &lt;code&gt;.gitattributes&lt;/code&gt; file including the list of files and directories that you want encrypted in your remote repository: &lt;/p&gt;
&lt;pre&gt;
secretfile filter=git-crypt diff=git-crypt
*.key filter=git-crypt diff=git-crypt
secretdir/** filter=git-crypt diff=git-crypt
&lt;/pre&gt;
&lt;p&gt;Note that, to include all files of a given directory &lt;code&gt;secretdir/&lt;/code&gt;, the syntax is &lt;code&gt;secretdir/**&lt;/code&gt; and not &lt;code&gt;secretdir/*&lt;/code&gt;!&lt;/p&gt;

&lt;p&gt;GnuPG users can be added by ID or email by:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;
git-crypt add-gpg-user tuxette@my-domain.org
&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;This creates an encrypted GPG key within &lt;code&gt;.git-crypt/keys&lt;/code&gt;, which is automatically commited.&lt;/p&gt;
&lt;p&gt;More information on GnuPG is available at &lt;a href=&quot;/2012/02/crypter-vos-donn%c3%a9es-et-emails-avec-gnupg/&quot; target=&quot;_blank&quot;&gt;this page&lt;/a&gt; (unfortunately in French).&lt;/p&gt;

&lt;p&gt;Then, configure your remote directory (supposed, here, to be empty; this is done with &lt;code&gt;git remote add ...&lt;/code&gt;), add and commit all the files that are supposed to be versionned, in addition to the file &lt;code&gt;.gitattributes&lt;/code&gt; and push. Further add, commit, pull, push commands can then be used as usual.&lt;/p&gt;

&lt;h1&gt;Second step: as a new user to an existing repository, set your git-crypt configuration&lt;/h1&gt;

&lt;p&gt;You need first to install gnupg and git-crypt with:&lt;/p&gt;
&lt;pre&gt;
sudo apt install gnupg git-crypt
&lt;/pre&gt;

&lt;p&gt;Then, start by generating your GPG key (if you don&apos;t have one already) with:&lt;/p&gt;
&lt;pre&gt;
gpg --gen-key
&lt;/pre&gt;
&lt;p&gt;Once done, you can check it with:&lt;/p&gt;
&lt;pre&gt;
gpg --list-keys
&lt;/pre&gt;
&lt;p&gt;that should look like:&lt;/p&gt;
&lt;pre&gt;
pub   rsa4096 2016-10-31 [SC]
      551C582A867ABF1865E86006378CDF2A339F144E
uid           [ultimate] Tuxette Chix &amp;lt;tuxette@my-domain.org&amp;gt;
sub   rsa4096 2016-10-31 [E]
&lt;/pre&gt;
&lt;p&gt;which you can export using&lt;/p&gt;
&lt;pre&gt;
gpg --armor --export 551C582A867ABF1865E86006378CDF2A339F144E &amp;gt; my_public_key.pub
&lt;/pre&gt;
&lt;p&gt;(the ID &lt;code&gt;551C582A867ABF1865E86006378CDF2A339F144E&lt;/code&gt; has to be adapted to your own key). Send this file to the repository admin and waits for her/him to allow you to access the git-crypt repository.&lt;/p&gt;

&lt;p&gt;When everything is ready, all you have to do is simply:&lt;/p&gt;
&lt;pre&gt;
git clone gitolite@git.my-domain.org:my-nice-git-repo.git
git-crypt unlock
&lt;/pre&gt;
&lt;p&gt;You can then add, commit, pull and push as usual.&lt;/p&gt;

&lt;h1&gt;Second step bis: as an admin, add a new user to use secrets&lt;/h1&gt;

&lt;p&gt;When a new user sends her/his GPG key, add it to your GnuPG configuration with:&lt;/p&gt;
&lt;pre&gt;
gpg --import new-public-key.pub
&lt;/pre&gt;
&lt;p&gt;You can check that it has properly been added with&lt;/p&gt;
&lt;pre&gt;
gpg --list-keys
&lt;/pre&gt;

&lt;p&gt;You may need to &quot;trust&quot; the key before you can proceed. You can do it by signing it:&lt;/p&gt;
&lt;pre&gt;
gpg --edit-key 551C582A867ABF1865E86006378CDF2A339F144E
&lt;/pre&gt;
&lt;p&gt;then type &lt;code&gt;sign&lt;/code&gt;, &lt;code&gt;quit&lt;/code&gt;, and finally &lt;code&gt;yes&lt;/code&gt; to save the edition of the key.&lt;/p&gt;

&lt;p&gt;Finally, in the git repository, run:&lt;/p&gt;
&lt;pre&gt;
git-crypt add-gpg-user &amp;lt;new_user_email@other-domain.org&amp;gt;
&lt;/pre&gt;
&lt;p&gt;where the email is the one referenced in the key (you can also add a user with the key ID). Do not forget to push the changes (the new user&apos;s encrypted key)!&lt;/p&gt;
</description>
        <pubDate>Tue, 09 Aug 2022 11:26:00 +0200</pubDate>
        <link>https://tuxette.nathalievialaneix.eu/2022/08/encrypting-files-in-git.html</link>
        <guid isPermaLink="true">https://tuxette.nathalievialaneix.eu/2022/08/encrypting-files-in-git.html</guid>
        
        <category>git</category>
        
        <category>gnupg</category>
        
        <category>git-crypt</category>
        
        <category>chiffrage</category>
        
        
        <category>asterics</category>
        
      </item>
    
      <item>
        <title>Installing multiple versions of R alongside and corresponding renv settings</title>
        <description>&lt;p&gt;This post describes how to properly install multiple versions of &lt;strong&gt;R&lt;/strong&gt; alongside on Ubuntu OS and to set up a properly controlled &lt;a href=&quot;https://rstudio.github.io/renv/articles/renv.html&quot; target=&quot;_blank&quot;&gt;&lt;code&gt;renv&lt;/code&gt;&lt;/a&gt; environment.&lt;/p&gt;

&lt;h2&gt;Preparation&lt;/h2&gt;

&lt;p&gt;It is better to start with a fresh installation of &lt;strong&gt;R&lt;/strong&gt;. However, if &lt;strong&gt;R&lt;/strong&gt; is already installed, especially if it is installed from the Ubuntu repository, it is better to get rid of the old version first:&lt;/p&gt;
&lt;pre&gt;
sudo apt autoremove --purge r-base r-base-dev r-recommended
&lt;/pre&gt;
&lt;p&gt;In addition, removing the packages is not enough to remove &lt;strong&gt;R&lt;/strong&gt; most of the times. A safe approach is to simply change the binary name in &lt;code&gt;/usr/bin&lt;/code&gt; with:&lt;/p&gt;
&lt;pre&gt;
sudo mv /usr/bin/R /usr/bin/R2
&lt;/pre&gt;
&lt;p&gt;(which is an ugly way to solve this issue, indeed).&lt;/p&gt;

&lt;h2&gt;Installing R from scratch&lt;/h2&gt;

&lt;p&gt;Inspired by &lt;a href=&quot;https://docs.rstudio.com/resources/install-r/&quot; target=&quot;_blank&quot;&gt;this tutorial&lt;/a&gt;, we can now install any &lt;strong&gt;R&lt;/strong&gt; version obtained from the RStudio repository (under the form of a &lt;code&gt;.deb&lt;/code&gt; package). The following lines of codes are given for &lt;strong&gt;R&lt;/strong&gt; version 4.0.3 and Ubuntu 20.04 LTS (they have to be adapted for other versions of &lt;strong&gt;R&lt;/strong&gt; and other OS and OS versions):&lt;/p&gt;
&lt;pre&gt;
export R_VERSION=4.0.3
export UBUNTU_YEAR=2004
curl -O https://cdn.rstudio.com/r/ubuntu-${UBUNTU_YEAR}/pkgs/r-${R_VERSION}_1_amd64.deb
sudo dpkg -i r-${R_VERSION}_1_amd64.deb
sudo apt install -f
&lt;/pre&gt;
&lt;p&gt;At this stage, &lt;strong&gt;R&lt;/strong&gt; should be properly installed and work with:&lt;/p&gt;
&lt;pre&gt;
/opt/R/${R_VERSION}/bin/R
&lt;/pre&gt;
&lt;p&gt;The last stage of the installation would ensure that the R binary is properly linked into a &lt;code&gt;bin&lt;/code&gt; folder:&lt;/p&gt;
&lt;pre&gt;
sudo ln -s /opt/R/${R_VERSION}/bin/R /usr/local/bin/R
sudo ln -s /opt/R/${R_VERSION}/bin/Rscript /usr/local/bin/Rscript
&lt;/pre&gt;

&lt;p&gt;If you are using RStudio with multiple &lt;strong&gt;R&lt;/strong&gt; versions installed as described here, you can choose between them as described &lt;a href=&quot;https://support.rstudio.com/hc/en-us/articles/200486138-Changing-R-versions-for-RStudio-desktop&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;&lt;code&gt;renv&lt;/code&gt; environment&lt;/h2&gt;

&lt;p&gt;Within our project directory, if the &lt;code&gt;renv.lock&lt;/code&gt; file is already present and has never been used, the virtual &lt;strong&gt;R&lt;/strong&gt; environment is installed with the following &lt;strong&gt;R&lt;/strong&gt; command lines:&lt;/p&gt;
&lt;pre&gt;
install.packages(&quot;renv&quot;)
renv::init()
&lt;/pre&gt;

&lt;p&gt;In our case, some packages have shown additional issues:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;code&gt;nloptr&lt;/code&gt; required the installation of an additional Ubuntu library:
&lt;pre&gt;
sudo apt install libnlopt-dev
&lt;/pre&gt;&lt;/li&gt;
  &lt;li&gt;some packages depended on curl and required the installation of:
&lt;pre&gt;
sudo apt install libcurl4-openssl-dev
&lt;/pre&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code&gt;ps&lt;/code&gt; had a problem with a wrong installation directory for &lt;code&gt;sed&lt;/code&gt; that can be resolved creating a symbolic link:
&lt;pre&gt;
ln -s /bin/sed /usr/bin/sed
&lt;/pre&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When the &lt;code&gt;renv&lt;/code&gt; initialization process is interrupted, it can be resumed with:&lt;/p&gt;
&lt;pre&gt;
renv::restore()
&lt;/pre&gt;

&lt;h2&gt;Special case of Bioconductor packages&lt;/h2&gt;

&lt;p&gt;Bioconductor packages can produce errors at installation within &lt;code&gt;renv&lt;/code&gt;. The reason is that the Bioconductor packages are linked to a Bioconductor version that is not itself well handled by &lt;code&gt;renv&lt;/code&gt;. Hence, you first have to check that your local Bioconductor version is identical with the Bioconductor version of the initial &lt;code&gt;renv&lt;/code&gt; installation (for ASTERICS, it is 3.12). To check your local Bioconductor version, do:&lt;/p&gt;
&lt;pre&gt;
BiocManager::version()
&lt;/pre&gt;
&lt;p&gt;(&lt;code&gt;BiocManager&lt;/code&gt; has previously been installed with &lt;code&gt;renv::install(&quot;BiocManager&quot;)&lt;/code&gt; for instance). You have to specify:&lt;/p&gt;
&lt;pre&gt;
BiocManager::install(&quot;3.12&quot;)
&lt;/pre&gt;
&lt;p&gt;and to install your Bioconductor packages with:&lt;/p&gt;
&lt;pre&gt;
BiocManager::install(&quot;pkg_name&quot;)
&lt;/pre&gt;
&lt;p&gt;before proceeding to &lt;code&gt;renv::restore()&lt;/code&gt;. If it still does not work, check your &lt;code&gt;renv.lock&lt;/code&gt; file and replace&lt;/p&gt;
&lt;pre&gt;
&quot;Source&quot;: &quot;Repository&quot;,
&quot;Repository&quot;: &quot;Bioconductor&quot;
&lt;/pre&gt;
&lt;p&gt;by&lt;/p&gt;
&lt;pre&gt;
&quot;Source&quot;: &quot;Bioconductor&quot;,
&lt;/pre&gt;
&lt;p&gt;for Bioconductor packages.&lt;/p&gt;
</description>
        <pubDate>Mon, 08 Feb 2021 10:26:00 +0100</pubDate>
        <link>https://tuxette.nathalievialaneix.eu/2021/02/multiple-versions-of-R.html</link>
        <guid isPermaLink="true">https://tuxette.nathalievialaneix.eu/2021/02/multiple-versions-of-R.html</guid>
        
        <category>20.04</category>
        
        <category>ubuntu</category>
        
        <category>R</category>
        
        <category>asterics</category>
        
        <category>renv</category>
        
        
        <category>asterics</category>
        
      </item>
    
      <item>
        <title>Branch management in asterics</title>
        <description>&lt;p&gt;This post describes the best practices for asterics in branch management.&lt;/p&gt;

&lt;h2&gt;Creating a new branch&lt;/h2&gt;

&lt;p&gt;Branches are created at the head of &lt;code&gt;dev&lt;/code&gt; as follows (within asterics repository):&lt;/p&gt;
&lt;pre&gt;
git checkout dev
git pull
git branch dev-new
git checkout dev-new
git branch --set-upstream-to origin/dev-new
&lt;/pre&gt;

&lt;h2&gt;Merging a branch&lt;/h2&gt;

&lt;p&gt;Feature branches are merged into &lt;code&gt;dev&lt;/code&gt; when they reach a stable state. Before merging, ensures that &lt;strong&gt;R&lt;/strong&gt; tests are all successfull (start a new &lt;strong&gt;R&lt;/strong&gt; session at the project root and proceed as described &lt;a href=&quot;http://tuxette.clementine.wf/2021/02/R-tests-in-asterics.html&quot;&gt;here&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;When you decide to merge, go to the ASTERICS project on ForgeMIA, into the menu (on the left) Repository/Branches and click on the &quot;Merge request&quot; button of the branch that you want to merge (be careful to ask for a merge into &lt;code&gt;dev&lt;/code&gt; and not another branch). Once the merge resquest is performed, ask for someone else to review your code and to perform the merge (this is a two-step process during which you first have to review and correct possible conflicts and then to approve the merge).&lt;/p&gt;

&lt;h2&gt;Deleting a branch&lt;/h2&gt;

&lt;p&gt;The person merging its branch into &lt;code&gt;dev&lt;/code&gt; is responsible for deleting his/her branch locally and remotely (after it has been merged and pushed):&lt;/p&gt;
&lt;pre&gt;
git branch -d dev-new
git push origin --delete dev-new
&lt;/pre&gt;

&lt;p&gt;If this change is not properly spread with &lt;code&gt;pull&lt;/code&gt; on a local repository, you can check which branches are present (with &lt;code&gt;git branch -a&lt;/code&gt;) and if they fit the branches as described on the forge. If not, delete the branch locally (as described above) and prune its remote counterpart:&lt;/p&gt;
&lt;pre&gt;
git remote update --prune
&lt;/pre&gt;
</description>
        <pubDate>Mon, 08 Feb 2021 10:26:00 +0100</pubDate>
        <link>https://tuxette.nathalievialaneix.eu/2021/02/branch-management.html</link>
        <guid isPermaLink="true">https://tuxette.nathalievialaneix.eu/2021/02/branch-management.html</guid>
        
        <category>git</category>
        
        <category>asterics</category>
        
        <category>branch</category>
        
        
        <category>asterics</category>
        
      </item>
    
      <item>
        <title>R tests in asterics</title>
        <description>&lt;p&gt;This post describes how &lt;strong&gt;R&lt;/strong&gt; unit tests are organized and managed in asterics using &lt;a href=&quot;https://testthat.r-lib.org/&quot; target=&quot;_blank&quot;&gt;&lt;code&gt;testthat&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;Tests organization&lt;/h2&gt;

&lt;p&gt;Tests are present in the directory &lt;code&gt;backend/R/tests&lt;/code&gt; in separate files starting with &lt;code&gt;test-&lt;/code&gt; (this is mandatory for the test to be run). In addition, as a naming convention, each test refers to a single function and is named from this function (for instance, the tests for &lt;code&gt;r_multivariate_dotplot&lt;/code&gt; are in the file &lt;code&gt;test-rmultivariatedotplot&lt;/code&gt;). They are all based on the &lt;code&gt;testthat&lt;/code&gt; package and can be executed with this **R** command line:&lt;/p&gt;
&lt;pre&gt;
test_dir(&quot;backend/R/tests&quot;)
&lt;/pre&gt;
&lt;p&gt;(if launched from the project root directory)&lt;/p&gt;

&lt;h2&gt;Automatic testing at the project startup&lt;/h2&gt;

&lt;p&gt;Tests are launched at the project startup within **R** with:&lt;/p&gt;
&lt;pre&gt;
tests &amp;lt;- TRUE
source(&quot;backend/R/conf_wd.R&quot;)
&lt;/pre&gt;

&lt;h2&gt;Tests and branch merging&lt;/h2&gt;

&lt;p&gt;When a branch is merged,&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;either this branch pre-existed before the merging of tests into &lt;code&gt;dev&lt;/code&gt; and the merging of the branch has to be done with: 1/ git merging of the branch into &lt;code&gt;dev&lt;/code&gt;; 2/ testing everything with a session restart; 3/ systematically correcting failed tests and documentation accordingly directly in &lt;code&gt;dev&lt;/code&gt;,&lt;/li&gt;
  &lt;li&gt;either this branch was creating after test support has been merged into &lt;code&gt;dev&lt;/code&gt;. In this case, tests have to be performed and fixed along with documentation before merging into &lt;code&gt;dev&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
</description>
        <pubDate>Mon, 08 Feb 2021 10:26:00 +0100</pubDate>
        <link>https://tuxette.nathalievialaneix.eu/2021/02/R-tests-in-asterics.html</link>
        <guid isPermaLink="true">https://tuxette.nathalievialaneix.eu/2021/02/R-tests-in-asterics.html</guid>
        
        <category>R</category>
        
        <category>asterics</category>
        
        <category>unit tests</category>
        
        <category>testthat</category>
        
        
        <category>asterics</category>
        
      </item>
    
      <item>
        <title>mysql installation</title>
        <description>&lt;p&gt;This post describes how to install and secure mysql and phpmyadmin on Ubuntu server 20.04 LTS.&lt;/p&gt;
&lt;h2&gt;mysql installation&lt;/h2&gt;
&lt;p&gt;&lt;i&gt;Refs&lt;/i&gt;: &lt;a href=&quot;https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-20-04-fr&quot; target=&quot;_blank&quot;&gt;https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-20-04-fr&lt;/a&gt; and &lt;a href=&quot;https://ostechnix.com/install-phpmyadmin-with-lamp-stack-on-ubuntu-20-04-lts/&quot; target=&quot;_blank&quot;&gt;https://ostechnix.com/install-phpmyadmin-with-lamp-stack-on-ubuntu-20-04-lts/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Installation of mysql is performed with the following command lines:
  &lt;pre&gt;
sudo apt install mysql-server
sudo mysql_secure_installation
  &lt;/pre&gt;
  with the options:
  &lt;pre&gt;
Would you like to setup VALIDATE PASSWORD component?
  &lt;/pre&gt;
  yes and 
  &lt;pre&gt;
There are three levels of password validation policy:
  &lt;/pre&gt;
  that is chosen between 
  &lt;pre&gt;
LOW    Length &amp;gt;= 8
MEDIUM Length &amp;gt;= 8, numeric, mixed case, and special characters
STRONG Length &amp;gt;= 8, numeric, mixed case, special characters and dictionary 
  &lt;/pre&gt;
  In addition, anonymous users are removed, root is only allowed to connect from localhost and the test database is removed.
&lt;/p&gt;

&lt;h2&gt;phpmyadmin installation&lt;/h2&gt;
&lt;p&gt;phpmyadmin is further installed with:
  &lt;pre&gt;
sudo apt install php libapache2-mod-php php-mysql phpmyadmin php-mbstring php-zip php-gd php-json php-curl
  &lt;/pre&gt;
  where the configuration is made with 
  &lt;pre&gt;
web server: apache2
connexion default: unix socket
authentication plugin: default
mysql database name: MYDATABASE
mysql username : MYUSER@localhost
  &lt;/pre&gt;
  If an error appears stating:
  &lt;pre&gt;
Error with password: type abort
  &lt;/pre&gt;
  you need to temporarily disable the validate password component:
  &lt;pre&gt;
sudo mysql
UNINSTALL COMPONENT &quot;file://component_validate_password&quot;;
exit
  &lt;/pre&gt;
  and relaunch phpmyadmin installation
  &lt;pre&gt;
sudo apt install phpmyadmin php-mbstring php-zip php-gd php-json php-curl
  &lt;/pre&gt;
  or 
  &lt;pre&gt;
sudo apt install -f
  &lt;/pre&gt;
  before re-installing the component:
  &lt;pre&gt;
sudo mysql
INSTALL COMPONENT &quot;file://component_validate_password&quot;;
exit
  &lt;/pre&gt;
&lt;/p&gt;
&lt;p&gt;
  The installation is completed with:
  &lt;pre&gt;
sudo phpenmod mbstring
sudo systemctl reload apache2
  &lt;/pre&gt;
  to enable php in apache2 configuration and with:
  &lt;pre&gt;
sudo mysql
CREATE USER &apos;MYUSER&apos;@&apos;localhost&apos; IDENTIFIED BY &apos;MYPASSWORD&apos;;
GRANT ALL PRIVILEGES ON *.* TO &apos;pma&apos;@&apos;localhost&apos; WITH GRANT OPTION;
  &lt;/pre&gt;
  to create a user for phpmyadmin (if not already performed during the installation). The connexion to phpmyadmin can be done at http://mydomain.org/phpmyadmin or a virtual host can be created after editing &lt;code&gt;/etc/apache2/conf-available/phpmyadmin.conf&amp;lt;/a&amp;gt; to comment out the automatic redirection (it is advised to configure SSL only connexion as well).
&amp;lt;/p&amp;gt;

&lt;h2&gt;phpmyadmin configuration&lt;/h2&gt;
&lt;p&gt;phpmyadmin configuration file is &lt;code&gt;/etc/phpmyadmin/config.inc.php&lt;/code&gt; where cookie authentication are enabled with the option:
  &lt;pre&gt;
$cfg[&apos;Servers&apos;][$i][&apos;auth_type&apos;] = &apos;cookie&apos;;
  &lt;/pre&gt;
  and root login is disabled with:
  &lt;pre&gt;
$cfg[&apos;Servers&apos;][$i][&apos;AllowRoot&apos;] = FALSE;
  &lt;/pre&gt;
&lt;/p&gt;

&lt;p&gt;To allow fail2ban to secure phpmyadmin connexion, the logs need to be activated with the following option:
  &lt;pre&gt;
$cfg[&apos;AuthLog&apos;] = &apos;syslog&apos;;
$cfg[&apos;AuthLogSuccess&apos;] = false;
  &lt;/pre&gt;
  which leads to the receive this type of message into &lt;code&gt;/var/log/auth.log&lt;/code&gt;:
  &lt;pre&gt;
Aug 14 13:55:51 chix phpMyAdmin[176689]: user denied: FAKEUSER (mysql-denied) from XX.YYY.YYY.ZZ
  &lt;/pre&gt;
  when users try to login without success. The edition of &lt;code&gt;/etc/fail2ban/jail.local&lt;/code&gt; with the addition of:
  &lt;pre&gt;
[phpmyadmin-syslog]
enabled = true
port = http,https
filter = phpmyadmin-syslog
logpath = /var/log/auth.log
backend = %(syslog_backend)s
  &lt;/pre&gt;
  leads to ban IPs with too many unsucessful login attempts. This configuration is enabled with:
  &lt;pre&gt;
sudo systemctl reload fail2ban
  &lt;/pre&gt;
&lt;/p&gt;

&lt;/code&gt;&lt;/p&gt;
</description>
        <pubDate>Tue, 11 Aug 2020 11:26:00 +0200</pubDate>
        <link>https://tuxette.nathalievialaneix.eu/2020/08/mysql-installation</link>
        <guid isPermaLink="true">https://tuxette.nathalievialaneix.eu/2020/08/mysql-installation</guid>
        
        <category>20.04</category>
        
        <category>ubuntu server</category>
        
        <category>mysql</category>
        
        <category>phpmyadmin</category>
        
        
        <category>Ubuntu serveur</category>
        
      </item>
    
      <item>
        <title>jekyll installation with git</title>
        <description>&lt;p&gt;This post describes how to install jekyll (and necessary plugins) on your server (Ubuntu 20.04 LTS) so as to automatically generate and publish your websites through git versionning.&lt;/p&gt;
&lt;p&gt;The best seems to start by &lt;strong&gt;not installing the jekyll package&lt;/strong&gt; from ubuntu public repositories. The reason is that it is best to have local gem installation to avoid versionning problems with pluggins installed using ruby and gems directly. To do so, you start by installing the ruby packages:
&lt;pre&gt;
sudo apt install ruby-full build-essential zlib1g-dev
&lt;/pre&gt;
and you switch to your git user (on my server, called &quot;git&quot;) to update its local profile:
&lt;pre&gt;
sudo su git
echo &apos;# Install Ruby Gems to ~/gems&apos; &amp;gt;&amp;gt; ~/.bashrc
echo &apos;export GEM_HOME=&quot;$HOME/gems&quot;&apos; &amp;gt;&amp;gt; ~/.bashrc
echo &apos;export PATH=&quot;$HOME/gems/bin:$PATH&quot;&apos; &amp;gt;&amp;gt; ~/.bashrc
source ~/.bashrc
&lt;/pre&gt;
&lt;/p&gt;
&lt;p&gt;jekyll (and plugins) can then be installed with the gem command:
&lt;pre&gt;
gem install jekyll bundler
gem install jekyll-scholar
&lt;/pre&gt;
At this stage, the user gitolite should be able to use the command &lt;code&gt;jekyll build&lt;/code&gt; to generate a website created for jekyll.
&lt;/p&gt;
&lt;p&gt;The last step is to automate the generation and publication of the website when a modification is pushed on its git repository. Suppose that the apache VH points to the directory &lt;code&gt;/var/www/blog&lt;/code&gt; in which the website is published. First, you have to ensure that this directory is owned by the user &quot;git&quot;:
&lt;pre&gt;
chown -R git:git /var/www/blog
&lt;/pre&gt;
&lt;/p&gt;
&lt;p&gt;The second steps consists in creating a script that will build and copy the website content. To do so, if the website is versionned in the directory &amp;lt;/code&amp;gt;/var/lib/gitolite3/repository/blog.git&amp;lt;/code&amp;gt;, you create and edit a file &amp;lt;/code&amp;gt;/var/lib/gitolite3/repository/blog.git/hooks/post-receive&amp;lt;/code&amp;gt; that contains:
&lt;pre&gt;
GIT_REPO=/var/lib/gitolite3/repositories/blog.git
TMP_GIT_CLONE=/var/lib/gitolite3/tmp/myrepo
PUBLIC_WWW=/var/www/blog

git clone $GIT_REPO $TMP_GIT_CLONE
cd $TMP_GIT_CLONE
jekyll build  -d $PUBLIC_WWW
cd ~/
rm -Rf $TMP_GIT_CLONE
exit
&lt;/pre&gt;
This file should be made executable with
&lt;pre&gt;
chmod ug+x /var/lib/gitolite3/repository/blog.git/hooks/post-receive
&lt;/pre&gt;
and... that&apos;s it!&lt;/p&gt;
</description>
        <pubDate>Tue, 11 Aug 2020 11:26:00 +0200</pubDate>
        <link>https://tuxette.nathalievialaneix.eu/2020/08/jekyll-installation-with-git</link>
        <guid isPermaLink="true">https://tuxette.nathalievialaneix.eu/2020/08/jekyll-installation-with-git</guid>
        
        <category>20.04</category>
        
        <category>ubuntu server</category>
        
        <category>jekyll</category>
        
        <category>git</category>
        
        
        <category>Ubuntu serveur</category>
        
      </item>
    
  </channel>
</rss>
