grub rescue

It could happen that your PC, after some operations (i.g. with gdisk) doesn’t start booting and you are therefore in grub rescue prompt. A very unpleasant situation.

The steps to follow are:

  1. see what are the partitions, with the command ls
    • you should see something like: (hd0)(hd0,msdos1)(hd0,msdos2)(hd1)(hd1,gpt1)
  2. understand what is the right partition to boot (i.g. hd0,gpt2):
    • you can list a single partition to see what it contains, with the command ls (hd0,gpt2). You should be able to see if a partition is the right one.
  3. give the command set prefix=(hd0,gpt2)/boot/grub
  4. give the command set root=(hd0,gpt2)/ root=/dev/sda2 (if the right partition is hd0,gpt2 the name is /dev/sda2, if it was hd1,gpt3 it would be /dev/sdb3)
  5. give the command insmod normal
  6. give the command: normal (or boot)

In this way the system should start with the expected partition.

boot useful tips

  1. It is not necessary to start booting with EFI if you have GPT partitions (you could choose to have legacy boot with GPT partitions).
  2. It is not necessary that EFI partition be at the start of a disk: it could be in every place, provided that it has a) boot (esp) flags, and b) at least 110mb of space.

Flatpak bad installation

It could happen that a flatpak installation, from a link, goes bad and from a GUI you can’t fix the problem. In this case you can try with: sudo flatpak repair in a terminal.

At least, this was my experience with Bottles.

wifi adapter not recognized

If you have a rtl88x2bu not recognized by Linux, you can try this:

git clone https://github.com/cilynx/rtl88x2bu.git

and then

sudo dkms add ./rtl88x2bu

and

sudo dkms install rtl88x2bu/5.8.7.1

You should change the release number (5.8.7.1), if necessary, according to your own release.

LibreWriter styles strange behavior

It could happen that apply a (custom) style doesn’t work as expected, i.g. even you have in that style a margin-left this margin is not applied, or it is only temporarily.

To solve you can try removing unused custom styles. Or making that style non hierarchically depending from other styles.

Regex for first lowercase letter

If you have en ebook that split badly a paragraph, you can try (to merge the bad splitted paragraph), as find

</p>\n\n\s\s<p>([a-z])

so that a paragraph beginning with a lowercase word be merged with the previous one.

But in Calibre editor you must check “case sensitive”, otherwise [a-z] will be read as [A-Z], and all first letters (lower and upper case) will be selected.

And as replace you could try

 \1

In this way you keep whatever letter is found with ([a-z]) in the result.

Regex for “space”

It can happen that you want replace a double space before <p>: use the \s. I.g. to replace

,</p>

<p>

You should use this find: ,</p>\n\n\s\s</p>