Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Wednesday, November 28, 2018

Ubuntu won't boot, waiting on dev-mapper-cryptswap

I updated Ubuntu 18.10 cosmic and of course everything was crappy. The trackpad started registered spurious touches of my palm in the upper left corner and made typing very frustrating. And then the machine started hanging with a weird window manager (GNOME?) glitch after I had it in sleep mode all night with the lid shut, so I had to hard reboot in the morning.

This happened twice and then it wouldn’t reboot anymore. It would hang on the purple screen with the word 'ubuntu' and some loading bar dots. I force rebooted (hold shift for GRUB) and selected the option 'Advanced' and chose a recovery mode option of the latest version. Then I could see that we were endlessly waiting on dev-mapper-cryptswap1.device and that is why it will not boot, not even in recovery.

I found several sites suggesting I edit the /etc/fstab file and comment out any lines talking about cryptswap. (to do note for myself for later: figure out if I should make an encrypted swap, or just live without the swap)
https://ubuntuhak.blogspot.com/2017/05/a-job-is-running-for-dev-mapper.html

OK but if I can’t boot, I can’t access any shell! How do I edit the fstab file??? I found this answer:
https://superuser.com/questions/1013658/how-to-skip-startup-jobs-for-fstab-no-timeout-centos7

But I was missing the context for it. Where do I enter that emergency boot parameter?

I was getting sick of typing google search queries in to my phone, so I went back to Grub and looked around. In the advanced options section, the text suggests you can press ‘e’ to edit the entry. Then I saw something like this:

setparams ‘Ubuntu, with Linux 4.18.0-11-generic’
    recordfail
    load_video
    gfxmode $linux_gfx_mode
    insmod gzio
    if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
    insmod part_gpt
    insmod ext2
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root [uuid]
    else
      search --no-floppy --fs-uuid --set=root [uuid]
    fi
    echo ‘Loading Linux 4.18.0-11-generic …’
    linux /boot/vmlinuz-4.18.0-11-generic root=UUID=[the uuid] ro acpi_rev_override quiet splash $vt_handoff
    echo ‘Loading initial ramdisk …’
    initrd /boot/initrd.img-4.18.0-11-generic 

So that seemed promising. I entered a -b into the /boot/vmlinuz arguments, as such:

linux /boot/vmlinuz-4.18.0-11-generic root=UUID=[the uuid] ro acpi_rev_override quiet splash $vt_handoff -b

Then hit control + x as the instructions suggested to boot. This doesn’t permanently change the options, but rather boots with this modified entry just this once. So I entered emergency mode, hit control + d as the instructions suggested, and I was in.

Back to the instructions from the answer from before: https://superuser.com/questions/1013658/how-to-skip-startup-jobs-for-fstab-no-timeout-centos7
In case this leaves the root file system read-only, you can run mount -o remount,rw / once in the shell.
I didn’t give this a try without doing that; I just assumed it was necessary, and that had I skipped that I would have found that I was looking at my file system in read-only mode.

So back to https://ubuntuhak.blogspot.com/2017/05/a-job-is-running-for-dev-mapper.html: 
The solution is to remove or comment out the "cryptswap" entries from /etc/fstab and /etc/crypttab. This can be done easily by editing the above mentioned files as commenting out the lines that say cryptswap by placing a "#" in front of the matching lines.
I did that, saved the file in nano (I forgot how to use nano, but the bottom of the screen suggested some commands, so I did the one for exit and then it asked me to type Y to save before exit). Then I restarted the computer, I believe with the command shutdown, and then pressing the power button afterwards to reboot.

Then I figured before I got back to work, I could make a short blog post out of it. Here you go.

-Shira

Monday, February 20, 2017

ThinkPad X200 Tablet as peripheral device Attempt 1

The goal of this project is to turn a "Wacom Penabled" Thinkpad Laptop into a peripheral screen and input device for my main Windows PC machines.

This documents just the first attempt, as not everything is working yet and I need to move on to other projects for a while.

The starting point: I have a Wacom Penabled ThinkPad x200 Lenovo Machine, pictured below. I read the following articles to figure out how I might go about my goal: article 1, article 2


The instructions from the article above were not sufficient for my setup and included some steps I skipped. Below are the steps I took to get as far as I have so far.

I installed Ubuntu (latest desktop version) on the Thinkpad machine. It installed cleanly alongside my existing Windows 7 install without need for any other tools (such as WUBI  mentioned in the articles). The pen worked out of the box on this system.

I verified the port of the pen with the following command (the port is /dev/ttyS4 for me)
    dmesg | grep ttyS 
I installed ser2net:
sudo apt-get install ser2net
And changed the configuration file located at /etc/ser2net.conf and added the following line at the bottom section:
    7000:telnet:600:/dev/ttyS4:38400 remctl NONE 1STOPBIT 8DATABITS -XONXOFF -RTSCTS -LOCAL 
I added my username to the group dialout with this line:
    sudo adduser myusername dialout
At this point, I was not able to see the output of the pen on port /dev/ttyS4 because all attempts to access manually it gave me a resource busy error. I fixed this by commenting out the second to last line in /lib/udev/rules.d/69-wacom.rules. This steps should require a restart of the machine afterwards in order to have effect. The line to comment out reads as follows, with comments:
    # comment out the next line if your distribution does not provide systemd
    # If a /dev/ttySx device with the WACf name is detected, start the
    # wacom-inputattach service with the kernel name as parameter
    # SUBSYSTEM=="tty|pnp", KERNEL=="ttyS[0-9]*", ATTRS{id}=="WACf*", TAG+="systemd", ENV{SYSTEMD_WANTS}+="wacom-inputattach@%k.service"
Now it is also necessary to disable the Wacom pen services from xinput. If not done, streaming the data out with the cat command will make the computer behave erratically, and probably caused the kernel panic I experienced once as well. To list the devices, use command "xinput" which will return a list with ID numbers listed to the right. I found three Wacom entries under Virtual Core Pointer. They were the stylus, eraser, and touch. They had IDs of 12, 13, and 14 respectively. I disabled all three with commands as follows. These should be put in a start up script, as otherwise they must be manually entered with each start up of the system, possibly including log ins.
xinput disable 12
xinput disable 13 
xinput disable 14

At this point the pen won't work on Ubuntu anymore, which shouldn't be a problem because the goal is just to get the data over to the Windows machine anyway.

Now I can finally test the device locally. I entered the following command and saw data (unintelligible gibberish symbols as displayed) come out whenever I touched the stylus to the screen.
sudo cat /dev/ttyS4
Now I opened up a PuTTY session on the Windows PC . I set it up to 'Connection Type: Telnet', 'Port: 7000', and host name as the IP of the Ubuntu machine on the network which I identified using the command 'ifconfig' on the Ubuntu machine. The connected network interface, which for me is called wls1 and indicates my wireless card, states the address on the second line. It looks something like the following:
inet addr: 192.168.1.150
With the address entered into the 'Hostname (or IP address)' field I hit the "Open" button and saw that whenever I moved the pen to the Ubuntu screen, unintelligible symbols appeared in the window. Excellent. [Note: close the PuTTY winow after this test]

The only remaining steps were to get the Wacom modified tablet drivers to work and install HW VSP. I only made half-successful progress here, so I won't write it up yet in detail. I followed the instructions for the drivers from article 2. I tried this on two Windows machines each running Windows 7.

On my desktop computer, the Wacom drivers (installed per the instructions on  seem to be the issue. I get a complaint about them every time I boot the machine, and the HW VSP says "connected" but all the packets end up just adding to the number in the Queued section, and the VSP fields other than Status all remain blank. On the Windows 7 laptop, I do not get the Wacom drivers complaining at me, and the HW VSP window shows some values for all the VSP fields, as well as incrementing values for Rx and Tx packets in the VSP column. But the pen on the Ubuntu machine still does not move the pen on the PC.

For now I'm shifting gears away from this project, but hopefully I can get it working in the future. The Windows drivers are clearly the problem, and I've tried a lot of things, including other drivers, as well as messing with the registry and the driver files. I might have more success going through a second Ubuntu machine and using Ubuntu tools and drivers here. But the point is in part to get this working for a Windows PC, just because of my software and OS use patterns (I develop on Ubuntu, but use design and entertainment software on Windows).

If you think you have a solution let me know!