Showing posts with label computers. Show all posts
Showing posts with label computers. 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

Wednesday, June 25, 2014

Robotics Course Picture Essay

I'm too exhausted to do a write up about my Robotics course. I'm also about to move to another location and teach it again to new students. So for now, here's a bunch of photos, a few videos, and a quick description.

We ended up using Vex kit parts, hot glue, foam board, assorted motors, and other stuff for building materials. The brains were Arduino Leonardos, and the wireless connection was accomplished with a Wixels. We used April Tags with an overhead camera to track the robots and send them position data wirelessly.










Monday, March 24, 2014

Building A Custom Blender Build (and failing)

I decided to compile my own build of Blender on Windows. The main reason is that the sewing addon I want is a patch, not a script, so I have to apply to to the Blender source code and then compile. I'm typically a Unix user (and most often I'm specifically a Darwin user), so when it comes to using the Windows command prompt, or knowing where certain important system files are, or anything a power user might need, I get a bit lost.

I have not yet produced a successful build. To illustrate a point about how difficult these things usually end up being, here are some of the issues I've run into so far:
  • I had no previous setup for Windows so I had to choose what tools to install, namely: a git or svn client, a compiler, a build system
  • I installed mingw64 in a directory with spaces in the pathname which is a no-no
  • I needed to add some directories to my Windows PATH variable
  • I retrieved precompiled libs for Windows but put them in the wrong place initially
  • I was not sure what command to actually use to install using the cmake-generated Makefile (mingw32-make, which confused me because I'm installing 64-bit blender with mingw64)
  • The compiler failed because of libmv, so I just decided to disable that in the build, as I don't need that feature in Blender
  • The process failed due to complaints about the openimageio library...and I had no clue how to proceed, so I decide to switch to using SCons instead of CMake, since somebody mentioned that the daily Blender builds are done with SCons and minGW
  • SCons installer can't find Python in the registry...I find out I need 32-bit Python, and I installed 64-bit Python
  • SCons errors out early, and I learn I need to set a flag BF_TOOLSET=mingw, which I just pass in the command line because SCons doesn't see my user-config.py file for some reason...
  • After a long time, build errors out. More online searches suggest the problem may be due to the fact that I am using gcc 4.8 and I need to get 4.6 instead...
  • Now the build fails compiling files to do with Cycles when using SCons...
  • Now the build fails at the linking stage when compiling with CMake-gui...
The bullet points seem to fly by quickly...but keep in mind that each, on average, required significant time in google searches, trial and error, and CPU time to actually diagnose and get past.

The good news is of course the availability of builds on graphicall.org and of course you can always go to http://www.blender.org/download/. Still, I'm hoping I can get this figured out someday soon.

Monday, March 9, 2009

Triple Booting on a Mac

When I first got my Macbook Pro, I was not exactly computer savvy, but in the spirit of forwarding that goal I decided that I needed my computer to have a Mac, Windows, and Linux OS. And I wanted native booting, not virtual machines. The process of triple booting on a Mac is not that hard if you know what you are doing, but as I had no idea what I was doing, it took me a while to figure out. I cobbled together numerous tutorials and help pages and I am posting my version here so that others might make use of it.

This isn't exactly something I built, but I think it is in the spirit of 'Building Stuff, Makin' Friends' (though I guess I pretty much decide the spirit of this place anyway). So, without further ado, the tutorial.

A summary first:
This tutorial assumes you have a Mac, with the Mac OS already installed. It also assumes no prior partitions on your drive. Furthermore, it assumes that your Windows install CD is exactly that--a SINGLE install CD (you won't be able to eject during the install process because you don't have the drivers for that installed!).

What you will essentially do is this: Install the rEFIt boot Menu, use Mac to make your partitions, install Windows first, install Linux second. The rest is just details.

What you need:
Mac install CDs (I have Leopard)
Windows install CD (I have XP)
Ubuntu (I used 8.10, the 64-bit version. The download is free. Burn it to CD with Disk Utility)

Download and install rEFIt.

Use the terminal (Applications->Utilities->Terminal) to write partitions. This assumes no previous partitions. (Type the stuff in italics. Be warned! This stuff can be dangerous. If you are not sure of what you're doing, back up your data, and maybe read up on these commands before executing them.)

sudo diskutil resizeVolume disk0s2 249G "HFS+" "Linux" 17G "MS-DOS FAT32" "Windows" 32G

Disk0s2 should be the Mac volume. I wanted to leave 249 GB to it, and put 17GB aside for Linux and 32 for Windows. The three sizes must add up to less than your total available space on the drive. The command
diskutil list will show you the partitions you have set up.

Windows will have to reformat the partition it will be using, otherwise it will install but not boot. I did this to get the installer to give me that option:

sudo dd if=/dev/zero of=/dev/rdisk0s4 bs=1m count=100

That writes over the metadata for that partition, making it Unknown Format to the installer. Alternatively, it seems like you can also just delete and recreate the partition in the Windows Installer instead of using the partition you created with the Mac OS. I prefer the former, though, because I know it worked for me.

Install Windows by putting in the CD and restarting with key C held. After setup, choose the right partition to install to. It will restart a few times, so make sure to boot into Windows to complete the process. After it is done, use the Mac OS install CD to install the drivers for Windows (for older Macbooks it may be necessary to find these drivers in BootCamp and burn them to a CD).

Next, put in the Ubuntu CD and boot it as a live CD. Open up the terminal. Back up the MBR (Master Boot Record). I don't remember if you need to use sudo to get this to work. If permissions are denied, just add it in.

dd if=/dev/sda of=/tmp/sda.mbr bs=512 count=1

Run the installer (it is sitting on the desktop). Choose to partition manually. Select the right partition (sda3 should be it) and press Edit partition. Choose to mount to '/', to format it, and to use ext3. Go to next and ignore the error message about swap. When offered the install summary, look at the advanced options (important!). Install the boot loader on sda3 (your Linux partition) and not on the default (that will make Windows unbootable and none of the fixes I found actually worked without jeopardizing the rest of my systems).

Restore the mbr. I'm not sure exactly when this is supposed to be done but I did it after hitting install and it worked fine. Again, in the terminal:

dd if=/tmp/sda.mbr of=/dev/sda

Wait for the installer to finish. Restart as necessary. Actually, try to shut down instead of restart, because at this point there's a bug that I experienced where restarting freezes my computer on the restart part. Shuts down works fine though, so shut down and press the power button.

Update the MBR by using the Partitioning Tool in rEFIt. When prompted, choose Yes to update. Boot Linux. I had to try booting it twice, but that seems to just be a fluke. I had a lot of those during this process, actually. Make sure all problems are real problems by checking if they happen at least twice.

Finally in Linux open the terminal to make a swap space. Use sudo when permissions are denied.

dd if=/dev/zero of=/swap bs=1024 count=1048576
mkswap /swap
swapon /swap
chmod 600 /swap

Now check all your systems to see if they boot properly.

An afterword: who needs that many operating systems anyway?
Well, I do. Since installing all three operating systems, I have found that I use them pretty equally. I use Linux for certain robotics and programming projects, Windows for gaming and other programming projects, and Mac just because it works best with this particular machine and also for programming certain things, like Widgets. There are a lot of things I wouldn't have tried if I didn't have the right OS, but now I can run just about anything. And now that I created a 32-bit environment in my Ubuntu for compiling 32-bit code, I can really run just about anything.

Hope this helps you out!