Month: March 2016

Use the dark side Luke (aka “resistance is futile”)

Today I received my HP LaserJet P1102w printer and decided to install it on Linux.
Using the USB cable was a piece of cake! I just ran “hp-setup -i” and it was done.

The WiFi configuration was a completely different history… The printer comes with an Install CD, but don’t expect it to have Linux support. Don’t be fool, don’t expect it from Hewlett-Packard (it is easy to forget your origin when you became rich!).

Searching in the internet forum I discovered all I need to do was to press the WiFi button and it will enable the Ad-Hoc mode. Then I should to press and hold the cancel (x) button until it prints the configuration information, including Ad-Hoc SSID. Ok I did it and received it: “Direct Print Name (SSID) = HP-Print-3D-LaserJet 1102”.

But unfortunately Debian Linux failed to connect to this Ad-Hoc network. It doesn’t appear in the wireless list, then I don’t know whether it as hidden or disabled. I tried to connect using many options, from command like using iw/ip tools, passing to wpa_supplicant to NetworkManager, nothing worked.

Then I decide to test running HpSetup.exe using Wine, but it didn’t work!

After spending more than two hours of my life to get it done, “I surrendered!!!”

Let use the dark side of force! I decided to test it on the free for test Win7 image offered by Microsoft (as explained here in portuguese: https://acassis.wordpress.com/2013/02/27/baixando-e-rodando-uma-imagem-do-windows-no-virtualbox/)

Initially I was trying to figure-out how to instruct VirtualBox to use my physical CD/DVD driver to let Win7 to run HpSetup.exe, but then I realised it could be easy to use an ISO image working as CD disk:

$ sudo dd if=/dev/sr0 of=hpinstall.iso bs=4k

Then I plugged the print’ USB cable to my Debian box and enabled the VirtualBox to use it. Then initialized Win7 and ran HpSetup.exe configuration to connect to my Wireless Router. I spent less then 5 minutes to get it done!

Next time I will avoid buying a printer from HP or any other company that doesn’t support Linux. But how to find a company with good support for Linux?

Update: I just confirmed that Direct Print Ad-hoc networking doesn’t enable the HTTP server for printer configuration. Probably it was enabled in the past, but HP changed it for security reasons.

Advertisements

Converting a VirtualBox VDI image to real HD image

I’m using a small Slitaz distro to create a game machine, it is working fine, now I need to convert the dynamic hard disc VDI image to real raw disc image.

First I tried this command:

$ VBoxManage clonehd Slitaz.vdi /tmp/slitaz_hd.img --format RAW
VBoxManage: error: Cannot register the hard disk '/home/alan/VirtualBox VMs/Slitaz_user/Slitaz.vdi' {e5727c28-c490-49f7-8b23-xxxxxxxxxxxx} because a hard disk '/home/alan/VirtualBox VMs/Slitaz/Slitaz.vdi' with UUID {e5727c28-c490-49f7-8b23-xxxxxxxxxxxx} already exists
VBoxManage: error: Details: code NS_ERROR_INVALID_ARG (0x80070057), component VirtualBoxWrap, interface IVirtualBox, callee nsISupports
VBoxManage: error: Context: "OpenMedium(Bstr(pszFilenameOrUuid).raw(), enmDevType, enmAccessMode, fForceNewUuidOnOpen, pMedium.asOutParam())" at line 178 of file VBoxManageDisk.cpp

Because I’m using dynamic disc the above command didn’t work.

Now let to try other alternative:

$ VBoxManage internalcommands converttoraw Slitaz.vdi /tmp/slitaz_hd.img
Converting image "Slitaz.vdi" with size 4294967296 bytes (4096MB) to raw...

Great! Worked as expected:

$ ls -l /tmp/slitaz_hd.img
-rw------- 1 alan alan 4294967296 Mar 18 12:03 /tmp/slitaz_hd.img

Source: http://superuser.com/questions/114445/is-it-possible-to-convert-virtual-machines-to-physical-environments

Hiding the blinking cursor of video console

I’m customizing a Linux distro to boot with a logo in full-screen.
So far so good, except the Linux video logo insist to show “boot-logo bigger than screen size” when using an 800×600 image with 800×600 resolution.

If I use a 800×600 image with 1024×768 resolution it work, but it is not full screen, because the logo background that I want to use is not black.
Even more interesting is if I use a 640×480 image with 640×480 resolution it works:

Note the blink cursor at upper left corner when the system is initializing.
Fortunately some one already found a way to fix it.
I just need to edit the linux/drivers/tty/vt/vt.c line 1640 replacing:

vc->vc_deccm		= global_cursor_default;
to
vc->vc_deccm            = 0;

In the kernel command line I’m passing:

console=null vga=785 quiet

Also in the autologin user ~/.xinitrc I put the command to run the application!

Source: http://www.arm9board.net/wiki/index.php?title=Create_your_own_boot_logo

Creating a boot logo to Linux kernel again

About 7 years ago I posted here how to create a boot logo:
https://acassis.wordpress.com/2009/07/01/creating-a-logo-to-linux-kernel/.

Those tips were very useful, but it was missing an important step, how to convert your image to only 224 colors needed by the Linux kernel?

Easy, use the tools from netpbm package:

$ sudo apt-get install netpbm
$ ppmquant 224 original_image.ppm > boot_logo_224.ppm
$ pnmnoraw boot_logo_224.ppm > boot_logo_ascii_224.ppm

Now you just need to follow the tips from previous post to get it working.

Source: http://www.armadeus.com/wiki/index.php?title=Linux_Boot_Logo

What to do when grub-install fails

I was trying to reinstall GRUB to use the new kernel image I compiled, but it was failing:

# grub-install /dev/sda

Fortunately using the “grub” terminal solved it:

# grub
grub> root (hd0,0)
root (hd0,0)
 Filesystem type is ext2fs, partition type 0x83
grub> setup (hd0)
setup (hd0)
...
Done.

This is my Dell laptop hardware list

$ sudo lshw -short
H/W path         Device      Class          Description
=======================================================
                             system         Computer
/0                           bus            Motherboard
/0/0                         memory         7865MiB System memory
/0/1                         processor      Intel(R) Core(TM) i7-3612QM CPU @ 2.10GHz
/0/100                       bridge         3rd Gen Core processor DRAM Controller
/0/100/1                     bridge         Xeon E3-1200 v2/3rd Gen Core processor PCI Express Root Port
/0/100/1/0                   display        GF108M [GeForce GT 630M]
/0/100/2                     display        3rd Gen Core processor Graphics Controller
/0/100/14                    bus            7 Series/C210 Series Chipset Family USB xHCI Host Controller
/0/100/14/0      usb4        bus            xHCI Host Controller
/0/100/14/1      usb3        bus            xHCI Host Controller
/0/100/14/1/1                generic        J-Link
/0/100/14/1/2                input          Storm Mizar Mouse
/0/100/14/1/3                generic        CP2102 USB to UART Bridge Controller
/0/100/16                    communication  7 Series/C210 Series Chipset Family MEI Controller #1
/0/100/1a                    bus            7 Series/C210 Series Chipset Family USB Enhanced Host Controller #2
/0/100/1a/1      usb1        bus            EHCI Host Controller
/0/100/1a/1/1                bus            Integrated Rate Matching Hub
/0/100/1a/1/1/3              generic        USB2.0-CRW
/0/100/1a/1/1/5              multimedia     Laptop_Integrated_Webcam_HD
/0/100/1b                    multimedia     7 Series/C210 Series Chipset Family High Definition Audio Controller
/0/100/1c                    bridge         7 Series/C210 Series Chipset Family PCI Express Root Port 1
/0/100/1c/0      wlan0       network        AR9485 Wireless Network Adapter
/0/100/1c.4                  bridge         7 Series/C210 Series Chipset Family PCI Express Root Port 5
/0/100/1c.4/0    eth0        network        AR8162 Fast Ethernet
/0/100/1d                    bus            7 Series/C210 Series Chipset Family USB Enhanced Host Controller #1
/0/100/1d/1      usb2        bus            EHCI Host Controller
/0/100/1d/1/1                bus            Integrated Rate Matching Hub
/0/100/1d/1/1/5              communication  Bluetooth USB Host Controller
/0/100/1f                    bridge         HM77 Express Chipset LPC Controller
/0/100/1f.2                  storage        7 Series Chipset Family 6-port SATA Controller [AHCI mode]
/0/100/1f.3                  bus            7 Series/C210 Series Chipset Family SMBus Controller
/0/2             scsi0       storage        
/0/2/0.0.0       /dev/sda    disk           1TB ST1000LM024 HN-M
/0/2/0.0.0/1     /dev/sda1   volume         76GiB EXT4 volume
/0/2/0.0.0/2     /dev/sda2   volume         3815MiB Linux swap volume
/0/2/0.0.0/3     /dev/sda3   volume         851GiB Extended partition
/0/2/0.0.0/3/5   /dev/sda5   volume         76GiB Linux filesystem partition
/0/2/0.0.0/3/6   /dev/sda6   volume         775GiB Linux filesystem partition
/0/3             scsi3       storage        
/0/3/0.0.0       /dev/cdrom  disk           DVDRWBD DS-6E2SH