Adults learn to swim in 6 Day phoenix Vacation - End of Fear! (Advertisement)

Ubuntu Nightmare


By Patrick   Follow   Sat, 19 Jan 2013, 5:44pm   1,054 views   21 comments
In Menlo Park CA 94025   Watch (0)   Share   Quote   Permalink   Like   Dislike (1)  

I'm migrating to a new laptop because my old one is literally falling apart, and I choose Ubuntu as the OS again. I think it was a mistake.

I created the account "patrick" during the Ubuntu install without really thinking about it and then spent two days getting other stuff migrated from my old laptop, like email, mysql, my development environment, etc.

Then I realize I actually want my account to be called "killelea" to be just like my production server. I try "usermod -l killelea" but it just fails. So I sudo edit /etc/passwd and change "patrick" to "killelea".

Then sudo suddenly stops working, so I could not do anything else needing sudo. I figured maybe I just need to log out and in again. I log out, and then can not log in with either "patrick" or "killelea". Why simply changing the username in /etc/passwd causes login to fail I do not know. Bad Ubuntu!

No problem, I'll just log in as root and fix it, right? Wrong. Ubuntu disables logging in as root by default. They also disable ssh logins by default. Bad Ubuntu!

I start to sweat, since two days of migration work are about to be lost forever. Doing a little research, I see that what I need to do is catch the Grub loader during the time it gives me to choose login options and select "recovery" mode. But the Grub loader does not ever show up during boot. Bad Ubuntu!

Doing more research, I see that the secret is to hold down shift during boot, and I can get into recovery mode and get a root shell. So I try to edit /etc/passwd back and it tells me no, file system is mounted read-only. Bad Ubuntu!

I figure out how to mount the drive and change /etc/passwd and forcibly set a root passwd. So I've recovered my work. But I'm really pissed at Ubuntu and don't think I will choose them again.

Viewing Comments 1-21 of 21     Last »     See most liked comments

  1. Peter P


    Follow
    Befriend (4)
    117 threads
    17,702 comments

    1   7:19pm Sat 19 Jan 2013   Share   Quote   Permalink   Like   Dislike  

    Have to say, I prefer WinTel.

    I had a form of Ubuntu on my workstation two jobs ago. But thet had a huge IT department.

  2. curious2


    Follow
    Befriend (4)
    92 threads
    3,817 comments

    2   7:32pm Sat 19 Jan 2013   Share   Quote   Permalink   Like   Dislike  

    Win7 gave a very similar experience when I changed a user account name. Although the name appeared to change on the welcome screen, the path names did not. Also, Win8 seems unable to upgrade from systems where the path for user files has been changed, it keeps crashing and restarting. So, we can encounter Linux difficulties that waste time but cost nothing, or we can encounter Windows difficulties that waste time and cost money.

  3. CaptainShuddup


    Follow
    Befriend (1)
    615 threads
    8,799 comments

    3   10:05am Sun 20 Jan 2013   Share   Quote   Permalink   Like (1)   Dislike (1)  

    On the bright side you'll know what to do next time.
    So it will be routine, and not be a long drawn out ordeal of search try and repeat.

  4. Patrick


    Follow
    Befriend (55)
    5,611 threads
    6,305 comments
    male
    Menlo Park, CA

    4   11:41am Sun 20 Jan 2013   Share   Quote   Permalink   Like   Dislike (1)  

    Anyone know why simply changing the username in /etc/passwd caused login to fail?

    Since changing the username does not change the user ID, you'd think it would be OK and login would just work with the new username and existing password.

  5. waiting_for_the_fall


    Follow
    Befriend (1)
    5 threads
    232 comments
    Half Moon Bay, CA

    5   11:49am Sun 20 Jan 2013   Share   Quote   Permalink   Like   Dislike  

    I think when you changed the name in /etc/passwd, you also need to add the new name in /etc/group to any group that had the previous name in it.

  6. kimtitu


    Follow
    Befriend
    39 threads
    91 comments

    6   1:19pm Sun 20 Jan 2013   Share   Quote   Permalink   Like   Dislike  

    I recently had a similar experience with opensuse 12. Because of the security consideration, opensuse 12 disables root login when you are in normal operation. I've to boot into expert or advance mode or sort(don't quite remember) to login as root. Later I learn I can avoid these type of setup by avoiding automatic configuration during installation.

    Now my system works like the old way that I can login as normal user and su to root for sysadmin task. By no mean I claim this is good but I like it that way as a desktop system.

  7. Patrick


    Follow
    Befriend (55)
    5,611 threads
    6,305 comments
    male
    Menlo Park, CA

    7   4:39pm Sun 20 Jan 2013   Share   Quote   Permalink   Like   Dislike (1)  

    Ah, it's probably because /etc/shadow (which has the encrypted passwords) is indexed by the username and not by the user ID.

    Indexing /etc/shadow by username is really dumb, IMHO. You are your user ID for almost all purposes, so usernames should be mapped to user IDs only in /etc/passwd and everything else should use user IDs.

  8. Hysteresis


    Follow
    Befriend (2)
    14 threads
    660 comments

    8   5:40pm Sun 20 Jan 2013   Share   Quote   Permalink   Like   Dislike  

    kind of like programming in C, Ubuntu let's you hang yourself if you don't know what you're doing. can't blame the OS in this case.

  9. havoc


    Follow
    Befriend
    4 comments

    9   8:55pm Sun 20 Jan 2013   Share   Quote   Permalink   Like (1)   Dislike  

    To avoid this kind of BS, I do everything in the virtualizer. I have a VM image (which has all the custumizations and software ive done iteratevily over the past 5 years) that I just throw onto the virtualizer on new hardware without going through the pain every time something crashes or hardware dies or gets lost. Also, I just take a snapshot of current VM state before doing any sort of experiments on it or just clone it. Takes less than 15s on my laptop with an SSD. As for the host I just use the barest bone linux distro with X and VirtualBox or VM Ware installed. Nothing else on it. I don't think I'll ever go back to running anything directly on the host OS. It is simply too inconvenient inflexible and risky. Plus I take my customized image between different job contracts. Takes me exactly 30 seconds to import my VM on any hardware that has virtualizer...

  10. Bellingham Bill


    Follow
    Befriend
    58 threads
    2,592 comments
    Bellingham, WA

    10   9:02pm Sun 20 Jan 2013   Share   Quote   Permalink   Like   Dislike  

    havoc says

    To avoid this kind of BS, I do everything in the virtualizer.

    += 1

  11. mell


    Follow
    Befriend (7)
    255 threads
    3,075 comments
    San Francisco, CA

    11   9:08pm Sun 20 Jan 2013   Share   Quote   Permalink   Like   Dislike  

    Bellingham Bill says

    havoc says

    To avoid this kind of BS, I do everything in the virtualizer.

    += 1

    Yeah, consider VMs, they are the way to go. Spin up your favorite config in an instance, and scale up to as many instances as you want. Beauty. BTW, never had a problem with Ubuntu, like it ;)

  12. Patrick


    Follow
    Befriend (55)
    5,611 threads
    6,305 comments
    male
    Menlo Park, CA

    12   10:31pm Sun 20 Jan 2013   Share   Quote   Permalink   Like   Dislike (1)  

    havoc says

    To avoid this kind of BS, I do everything in the virtualizer. I have a VM image (which has all the custumizations and software ive done iteratevily over the past 5 years) that I just throw onto the virtualizer on new hardware without going through the pain every time something crashes or hardware dies or gets lost.

    This sounds interesting. Tell me more about this virtualizer. Where do I get it?

  13. zzyzzx


    Follow
    Befriend (10)
    679 threads
    5,958 comments
    Baltimore, MD

    13   6:58am Mon 21 Jan 2013   Share   Quote   Permalink   Like (1)   Dislike (1)  

    Try Fedora instead!

  14. havoc


    Follow
    Befriend
    4 comments

    14   9:35pm Mon 21 Jan 2013   Share   Quote   Permalink   Like   Dislike  

    There are a number of options. I myself use VM Ware's Workstation (requires a lic.) and a VirtualBox (free / open source).

    There is also VM Ware Player (also free) (I've found it to be somewhat limited though).
    And half a dozen of other solutions (from MS, Open Source and Apple)

    Try VirtualBox first (it is free and extremely self intuitive. you can install any os onto it using just an ISO image. No need to burn optical media / USB flash). You can easily export an the installed and configured image and transfer it between different virtualizers (made by different vendors). Exported images are called virtual appliances. You can have multiple OS (appliances) running CONCURRENTLY on a single CPU.

    In fact, there is a project (USB VirtualBox I believe) that would allow you to have a VirtualBox with various images on a USB key. That way you can launch your own personal OS in any internet cafe :)

    https://www.virtualbox.org/
    http://www.vmware.com/

    NOTE: make sure that the virtualization extension for your particular CPU is enabled ! Otherwise, you'll take a huge performance hit. That option is found somewhere in the BIOS setup. By default 99% of the machines have it disabled from the factory... for some idiotic reason...

    Once you have virtualizer installed, it will take you less then 2 minutes to try any linux or other OS you'd like... in fact with some minimal tweaking you can run Apple's OS (Leopard / Snow Lion etc) if you so choose :)

  15. CrazyMan


    Follow
    Befriend
    509 comments
    Boulder Creek, CA

    15   10:03pm Mon 21 Jan 2013   Share   Quote   Permalink   Like   Dislike  

    You should have booted into single user mode after that particular mistake. On CentOS/Redhat/Fedora it's TAB at the boot loader and then pass the arg single to the kernel to boot into single user mode. This will mount slash (/) in rw mode. Ubuntu will have something similar if not exactly the same.

    Virtualizing this (I'm a huge fan, I run massive clusters) would not have helped unless you remembered to take a snapshot first, so I'd recommend it but it's not really relevant.

    /etc/shadow *is* based on UID (pretty much everything in Unix is, your username is just a reference to the UID, it's no different than Windows). One of the exceptions to this is sudo, as you found out.

    The only mistake you made was not updating /etc/sudoers before logging out of your shell.

    Also, next time do sudo bash (or whatever shell you like) that way you get a root shell instead of running one thing at a time via sudo.

  16. David9


    Follow
    Befriend (4)
    31 threads
    977 comments
    Tarzana, CA

    16   10:21pm Mon 21 Jan 2013   Share   Quote   Permalink   Like   Dislike  

    I have been working on a new laptop top too.

    The one I had was just stolen in a burglary on Friday, they pried open the sliding glass door. The tree trimming people? Someone jealous I went to Paris? Who knows. Not the only apartment hit either.

    Anyway, I bought a floor model Acer because I liked the price, keyboard, and bright screen and I needed one quick.

    Not sure if I like Windows 8, glad I found my MS office key.

  17. zzyzzx


    Follow
    Befriend (10)
    679 threads
    5,958 comments
    Baltimore, MD

    17   7:13am Tue 22 Jan 2013   Share   Quote   Permalink   Like (1)   Dislike (1)  

    David9 says

    I have been working on a new laptop top too.

    The one I had was just stolen in a burglary on Friday

    Reason enough to keep using desktops.

  18. havoc


    Follow
    Befriend
    4 comments

    18   1:47pm Tue 22 Jan 2013   Share   Quote   Permalink   Like   Dislike  

    Well, it depends.... I personally enabled the option "automatically take snapshot when VM is shut down". So, one always will have a somewhat fresh copy of the VM to revert too... Besides, I have few image copies on: my laptop, my desktop , the corporate laptop... On various USB keys... (I'm using the same image for the past few years).

  19. Patrick


    Follow
    Befriend (55)
    5,611 threads
    6,305 comments
    male
    Menlo Park, CA

    19   6:30pm Tue 22 Jan 2013   Share   Quote   Permalink   Like   Dislike  

    CrazyMan says

    /etc/shadow *is* based on UID (pretty much everything in Unix is, your username is just a reference to the UID, it's no different than Windows). One of the exceptions to this is sudo, as you found out.

    No, looks like /etc/shadow on Ubuntu doesn't even mention UID at all. Only username, which is the problem.

  20. CrazyMan


    Follow
    Befriend
    509 comments
    Boulder Creek, CA

    20   9:32pm Tue 22 Jan 2013   Share   Quote   Permalink   Like   Dislike  

    You're right, it only has the username, I was mistaken. The issue you had was from not having the "new" username is /etc/sudoers, so you essentially lost sudo access. /etc/shadow just has an encrypted copy of your password and basically expiration info. It doesn't have anything to do with sudo.

    Usually people use groups (like wheel) to grant sudo access, though it can be specific usernames and/or specific commands (which is why it was written in the 1st place). You'd want to run visudo (or cat the file) to see if a group you're in is listed or just the username.

  21. CrazyMan


    Follow
    Befriend
    509 comments
    Boulder Creek, CA

    21   9:38pm Tue 22 Jan 2013   Share   Quote   Permalink   Like   Dislike  

    havoc says

    Well, it depends.... I personally enabled the option "automatically take snapshot when VM is shut down". So, one always will have a somewhat fresh copy of the VM to revert too...

    Keep in mind that snapshots are a huge performance hit (it's a delta of all the changes made from the base). For most home users, this is fine, but it's a killer in a production environment. Snapshots are meant for slight changes (patches, config changes) and then they should be deleted ASAP after confirming the sanity of the changes.

    That being said, I agree that virtualization is the best thing since sliced bread. Once you put vmware in a clustered pool, the things you can do with it are pretty amazing. Virtualbox for home and minor commecial use is quite nice as well.

Patrick is moderator of this thread.

Email

Username

Watch comments by email
Home   Tips and Tricks   Questions or suggestions? Mail p@patrick.net   Thank you for your kind donations

Page took 140 milliseconds to create.