LVM Luks Cryptsetup Mount from Alternate Machine or VM

I’ve run into some problems lately as I decided to setup various configurations using encrypted drives, which also includes LVM by default. I accidentally stumbled across an article from 2008 posted on Ubuntu Geek which describes the process. The drive I used for testing was connected via VirtualBox with a USB Cable on a Macbook Pro running El Capitan. The operating system on the VM was Xubuntu 16.04 (an Ubuntu 16.04 derivative) and the original operating system on the encrypted drive was the same.

The link to the original article is: http://www.ubuntugeek.com/rescue-an-encrypted-luks-lvm-volume.html

This tutorial is for people who have encrypted their main volumes of their hard drives using the method offered by the Alternate CD installer.

First you need to Boot into a Live CD environment and open up a terminal window. (applications–>accessories—>terminal)

Install required packages using the following command

sudo apt-get install lvm2 cryptsetup

probe required module using the following command [I didn’t have to do this step]

sudo modprobe dm-crypt

setup the crypto module to recognise the partition

sudo cryptsetup luksOpen /dev/hda5 crypt1

Enter your passphrase. You should get the following message:

key slot 0 unlocked.
Command successful.
If not, something has gone wrong.

Scan for volume groups

sudo vgscan --mknodes

sudo vgchange -ay

[NOTE: You might receive multiple errors at this step about incorrect names, etc. The main take-away from this step is whether it admits to finding a volume.]

REMEMBER the name of the volume group, as you will need it later.

Create a mount point [I simply mounted to /mnt instead]

sudo mkdir /volume

mount the encrypted volume to the mountpoint you just created. [Substitute the volume group name found in place of the paulb-desktop in the next command]

sudo mount /dev/paulb-desktop/root /volume

The volume is mounted, now you can chroot or whatever else you need to do. If you would like to open the gnome file manager for writing to it issue the following command:

sudo nautilus /volume


At this point, hopefully it worked. I wish I’d found these instructions a couple of years ago as I’ve ended up trashing 2 volumes in the process of trying to recover files. Fortunately, I didn’t lose that much but it could have been truly catastrophic, especially had it been a production server.

Dell T7400 and nVidia GT730 audio issues

So, just installed a GT730 or other HDMI-enabled nVidia video card and now your Dell T7400 has lost audio? Messages like “no output device” or “audio not responding”? Well, after 2 hours of useless searching, finally found that the T7400 BIOS allows 3 settings for the onboard audio: OFF, AUTO, and ON. Turns out that if you set the onboard audio to AUTO, it will disable the onboard audio system if another audio system (such as an HDMI video card) is installed. If you wish to keep the built-in audio working, set the onboard audio to ON and then reboot. Windows 8.1 found it this way, others should as well. Once you reboot, you’ll need to open your Playback and Recording from the System Tray and make sure you direct output to the correct device (not nVidia HD audio).

Raspberry Pi Zero, Raspbian Jessie, and WN-250gi WiFi Adapter

So, I bought a Pi Zero right after they came out and have left it languishing on the shelf since as I haven’t had sufficient time to mess with it. However, I recently decided to take a look at some home automation using various IoT concepts and thought this might make a nice little gateway. I ran into several issues getting the device to work, however, for several reasons.

First, I didn’t have a USB hub available to run multiple devices at the same time. With only 1 OTG (on the go) cable available, I was out of luck in that department. (I’m trying to do some gateway / server testing without purchasing new equipment at this point. Second, I don’t have an HDMI TV available, nor do I have any type of adapter to convert to an old-style RCA jack video connection. What I needed was to create the SD card with the image on it, modify the image to support everything, and then remote into it via SSH to run the raspi-config program to configure the rest.

To get the project off the ground, I downloaded the latest image of Raspbian Jessie and installed it on my 64 GB micro-SD card. Note that I’m running Xubuntu 16.04 LTS and the SD card shows up as /dev/mmcblk0. Since DD gives no feedback, I decided to use DCFLDD in its place (which required running sudo apt-get install dcfldd to install the package). The command I used to write the image to the micro-SD card was:

sudo dcfldd bs=1M if=~/Desktop/rasp-jess.img of=/dev/mmcblk0

After this was completed, the number of blocks written was displayed, but it took about 2 minutes to finish emptying the cache and return to the prompt. Be patient, don’t eject the card thinking that it has locked up. Also, make sure before you eject the card it hasn’t been mounted to any locations.

Once the image is written and you’ve ejected the card, re-insert and mount the second partition (probably /dev/mccblk0p2) if it doesn’t automatically mount after 30 seconds or so. From here, you’ll need to edit 4 files to get the image to a useful (headless) state. Not all of these require editing with root rights, but I used sudo for them anyway to avoid error messages.

First, figure out where your card was mounted. Mine was in /media/brian/7f…/, with the 7f being a long 32 character (maybe, I didn’t actually count the characters) string of text. This is where the command line TAB key expansion capability comes in handy.

Use nano or other favorite text editor (remember, sudo may be required) to edit /path_to_partition2/etc/network/interfaces. I wanted to add a static IP address, so my file edited the following section:

auto wlan0 <<=== added this line
allow-hotplug wlan0
iface wlan0 inet static <<=== changed keyword manual to static
address 192.168.3.40 <<=== added the remaining static IP info and wpa
netamsk 255.255.255.0
gateway 192.168.3.1
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

At this point, you can save the file. Note that one gotcha may ultimately be that your wireless device doesn’t try to enable as wlan0. In this section and others, you might need to boot the Raspberry Pi Zero, wait for it to boot (90 seconds max usually), plug in the wireless device (mine was a generic type WN-250gi), allow it to boot for 10 to 20 seconds, then shut the Raspberry down and read the syslog file from the SD card. This file will be located in the /path_to_partition2/var/log/syslog location once the card is mounted. Make sure you don’t accidentally read the syslog for your system… Makes you feel kinda dumb for troubleshooting something for 20 minutes only to realize… This file will give you an idea of which interface name is in use but you’ll need to read through it.

Once again, use your favorite sudo’d editor to add the following information to /path_to_partition2/etc/wpa_supplicant/wpa_supplicant.conf. Especially notice that if your SSID is not broadcast you will need to include the scan_ssid=1 line, otherwise omit it.

country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
ssid=”rpihost”
scan_ssid=1
psk=”12345678912345678912345678″
key_mgmt=WPA-PSK
}

The country was changed on line 1, then the network entry was added; the other lines were left as found. The SSID is the name of your wifi, scan_ssid=1 is required if SSID is not broadcast, psk is your key (mine is using a 26 character key), and key_mgmt can be something besides WPA-PSK if you have different wireless capabilities. However, you’ll need to look up the changes necessary to make the correct wpa_supplicant.conf entries for WEP or other types of security. Also, this is another place where the syslog file can be your friend. If you’re not getting a connection, you might be missing a firmware file for your wifi adapter. This is usually stated in plain text and will usually give the name of the file needed. Use the Internet to find the correct file, rename it if needed, and use sudo to copy it into /path_to_partition2/lib/firmware.

Now, sudo edit the file /path_to_partition2/etc/resolv.conf to include the name servers that you need. If you have a DNS server on your network (or more than one) you’ll need to include that address; I have both a DNS server and my router to act as DNS servers, so my entries appear as follows:

nameserver 192.168.3.22
nameserver 192.168.3.1

If there are any other lines and you don’t see a need for them, you can comment them out with a # symbol. As you’re manually editing this card until all errors have been resolved, you can always uncomment if needed.

After those changes, the Pi booted up great and responded to pings in 3 to 6 ms, but absolutely refused to allow an SSH connection to configure the damn thing. Every attempt resulted in a “connection refused” message on port 22. I wasn’t able to find a description of how sshd (the ssh daemon) gets enabled on the Pi other than I needed to run raspi-config on the Pi. The whole point of this exercise is that I can’t connect to the bloody thing to enable ssh. Finally, I sudo edited the file /path_to_partition2/etc/rc.local to include the following 2 lines PRIOR TO exit 0. These lines will cause the sshd server to load and run but it is a temporary solution only and should be removed as soon as you can run raspi-config to enable ssh through the Advanced Options.

insserv ssh <=== this line might not be necessary but I put it in anyway
service ssh start

At this point, go ahead and unmount everything cleanly and boot the Pi with the wifi adapter installed. Give it sufficient time then start pinging. If pings are successful, then attempt an ssh connection using:

ssh pi@192.168.3.40 (or whatever your address is)

The password for the user pi is raspberry. You can then change the password once you’re logged in and able to run raspi-config.

If the wifi adapter doesn’t appear to come out (lights are blinking properly) or address doesn’t appear to be properly assigned, load the syslog file from the Pi and examine it carefully. It is really your best source of troubleshooting assistance.

HP Proliant SE1101

Picked up a Proliant SE1101 server this weekend that I plan to use for my home server to replace an aging eMachine that has held up for about 7 years. The server is probably almost the same age but has much more functionality (dual, quad-core Xeon processors, 16 GB RAM, etc). Unit was $50 on Craigslist and is a little beat up on the outside, with 2 drive trays missing and the 1 remaining drive being questionable, but interior is very clean. Will probably get 2 additional drive trays and put several 2 TB drives in the system in a mirrored RAID configuration (unfortunately, the internal RAID is 0,1 only). Also have a Dell PowerEdge R805 coming that will hopefully become a NextCloud server on CentOS 7.

While I’m more comfortable with Xubuntu distro, I believe I’m going to migrate my existing home server from Win 2003 PDC to CentOS and utilize a SAMBA configuration instead. I still need my home users to be able to login on Win 7 through Win 10 (or whatever they want), but I’m tired of maintaining a Windows Server. Then again, I might just keep it on Windows just for practice. Either way, will probably be running on ESXi bare metal with virtual machines. Much easier to maintain.

The system is currently dispersed throughout the house. However, with recent kid departures, we are rearranging and I will be consolidating equipment into one room, with more powerful and reliable Cisco equipment taking the place of other cheap equipment.

LaserDisc Player Pioneer CLD-D503

Finally bought a LaserDisc player this weekend along with the first 3 Star Wars (Wide Screen). Also picked up a few LDs from Goodwill in Austin through their online sales. So far, the quality might not be as good as other modern media but it’s a joy to watch movies with the artifacts and imperfections that you often see in analog vs. digital. Unfortunately, the player didn’t have an original Pioneer remote control, but I found a cheap GE 8 unit universal remote that includes codes for several LD player brands, including Pioneer, that seems to work (code #0222 if it’s a CL3 variant). It won’t turn the player on, but other functionality is good enough to play, pause, and stop, which is really all I care about at this point. It can also do some chapter searching but I haven’t played with it much more.

Currently watching Vertigo. I haven’t seen it before, so it’s actually pretty nice watching it on a clean media. Very little deterioration of the disc considering it’s over 30 years old.

Xubuntu – Programs I Use (16.04 LTS version)

I use Xubuntu rather than the regular Ubuntu distribution as I like the XFCE system better than most of the others associated with the various distros. I thought I might compile a list of programs that I use on a regular basis, along with the similar Windows application as a point of reference. Note, most programs can be installed by running

sudo apt-get install program-name

After typing several characters of the program name, you can hit the TAB key a couple of times to get auto complete or a list of installables that begin with the characters you’ve entered so far…

  • xubuntu-restricted-addons: easy installation for a number of codecs and useful items that are not installed by default for legal (or other) reasons
  • xubuntu-restricted-extras: easy installation of several items such as cabextract (extract Windows CAB files), Microsoft Core Fonts (useful for many reasons), etc
  • build-essential: if you plan on building any programs from source, it’s a good idea to install this package as it contains a number of essential utilities
  • exfat-utils: if you use any of the newer external drives that include exfat file systems (seem to be taking the place of FAT32), this will install both the utilities and the filesystem driver itself and ease your life
  • gparted: this is a partition manager that can handle gpt, mbr, etc., and is a GUI-based interface to parted and many (many) file system utilities
  • kicad: this is an electronics development system that includes schematic, board layout, simulation, etc. Probably not needed by many users, but for people like myself, it’s very useful
  • librecad: similar to other CAD drawing programs
  • hfsutils-tcltk: for those with Mac HFS formatted drives, etc., this GUI and utilities package can provide some useful functionality
  • hfsprogs: provides additional HFS functionality [NOTE: for both of these, you might have to turn off journaling via a Mac prior to working with these drives under Linux, depending on what you want to do]
  • dia: a diagram program that is similar to Microsoft Visio (but not compatible)
  • gramps: family tree management, very detailed so can be challenging for users that are used to the more user-friendly Windows programs
  • wine: this is a Windows compatibility system (not an emulator) that allows running some Windows programs perfectly, and many others less than perfectly. I recommend downloading and installing from the homepage, http://winehq.org, rather than from the distro as the distros are often behind on updates. Check out the instructions for the Ubuntu distro, it will walk you through adding a ppa repository and other optional/required steps
  • winetricks: this is a package that works with wine to simplify installation of various libraries, runtimes, and general applications
  • VirtualBox: Oracle now owns this program, but it is still essentially free; it provides the ability to run many different operating systems via emulation and has good speed and performance. For high-end data centers, other systems are better but VirtualBox is geared towards testing and development installations (in my opinion, not their official statement). I recommend downloading from the homepage, http://virtualbox.org, as the distros tend to lag behind on this one as well.
  • joe: a very nice text editor that works well from the command line; vim is great for those that are used to its syntax but I was more familiar with editors similar to joe
  • minicom: great terminal program for serial communications, similar to Telix and other DOS-based programs
  • openssh-server: if you want to be able to connect to your computer via a remote shell session, as well as using sftp to transfer files. Many users probably don’t need this, but it’s helpful
  • remmina: remote desktop access if you need to manage Windows machines through RDP sessions

A few quick notes:

  • For serial port access, you should add yourself to the dialout, tty, and uucp groups; I’ve had mixed success depending on the program but adding to all three seems to enable access to the serial ports/serial port converters (/dev/ttySx and /dev/ttyUSBx)
  • For VirtualBox, you need to add yourself to the vboxusers group; otherwise, you can’t give control of USB and other devices to VirtualBox
  • Note that if you install VirtualBox from a package rather than through the distro, you’ll need to do vboxsetup after some system updates to rebuild the drivers; look for updates that affect the linux version itself

TRS-80 Stuff

A couple of very nice lots from Louisville this evening. First, a doctor/gentleman that was downsizing and decided to give up his TRS-80 Model III with various peripherals and software. Includes an SPSS (statistical package clone which he swears could solve a t value in no more than 5 minutes or so), along with printer and various software. He was also kind enough to include a trunk of various software and an external floppy drive, in addition to the 2 installed drives. No time yet to power up the system and confirm memory, graphics, etc., but the machine was single owner and purchased for his dissertation.

Another batch of items included (2) TRS CoCo 2’s and a TRS CoCo 3 (unexpectedly). I’ve been looking for a 3 for quite a while so was definitely pleased with all of this hardware. There were 3 Radio Shack tape units, at least 3 or 4 disk drives, and various other hardware and software.

I look forward to unboxing and playing with all of these items and will post more details as they become available.

Acer C710 ChromeBook with Xubuntu 15.10

Looks like the previous methods to install Xubuntu on the C710 do not properly activate the touchpad. The cyapa module name has changed but doesn’t seem to be the main culprit. There appears to be a more significant change in the modules being loaded (specifically, cyapatp, i2c_i801, and chromeos_laptop) that are causing issues. I have tried a number of combinations of blacklist.conf entries and modules entries and have been unable to get the touchpad to load automagically. However, it works as soon as one or more of the above modules are insmod’ed. I hope to eventually figure out what has to be done, although under most cases it doesn’t really matter to me as I have a bluetooth mouse being used most of the time anyway.

Edit: Successful, but not exactly what I expected. The /etc/modules file doesn’t seem to do anything; I haven’t had time to research as this is all I ever used it for in the past. However, use sudo nano /etc/rc.local (or your favorite text editor) and add the following lines just before exit 0.

# C710 modules for trackpad

modprobe i2c-i801

modprobe chromeos_laptop.

Hopefully, this will solve the problem for you; seems to work fine on my system.

Getting Older

I guess one of the curses of getting older is you begin to lose friends. A co-worker passed away recently, great guy with lots of knowledge and experience. Although he was almost 60 years old, he was only 10 years older than I am. As I get older and begin to lose friends (or, at least, those that I work with or know in some context), life becomes more precious. While I won’t patronize you by saying I’ll keep you in my prayers, I will say that my condolences go out to the families of each and that it was a pleasure to know you.

MacBook Pro 3,1

Purchased a MacBook Pro 3,1 (2008) model via a newsgroup recently that was described as a project machine. It had a habit of shutting down or rebooting unexpectedly. Since it had no battery or power adapter, I acquired aftermarket versions of those as well. When the unit arrived, I found that it still contained a 500 GB drive and had the original 2 GB RAM. I also found that, sure enough, the machine would reboot after a few minutes to a couple of hours. In the process of troubleshooting, I found that both SO-DIMMs were exhibiting faults but a fresh 1 GB installed by itself ran for a couple of days without incident. I went ahead and purchased 2x2GB SO-DIMMs.

While waiting for the new RAM to arrive, I had purchased a second 85 Watt power supply (aftermarket) through eBay. Less than 90 minutes after starting to use that power supply, it popped and took out the MacBook as well. The PS was useless and was severely charred inside; the power/USB/audio board in the MacBook smelled of burnt components, too. I ordered a replacement and installed it when it arrived, only to find that the primary flat connector didn’t seat very well on the logic board, requiring jamming a piece of cardboard on top of it to maintain sufficient pressure at all times.

Lessons learned:

  • Crappy aftermarket PS can kill your MacBook; glad I only had $100 invested in the Mac
  • Green light on cable indicates a complete circuit only to a point; you might still have any number of other problems if the machine won’t boot
  • Three flashes on the white LED on the front of the MacBook generally indicates that there is a RAM fault
  • If green light on cable won’t come on, check that the flat connector from the power board to the logic board is properly seated
  • For some reason, the MacBook won’t run with the keyboard “detached”, although it seems that it should be able to

So far, so good…