2019-10-26

Boot a linux live ISO image from grub

Trying out a particular flavor using its live-CD distribution is a good idea before going ahead with a full installation in our machine.

We used to have to burn a live system ISO image onto a CD or DVD, and then it became far more convenient to burn it onto a USB thumb drive.

However, another option to boot the live image is possible:  if we have a Linux system already, and the ISO file is in our filesystem, it is possible to boot into the ISO directly from the grub boot menu, avoiding the process of burning the file into any type of media.

Every once in a while I want to do this and I always forget from one time to the next, so I am documenting it here.

The key is to create a grub.cfg menu entry with the right info.   Searching through the net I found there are different parameters required, depending on the type of Linux distribution.   I have not been able to find proper documentation on the boot parameters that may be passed to the kernel (I could find several examples, but no "formal" documentation).

My guess is that different distributions may use different parameters, but here are a couple of examples:

menuentry 'Kali Linux 2019.3 Live' {
       set isofile="/iso/kali-linux-2019.3-amd64.iso"
       insmod ext2
       insmod loopback
       insmod iso9660
       loopback loop (hd3,gpt2)$isofile
       linux (loop)/live/vmlinuz boot=live fromiso=/dev/sda2/$isofile
       initrd (loop)/live/initrd.img
       }

menuentry 'Ubuntu 19.10 Live' {
       set gfxpayload=keep
       set isofile="/iso/ubuntu-19.10-desktop-amd64.iso"
       insmod ext2
       insmod loopback
       insmod iso9660
       loopback loop (hd3,gpt2)$isofile
       linux (loop)/casper/vmlinuz iso-scan/filename=$isofile noprompt noeject
       initrd (loop)/casper/initrd
       }

I found these two distros require a different way to specify the location of the live image after the kernel has booted.    Kali requires the "fromiso" parameter while Ubuntu (and its derivatives) require "iso-scan/filename".  See above for examples.

In the above example, the location of the ISO file is in the third harddrive, and second GPT partition. 

During my trial and error to get this right I found that the specification of harddisk and partition required in these menu entries may be different than what you'd expect.  

For instante, you may have saved the ISO file into:
             /home/username/iso/image.iso

In this example, the /home partition is in /dev/sda.    This would usually be hd0 to grub, but during boot time I found that in some hardware configurations, grub would identify the disk normally found in /dev/sda as hd3, not hd0

A little playing around may be necessary to find the correct pair (hdX,partitionY) specification.   Boot into grub, and while the menu is showing, press "c" for a command interface.   From there use the "ls" command to get a list of harddisks and partitions available.   The list shown ought to help identify which disk is the one with the /home partition.  
If the disk is partitioned with an MSDOS table, your partition would be referred to as (hd3,msdos1),  while in a GPT table, it would be (hd3,gpt2),  for the second partition in the 3rd disk.



2018-12-17

Ubuntu: force reinstallation of package in ubuntu

This post describes how to reinstall a package in Ubuntu (or Linut Mint, or other Ubuntu derivatives, and possibly on Debian, but I did not test it).

I needed to remove a package that was installed in the system which came from a non-standard repository.   However there were many others that depended on it, so I could not simply remove it.

It wasn't practical to remove them all, but I needed to replace the package with a version from the official Ubuntu repository.

This is the way I found to do it.    I found the answer in this post:

First, check available versions to be able to force a particular one:

apt-cache madison libbrotli1

This provides a list of available packages similar to this:

libbrotli1 | 1.0.3-1ubuntu1.2 | http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
libbrotli1 | 1.0.3-1ubuntu1.2 | http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages
libbrotli1 | 1.0.3-1ubuntu1 | http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages


Then, to reinstall indicating a particular version, issue the following command:

apt-get install --reinstall libbrotli1=1.0.3-1ubuntu1.2

This will reinstall libbrotli1 without having to remove and reinstall all packages that depend on it.

2013-05-26

gthumb not playing videos (lubuntu)

In multiple versions of lubuntu (since a couple of years ago, up to and including lubuntu 13.04) I have noticed that gthumb does not play videos.  

The problem is fixed by installing package gstreamer0.10-x

A little more detail:   The videos that are not working are from a Canon camera.   I am not sure if other videos work or not in gthumb.

gthumb uses gstreamer to play videos.   The abovementioned package is described as "GStreamer plugins for X11 and Pango".    So the lack of video in gthumb in my system is either:

  1. due to my hardware (and thus the additional plugin solves my problem)
  2. hardware independent (and then all lubuntu installations should have this problem).

2013-04-10

Poor bass-less sound on HP EliteBook 2560p

Every once in a while the audio in my EliteBook 2560p (Windows 7) does not work properly:    Music on the headphones sounds as if it was being played through a high-pass filter, and at a low volume.    

I thought it was an issue with the fact that the audio jack is prepared for a headset (with microphone) and not really for regular headphones.  

But it turns out that the audio problem goes away some times, and music sounds just fine.

I rarely reboot this machine:  I either suspend it, or hibernate it.    It seems something goes wrong with the audio sometimes when sleeping/hibernating, but I never knew what it is.

Today I finally found a solution:   There is a Windows 7 service called "STacSV" ("Audio Service", described as "Manages audio jack configurations").    The service was stopped;   all I had to do is hit "Start", and the music on the headphones instantly began to sound correctly in full frequency range, with proper bass and volume.


2012-07-23

HP EliteBook 2560p missing Page Up/Down keys

My work machine is an HP EliteBook 2560p.    When it was given to me, I was shocked to see that a professional machine had no page-up / page-down keys.      Instead one has to press FN+arrow up / FN+arrow down to get the page-up/down functionality.     So.... what about when I have to press CTRL+PGUP (for instance, to switch worksheets in Excel)?    I would have to press CTRL+FN+UP....    three keys!!!

That was too much for me.     This madness had to stop.    

The simplest solution was to remap other keys to pure PGUP/PGDOWN functionality to get around the poor design in this HP laptop.  

So I used "KeyTweak" (http://webpages.charter.net/krumsick/) to remap the right Windows-meny key and the right CTRL key into PGUP and PGDOWN respectively.     It works.

2012-06-16

Windows 7 and old 3com OfficeConnect wifi AP

Windows 7 came finally into my life when I got a new work PC.   No chance of getting XP... sadly.
One of the first problems I ran into appeared when trying to connect this Windows 7 machine to a (somewhat old) 3com OfficeConnect WiFi access point.    This is an AP that has properly established WiFi connections with all sorts of old and new equipment (iPhones, Android smart phones, very old Nokia N95 phones, XP PCs, Macs, .... anything).    But now this Windows 7 machine would have lots of trouble connecting to the AP.     Sometimes it would establish the connection after 5 minutes trying, but mostly it just didn't connect.    The Windows 7 system does connect to other APs, though.

The Windows 7 network troubleshooter was of no help at all. 

In trying to solve my problem, I installed Intel's ProSet Wireless utility (the machine has an Intel Centrino Advanced-N 6205 networking chip) with the hopes that it would manage the connection to the AP better than Windows 7 did.    No luck.... but at least this nice tool does provide quite some technical details about the connection it is trying to establish.      So I saw that Windows 7 was trying to assign an IPv6 address to the network connection with the AP.   This AP does not have IPv6 support, so I don't understand why Windows 7 is so keen in using IPv6 with it.

Nevertheless, I thought this might be the issue.... so I disabled the IPv6 stack in the Windows 7 wireless network adapter configuration (see screenshot below),  and that did it:     Now Windows 7 connects to this AP normally in a few seconds, and a proper IPv4 connection gets established.



2011-12-18

Google chrome install problem on Windows XP

I ran into a problem installing Google Chrome on Windows XP (Professional).
When running the installer (the small file that you can obtain from the Google Chrome webpage), the install process would end very very quickly. In theory it should download the full Google Chrome software from the internet, and then the install process would begin.
For some reason, the process was too quick on my machine. In fact, after installing, it appeared as if it had not been installed really. There was no Start menu entry for Chrome, nor could it be executed.
I suspected it had to do with an old installation of Google Chrome (from months ago) that for some reason did not work either.
The solution was to remove all old Chrome Files (basically removing the folder C:\Documents and Settings\\Local Settings\Application Data\Google\Chrome), and do a new install from the Google Chrome webpage.

Great file search tool for Windows (NTFS)

A couple of weeks ago I came across this great tool for Windows (I am using XP), for searching for files by their filename. It works only with NTFS volumes (because it makes use of NTFS features), but it is simply amazing. You can type any part of a filename, and it is located instantly. There is no waiting to do.

Highly recommended: Everything search engine, by David Carpenter (http://www.voidtools.com)

2010-12-18

Mount removable drives from command line

This is too simple, but it took me a while to find this type of solution, so I want to post it here to keep track of it, next time I need it:

I have an Ubuntu (10.x) with a couple of users. Some need to use the GUI (Gnome or XFCE) to work, including accessing removable media. Other users need (or rather, wish) to use the CLI to access removable media. This means /etc/fstab may not have specific entries for removable media (say, /dev/sdg1) with the "user" option, because this would block Nautilus (Gnome) or Thunar (XFCE) from automatically mounting the removable media for the GUI users.

So I just found that there exists a mount wrapper called pmount. (to install in an Ubuntu system, simply sudo apt-get install pmount). The CLI user now has a few aliases in his .csh file to easily mount and umount several types of removable media:

alias flash 'pmount /dev/sdf1 photo_sd' (for SD cards)
alias cflash 'pmount /dev/sdc1 photo_cf' (for Compact Flash cards)
alias pen 'pmount /dev/sdg pen' (for flashdrives)
alias pen1 'pmount /dev/sdg1 pen1' (for the 1st partition in a flashdrive)

All of the above create mount points ( /media/photo_sd, /media/photo_cf, etc...).
To unmount each of them, I've set up aliases too:

alias flash-u 'pumount photo_sd'
alias cflash-u 'pumount photo_cf'
alias pen-u 'pumount pen'
alias pen1-u 'pumount pen1'

2010-03-31

Bluetooth crashes randomly in Ubuntu 9.10

I installed Linux Ubuntu 9.10 (Karmic Koala) in my Dell Mini 9 (Inspiron 910). Everything works fine, except for the bluetooth support. Occasionally, the bluetooth service apparently dies, and I don't know exactly why. When this happens, I cannot restart the bluetooth service simply with "service bluetooth restart"; even after doing that, the report resulting from "service bluetooth status" is "Bluetooth is *not* running". There are no logs that could give a clue as to what's going on. Since the bluetooth service is down, the bluetooth application (blueman) does not work either.

The bluetooth device in this Dell mini is a USB device identified as:
Bus 005 Device 004: ID 413c:02b0 Dell Computer Corp.
You can check your machine with this command: "lsusb -v |grep Bluetooth"

I figured that the hardware bluetooth device must be switched off (again, for some odd reason), and sure enough, that seemed to be the problem. So the solution I found is:

  1. Turn the hardware bluetooth device on
  2. Restart the bluetooth service
  3. Run my bluetooth application (blueman)
Step by step, this means:

1) Turn the hardware bluetooth device back on. The best way I found to do this is by using the "aircraft manager" application. You can install this with this set of commands:
sudo add-apt-repository ppa:opensource-subakutty/ppa
sudo apt-get update
sudo apt-get install aircraft-manager
Now you will have a nice command-line tool, /usr/bin/aircraft-manager-util
To use it:
/usr/bin/aircraft-manager-util BT on (to turn bluetooth on)
/usr/bin/aircraft-manager-util BT status (to check the status of the bluetooth hardware)

2) Once the device is turned on, restart the bluetooth service in Linux:
sudo service bluetooth restart

You can check that the service is indeed running:
sudo service bluetooth status

3) Restart your blueman applet:
killall blueman-applet
blueman-applet &

At this point, the bluetooth application should be fully operational again.

References:
http://www.ubuntumini.com/2009/12/aircraft-manager-turn-wifi-bluetooth.html
http://blueman-project.org/