Posts Tagged ‘ubuntu’

Encrypting an external drive

July 26th, 2015 No comments

I wanted to encrypt the disks that I use to regularly make a backup so I can put it offsite without that nagging thought that just about anyone can read it’s contents when it gets stolen/lost.

Find out the name of the disk you want to encrypt. I usually use a ‘sudo fdisk -l’ to find out which disk. In my case /dev/sdc3 so I will use that in this example. Substitute with your own unless you want to lose data.

Make sure your disk is not mounted:

sudo umount /dev/sdc3

It is good practice to fill the disk with some initial garbage to make any decryption attempts harder.

sudo dd if=/dev/urandom of=/dev/sdc3

Initial creation:

# Login as root
sudo -i
# Install cryptsetup
apt-get install cryptsetup
# I am using a passphrase to setup the encryption you could optionally use a keyfile. Check out the manual for more info.
cryptsetup -y create crypt /dev/sdc3
# Create an ext4 filesystem. (-m 0 -> No reserved blocks for root, this is an external disk)
mkfs.ext4 -m 0 /dev/mapper/crypt
# Create a directory to mount to and mount
mkdir /mnt/crypt && mount /dev/mapper/crypt /mnt/crypt


sudo cryptsetup create crypt /dev/sdc3
sudo mount /dev/mapper/crypt /mnt/crypt

That did it for me. I just wanted a small barrier to chase away curious people.

Categories: Debian, Ubuntu Tags: ,

Blank screen during install

November 30th, 2013 No comments

I had some problems while installing Ubuntu/Linux Mint on a laptop. The screen went blank.
After some investigation it turned out that the backlight was turned off. (Intel GMA 4500m chipset)
To fix this I found two options that worked (default brightness buttons on laptop were not working)

Add the following boot options:


This option allows me to use the brightness controls on the laptop and thus restore the brightness to a viewable state.
If that doesn’t work you could also turn off i915. That will allow you to pass the setup at first. Maybe install an OpenSSH server and then go in to output a acceptable value into the backlight.


After this I created a init.d script called backlight to set the backlight to a valid value at boot.

First I got the current value:

cat /sys/class/backlight/intel_backlight/actual_brightness

Use that in the backlight script.

echo 72250 > /sys/class/backlight/intel_backlight/brightness

This will probably only work when acpi_osi=Linux during boot. You can add that option to grub later on.
Edit (/etc/default/grub) add the rule to GRUB_CMDLINE_LINUX_DEFAULT, GRUB_CMDLINE_LINUX or GRUB_CMDLINE_DEFAULT and run update-grub2 afterwards.

Make it executable.

chmod +x backlight

Make it run at different runlevels.

update-rc.d backlight defaults 00

That should restore the backlight at some point during boot. Not an ideal solution, but at least a working one.

Categories: Linux, Ubuntu Tags: , , ,

Setting up an OrientDB server on Ubuntu

January 19th, 2013 13 comments

Go to the directory you want to install OrientDB.

cd /opt

Download one of the two flavors of OrientDB (standard or graph edition). (If you don’t know which to take, pick the Graph Ed.)

sudo wget
#sudo wget

Unpack the file

sudo tar -zxvf orientdb-1.3.0.tar.gz

I usually remove the tar.gz file and add a symlink

sudo rm orientdb-1.3.0.tar.gz
sudo ln -s orientdb-1.3.0/ orientdb

Configure the default orientdb password. (I use vi, you use your own favorite editor ;))

sudo vi orientdb/config/orientdb-server-config.xml

Go to the section [orient-server > storages > storage] in the xml, change the default username and password and save the file

<!-- Default in-memory storage. Data are not saved permanently. -->
<storage path="memory:temp" name="temp" userName="yourUsername" userPassword="yourPassword" loaded-at-startup="true" />

Get the root password for later use or/and add your own preferred account in [orient-server > users]:
(I prefer to remove the root account and add a new one)

<user name="yourUsername" password="yourPassword" resources="*"/>

As the file is holding passwords it might be a good idea to remove the read permission for other users.

sudo chmod 640 /opt/orientdb/config/orientdb-server-config.xml

Create a user that will run the server:

# -d, --home-dir HOME_DIR       home directory of the new account
# -M, --no-create-home          do not create the user's home directory
# -r, --system                  create a system account
# -s, --shell SHELL             login shell of the new account (/bin/false =  no login)
# -U, --user-group              create a group with the same name as the user
sudo useradd -d /opt/orientdb -M -r -s /bin/false -U orientdb

Change ownership of orientdb directory/links:

sudo chown -R orientdb.orientdb orientdb*

Modify the user group rights so that users in the orientdb group can invoke shell scripts.

sudo chmod 775 /opt/orientdb/bin
sudo chmod g+x /opt/orientdb/bin/*.sh
sudo usermod -a -G orientdb yourUsername

Copy the init.d script:

sudo cp orientdb/bin/ /etc/init.d/

Update the init.d script with this sed script or just edit the file. (The copied one)

sudo sed -i "s|YOUR_ORIENTDB_INSTALLATION_PATH|/opt/orientdb|;s|USER_YOU_WANT_ORIENTDB_RUN_WITH|orientdb|" /etc/init.d/

And change the following lines, we use sudo because our system account does not have a login shell.

# You have to SET the OrientDB installation directory here (if not already done so)
#su -c "cd \"$ORIENTDB_DIR/bin\"; /usr/bin/nohup ./ 1>../log/orientdb.log 2>../log/orientdb.err &" - $ORIENTDB_USER
sudo -u $ORIENTDB_USER sh -c "cd \"$ORIENTDB_DIR/bin\"; /usr/bin/nohup ./ 1>../log/orientdb.log 2>../log/orientdb.err &"
#su -c "cd \"$ORIENTDB_DIR/bin\"; /usr/bin/nohup ./ 1>>../log/orientdb.log 2>>../log/orientdb.err &" - $ORIENTDB_USER
sudo -u $ORIENTDB_USER sh -c "cd \"$ORIENTDB_DIR/bin\"; /usr/bin/nohup ./ 1>>../log/orientdb.log 2>>../log/orientdb.err &"

Update the rc.d dirs

cd /etc/init.d
sudo update-rc.d defaults

The server will now start and stop on startup/shutdown. For now we start it by hand.

sudo /etc/init.d/ start

Verify that it is running by opening the studio (e.g. http://localhost:2480/) or run ‘sudo /etc/init.d/ status’.

Now we can log in and create a new database,
Start the console:


Create a new database:

create database remote:/yourDatabaseName yourUsername yourPassword local

Done. Grab a beer, you’ve earned it. 😉