Closed MathieuMoalic closed 1 year ago
chezmoi
hangs on most commands.
chezmo is used by tens of thousands of people where it does not hang on most commands. The problems here are almost certainly due to a problem with your machine and are not a bug in chezmoi.
Also ^C doesn't stop the process when it hangs. I must kill the terminal.
This means that chezmoi is getting stuck in uninterruptible sleep. This is typically due to I/O problems on your machine.
To debug this, try running chezmoi with strace
, which may help you find out which system call is causing the uninterruptible sleep.
ah I didn't know strace
to debug executables before. This is interesting. There seems to be someting wrong here indeed.
13:57:45 write(2, "\33[90m2023-04-05T13:57:45+02:00\33["..., 1492023-04-05T13:57:45+02:00 INF Mkdir component=system name=/home/users/mathieum/.config/chezmoi perm=511
) = 149
13:57:45 openat(AT_FDCWD, "/home/users/mathieum/.config/chezmoi/chezmoistate.boltdb", O_RDWR|O_CREAT|O_CLOEXEC, 0600) = 3
13:57:45 fcntl(3, F_GETFL) = 0x8002 (flags O_RDWR|O_LARGEFILE)
13:57:45 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK|O_LARGEFILE) = 0
13:57:45 epoll_ctl(4, EPOLL_CTL_ADD, 3, {EPOLLIN|EPOLLOUT|EPOLLRDHUP|EPOLLET, {u32=2485757272, u64=140293297513816}}) = -1 EPERM (Operation not permitted)
13:57:45 fcntl(3, F_GETFL) = 0x8802 (flags O_RDWR|O_NONBLOCK|O_LARGEFILE)
13:57:45 fcntl(3, F_SETFL, O_RDWR|O_LARGEFILE) = 0
13:57:45 flock(3, LOCK_EX|LOCK_N
From this trace, I can roughly guess that chezmoi
can't open ~/.config/chezmoi/chezmoistate.boltdb
?
I can interact with this file just fine though. It's more of a boltDB issue than a chezmoi
issue, would you agree ?
Thank you for the investigation. What's happening here is that chezmoi stores its persistent state in a BoltDB database, and the system call to lock the database file is hanging.
BoltDB, like most (all?) databases, requires file locking to ensure database consistency. Some filesystems do not support file locking. This is not really a BoltDB issue, more of a "your filesystem lacks a critical feature" issue.
What's the output of mount
for the filesystem containing your home directory?
I'm considering adding a simple persistent state backend that does not require file locking, which would also help chezmoi run on a wider range of systems.
(Incidentally, my initial guess would be that your home directory is on a NFS partition and NFS file locking has not been configured)
You are spot on! From the mount
command I learn that the home directory is using GPFS if I'm not wrong. I guess it doesn't support file locking as you mentionned. With this information I used chezmoi
with the --persistent-state
flag to change the db location to another filesystem and it works! Thanks for helping me :)
Describe the bug
chezmoi
hangs on most commands.chezmoi init --apply git@github.com:mathieumoalic/dotfiles.git --verbose --debug
: hangschezmoi init
: workschezmoi add .config/file
: hangsAlso ^C doesn't stop the process when it hangs. I must kill the terminal.
To reproduce
chezmoi init --apply git@github.com:mathieumoalic/dotfiles.git --verbose --debug
Expected behavior
Anything happens
Output of command with the
--verbose
flagOutput of
chezmoi doctor
Output of
chezmoi init
Additional context
I'm running this on an HPC with no admin privileges and 10 years old system libs.
The debug info does not help as it only mentions operations that worked: The last line
2023-04-03T11:35:04+02:00 INF Mkdir component=system name=/home/users/mathieum/.config/chezmoi perm=511
actually makes the directory succesfully but I have no idea what comes next.