Menu Close

Tag: howto

Restoring Gitlab from its own backups is a pain, but it's possible!

Gitlab helpfully lets you know it’s making backups of the database each time it does an upgrade, but trying to find information on where those files are stored by default on the web is an exercise in futility. Most links lead to Gitlab themselves and they sure as hell aren’t telling you.

Well I hope to help someone else (and possibly myself in the future) by listing a few useful ones here.

Step 1: Needed files

To restore from a boot / OS failure, or after a fresh install, you’ll need the following files:

  • /etc/gitlab/gitlab.rb
  • /etc/gitlab/gitlab-secrets.json
  • the entire /var/opt/gitlab/git-data folder
  • the file you want from /var/opt/gitlab/backups
  • install the exact same version of gitlab you were previously running before the failure

So hopefully you were able to rescue those files as they contain your settings, secrets, the db backup and the repositories themselves.

Step 2: Install Gitlab

Having gathered all of these things, you’ll need to first install the relevant version of Gitlab. I needed the version before current so the command in Xubuntu (using apt) is:

sudo apt install gitlab-ce=12.5.3-ce.0

12.5.3 is the version the restore process told me I needed. The -ce.0 part is important if you’re using gitlab-ce.

If you’ve already installed a prior version before coming here, you can look at the output of that command for clues on how to get it to continue despite you already having a database.

Step 3: Restore the database

Now copy the backup files from where you have them into /var/opt/gitlab/backups:

sudo cp -R <source folder goes here> /var/opt/gitlab/backups/

Now that you have the right version installed, you can restore the backup. Make sure you set the permissions on /var/opt/gitlab/backups so the user git can access it.

# Allow the git user to access the backups
sudo chown -R git:git /var/opt/gitlab/backups

# List the backups to see what we can restore!
sudo ls -alF /var/opt/gitlab/backups

You should get a listing of the different backups that were made. Usually you’ll want to pick the most recent one, which will be listed last.

Next you type in the command to actually restore the backup database. My backup file was 1576180022_2019_12_12_12.5.3_gitlab_backup.tar

We need to take the _gitlab_backup.tar part off of the end and use that as our file to restore:

sudo gitlab-backup restore BACKUP=1576180022_2019_12_12_12.5.3

If you have any problems, the fix is usually in the error output. You may run into an issue if you have the wrong version installed. Go back to Step 2: Installing Gitlab and fetch the version it tells you to.

Step 4: Restore the repositories

After the db is restored, you may still need to copy the repositories over too. Those are located in the /var/opt/gitlab/git-data folder.

sudo cp -R <source folder goes here> /var/opt/gitlab/git-data/

# Allow Gitlab to access the files
sudo chown git:git /var/opt/gitlab/git-data/

I’ve had some luck simply copying them over but sometimes that doesn’t work. So you may need to import those repositories manually. That fix is outside the scope of this short how-to, but keep at it and you’ll get things back up and running in no time!

How To Get the Touchscreen Working in Xubuntu Linux on an Insignia Flex 11.6″ Tablet

The Insignia Flex 11.6″ tablet (NS-P11W7100) felt like a great deal at the time. It was about $100 and came with a quad core 1.4Ghz CPU and a paltry, but possibly sufficient 2GB of RAM. Storage is also only 32GB. For Windows 10, this is just crap. So I decided to install Xubuntu Linux to get it to run things faster.

And faster it was! Wow! I can play HD video without stuttering, and many other simple tasks now happen instantly instead of waiting forever for Windows 10 to get around to it.

Only one problem, many of the devices did not work out of the box. So I’m going to share with you today part of my journey: getting the touchscreen to work in Xubuntu Linux!

For now, I’ll skip telling you how to install Xubuntu. There are other tutorials on the Internet for that, but if someone comments asking for a better walkthrough, I’ll certainly give you one. I had success by using Rufus to create the bootable USB key, though. Also you’ll need to set the security setting in your BIOS to off (Del key at the Insignia logo).

Firmware

I was able to obtain the firmware for the Insignia Flex NS-P11W7100 touchscreen by visiting the gsl firmware repository by onitake on Github. There is a thread there where I have also documented my journey.

I have also packaged up all of the firmware I currently am using in a handy file!

You will need to copy this file to /lib/firmware/silead on your own machine.

tar -xvf mssl1680.fw_.tar /lib/firmware/silead/

This will take a while, and once it’s finished, you will have the firmware necessary for your Insignia Flex NS-P11W7100 on your machine. Yay!

evdev

But that’s not all! Now you need to install Xorg evdev. This package seems to work far better than the default. It works for me, so I’m sure it’ll work for you. (Unless Xubuntu changes significantly after I make this tutorial.)

sudo apt install xserver-xorg-input-evdev xserver-xorg-core xinput-calibrator

This will install evdev and xinput_calibrator which will be used in the next step. For now, reboot your machine.

sudo reboot

Calibration

Once you reboot, you should notice your tablet responding to touch! But it’s all wrong! It’s up in the top left of the screen no matter where you touch and it’s upside-down! xinput_calibrator to the rescue!

xinput_calibrator

Now you’ll see your screen is completely taken over by a calibration program. Follow the instructions, pressing first the + at the top left of your screen, then top right, then the bottom two. It may take a few tries before the calibrator accepts your input. Once it does, it will present you with your calibration details and they should look like this:

$ xinput_calibrator
Calibrating EVDEV driver for "silead_ts" id=13
	current calibration values (from XInput): min_x=42, max_x=1946 and min_y=1500, max_y=11

Doing dynamic recalibration:
	Setting calibration data: 50, 1944, 1517, -9
	--> Making the calibration permanent <--
  copy the snippet below into '/etc/X11/xorg.conf.d/99-calibration.conf' (/usr/share/X11/xorg.conf.d/ in some distro's)
Section "InputClass"
	Identifier	"calibration"
	MatchProduct	"silead_ts"
	Option	"Calibration"	"50 1944 1517 -9"
	Option	"SwapAxes"	"0"
EndSection

Immediately you should notice touch is working much better. If not, try running xinput_calibrator again. If the problem persists, I suggest you read the repository linked above. It has a lot of great info.

Save your changes

But we’re not done yet! That output is telling you something important! You need to save your config in order for it to work next time you reboot. So let’s do that now. Copy the “Section … EndSection” value and open the terminal again to edit the config file.

sudo nano /usr/share/X11/xorg.conf.d/99-calibration.conf

Now you can paste in the configuration.

Section "InputClass"
	Identifier	"calibration"
	MatchProduct	"silead_ts"
	Option	"Calibration"	"50 1944 1517 -9"
	Option	"SwapAxes"	"0"
EndSection

That’s it! You have configured your touchscreen! Enjoy! Paint a nice picture on your lovely (actually really crappy) touchscreen and share it! 🙂


Bonus round: fix the sound!

I had issues after re-installing Xubuntu for this tutorial. I had no sound! Audio apps couldn’t even find a working audio output. They just froze at 0:00 time. (Both Parole and YouTube in Firefox were tested.)

To fix it, I simply downloaded the whole repository here: https://github.com/plbossart/UCM

Download a zip or check it out. It doesn’t matter. Get the files and copy them over to /usr/share/alsa/ucm/

After doing this I had sound! But it was too quiet. 🙁

The fix was to open up alsamixer, make sure the headphone output wasn’t muted for headphones, and turn DOWN the volumes of the left and right headphones and speakers. The headphone gain seems to be reveresed. The speaker gain seems to shut right off after green. So I just set it to the top green value.

Hope this helps someone!

© 2020 Welcome to My World. All rights reserved.

Theme by Anders Norén.