неделя, 16 юни 2024 г.

How to enable hibernate on Manjaro

 To enable hibernate:

1. >sudo nano /etc/mkinitcpio.conf 

Add "resume" at the end of HOOKS=()

HOOKS=(base udev autodetect kms modconf block keyboard keymap consolefont plymouth filesystems fsck resume)
 

2.  sudo mkinitcpio -P #careful with this as if you get wrong mkinitcpio.conf it can ruin your system, it did for mine and I had to chroot it

3. In case you don't have swap entry in your fstab (but you have it otherwise) add it with:

>sudo blkid

Copy the #id from the line saying swap

>sudo nano /etc/fstab

add:

UUID=#id none swap defaults 0 0

where #id is the uuid from blkid

4.  >sudo nano /etc/default/grub

add at the end of GRUB_CMDLINE_LINUX_DEFAULT the resume=UUID=#id

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash udev.log_priority=3 resume=UUID=#id"

(make sure that #id in blkid, fstab and grub is the same!)

5. >sudo update-grub

And now it seems that hibernate is working. Yay.

петък, 7 юни 2024 г.

How to recover system after it crashes during update

Today was a crazy day. I wanted to update the system to see if the new ollama is available and in the middle of the update, I got kernel panic and everything froze. Upon restart, Manjaro 6.89 said kernel doesn't exist and Manjaro 6.77 was starting only in terminal with alt+f2 with no wifi. It was a disaster. 

First, I found that internet from the phone trough usb works, but that didn't help as it would download the packages and then complain about the wrong PGP signature.

Here's a list of the problems I had:

1) my konsole was giving me the errors in Bulgarian, which showed up like white squares making them unreadable. 

I fixed that by changing:

>localectl set-locale LANG=en_US.UTF-8

and then I commented >#bg_BG.UTF-8 UTF-8

in

sudo nano /etc/locale.gen

and now I have a line: LANG=en_US.UTF-8

in sudo nano /etc/locale.conf

2)  I tried installing the kernel without dependencies (as I was convinced that would solve the problem)

>pacman -Sdd linux68 

and that did something random (it installed the files but when I tried to launch it, it couldn't find my hard at all).

3) I did all kinds of attempts to solve the problem with the wrong PGP signature

>bash <(curl -s "https://notabug.org/megavolt/random-scripts/raw/master/fix-gpg-pacman.sh")

the line above was the recommended method, it did something but the problem remained. 

Also this code:

sudo pacman-mirrors -c Global 

sudo cp /etc/pacman.conf /etc/pacman.conf.backup

sudo sed --in-place --regexp-extended 's/^(SigLevel).+$/\1 = Never/g' /etc/pacman.conf

sudo pacman -Syyuu

was supposed to remove the PGP check at all. It might have worked because by then I realised the problem was that pacman was giving an error "package already exist". 

So I made a live usb, backed up the whole home partition (just in case), then I did:

sudo blkid

mount /dev/nvme0n1p6 /mnt

mount -t proc proc /mnt/proc; mount --rbind /sys /mnt/sys; mount --rbind /dev /mnt/dev

pacman --root=/mnt --cachedir=/mnt/var/cache/pacman/pkg -Syu --overwrite "*"

pacman --root=/mnt --cachedir=/mnt/var/cache/pacman/pkg -Syu --overwrite linux68 #not needed but just in case

pacman --root=/mnt --cachedir=/mnt/var/cache/pacman/pkg -Syu  #also just in case

That surprisingly solved all the drama. And my whole day is gone. 

Finally when I restarted into my now working 6.67 linux, I did

>sudo mwid -i linux68

and it found both my Windows and my other kernels and now I had also grub. Yay.

сряда, 28 февруари 2024 г.

From 0 to working scientific python with pypolychord

This is a brand new Lenovo laptop I got as a backup because my dear Asus got broken. So I got this smaller and weaker but still cute laptop. So I wanted to make this post just to list the quickest install from 0 to a working python file. 

Install python and jupyter

1. pacman -S python3

2. pacman -S jupyter-notebook

Install miniconda3 (instructions here)

3. mkdir -p ~/miniconda3

4. cd ~/miniconda3                                                                                                                                                                                                        
5. wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh

6. bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3

7. ~/miniconda3/bin/conda init bash
 

Then install the packages I need. I'm pretty sure I have an exported file from this environment with the packages but this is the absolute minimum of stuff. 

8.
conda create --name myenv
conda install -n myenv pip
conda install ipykernel
python3 -m ipykernel install --user --name=myenv
pacman -S gcc
pip install wheel
sudo pacman -S make
sudo pacman -S gcc-fortran

(optional conda install libgcc - no idea if this helped)

sudo pacman -S gcc-libs

pip install numpy
pip install git+https://github.com/PolyChord/PolyChordLite@master
conda install matplotlib
pip install getdist

I was getting a persistent error with libstdc++.so.6 (see here for other suggestions), here's what I did (after I installed gcc-libs and gcc-fortran)

sudo find / -name "libstdc++.so*"
conda install -c anaconda libstdcxx-ng
conda update libstdcxx-ng
ls ~/miniconda3/envs/myenv/bin/../lib
cp /usr/lib/libstdc++.so.6.0.32 ~/miniconda3/envs/myenv/bin/../lib 

And then manually removing libstdc++.so.6.0.21 and libstdc++.so.6.0.29

The problem with mpi4py:

I was getting a kernel crash from inside polychord, that I know it's related to mpi4py. So I had to install it. When trying to pip install it, I woul get this error:

"The Open MPI wrapper compiler was unable to find the specified compiler
     x86_64-conda_cos6-linux-gnu-cc in your PATH.
      
     Note that this compiler was either specified at configure time or in
     one of several possible environment variables.
     --------------------------------------------------------------------------
     failure.
     removing: _configtest.c _configtest.o
     error: Cannot compile MPI programs. Check your configuration!!!"

Solving it took a long time and 3 gpts!
 >sudo pacman -S openmpi

>yay -S mpicc
 >yay -S mpich

>echo $PATH
>conda list #look for openmpi - I had it, but obviously not working well enough

x86_64-conda_cos6-linux-gnu-cc

which gcc
/usr/bin/gcc

which mpicc
~/miniconda3/envs/BAO/bin/mpicc
export MPICC=~/miniconda3/envs/BAO/bin/mpicc

>pip install mpi4py #longer output but still and error

The Open MPI wrapper compiler was unable to find the specified compiler
      x86_64-conda_cos6-linux-gnu-cc in your PATH.
      
      Note that this compiler was either specified at configure time or in
      one of several possible environment variables.
      --------------------------------------------------------------------------
      failure.
      removing: _configtest.c _configtest.o
      error: Cannot compile MPI programs. Check your configuration!!!

>which x86_64-conda_cos6-linux-gnu-cc
/i didn't have it anywhere/
>conda install x86_64-conda_cos6-linux-gnu-cc
ls ~/miniconda3/envs/BAO/bin #look for x86_64-conda_cos6-linux-gnu-cc - I have x86_64-conda-linux-gnu-cc
>export PATH=~/miniconda3/envs/BAO/bin:$PATH
>pip install mpi4py #nope, same error as above
>conda install -c conda-forge openmpi
>conda install -c conda-forge openmpi --force-reinstall
>pip install mpi4py #yay!!! 

It finally worked. As you can imagine, a lot of steps, it took a while to figure it out. But now polychord is working and all is fine. 


Edit (03.08.2024):

Assuming the system is already up and running with gcc, g++, mpi, mpich, openmpi, I just reinstalled the environment super quick with python 3.12

conda create --name BAOn  

conda activate BAOn

conda install pip

conda install ipykernel

python3 -m ipykernel install --user --name=BAOn

which pip #to confirm you're working within the environment 

pip install wheel  

pip install pillow 

pip install numpy==1.26 --force #to confirm it's not using the outside numpy   

conda install matplotlib

pip install openmpi  #note here on my computer conda install openmpi makes the calculation speed 3 times slower, so either do pip install openmpi or conda install mpich

which mpicc #to confirm the mpicc refers to the env  

pip install mpi4py --force #use force in case you have an old library
 

# see https://stackoverflow.com/questions/61003570/cannot-install-mpi4py-using-conda-and-specify-pre-installed-mpicc-path  

pip install git+https://github.com/PolyChord/PolyChordLite@master #this didn't work for me

#this below did work:

git clone https://github.com/PolyChord/PolyChordLite.git
cd PolyChordLite
make
pip install .

conda install jupyter
pip install emcee --force
pip install getdist
pip install anesthetic
 

Also, to useful commands (which I still haven't tried but I will in the future):

conda env export > BAOn.yml

conda env create -f BAOn.yml

 

понеделник, 19 февруари 2024 г.

Install Maple on a new Manjaro computer

 1. Install ld-lsb (the name of Linux Standard Base package in Manjaro)

2. Download Maple Network Tools from here

3. chmod +X NetworkToolsLinuxX64Installer.run and then run it to install the Network Tools

3. Install Maple and Activate. 

Without the Network Tools, Maple won't activate and will give you FLEXnet error with the license. Apart from that, everything installed flawlessly. No machine name complaints.