How can I kill a stuck LXC container?
I have a new unprivileged LXC container that I just cannot seem to stop. lxc-stop -n dl
hangs. lxc-stop -k --nolock -n dl
hangs. lxc-ls
hangs. lxc-attach -n dl
hangs. Nothing works on this container.
I have restarted lcxfs
. All that did was upset a privileged container. This is what the current processes for this container look like (from the host).
lxc-start,24434
└─systemd,24446 --system --deserialize 9
├─agetty,25258 --noclear --keep-baud console 115200 38400 9600 vt220
├─agetty,25846 --noclear --keep-baud pts/1 115200 38400 9600 vt220
├─agetty,25878 --noclear --keep-baud pts/3 115200 38400 9600 vt220
├─agetty,25906 --noclear --keep-baud pts/2 115200 38400 9600 vt220
├─agetty,25934 --noclear --keep-baud pts/0 115200 38400 9600 vt220
├─rsyslogd,26016 -n
│ ├─{rsyslogd},26043
│ └─{rsyslogd},26044
└─systemd-journal,25962
And the process states:
$ ps aux | grep -P '24434|24446|25258|25846|25878|25906|25934|25934|26016|26043|26044|25962'
oli 24434 0.0 0.0 43400 3552 ? Ss 10:56 0:00 [lxc monitor] /home/oli/.local/share/lxc dl
100000 24446 0.0 0.1 36896 4972 ? Ss 10:56 0:00 /lib/systemd/systemd --system --deserialize 9
100000 25258 0.0 0.0 15676 2504 pts/0 Ss+ 10:56 0:00 /sbin/agetty --noclear --keep-baud console 115200 38400 9600 vt220
100000 25846 0.0 0.0 15676 2496 pts/1 Ss+ 11:33 0:00 /sbin/agetty --noclear --keep-baud pts/1 115200 38400 9600 vt220
100000 25878 0.0 0.0 15676 2380 pts/3 Ss+ 11:33 0:00 /sbin/agetty --noclear --keep-baud pts/3 115200 38400 9600 vt220
100000 25906 0.0 0.0 15676 2416 pts/2 Ss+ 11:33 0:00 /sbin/agetty --noclear --keep-baud pts/2 115200 38400 9600 vt220
100000 25934 0.0 0.0 15676 2332 pts/0 Ss+ 11:33 0:00 /sbin/agetty --noclear --keep-baud pts/0 115200 38400 9600 vt220
100000 25962 0.0 0.0 35256 3500 ? Ss 11:33 0:00 /lib/systemd/systemd-journald
100104 26016 0.0 0.0 182640 3244 ? Ssl 11:33 0:00 /usr/sbin/rsyslogd -n
lxc
bumped to the homepage by Community♦ 6 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I have a new unprivileged LXC container that I just cannot seem to stop. lxc-stop -n dl
hangs. lxc-stop -k --nolock -n dl
hangs. lxc-ls
hangs. lxc-attach -n dl
hangs. Nothing works on this container.
I have restarted lcxfs
. All that did was upset a privileged container. This is what the current processes for this container look like (from the host).
lxc-start,24434
└─systemd,24446 --system --deserialize 9
├─agetty,25258 --noclear --keep-baud console 115200 38400 9600 vt220
├─agetty,25846 --noclear --keep-baud pts/1 115200 38400 9600 vt220
├─agetty,25878 --noclear --keep-baud pts/3 115200 38400 9600 vt220
├─agetty,25906 --noclear --keep-baud pts/2 115200 38400 9600 vt220
├─agetty,25934 --noclear --keep-baud pts/0 115200 38400 9600 vt220
├─rsyslogd,26016 -n
│ ├─{rsyslogd},26043
│ └─{rsyslogd},26044
└─systemd-journal,25962
And the process states:
$ ps aux | grep -P '24434|24446|25258|25846|25878|25906|25934|25934|26016|26043|26044|25962'
oli 24434 0.0 0.0 43400 3552 ? Ss 10:56 0:00 [lxc monitor] /home/oli/.local/share/lxc dl
100000 24446 0.0 0.1 36896 4972 ? Ss 10:56 0:00 /lib/systemd/systemd --system --deserialize 9
100000 25258 0.0 0.0 15676 2504 pts/0 Ss+ 10:56 0:00 /sbin/agetty --noclear --keep-baud console 115200 38400 9600 vt220
100000 25846 0.0 0.0 15676 2496 pts/1 Ss+ 11:33 0:00 /sbin/agetty --noclear --keep-baud pts/1 115200 38400 9600 vt220
100000 25878 0.0 0.0 15676 2380 pts/3 Ss+ 11:33 0:00 /sbin/agetty --noclear --keep-baud pts/3 115200 38400 9600 vt220
100000 25906 0.0 0.0 15676 2416 pts/2 Ss+ 11:33 0:00 /sbin/agetty --noclear --keep-baud pts/2 115200 38400 9600 vt220
100000 25934 0.0 0.0 15676 2332 pts/0 Ss+ 11:33 0:00 /sbin/agetty --noclear --keep-baud pts/0 115200 38400 9600 vt220
100000 25962 0.0 0.0 35256 3500 ? Ss 11:33 0:00 /lib/systemd/systemd-journald
100104 26016 0.0 0.0 182640 3244 ? Ssl 11:33 0:00 /usr/sbin/rsyslogd -n
lxc
bumped to the homepage by Community♦ 6 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I have a new unprivileged LXC container that I just cannot seem to stop. lxc-stop -n dl
hangs. lxc-stop -k --nolock -n dl
hangs. lxc-ls
hangs. lxc-attach -n dl
hangs. Nothing works on this container.
I have restarted lcxfs
. All that did was upset a privileged container. This is what the current processes for this container look like (from the host).
lxc-start,24434
└─systemd,24446 --system --deserialize 9
├─agetty,25258 --noclear --keep-baud console 115200 38400 9600 vt220
├─agetty,25846 --noclear --keep-baud pts/1 115200 38400 9600 vt220
├─agetty,25878 --noclear --keep-baud pts/3 115200 38400 9600 vt220
├─agetty,25906 --noclear --keep-baud pts/2 115200 38400 9600 vt220
├─agetty,25934 --noclear --keep-baud pts/0 115200 38400 9600 vt220
├─rsyslogd,26016 -n
│ ├─{rsyslogd},26043
│ └─{rsyslogd},26044
└─systemd-journal,25962
And the process states:
$ ps aux | grep -P '24434|24446|25258|25846|25878|25906|25934|25934|26016|26043|26044|25962'
oli 24434 0.0 0.0 43400 3552 ? Ss 10:56 0:00 [lxc monitor] /home/oli/.local/share/lxc dl
100000 24446 0.0 0.1 36896 4972 ? Ss 10:56 0:00 /lib/systemd/systemd --system --deserialize 9
100000 25258 0.0 0.0 15676 2504 pts/0 Ss+ 10:56 0:00 /sbin/agetty --noclear --keep-baud console 115200 38400 9600 vt220
100000 25846 0.0 0.0 15676 2496 pts/1 Ss+ 11:33 0:00 /sbin/agetty --noclear --keep-baud pts/1 115200 38400 9600 vt220
100000 25878 0.0 0.0 15676 2380 pts/3 Ss+ 11:33 0:00 /sbin/agetty --noclear --keep-baud pts/3 115200 38400 9600 vt220
100000 25906 0.0 0.0 15676 2416 pts/2 Ss+ 11:33 0:00 /sbin/agetty --noclear --keep-baud pts/2 115200 38400 9600 vt220
100000 25934 0.0 0.0 15676 2332 pts/0 Ss+ 11:33 0:00 /sbin/agetty --noclear --keep-baud pts/0 115200 38400 9600 vt220
100000 25962 0.0 0.0 35256 3500 ? Ss 11:33 0:00 /lib/systemd/systemd-journald
100104 26016 0.0 0.0 182640 3244 ? Ssl 11:33 0:00 /usr/sbin/rsyslogd -n
lxc
I have a new unprivileged LXC container that I just cannot seem to stop. lxc-stop -n dl
hangs. lxc-stop -k --nolock -n dl
hangs. lxc-ls
hangs. lxc-attach -n dl
hangs. Nothing works on this container.
I have restarted lcxfs
. All that did was upset a privileged container. This is what the current processes for this container look like (from the host).
lxc-start,24434
└─systemd,24446 --system --deserialize 9
├─agetty,25258 --noclear --keep-baud console 115200 38400 9600 vt220
├─agetty,25846 --noclear --keep-baud pts/1 115200 38400 9600 vt220
├─agetty,25878 --noclear --keep-baud pts/3 115200 38400 9600 vt220
├─agetty,25906 --noclear --keep-baud pts/2 115200 38400 9600 vt220
├─agetty,25934 --noclear --keep-baud pts/0 115200 38400 9600 vt220
├─rsyslogd,26016 -n
│ ├─{rsyslogd},26043
│ └─{rsyslogd},26044
└─systemd-journal,25962
And the process states:
$ ps aux | grep -P '24434|24446|25258|25846|25878|25906|25934|25934|26016|26043|26044|25962'
oli 24434 0.0 0.0 43400 3552 ? Ss 10:56 0:00 [lxc monitor] /home/oli/.local/share/lxc dl
100000 24446 0.0 0.1 36896 4972 ? Ss 10:56 0:00 /lib/systemd/systemd --system --deserialize 9
100000 25258 0.0 0.0 15676 2504 pts/0 Ss+ 10:56 0:00 /sbin/agetty --noclear --keep-baud console 115200 38400 9600 vt220
100000 25846 0.0 0.0 15676 2496 pts/1 Ss+ 11:33 0:00 /sbin/agetty --noclear --keep-baud pts/1 115200 38400 9600 vt220
100000 25878 0.0 0.0 15676 2380 pts/3 Ss+ 11:33 0:00 /sbin/agetty --noclear --keep-baud pts/3 115200 38400 9600 vt220
100000 25906 0.0 0.0 15676 2416 pts/2 Ss+ 11:33 0:00 /sbin/agetty --noclear --keep-baud pts/2 115200 38400 9600 vt220
100000 25934 0.0 0.0 15676 2332 pts/0 Ss+ 11:33 0:00 /sbin/agetty --noclear --keep-baud pts/0 115200 38400 9600 vt220
100000 25962 0.0 0.0 35256 3500 ? Ss 11:33 0:00 /lib/systemd/systemd-journald
100104 26016 0.0 0.0 182640 3244 ? Ssl 11:33 0:00 /usr/sbin/rsyslogd -n
lxc
lxc
edited Dec 9 '15 at 13:51
Tim
20k1586141
20k1586141
asked Dec 9 '15 at 13:11
Oli♦Oli
223k89566766
223k89566766
bumped to the homepage by Community♦ 6 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 6 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Force killing the container's systemd
process worked for me.
In your example,
kill -9 24446
add a comment |
I keep this command line around to quickly kill all processes with a very high UID (which are in my container):
ps -ef | grep "^100[0-9][0-9][0-9]" | tr -s " " | cut -f2 -d " " | xargs -I {} kill -9 {}
Then I can use lxc-start
again.
I also found out that I have less problems with lxc-stop
when I use lxc-start -d
(in background mode) and then connect using lxc-attach
or ssh
.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f707743%2fhow-can-i-kill-a-stuck-lxc-container%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Force killing the container's systemd
process worked for me.
In your example,
kill -9 24446
add a comment |
Force killing the container's systemd
process worked for me.
In your example,
kill -9 24446
add a comment |
Force killing the container's systemd
process worked for me.
In your example,
kill -9 24446
Force killing the container's systemd
process worked for me.
In your example,
kill -9 24446
answered Nov 28 '16 at 9:05
HRJHRJ
344215
344215
add a comment |
add a comment |
I keep this command line around to quickly kill all processes with a very high UID (which are in my container):
ps -ef | grep "^100[0-9][0-9][0-9]" | tr -s " " | cut -f2 -d " " | xargs -I {} kill -9 {}
Then I can use lxc-start
again.
I also found out that I have less problems with lxc-stop
when I use lxc-start -d
(in background mode) and then connect using lxc-attach
or ssh
.
add a comment |
I keep this command line around to quickly kill all processes with a very high UID (which are in my container):
ps -ef | grep "^100[0-9][0-9][0-9]" | tr -s " " | cut -f2 -d " " | xargs -I {} kill -9 {}
Then I can use lxc-start
again.
I also found out that I have less problems with lxc-stop
when I use lxc-start -d
(in background mode) and then connect using lxc-attach
or ssh
.
add a comment |
I keep this command line around to quickly kill all processes with a very high UID (which are in my container):
ps -ef | grep "^100[0-9][0-9][0-9]" | tr -s " " | cut -f2 -d " " | xargs -I {} kill -9 {}
Then I can use lxc-start
again.
I also found out that I have less problems with lxc-stop
when I use lxc-start -d
(in background mode) and then connect using lxc-attach
or ssh
.
I keep this command line around to quickly kill all processes with a very high UID (which are in my container):
ps -ef | grep "^100[0-9][0-9][0-9]" | tr -s " " | cut -f2 -d " " | xargs -I {} kill -9 {}
Then I can use lxc-start
again.
I also found out that I have less problems with lxc-stop
when I use lxc-start -d
(in background mode) and then connect using lxc-attach
or ssh
.
answered Sep 1 '17 at 16:17
antoineMoPaantoineMoPa
1112
1112
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f707743%2fhow-can-i-kill-a-stuck-lxc-container%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown