This blog began as a result of my flailing-about to learn how to install and use Ubuntu and basic applications. But once I got going with Ubuntu, the blog became a repository of general Ubuntu-related tips.
Thursday, June 14, 2018
Using Kdenlive to extract segments from videos
A) Click on Project in the main menu, then click on Add Clip, then on the source-file of interest, which then becomes known as a "clip."
B) Play the clip in the CLIP monitor (not the Project monitor) and pause the clip at the beginning of the segment to be extracted. (You can also simply drag the current-position marker under the clip monitor to the start-point of the segment.) If you're trying to extract a short segment from a long video, you might have to extract a segment, and then extract a segment from the segment, to get a sufficient degree of precision.
C) Click on the "left-arrow" button on the left in the row of buttons under the clip monitor. This marks the beginning of the segment or "zone" to be extracted.
E) Somehow get the aforementioned current-position marker to the end of the zone of interest (play the clip and pause it, or pause the clip and drag the marker), and then click on the "right-arrow" button next to the aforementioned left-arrow button to mark the end of the zone to be extracted.
F) Right-click on the display-area of the clip monitor and select "Extract Zone" in the menu which appears.
G) The rest should be obvious.
Sunday, June 3, 2018
Using Ethernet-to-wifi bridges to connect Linux installations to wifi hotspots
It turns out that such things exist, and I got one by an outfit named Vonets (vonets.com) from Amazon for $20. Setting it up is easy - just connect the device to your PC (Ethernet port, and a USB port for power), and it will find any wifi hotspots in the area. To connect, you just open a web-browser, enter a certain address (192.168.254.254 for the typical Vonets device), enter the default user ID and password (admin in both cases) and then select one of the hotspots which the adapter found, and enter its password. After doing this once, it's ready to go from then on - just hook it up and wait a bit.
XFCE live user ID, password
Wednesday, January 10, 2018
Created blog for Apt-offline-related posts
Wednesday, September 6, 2017
Using a dual-PC system for security
If you trust software entirely to isolate data from the internet, you trust people in general too much. You should assume that if it's technologically feasible to spy on you, it's being done, no matter how low and seemingly pointless it is. (Snowden: "What's more shocking is the dirtiness of the targeting. It's the lack of respect for the public and for the intrusiveness of surveillance.") Maybe you just don't think that anyone would want to access your data, which only indicates that you don't understand Big Brother's motives, in which case you should study 1984 (which is loosely based on an aspect of our actual government, but enough on that). For example, if you keep a to-do or to-get list on a Windows PC, you might find that these goals are often frustrated.
So, instead of trying to isolate data from the internet via software, I isolate it electromagnetically, by using a "secure" offline mini-PC for everything that doesn't require internet access. This PC has no internet connection, internal storage (i.e. ssd, hdd, or nonvolatile memory other than the traditional tiny "BIOS memory") or wireless capability of any kind (to prevent the OS from surreptitiously activating it in burst-mode, which is a reality - just Google "wifi burst mode"), and it runs various types of Linux non-persistent flash-drive installations which don't retain data upon shut-down. [1] For storage, I use physically tiny encrypted flash drives which can be hidden anywhere. (Linux can encrypt regular flash drives and even micro-SSD cards, which can store vast amounts of data and transfer it at phenomenal speed.)
Washington Post reporter Dana Priest investigated post-9/11 surveillance capabilities and concluded that using such an "air gap" PC is necessary for secure communications - it would be used for composing and encrypting messages, and decrypting and reading them. This way, the unencrypted messages are electromagnetically isolated from the internet, instead of being supposedly isolated via software provided by Big Bro Inc., and only the encrypted versions are allowed onto internet-connected devices. (Supposedly secure platforms such as iPhones might be secure, but the average person can't be certain.) You could use a simple symmetrical encryption program known as Ccrypt to encrypt and decrypt messages, but since it uses the same password to encrypt and decrypt, password-security is a challenge. Linux also makes it relatively convenient to use public/private-key encryption with such a setup, in which case, the weak link is the recipient - test them by feeding them a supposed secret and watching what they do with it.
I switch a keyboard/touchpad and a monitor between my online and offline PCs with a cheap KVM switch. (The keyboard must be wired-only. Bluetooth isn't secure, as can be seen by Googling "hacking Bluetooth." Don't trust any assurances that the power levels are too low to detect beyond a few feet.) I wouldn't switch a printer between online and offline PC's because printers contain RAM which I just assume hackers could access via the online PC. If the power to the printer were turned off to erase the RAM after printing something with the offline PC, then it would be secure. (Don't just turn it off - unplug it, or the equivalent.)
So, my system doesn't rely completely on software for security, and I don't bother to update the online installation because the only sensitive data on it are some passwords (which I change periodically, and which are stored and processed with mature, relatively simple software) and financial transactions, which don't rely on the OS for security. I just replace my installations completely every couple of years just to stay reasonably current. (Try ignoring Windows-updates, or keeping Windows up-to-date without a high-speed internet connection. My Windows LAPTOP - not just the OS - died immediately after an "update," so it would seem that there's more to Window's "updates" than we're told. Some claim that Windows "updates" are a way for Big Bro to keep up-to-date on what we've been doing with our PC's while offline. It's technologically feasible, so you can't rule it out.)
Not having to constantly worry about security is a big relief, and using a dual-PC system provides more trustworthy security at a lower price than Windows can provide at any price.
Such a dual-PC system isn't necessarily expensive, thanks partly to the fact that Linux costs only what you care to donate to the developers, unless you use Red Hat Enterprise Linux. There will soon be mini-PCs with AMD's new Raven Ridge APU's, which provide a lot of processing-power per watt at a lower cost than Intel's similar products. A lot of the peripheral circuitry is on-chip, which will help to reduce the size and cost of the mini-PC. Although they won't be cheap at first ($250 per APU, according to what I've read) due to demand, they'll have the effect of reducing the cost of older models.
> Linux permissions & creating encrypted partitions
Linux newbies should be warned about the Linux permission-system, even if they don't intend to use it to anything near its full potential. If you intend to create and use encrypted drives, the default permissions on the drive will create problems if you try to use the encrypted drives on certain other types of Linux. So, if you want to be able to use the drive on any variety of Linux, you need to set the permissions so that any type of Linux can create and delete files, and the permissions on the files so that any type of Linux can read them and write to them. Only the "owner' can change permissions, so you'll have to change the permissions with the installation which was used for formatting the drive or for creating the file of interest. When you add a file to an encrypted partition, you should set its permissions to allow any type of Linux to read it and write to it. (Right-click on the file, select Properties, then Permissions, etc.) If you just copy a file from place to place the copy will retain the permissions of the original, except when copying from encrypted drives to FAT drives, the latter of which have no permission-system.
To create an encrypted (LUKS) partition, use the Disks utility, and first create a FAT partition where you want the LUKS partition, then reformat it as LUKS. (Linux formats use more space for "overhead" than FAT uses, so you might want to compensate by making the FAT partition larger than you need the LUKS partition to be. If you want the drive to have a FAT partition which can be read with Windows, make it the first partition, or Windows won't be able to find it, and test it on a Windows PC to be certain that Windows can find it.) Before creating a LUKS partition, be sure that you will have a way to remember the passphrase if it slips your mind. A good passphrase has a certain minimum number of characters, including upper and lower case letters, numbers, and symbols. It should be easy to remember but impossible to guess, and it helps if it's associated with a vivid image, such as "1/4"x4'x8'GradeX." It doesn't have to be easy to type - you could enter it once, save it in a clipboard-app, and paste it whenever you need it.
As far as I know, the best way to erase a LUKS partition on a USB flash drive is to use a USB-installer (see Note 1, para. B) just to format the drive, which takes just a few seconds. (Regular format utilities might appear at first to have the power to erase LUKS from a USB flash drive, but if you try to use them for this, you'll find that they don't.) So, you'd start the installation process, and stop it after a few seconds. Then you could format the drive with a regular format-utility such as GParted (which can't create LUKS partitions) or Disks, both of which, as I recall, can erase LUKS partitions from SD-cards.
> If you need Windows
If you need special hardware or software, you might still need Windows, in which case you could have a third PC or use one of the PCs for both Windows and Linux. In this case, I recommend keeping them on separate drives - I bought a cheap Acer Windows 7 PC and added an hdd for Linux, which I use mainly as a PVR in conjunction with an HDHomerun tuner - the software required to interface with the HDHomerun is available from the Linux repositories, listed under HDHomerun. (The VLC Player, which is included with many varieties of Linux, provides the rest of the functionality required for a PVR, although I recommend creating a bunch of batch files to perform some of the steps involved in starting a recording, as described in an earlier entry in my blog toggwu.blogspot.com. If you want something to automatically record TV programs, you'll probably end up wanting a DVR.) I use a rotary switch which I added on back of the PC to switch the power to one hdd or the other. (This is not the recommended approach in general, but I've never had any problems with it. To be on the safe side, you just have to be sure that the PC is off before flipping the switch.) I can also switch both hdd's off, and boot the PC from the USB ports with flash-drive installations. (When I boot from a flash drive, and then switch to Windows, Windows tells me that it has to perform a "repair" procedure, which is just an attempt to scare us away from using Linux. I once let it run its course, and even stopped it and restarted it, which is taboo, and it supposedly couldn't repair "the problem." On a lark, I rebooted, and had no problems, and haven't in years since then. Windows can tell when I boot the PC from a USB port by examining the BIOS memory, which retains an indication of the port used previously for booting, and only Linux boots from a USB port. What it doesn't know is that the Windows drive was off when Linux was running, and that there is no way it could have damaged the Windows installation.) I've used Windows 7 in an offline mode for years without updating it, so I'd never consider using it to access the internet. I'm not sure whether this could be done with Windows 10.
Notes
[1] Suppose that you just have a no-OS mini-PC at home, and want to run Linux on it. To obtain "bootable" copies of Linux (copies which you can run on PCs), and the ingredients required to create additional bootable copies in case the need should arise, I'd take the following items to a library:
A) A flash drive for storing a Linux "ISO." An ISO is a type of archive-file which is used for various purposes, including for distributing Linux via the internet. The largest ISO I've seen lately is on the order of 2.5 GB, although I have seen them as large as 4GB.
B) A flash drive or two to turn into bootable flash drives (not for storing data). A bootable flash drive is made by copying a Linux ISO to the flash drive with a "USB installer" program, such as the Windows program known as Rufus. Bootable flash drives are used by plugging them into a compatible PC (chances are that any recent type of Linux is compatible with any recent PC, although Mint has been known to have compatibility issues, which are beyond the scope of this note). The PC is then started, hopefully causing it to boot from the flash drive. (If there's an internal drive, I'd disable it by disabling the SATA controller via the "BIOS"-settings menu before trying to boot with a flash drive. You could also change the boot-order so that the PC would first try to boot from a USB port. Likewise, I'd remove any bootable DVDs from the PC's DVD drive, which is easier than changing the boot order.) I'd plug the boot-drive into the rear of the PC to avoid accidentally unplugging it while the PC is running, which would require rebooting and perhaps cause some work to be lost.
C) A blank DVD to turn into a bootable DVD, to use for booting the PC if all of my bootable flash drives were to die, or if I wanted to create a full installation on an internal drive. To create a full installation, you'd boot from the bootable DVD and then select the install-option. Bootable flash drive installations don't always work for this - you might get all the way through the installation process, and then when you try to boot the PC from the hdd/ssd, discover that the PC can't find the supposed installation. I'd take a couple of extra DVDs to the library in case something goes wrong.
When you arrive at the library with these items, download the Linux "desktop" ISO of choice to the Windows PC's Downloads directory and the send a copy to your flash drive. (Mint Cinnamon or Mint Mate, from linuxmint.com, are good for starters due to their selection of software, and the 64-bit versions will probably run on almost any recent PC.)
To create a bootable DVD, put a blank DVD in the PC's DVD-drive, right-click on the ISO, and make the selections required to copy it to the DVD "as image," which copies the CONTENTS of the ISO to the DVD, resulting in a bootable DVD. Copying "as data" or "as file" will create another copy of the ISO, which isn't bootable.
To create a bootable flash drive, download a copy of the USB-installer known as Rufus, and plug a flash drive that you want to turn into a bootable flash drive into the PC (unplug your data-drive to avoid installing Linux over the data). Start Rufus, tell it to use an ISO as the source, point it to the ISO you just downloaded, and then start the installation-process. Rufus might need to update itself, but this is typically quick and easy, although you'll have to keep copies of the update-files for home use and keep them in a directory with Rufus so that it can find them when it tries to update itself offline.
Another possibility, although less practical, is to purchase a bootable DVD from OSDisc.com and create an ISO from it using a Windows program known as "CD Burner XP," or a Linux burner-program known as Brasero. In the latter case, you'd probably need two DVD's - one for booting and the other to use as the data-source, and two DVD-drives. Then you could use the ISO and the USB installer supplied with Mint to create bootable flash drives.
Revisions
9/7/17 - Added material to the end of the 1st paragraph and revised the beginning of the 2nd paragraph.
9/9/17 - Essentially rewrote everything and added a lot of stuff.
9/10/17 - A) Added parenthetical passage in 1st paragraph. B) In 2nd para., might have tweaked passage on wi-fi burst mode. C) Tweaked last sentence in 4th para. D) Heavily revised paragraph beginning with "So, my system doesn't totally rely on software," for clarity. E) Deleted superfluous sentence from end of paragraph beginning with "Not having to constantly worry...." F) Tweaked 1st sentence in 2nd para. in Note 1.
9/11/17 - A) Rewrote Note 1. B) Added section entitled "> Linux permissions & creating encrypted partitions." C) Added heading "> If you need Windows" and added a recommendation in that section to create batch files for starting recordings with the HDHomerun tuner. D) Added Snowden quote to 1st paragraph. E) Revise 3rd paragraph for clarity, and mentioned that recipients of confidential information are typically the weak links.
9/12/17 - A) Added "(see Note 1, para. B)" and tweaked para. B because previous version might have given the impression that all USB-installers run on Windows. B) Revised last half of 3rd para. C) Revised beginning of 5th para.
9/13/17 - Revised 2nd sentence of 2nd paragraph to include nonvolatile memory as a form of internal storage. There are plans for new types of CPUs with built-in nonvolatile RAM which will revolutionize computing (such as by allowing instant-on portable devices with blazing speed), but pose a security problem, although the NV RAM would be encrypted. Perhaps it will be possible in certain cases to make the portion with NV RAM removable so that it can be physically secured.
9/25/17 - A) Fixed sentence which now begins with "So, my system doesn't rely completely on software for security,..." B) Clarified paragraph which begins with "To create an encrypted (LUKS) partition," C) Revised Note 1, parts A, C, and the paragraphs beginning with "To create a bootable...."
Tuesday, May 16, 2017
A convenient way to add apps to live sessions of Debian-based versions of Linux
I decided to name the main folder for this purpose "ForAddingAppsToLiveSessions," and in this folder to put a sub-folder for each case (such as for one named Mousepad-Neon for installing Mousepad on KDE Neon), and put the following items in the sub-folder:
1) a copy of the folder extracted from the Apt-offline tar.xz or zip-file which is downloaded from the official Apt-offline site. I used version 1.7 for this example because I had a copy on hand, and the extracted folder in this case is named "apt-offline-master."
2) a folder named Mousepad to serve as a repository for the Mousepad-related packages to be installed
3) the aforementioned installation-script, which reads as follows:
#!/bin/bash
cd /home/neon/ForAddingAppsToLiveSessions/Mousepad-Neon/apt-offline-master
python setup.py build
sudo python setup.py install
sudo apt-offline install /home/neon/ForAddingAppsToLiveSessions/Mousepad-Neon/Mousepad
sudo apt-get install mousepad
[end of script]
The first line starts bash, which the reads the subsequent lines. The first "cd" command tells bash to look in the apt-offline-master folder for the setup.py module used in the subsequent commands (to install Apt-offline). ("Python" tells bash to feed setup.py into the installation's Python interpreter, one of which is included with every Linux distribution I've checked. To check it yourself, enter "python." Apt-offline requires Python 2.x, and is not compatible with 3.x, at least as of this writing.) The "apt-offline install" command tells Apt-offline to "install" the packages contained in Mousepad, i.e. to copy them to the /var/cache/apt/archives folder. (If only one packgage had to be installed in order to install Mousepad, it could installed by opening it anywhere, such as on a flash drive, as long as it's connected to the target installation, but when multiple packages have to be installed in order to install a particular app, it is my experience that they must be placed in the aforementioned archives folder, which is inconvenient at best, and very inconvenient in the case of KDE Neon.) The "apt-get install..." command performs the actual installation.
To run the shell script, give it permission to run as a program (right-click on the file, click on Properties in menu which appears, then on the Permissions tab in the window which appears, etc.). Then close the Properties window, right-click on the script and select "Run with," then in the window which appears, enter "bash" in the box at the top of the window, select "Run in terminal" below, and click on OK. Then all you have to do is enter "y" when the package manager asks whether you want to proceed with the installation. (You could add a "-y" to the end of the "sudo apt-get install mousepad" instruction so that the question would be answered automatically in the affirmative, and avoid the need to run it in the terminal, but I prefer to monitor the progress of the process.) When the process is complete, the terminal will close.
Tuesday, May 20, 2014
Super-simple way to tune HdHomerun tuners and record their output
Rev 7/4/22 (see Notes)
This article describes a simple, dirt-cheap system for using a basic HDHomerun tuner to record OTA broadcasts "on the fly" in their native format to a PC running Ubuntu or one of its derivatives. (I prefer Kubuntu for my PVR, partly because, as of this writing, using Kubuntu 22.04, the KDEnlive video editor can be installed on it with a download of only about 57MB, which is small for a video editor with its capabilities.) I've used this system for years without feeling that it needs to be improved. It consists of a set of shell scripts which can be launched by clicking on them, and thus act as buttons, each of which sets a particular HDHR tuner (0,1, etc.) of an HDHR unit to a particular channel and subchannel ("program"), then requests a name for the .ts file to be used for storing the program, which ends up in the directory which conains the scripts. When a script is launched, the corresponding tuner-section (0,1, etc) is set to the corresponding channel and subchannel, and a terminal window appears and requests a name for a file to contain the tuner's output. Then, when a name is entered and Enter is pressed, the tuner's output is stored in the designated file, until the terminal is closed. I've created a directory for the shell scripts for each tuner-section (0,1, etc), and the files produced by the corresponding tuner are stored in the same directory.
Another name for "shell script" is "bash script," where BASH is an interpreter which sequentially converts each command in the script to a lower-level language and sends it to the OS. The first line in a bash script is always "#!/bin/bash," which declares it to be a bash script and launches the bash interpreter. To run the script, it's necessary to give it execute-permission (right-click on the file, select Properties, then Permissions, and then the execute-permission box), which can also be done with the 'chmod 700 <path/filename>' command. It's also sometimes necessary to tell the computer how to run the script, such as by telling it to open it with bash and to run it in a terminal (this is done once, after which any bash script would be launched by simply clicking on it).
Here's an example script, named 4-1_KVOA.sh (avoid spaces in file names, in case they end up getting used in commands). It's for recording Tucson station KVOA [1] with HDHomerun s/n 1038702F Tuner 0:
#!/bin/bash
hdhomerun_config 1038702F set /tuner0/channel auto:23
hdhomerun_config 1038702F set /tuner0/program 1
echo "Enter desired name for ts file"
read filename
hdhomerun_config 1038702F save /tuner0 $filename.ts
"Echo" just displays the specified prompt on the command line, "read" assigns whatever is subsequently entered to the variable "filename," and $filename is the value of the variable 'filename.' The HDHomerun commands can be found in hdhomerun-config "manpage," or by entering "hdhomerun-config -h" after installing hdhomerun-config. You'll also need hdhomerun-config-gui to gather information for the scripts. As far as I've been able to determine, the GUI is available only for Ubuntu and its derivatives.
I had some trouble finding a way to get the scripts to run in Kubuntu 22.04, so I'll describe my solution: Right click on the file, select "open with other application," then in the box which appears, enter "bash," and enable it to run in the terminal. If that works, you would do it again and make it the default method, although you might not want all shell scripts to run in the terminal, in which case you would create an exception for each script which you don't want to run in a terminal. Then, you can simply click on the file and select "open" in the box which appears ("execute" didn't work for me). A terminal will appear with the prompt "Enter desired name for ts file," and you would enter the name and hit Enter, and the recording process should begin.
Naturally, the HDHomerun "config" software (hdhomerun-config) would have to be installed, which in Linux is done through the package manager if you have a direct 4G or better internet connection. (If you don't have such an internet connection, see AnAptOfflineBlog.blogspot.com.) I doubt that you'll have to update the package index to install just HDHR - you could check the relevant Packages site, such as Ubuntu Packages, to see if there have been any revisions to the HDHR packages or any dependencies since you performed an update.
You might also have to set up the ethernet connection with the connection-management utility, which is typically found in the system-settings section of the main menu. If your tuner is connected directly to your computer, instead of through a network, all you have to do is to turn the tuner on and to set the connection's IPv4/Method option to "Link-local only," and the connection should then set itself up automatically. Then you could launch the hdhomerun-config-gui, scan for channels, and press View in the GUI to view them on VLC.
Notes
Rev 7/4/22 - Rewrote the entire mess, and added some information I've learned since first writing it.
[1] KVOA is virtual channel 4.1, which broadcasts on Tucson physical channel 23, Program 1. Note that the virtual subchannel's number isn't always the program-number, as you probably notice when scanning through the channels and examining the subchannels.