You are not logged in.

#1 2014-05-24 23:37:01

korwynkim
Member
Registered: 2014-05-24
Posts: 3

[SOLVED]Changing password with chroot on a live USB doesn't work

I recently had a problem with my hard drive and the partition containing my Arch install. I decided to back up the installation and format the partition. I used rsync to backup:

rsync -aAXv /* /media/Data/Backup --exclude={/mnt/*,/media/*,/proc/*,/run/*,/dev/*,/sys/*,/tmp/*,/lost+found}

I formatted the partition and booted a live Arch install USB. I used rsync to restore the backup to the partition. After rebooting, I couldn't log in. The tty told me Incorrect Login. I tried logging in to both root and my user account. I rebooted the Arch installer and mounted the partition. I chrooted into it and used passwd to change the password. After rebooting, I still couldn't log in. I tried editing the /etc/passwd and /etc/shadow to remove the password. Now it just tells me "Incorrect Login" without even prompting me for the password after I type in the username. Is this perhaps a security feature?

I did try re installing then moving the old data over. This caused conflicts with packages, ownership and permissions. For example:

sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set

I tried to fix this by chowning /usr/bin/sudo, but it didn't work.

The password worked fine with the re installed Arch as long as I only changed it while the actual installation was booted, and not the live USB.

Last edited by korwynkim (2014-05-26 22:47:40)

Offline

#2 2014-05-25 00:06:33

nagaseiori
Member
Registered: 2012-09-22
Posts: 72

Re: [SOLVED]Changing password with chroot on a live USB doesn't work

Seems like you backed up your stuff to a filesystem that does not support Unix permissions (NTFS, FAT, etc.).

Offline

#3 2014-05-25 00:40:22

korwynkim
Member
Registered: 2014-05-24
Posts: 3

Re: [SOLVED]Changing password with chroot on a live USB doesn't work

Doh. Is there a good way to copy over data and packages without causing too many problems?

Also, how does that affect changing the password? Once everything is restored onto an ext4 partition, shouldn't I be able to change the password using a live USB? Or does the live USB also have to be formatted to a file system that supports Linux permissions?

Last edited by korwynkim (2014-05-26 15:50:58)

Offline

#4 2014-05-25 11:42:58

jackwild
Member
Registered: 2014-01-15
Posts: 30

Re: [SOLVED]Changing password with chroot on a live USB doesn't work

Use the -z flag as well as the -a flag for rsync to preserve permissions. This will create a zlib compressed file. For speed sake, to avoid compression you can use tar with the p flag and without any compression flag. Another option is to mirror the whole drive using dd, but this is wasteful of space.

Offline

#5 2014-05-25 12:01:33

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,571
Website

Re: [SOLVED]Changing password with chroot on a live USB doesn't work

korwynkim wrote:

Once everything is restored onto an ext4 partition... Or does the USB also have to be formatted to a file system that supports Linux permissions?

Yes, the backup filesystem also needs to support these permissions, otherwise where would they be stored.  When you copy from ext4 to FAT, there is no where for the information about permissions to be stored, so that information is lost.  Copying back from FAT to ext4 means there is now a place for the permission information to be stored, but there is no way for the filesystem to know which files previously had which permissions.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#6 2014-05-25 17:24:57

korwynkim
Member
Registered: 2014-05-24
Posts: 3

Re: [SOLVED]Changing password with chroot on a live USB doesn't work

Trilby wrote:

Yes, the backup filesystem also needs to support these permissions, otherwise where would they be stored ...

I meant the bootable USB with the Arch ISO loaded onto it. I couldn't change the password from the live USB with chroot.

Last edited by korwynkim (2014-05-26 15:48:17)

Offline

Board footer

Powered by FluxBB